blob: d2ed9d75194421140bc3b2c842c98e837a65e035 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*******************************************************************************
* Copyright (c) 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
package org.eclipse.jpt.jaxb.eclipselink.core.internal.libval;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.common.core.libval.LibraryValidator;
import org.eclipse.jpt.common.eclipselink.core.internal.libval.EclipseLinkLibValUtil;
import org.eclipse.jpt.jaxb.core.internal.libprov.JaxbUserLibraryProviderInstallOperationConfig;
import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
import org.eclipse.jpt.jaxb.eclipselink.core.ELJaxbPlatform;
import org.eclipse.osgi.service.resolver.VersionRange;
/**
* Library validator for EclipseLink JAXB user libraries.
*
* In order to validate that the correct eclipselink.jar is present in the user library, the version
* class which appears in standard EclipseLink libraries will be examined and compared against the
* union of calculated version ranges, depending on the platform specified in the config.
*/
public class ELJaxbUserLibraryValidator
implements LibraryValidator {
public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
JaxbUserLibraryProviderInstallOperationConfig jaxbConfig
= (JaxbUserLibraryProviderInstallOperationConfig) config;
JaxbPlatformDescription platform = jaxbConfig.getJaxbPlatform();
Set<VersionRange> versionRanges = new HashSet<VersionRange>();
if (ELJaxbPlatform.VERSION_2_3.equals(platform)) {
versionRanges.add(new VersionRange("[2.3, 3.0)")); //$NON-NLS-1$
}
return EclipseLinkLibValUtil.validate(jaxbConfig.resolve(), versionRanges);
}
}
|