InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() : new InstallableUnitFragmentDescription(); description.setId(unitId); description.setVersion(unitVersion); ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map<Locale, Map<String, String>> hostLocalizations) { InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription(); String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName()); fragment.setId(fragmentId); fragment.setVersion(PublisherHelper.fromOSGiVersion(bd.getVersion())); // TODO: is this a meaningful version? HostSpecification hostSpec = bd.getHost(); IRequirement[] hostReqs = new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), PublisherHelper.fromOSGiVersionRange(hostSpec.getVersionRange()), null, false, false, false)}; fragment.setHost(hostReqs); fragment.setSingleton(true); fragment.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); // Create a provided capability for each locale and add the translated properties. ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(hostLocalizations.keySet().size()); providedCapabilities.add(PublisherHelper.createSelfCapability(fragmentId, fragment.getVersion())); for (Entry<Locale, Map<String, String>> localeEntry : hostLocalizations.entrySet()) { Locale locale = localeEntry.getKey(); Map<String, String> translatedStrings = localeEntry.getValue(); for (Entry<String, String> entry : translatedStrings.entrySet()) { fragment.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue()); } providedCapabilities.add(PublisherHelper.makeTranslationCapability(hostId, locale)); } fragment.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); return MetadataFactory.createInstallableUnitFragment(fragment); }
public static IInstallableUnit createBundleConfigurationUnit(String hostId, Version cuVersion, boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor, IMatchExpression<IInstallableUnit> filter) { if (configInfo == null) return null; InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = configurationFlavor + hostId; cu.setId(configUnitId); cu.setVersion(cuVersion); //Indicate the IU to which this CU apply Version hostVersion = Version.parseVersion(configInfo.getVersion()); VersionRange range = hostVersion == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(hostVersion, true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] { // MetadataFactory.createRequirement(CAPABILITY_NS_OSGI_BUNDLE, hostId, range, null, false, false, true), // MetadataFactory.createRequirement(PublisherHelper.NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new VersionRange(Version.createOSGi(1, 0, 0), true, Version.createOSGi(2, 0, 0), false), null, false, false, false)}); //Adds capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, cuVersion), MetadataFactory.createProvidedCapability(PublisherHelper.NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("configure", createConfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$ touchpointData.put("unconfigure", createUnconfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); cu.setFilter(filter); return MetadataFactory.createInstallableUnit(cu); }
InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() : new InstallableUnitFragmentDescription(); description.setId(unitId); description.setVersion(unitVersion); ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() : new InstallableUnitFragmentDescription(); description.setId(unitId); description.setVersion(unitVersion); ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() : new InstallableUnitFragmentDescription(); description.setId(unitId); description.setVersion(unitVersion); ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()]));
currentUnit = new InstallableUnitDescription(); } else { currentUnit = new MetadataFactory.InstallableUnitFragmentDescription(); ((InstallableUnitFragmentDescription) currentUnit).setHost(hostRequiredCapabilitiesHandler.getHostRequiredCapabilities());
currentUnit = new InstallableUnitDescription(); } else { currentUnit = new MetadataFactory.InstallableUnitFragmentDescription(); ((InstallableUnitFragmentDescription) currentUnit).setHost(hostRequiredCapabilitiesHandler.getHostRequiredCapabilities());
currentUnit = new InstallableUnitDescription(); } else { currentUnit = new MetadataFactory.InstallableUnitFragmentDescription(); ((InstallableUnitFragmentDescription) currentUnit).setHost(hostRequiredCapabilitiesHandler.getHostRequiredCapabilities());
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = flavor + iuId; cu.setId(configUnitId); cu.setVersion(version); cu.setFilter(filter); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iuId, new VersionRange(version, true, version, true), null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, version)}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = flavor + iuId; cu.setId(configUnitId); cu.setVersion(version); cu.setFilter(filter); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iuId, new VersionRange(version, true, version, true), null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, version)}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = flavor + iuId; cu.setId(configUnitId); cu.setVersion(version); cu.setFilter(filter); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iuId, new VersionRange(version, true, version, true), null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, version)}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configId = "config." + iu.getId();//$NON-NLS-1$ cu.setId(configId); cu.setVersion(iu.getVersion()); VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT); String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT);
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configId = "config." + iu.getId();//$NON-NLS-1$ cu.setId(configId); cu.setVersion(iu.getVersion()); VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT); String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT);
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = flavor + iuId; cu.setId(configUnitId); cu.setVersion(version); cu.setFilter(filter); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iuId, new VersionRange(version, true, version, true), null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, version)}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configId = "config." + iu.getId();//$NON-NLS-1$ cu.setId(configId); cu.setVersion(iu.getVersion()); VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<String, String>(); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT); String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT);
InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configId = "config." + iu.getId();//$NON-NLS-1$ cu.setId(configId); cu.setVersion(iu.getVersion()); VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, null, false, false)}); cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configId, iu.getVersion())}); cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE); Map<String, String> touchpointData = new HashMap<>(); cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT); String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); results.addIU(MetadataFactory.createInstallableUnit(cu), IPublisherResult.ROOT);
public static IInstallableUnit createBundleConfigurationUnit(String hostId, Version cuVersion, boolean isBundleFragment, GeneratorBundleInfo configInfo, String configurationFlavor, IMatchExpression<IInstallableUnit> filter) { if (configInfo == null) return null; InstallableUnitFragmentDescription cu = new InstallableUnitFragmentDescription(); String configUnitId = configurationFlavor + hostId; cu.setId(configUnitId); cu.setVersion(cuVersion); //Indicate the IU to which this CU apply Version hostVersion = Version.parseVersion(configInfo.getVersion()); VersionRange range = hostVersion == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(hostVersion, true, Version.MAX_VERSION, true); cu.setHost(new IRequirement[] { // MetadataFactory.createRequirement(CAPABILITY_NS_OSGI_BUNDLE, hostId, range, null, false, false, true), // MetadataFactory.createRequirement(PublisherHelper.NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new VersionRange(Version.createOSGi(1, 0, 0), true, Version.createOSGi(2, 0, 0), false), null, false, false, false)}); //Adds capabilities for fragment, self, and describing the flavor supported cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, cuVersion), MetadataFactory.createProvidedCapability(PublisherHelper.NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); Map<String, String> touchpointData = new HashMap<String, String>(); touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("configure", createConfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$ touchpointData.put("unconfigure", createUnconfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$ cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); cu.setFilter(filter); return MetadataFactory.createInstallableUnit(cu); }
private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map<Locale, Map<String, String>> hostLocalizations) { InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription(); String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName()); fragment.setId(fragmentId); fragment.setVersion(PublisherHelper.fromOSGiVersion(bd.getVersion())); // TODO: is this a meaningful version? HostSpecification hostSpec = bd.getHost(); IRequirement[] hostReqs = new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), PublisherHelper.fromOSGiVersionRange(hostSpec.getVersionRange()), null, false, false, false)}; fragment.setHost(hostReqs); fragment.setSingleton(true); fragment.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); // Create a provided capability for each locale and add the translated properties. ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(hostLocalizations.keySet().size()); providedCapabilities.add(PublisherHelper.createSelfCapability(fragmentId, fragment.getVersion())); for (Entry<Locale, Map<String, String>> localeEntry : hostLocalizations.entrySet()) { Locale locale = localeEntry.getKey(); Map<String, String> translatedStrings = localeEntry.getValue(); for (Entry<String, String> entry : translatedStrings.entrySet()) { fragment.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue()); } providedCapabilities.add(PublisherHelper.makeTranslationCapability(hostId, locale)); } fragment.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); return MetadataFactory.createInstallableUnitFragment(fragment); }
private static IInstallableUnitFragment createLocalizationFragmentOfHost(BundleDescription bd, String hostId, String[] hostManifestValues, Map<Locale, Map<String, String>> hostLocalizations) { InstallableUnitFragmentDescription fragment = new MetadataFactory.InstallableUnitFragmentDescription(); String fragmentId = makeHostLocalizationFragmentId(bd.getSymbolicName()); fragment.setId(fragmentId); fragment.setVersion(PublisherHelper.fromOSGiVersion(bd.getVersion())); // TODO: is this a meaningful version? HostSpecification hostSpec = bd.getHost(); IRequirement[] hostReqs = new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), PublisherHelper.fromOSGiVersionRange(hostSpec.getVersionRange()), null, false, false, false)}; fragment.setHost(hostReqs); fragment.setSingleton(true); fragment.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); // Create a provided capability for each locale and add the translated properties. ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(hostLocalizations.keySet().size()); providedCapabilities.add(PublisherHelper.createSelfCapability(fragmentId, fragment.getVersion())); for (Entry<Locale, Map<String, String>> localeEntry : hostLocalizations.entrySet()) { Locale locale = localeEntry.getKey(); Map<String, String> translatedStrings = localeEntry.getValue(); for (Entry<String, String> entry : translatedStrings.entrySet()) { fragment.setProperty(locale.toString() + '.' + entry.getKey(), entry.getValue()); } providedCapabilities.add(PublisherHelper.makeTranslationCapability(hostId, locale)); } fragment.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); return MetadataFactory.createInstallableUnitFragment(fragment); }