/** * Creates an OSGi version identifier from the specified numerical components. * * <p> * The qualifier is set to the empty string. * * @param major Major component of the version identifier. * @param minor Minor component of the version identifier. * @param micro Micro component of the version identifier. * @throws IllegalArgumentException If the numerical components are * negative. */ public static Version createOSGi(int major, int minor, int micro) { return createOSGi(major, minor, micro, null); }
public static IProvidedCapability makeTranslationCapability(String hostId, Locale locale) { return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), Version.createOSGi(1, 0, 0)); }
public static IProvidedCapability makeTranslationCapability(String hostId, Locale locale) { return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), Version.createOSGi(1, 0, 0)); }
public static IProvidedCapability makeTranslationCapability(String hostId, Locale locale) { return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), Version.createOSGi(1, 0, 0)); }
public static IProvidedCapability makeTranslationCapability(String hostId, Locale locale) { return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), Version.createOSGi(1, 0, 0)); }
/** * Returns a version range which includes "equivalent" versions, i.e. versions with the same * major, minor, and micro version. */ private static VersionRange getRangeOfEquivalentVersions(Version version) { Integer major = (Integer) version.getSegment(0); Integer minor = (Integer) version.getSegment(1); Integer micro = (Integer) version.getSegment(2); VersionRange range = new VersionRange(Version.createOSGi(major, minor, micro), true, Version.createOSGi(major, minor, micro + 1), false); return range; }
private IInstallableUnit createIURepresentingTheProfile(Set<IRequirement> allRequirements) { InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription(); String time = Long.toString(System.currentTimeMillis()); iud.setId(time); iud.setVersion(Version.createOSGi(0, 0, 0, time)); iud.setRequirements(allRequirements.toArray(new IRequirement[allRequirements.size()])); return MetadataFactory.createInstallableUnit(iud); }
protected static IInstallableUnit createUnitRequiring(String name, Collection<IInstallableUnit> units, Collection<IRequirement> additionalRequirements) { InstallableUnitDescription result = new MetadataFactory.InstallableUnitDescription(); String time = Long.toString(System.currentTimeMillis()); result.setId(name + "-" + time); result.setVersion(Version.createOSGi(0, 0, 0, time)); ArrayList<IRequirement> requirements = new ArrayList<>(); if (units != null) { for (IInstallableUnit unit : units) { requirements.add(createStrictRequirementTo(unit)); } } if (additionalRequirements != null) { requirements.addAll(additionalRequirements); } result.addRequirements(requirements); return MetadataFactory.createInstallableUnit(result); }
private Object convertScalarAttribute(Object attr) { if (attr instanceof org.osgi.framework.Version) { org.osgi.framework.Version osgiVer = (org.osgi.framework.Version) attr; return Version.createOSGi(osgiVer.getMajor(), osgiVer.getMinor(), osgiVer.getMicro(), osgiVer.getQualifier()); } return attr.toString(); }
/** * @see org.eclipse.tycho.artifacts.DependencyArtifacts.getArtifact(String, String, String) */ protected VersionRange getVersionRange(Version version) { if (version == null || OSGi_versionMin.equals(version)) { return VersionRange.emptyRange; } org.osgi.framework.Version osgiVersion = PublisherHelper.toOSGiVersion(version); String qualifier = osgiVersion.getQualifier(); if (qualifier == null || "".equals(qualifier) || ANY_QUALIFIER.equals(qualifier)) { Version from = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro()); Version to = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro() + 1); return new VersionRange(from, true, to, false); } return new VersionRange(version, true, version, true); }
public static IInstallableUnit createDefaultConfigurationUnitForSourceBundles(String configurationFlavor) { InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = createDefaultConfigUnitId("source", configurationFlavor); //$NON-NLS-1$ cu.setId(configUnitId); Version configUnitVersion = Version.createOSGi(1, 0, 0); cu.setVersion(configUnitVersion); // Add capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); // Create a required capability on source providers IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequirement(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, VersionRange.emptyRange, null, true, true, false)}; cu.setHost(reqs); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("install", "addSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "removeSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); return MetadataFactory.createInstallableUnit(cu); }
public static IInstallableUnit createDefaultConfigurationUnitForSourceBundles(String configurationFlavor) { InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = createDefaultConfigUnitId("source", configurationFlavor); //$NON-NLS-1$ cu.setId(configUnitId); Version configUnitVersion = Version.createOSGi(1, 0, 0); cu.setVersion(configUnitVersion); // Add capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); // Create a required capability on source providers IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequirement(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, VersionRange.emptyRange, null, true, true, false)}; cu.setHost(reqs); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("install", "addSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "removeSourceBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); return MetadataFactory.createInstallableUnit(cu); }
public static IInstallableUnit createDefaultFeatureConfigurationUnit(String configurationFlavor) { InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = createDefaultConfigUnitId(ECLIPSE_FEATURE_CLASSIFIER, configurationFlavor); cu.setId(configUnitId); Version configUnitVersion = Version.createOSGi(1, 0, 0); cu.setVersion(configUnitVersion); // Add capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); // Create a required capability on features IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequirement(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, VersionRange.emptyRange, null, true, true, false)}; cu.setHost(reqs); cu.setFilter(INSTALL_FEATURES_FILTER); Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("install", "installFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$ touchpointData.put("uninstall", "uninstallFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); return MetadataFactory.createInstallableUnit(cu); }
public static IInstallableUnit createDefaultFeatureConfigurationUnit(String configurationFlavor) { InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = createDefaultConfigUnitId(ECLIPSE_FEATURE_CLASSIFIER, configurationFlavor); cu.setId(configUnitId); Version configUnitVersion = Version.createOSGi(1, 0, 0); cu.setVersion(configUnitVersion); // Add capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); // Create a required capability on features IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequirement(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, VersionRange.emptyRange, null, true, true, false)}; cu.setHost(reqs); cu.setFilter(INSTALL_FEATURES_FILTER); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("install", "installFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$ touchpointData.put("uninstall", "uninstallFeature(feature:${artifact},featureId:default,featureVersion:default)"); //$NON-NLS-1$//$NON-NLS-2$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); return MetadataFactory.createInstallableUnit(cu); }
private IInstallableUnit createIUForMetaRequirements(IProfile profile, Collection<IRequirement> metaRequirements) { InstallableUnitDescription description = new InstallableUnitDescription(); String id = getActionGatheringIUId(profile); description.setId(id); Version version = Version.createOSGi(1, 0, 0, Long.toString(profile.getTimestamp())); description.setVersion(version); description.addRequirements(metaRequirements); ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); IProvidedCapability providedCapability = MetadataFactory .createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, id, version); providedCapabilities.add(providedCapability); description.addProvidedCapabilities(providedCapabilities); IInstallableUnit actionsIU = MetadataFactory.createInstallableUnit(description); return actionsIU; }
/** * Create an omni version from an OSGi <code>version</code>. * @param version The OSGi version. Can be <code>null</code>. * @return The created omni version */ public static Version fromOSGiVersion(org.osgi.framework.Version version) { if (version == null) return null; if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) return Version.MAX_VERSION; return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier()); }
private static Version fromOSGiVersion(org.osgi.framework.Version version) { if (version == null) return Version.MAX_VERSION; if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) return Version.MAX_VERSION; return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier()); }
/** * Create an omni version from an OSGi <code>version</code>. * @param version The OSGi version. Can be <code>null</code>. * @return The created omni version */ public static Version fromOSGiVersion(org.osgi.framework.Version version) { if (version == null) return null; if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) return Version.MAX_VERSION; return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier()); }
/** * Create an omni version from an OSGi <code>version</code>. * @param version The OSGi version. Can be <code>null</code>. * @return The created omni version */ public static Version fromOSGiVersion(org.osgi.framework.Version version) { if (version == null) return null; if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) return Version.MAX_VERSION; return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier()); }
/** * Create an omni version from an OSGi <code>version</code>. * @param version The OSGi version. Can be <code>null</code>. * @return The created omni version */ public static Version fromOSGiVersion(org.osgi.framework.Version version) { if (version == null) { return Version.MAX_VERSION; } if (version.getMajor() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE && version.getMicro() == Integer.MAX_VALUE) { return Version.MAX_VERSION; } return Version.createOSGi(version.getMajor(), version.getMinor(), version.getMicro(), version.getQualifier()); }