Lines 48-84
Link Here
|
48 |
public class MetadataGeneratorHelper { |
48 |
public class MetadataGeneratorHelper { |
49 |
/** |
49 |
/** |
50 |
* A capability namespace representing the type of Eclipse resource (bundle, feature, source bundle, etc) |
50 |
* A capability namespace representing the type of Eclipse resource (bundle, feature, source bundle, etc) |
51 |
* @see RequiredCapability#getNamespace() |
51 |
* @see IRequiredCapability#getNamespace() |
52 |
* @see ProvidedCapability#getNamespace() |
52 |
* @see IProvidedCapability#getNamespace() |
53 |
*/ |
53 |
*/ |
54 |
public static final String NAMESPACE_ECLIPSE_TYPE = "org.eclipse.equinox.p2.eclipse.type"; //$NON-NLS-1$ |
54 |
public static final String NAMESPACE_ECLIPSE_TYPE = "org.eclipse.equinox.p2.eclipse.type"; //$NON-NLS-1$ |
55 |
|
55 |
|
56 |
/** |
56 |
/** |
57 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
57 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
58 |
* representing and OSGi bundle resource |
58 |
* representing and OSGi bundle resource |
59 |
* @see RequiredCapability#getName() |
59 |
* @see IRequiredCapability#getName() |
60 |
* @see ProvidedCapability#getName() |
60 |
* @see IProvidedCapability#getName() |
61 |
*/ |
61 |
*/ |
62 |
public static final String TYPE_ECLIPSE_BUNDLE = "bundle"; //$NON-NLS-1$ |
62 |
public static final String TYPE_ECLIPSE_BUNDLE = "bundle"; //$NON-NLS-1$ |
63 |
/** |
63 |
/** |
64 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
64 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
65 |
* representing a feature |
65 |
* representing a feature |
66 |
* @see RequiredCapability#getName() |
66 |
* @see IRequiredCapability#getName() |
67 |
*/ |
67 |
*/ |
68 |
public static final String TYPE_ECLIPSE_FEATURE = "feature"; //$NON-NLS-1$ |
68 |
public static final String TYPE_ECLIPSE_FEATURE = "feature"; //$NON-NLS-1$ |
69 |
|
69 |
|
70 |
/** |
70 |
/** |
71 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
71 |
* A capability name in the {@link #NAMESPACE_ECLIPSE_TYPE} namespace |
72 |
* representing a source bundle |
72 |
* representing a source bundle |
73 |
* @see RequiredCapability#getName() |
73 |
* @see IRequiredCapability#getName() |
74 |
*/ |
74 |
*/ |
75 |
public static final String TYPE_ECLIPSE_SOURCE = "source"; //$NON-NLS-1$ |
75 |
public static final String TYPE_ECLIPSE_SOURCE = "source"; //$NON-NLS-1$ |
76 |
|
76 |
|
77 |
/** |
77 |
/** |
78 |
* A capability namespace representing the localization (translation) |
78 |
* A capability namespace representing the localization (translation) |
79 |
* of strings from a specified IU in a specified locale |
79 |
* of strings from a specified IU in a specified locale |
80 |
* @see RequiredCapability#getNamespace() |
80 |
* @see IRequiredCapability#getNamespace() |
81 |
* @see ProvidedCapability#getNamespace() |
81 |
* @see IProvidedCapability#getNamespace() |
82 |
* TODO: this should be in API, probably in IInstallableUnit |
82 |
* TODO: this should be in API, probably in IInstallableUnit |
83 |
*/ |
83 |
*/ |
84 |
public static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$ |
84 |
public static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$ |
Lines 121-129
Link Here
|
121 |
public static final TouchpointType TOUCHPOINT_NATIVE = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.native", new Version(1, 0, 0)); //$NON-NLS-1$ |
121 |
public static final TouchpointType TOUCHPOINT_NATIVE = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.native", new Version(1, 0, 0)); //$NON-NLS-1$ |
122 |
public static final TouchpointType TOUCHPOINT_OSGI = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.osgi", new Version(1, 0, 0)); //$NON-NLS-1$ |
122 |
public static final TouchpointType TOUCHPOINT_OSGI = MetadataFactory.createTouchpointType("org.eclipse.equinox.p2.osgi", new Version(1, 0, 0)); //$NON-NLS-1$ |
123 |
|
123 |
|
124 |
public static final ProvidedCapability BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new Version(1, 0, 0)); |
124 |
public static final IProvidedCapability BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new Version(1, 0, 0)); |
125 |
public static final ProvidedCapability FEATURE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, new Version(1, 0, 0)); |
125 |
public static final IProvidedCapability FEATURE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, new Version(1, 0, 0)); |
126 |
public static final ProvidedCapability SOURCE_BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, new Version(1, 0, 0)); |
126 |
public static final IProvidedCapability SOURCE_BUNDLE_CAPABILITY = MetadataFactory.createProvidedCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, new Version(1, 0, 0)); |
127 |
|
127 |
|
128 |
static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$ |
128 |
static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$ |
129 |
|
129 |
|
Lines 213-225
Link Here
|
213 |
cu.setVersion(iuVersion); |
213 |
cu.setVersion(iuVersion); |
214 |
|
214 |
|
215 |
//Indicate the IU to which this CU apply |
215 |
//Indicate the IU to which this CU apply |
216 |
cu.setHost(new RequiredCapability[] { // |
216 |
cu.setHost(new IRequiredCapability[] { // |
217 |
MetadataFactory.createRequiredCapability(CAPABILITY_NS_OSGI_BUNDLE, iuId, new VersionRange(iuVersion, true, versionMax, true), null, false, false, true), // |
217 |
MetadataFactory.createRequiredCapability(CAPABILITY_NS_OSGI_BUNDLE, iuId, new VersionRange(iuVersion, true, versionMax, true), null, false, false, true), // |
218 |
MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new VersionRange(new Version(1, 0, 0), true, new Version(2, 0, 0), false), null, false, false, false)}); |
218 |
MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, new VersionRange(new Version(1, 0, 0), true, new Version(2, 0, 0), false), null, false, false, false)}); |
219 |
|
219 |
|
220 |
//Adds capabilities for fragment, self, and describing the flavor supported |
220 |
//Adds capabilities for fragment, self, and describing the flavor supported |
221 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
221 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
222 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configUnitId, iuVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
222 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, iuVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
223 |
|
223 |
|
224 |
Map touchpointData = new HashMap(); |
224 |
Map touchpointData = new HashMap(); |
225 |
touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ |
225 |
touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ |
Lines 286-292
Link Here
|
286 |
//TODO this needs to be refined to take into account all the attribute handled by imports |
286 |
//TODO this needs to be refined to take into account all the attribute handled by imports |
287 |
reqsDeps.add(MetadataFactory.createRequiredCapability(CAPABILITY_NS_JAVA_PACKAGE, importPackageName, versionRange, null, isOptional(importSpec), false)); |
287 |
reqsDeps.add(MetadataFactory.createRequiredCapability(CAPABILITY_NS_JAVA_PACKAGE, importPackageName, versionRange, null, isOptional(importSpec), false)); |
288 |
} |
288 |
} |
289 |
iu.setRequiredCapabilities((RequiredCapability[]) reqsDeps.toArray(new RequiredCapability[reqsDeps.size()])); |
289 |
iu.setRequiredCapabilities((IRequiredCapability[]) reqsDeps.toArray(new IRequiredCapability[reqsDeps.size()])); |
290 |
|
290 |
|
291 |
// Create set of provided capabilities |
291 |
// Create set of provided capabilities |
292 |
ArrayList providedCapabilities = new ArrayList(); |
292 |
ArrayList providedCapabilities = new ArrayList(); |
Lines 321-327
Link Here
|
321 |
} |
321 |
} |
322 |
} |
322 |
} |
323 |
|
323 |
|
324 |
iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
324 |
iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
325 |
|
325 |
|
326 |
iu.setArtifacts(new IArtifactKey[] {key}); |
326 |
iu.setArtifacts(new IArtifactKey[] {key}); |
327 |
|
327 |
|
Lines 407-413
Link Here
|
407 |
fragment.setVersion(Version.fromOSGiVersion(bd.getVersion())); // TODO: is this a meaningful version? |
407 |
fragment.setVersion(Version.fromOSGiVersion(bd.getVersion())); // TODO: is this a meaningful version? |
408 |
|
408 |
|
409 |
HostSpecification hostSpec = bd.getHost(); |
409 |
HostSpecification hostSpec = bd.getHost(); |
410 |
RequiredCapability[] hostReqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), VersionRange.fromOSGiVersionRange(hostSpec.getVersionRange()), null, false, false, false)}; |
410 |
IRequiredCapability[] hostReqs = new IRequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, hostSpec.getName(), VersionRange.fromOSGiVersionRange(hostSpec.getVersionRange()), null, false, false, false)}; |
411 |
fragment.setHost(hostReqs); |
411 |
fragment.setHost(hostReqs); |
412 |
|
412 |
|
413 |
fragment.setSingleton(true); |
413 |
fragment.setSingleton(true); |
Lines 426-432
Link Here
|
426 |
} |
426 |
} |
427 |
providedCapabilities.add(makeTranslationCapability(hostId, locale)); |
427 |
providedCapabilities.add(makeTranslationCapability(hostId, locale)); |
428 |
} |
428 |
} |
429 |
fragment.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
429 |
fragment.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
430 |
|
430 |
|
431 |
return MetadataFactory.createInstallableUnitFragment(fragment); |
431 |
return MetadataFactory.createInstallableUnitFragment(fragment); |
432 |
} |
432 |
} |
Lines 451-457
Link Here
|
451 |
return id + ".translated_host_properties"; //$NON-NLS-1$ |
451 |
return id + ".translated_host_properties"; //$NON-NLS-1$ |
452 |
} |
452 |
} |
453 |
|
453 |
|
454 |
private static ProvidedCapability makeTranslationCapability(String hostId, Locale locale) { |
454 |
private static IProvidedCapability makeTranslationCapability(String hostId, Locale locale) { |
455 |
return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), new Version(1, 0, 0)); |
455 |
return MetadataFactory.createProvidedCapability(NAMESPACE_IU_LOCALIZATION, locale.toString(), new Version(1, 0, 0)); |
456 |
} |
456 |
} |
457 |
|
457 |
|
Lines 482-488
Link Here
|
482 |
if (parentCategory != null) { |
482 |
if (parentCategory != null) { |
483 |
reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, parentCategory.getId(), VersionRange.emptyRange, parentCategory.getFilter(), false, false)); |
483 |
reqsConfigurationUnits.add(MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, parentCategory.getId(), VersionRange.emptyRange, parentCategory.getFilter(), false, false)); |
484 |
} |
484 |
} |
485 |
cat.setRequiredCapabilities((RequiredCapability[]) reqsConfigurationUnits.toArray(new RequiredCapability[reqsConfigurationUnits.size()])); |
485 |
cat.setRequiredCapabilities((IRequiredCapability[]) reqsConfigurationUnits.toArray(new IRequiredCapability[reqsConfigurationUnits.size()])); |
486 |
|
486 |
|
487 |
// Create set of provided capabilities |
487 |
// Create set of provided capabilities |
488 |
ArrayList providedCapabilities = new ArrayList(); |
488 |
ArrayList providedCapabilities = new ArrayList(); |
Lines 502-508
Link Here
|
502 |
} |
502 |
} |
503 |
} |
503 |
} |
504 |
|
504 |
|
505 |
cat.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
505 |
cat.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
506 |
|
506 |
|
507 |
cat.setArtifacts(new IArtifactKey[0]); |
507 |
cat.setArtifacts(new IArtifactKey[0]); |
508 |
cat.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, "true"); //$NON-NLS-1$ |
508 |
cat.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, "true"); //$NON-NLS-1$ |
Lines 550-559
Link Here
|
550 |
|
550 |
|
551 |
// Add capabilities for fragment, self, and describing the flavor supported |
551 |
// Add capabilities for fragment, self, and describing the flavor supported |
552 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
552 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
553 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
553 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
554 |
|
554 |
|
555 |
// Create a required capability on bundles |
555 |
// Create a required capability on bundles |
556 |
RequiredCapability[] reqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true, false)}; |
556 |
IRequiredCapability[] reqs = new IRequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true, false)}; |
557 |
cu.setHost(reqs); |
557 |
cu.setHost(reqs); |
558 |
Map touchpointData = new HashMap(); |
558 |
Map touchpointData = new HashMap(); |
559 |
|
559 |
|
Lines 586-595
Link Here
|
586 |
|
586 |
|
587 |
// Add capabilities for fragment, self, and describing the flavor supported |
587 |
// Add capabilities for fragment, self, and describing the flavor supported |
588 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
588 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
589 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
589 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
590 |
|
590 |
|
591 |
// Create a required capability on features |
591 |
// Create a required capability on features |
592 |
RequiredCapability[] reqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, VersionRange.emptyRange, null, true, true, false)}; |
592 |
IRequiredCapability[] reqs = new IRequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_FEATURE, VersionRange.emptyRange, null, true, true, false)}; |
593 |
cu.setHost(reqs); |
593 |
cu.setHost(reqs); |
594 |
|
594 |
|
595 |
cu.setFilter(INSTALL_FEATURES_FILTER); |
595 |
cu.setFilter(INSTALL_FEATURES_FILTER); |
Lines 610-619
Link Here
|
610 |
|
610 |
|
611 |
// Add capabilities for fragment, self, and describing the flavor supported |
611 |
// Add capabilities for fragment, self, and describing the flavor supported |
612 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
612 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
613 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
613 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, configUnitVersion), MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_FLAVOR, configurationFlavor, new Version(1, 0, 0))}); |
614 |
|
614 |
|
615 |
// Create a required capability on source providers |
615 |
// Create a required capability on source providers |
616 |
RequiredCapability[] reqs = new RequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, VersionRange.emptyRange, null, true, true, false)}; |
616 |
IRequiredCapability[] reqs = new IRequiredCapability[] {MetadataFactory.createRequiredCapability(NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_SOURCE, VersionRange.emptyRange, null, true, true, false)}; |
617 |
cu.setHost(reqs); |
617 |
cu.setHost(reqs); |
618 |
Map touchpointData = new HashMap(); |
618 |
Map touchpointData = new HashMap(); |
619 |
|
619 |
|
Lines 715-721
Link Here
|
715 |
} |
715 |
} |
716 |
} |
716 |
} |
717 |
|
717 |
|
718 |
iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
718 |
iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
719 |
|
719 |
|
720 |
if (extraProperties != null) { |
720 |
if (extraProperties != null) { |
721 |
Enumeration e = extraProperties.propertyNames(); |
721 |
Enumeration e = extraProperties.propertyNames(); |
Lines 759-765
Link Here
|
759 |
iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, new VersionRange(new Version(0, 0, 0), true, new Version(feature.getVersion()), false), IUpdateDescriptor.NORMAL, null)); |
759 |
iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, new VersionRange(new Version(0, 0, 0), true, new Version(feature.getVersion()), false), IUpdateDescriptor.NORMAL, null)); |
760 |
|
760 |
|
761 |
FeatureEntry entries[] = feature.getEntries(); |
761 |
FeatureEntry entries[] = feature.getEntries(); |
762 |
RequiredCapability[] required = new RequiredCapability[entries.length + (featureIU == null ? 0 : 1)]; |
762 |
IRequiredCapability[] required = new IRequiredCapability[entries.length + (featureIU == null ? 0 : 1)]; |
763 |
for (int i = 0; i < entries.length; i++) { |
763 |
for (int i = 0; i < entries.length; i++) { |
764 |
VersionRange range = getVersionRange(entries[i]); |
764 |
VersionRange range = getVersionRange(entries[i]); |
765 |
String requiredId = entries[i].getId(); |
765 |
String requiredId = entries[i].getId(); |
Lines 772-778
Link Here
|
772 |
if (featureIU != null) |
772 |
if (featureIU != null) |
773 |
required[entries.length] = MetadataFactory.createRequiredCapability(IU_NAMESPACE, featureIU.getId(), new VersionRange(featureIU.getVersion(), true, featureIU.getVersion(), true), INSTALL_FEATURES_FILTER, false, false); |
773 |
required[entries.length] = MetadataFactory.createRequiredCapability(IU_NAMESPACE, featureIU.getId(), new VersionRange(featureIU.getVersion(), true, featureIU.getVersion(), true), INSTALL_FEATURES_FILTER, false, false); |
774 |
iu.setRequiredCapabilities(required); |
774 |
iu.setRequiredCapabilities(required); |
775 |
iu.setTouchpointType(TouchpointType.NONE); |
775 |
iu.setTouchpointType(ITouchpointType.NONE); |
776 |
iu.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); |
776 |
iu.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); |
777 |
// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl |
777 |
// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl |
778 |
// of the feature? |
778 |
// of the feature? |
Lines 796-802
Link Here
|
796 |
} |
796 |
} |
797 |
} |
797 |
} |
798 |
|
798 |
|
799 |
iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
799 |
iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
800 |
|
800 |
|
801 |
if (extraProperties != null) { |
801 |
if (extraProperties != null) { |
802 |
Enumeration e = extraProperties.propertyNames(); |
802 |
Enumeration e = extraProperties.propertyNames(); |
Lines 834-846
Link Here
|
834 |
ArrayList requirementChanges = new ArrayList(); |
834 |
ArrayList requirementChanges = new ArrayList(); |
835 |
for (int i = 0; i < entries.length; i++) { |
835 |
for (int i = 0; i < entries.length; i++) { |
836 |
VersionRange range = getVersionRange(entries[i]); |
836 |
VersionRange range = getVersionRange(entries[i]); |
837 |
RequiredCapability req = MetadataFactory.createRequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), range, getFilter(entries[i]), entries[i].isOptional(), false); |
837 |
IRequiredCapability req = MetadataFactory.createRequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), range, getFilter(entries[i]), entries[i].isOptional(), false); |
838 |
if (entries[i].isRequires()) { |
838 |
if (entries[i].isRequires()) { |
839 |
applicabilityScope.add(req); |
839 |
applicabilityScope.add(req); |
840 |
continue; |
840 |
continue; |
841 |
} |
841 |
} |
842 |
if (entries[i].isPlugin()) { |
842 |
if (entries[i].isPlugin()) { |
843 |
RequiredCapability from = MetadataFactory.createRequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), VersionRange.emptyRange, getFilter(entries[i]), entries[i].isOptional(), false); |
843 |
IRequiredCapability from = MetadataFactory.createRequiredCapability(IU_NAMESPACE, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), VersionRange.emptyRange, getFilter(entries[i]), entries[i].isOptional(), false); |
844 |
requirementChanges.add(new RequirementChange(from, req)); |
844 |
requirementChanges.add(new RequirementChange(from, req)); |
845 |
continue; |
845 |
continue; |
846 |
} |
846 |
} |
Lines 848-866
Link Here
|
848 |
} |
848 |
} |
849 |
//Always add a requirement on the IU containing the feature jar |
849 |
//Always add a requirement on the IU containing the feature jar |
850 |
patchRequirements.add(MetadataFactory.createRequiredCapability(IU_NAMESPACE, featureIU.getId(), new VersionRange(featureIU.getVersion(), true, featureIU.getVersion(), true), INSTALL_FEATURES_FILTER, false, false)); |
850 |
patchRequirements.add(MetadataFactory.createRequiredCapability(IU_NAMESPACE, featureIU.getId(), new VersionRange(featureIU.getVersion(), true, featureIU.getVersion(), true), INSTALL_FEATURES_FILTER, false, false)); |
851 |
iu.setRequiredCapabilities((RequiredCapability[]) patchRequirements.toArray(new RequiredCapability[patchRequirements.size()])); |
851 |
iu.setRequiredCapabilities((IRequiredCapability[]) patchRequirements.toArray(new IRequiredCapability[patchRequirements.size()])); |
852 |
iu.setApplicabilityScope(new RequiredCapability[][] {(RequiredCapability[]) applicabilityScope.toArray(new RequiredCapability[applicabilityScope.size()])}); |
852 |
iu.setApplicabilityScope(new IRequiredCapability[][] {(IRequiredCapability[]) applicabilityScope.toArray(new IRequiredCapability[applicabilityScope.size()])}); |
853 |
iu.setRequirementChanges((RequirementChange[]) requirementChanges.toArray(new RequirementChange[requirementChanges.size()])); |
853 |
iu.setRequirementChanges((IRequirementChange[]) requirementChanges.toArray(new IRequirementChange[requirementChanges.size()])); |
854 |
|
854 |
|
855 |
//Generate lifecycle |
855 |
//Generate lifecycle |
856 |
RequiredCapability lifeCycle = null; |
856 |
IRequiredCapability lifeCycle = null; |
857 |
if (applicabilityScope.size() > 0) { |
857 |
if (applicabilityScope.size() > 0) { |
858 |
RequiredCapability req = (RequiredCapability) applicabilityScope.get(0); |
858 |
IRequiredCapability req = (IRequiredCapability) applicabilityScope.get(0); |
859 |
lifeCycle = MetadataFactory.createRequiredCapability(req.getNamespace(), req.getName(), req.getRange(), null, false, false, false); |
859 |
lifeCycle = MetadataFactory.createRequiredCapability(req.getNamespace(), req.getName(), req.getRange(), null, false, false, false); |
860 |
iu.setLifeCycle(lifeCycle); |
860 |
iu.setLifeCycle(lifeCycle); |
861 |
} |
861 |
} |
862 |
|
862 |
|
863 |
iu.setTouchpointType(TouchpointType.NONE); |
863 |
iu.setTouchpointType(ITouchpointType.NONE); |
864 |
iu.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); |
864 |
iu.setProperty(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString()); |
865 |
iu.setProperty(IInstallableUnit.PROP_TYPE_PATCH, Boolean.TRUE.toString()); |
865 |
iu.setProperty(IInstallableUnit.PROP_TYPE_PATCH, Boolean.TRUE.toString()); |
866 |
// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl |
866 |
// TODO: shouldn't the filter for the group be constructed from os, ws, arch, nl |
Lines 885-891
Link Here
|
885 |
} |
885 |
} |
886 |
} |
886 |
} |
887 |
|
887 |
|
888 |
iu.setCapabilities((ProvidedCapability[]) providedCapabilities.toArray(new ProvidedCapability[providedCapabilities.size()])); |
888 |
iu.setCapabilities((IProvidedCapability[]) providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()])); |
889 |
|
889 |
|
890 |
if (extraProperties != null) { |
890 |
if (extraProperties != null) { |
891 |
Enumeration e = extraProperties.propertyNames(); |
891 |
Enumeration e = extraProperties.propertyNames(); |
Lines 928-936
Link Here
|
928 |
String configId = "config." + id;//$NON-NLS-1$ |
928 |
String configId = "config." + id;//$NON-NLS-1$ |
929 |
cu.setId(configId); |
929 |
cu.setId(configId); |
930 |
cu.setVersion(version); |
930 |
cu.setVersion(version); |
931 |
cu.setHost(new RequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(version, true, versionMax, true), null, false, false)}); |
931 |
cu.setHost(new IRequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, id, new VersionRange(version, true, versionMax, true), null, false, false)}); |
932 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
932 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
933 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configId, version)}); |
933 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configId, version)}); |
934 |
cu.setTouchpointType(TOUCHPOINT_NATIVE); |
934 |
cu.setTouchpointType(TOUCHPOINT_NATIVE); |
935 |
Map touchpointData = new HashMap(); |
935 |
Map touchpointData = new HashMap(); |
936 |
|
936 |
|
Lines 986-992
Link Here
|
986 |
|
986 |
|
987 |
IArtifactKey key = createLauncherArtifactKey(launcherId, LAUNCHER_VERSION); |
987 |
IArtifactKey key = createLauncherArtifactKey(launcherId, LAUNCHER_VERSION); |
988 |
iu.setArtifacts(new IArtifactKey[] {key}); |
988 |
iu.setArtifacts(new IArtifactKey[] {key}); |
989 |
iu.setCapabilities(new ProvidedCapability[] {createSelfCapability(launcherId, LAUNCHER_VERSION)}); |
989 |
iu.setCapabilities(new IProvidedCapability[] {createSelfCapability(launcherId, LAUNCHER_VERSION)}); |
990 |
iu.setTouchpointType(TOUCHPOINT_NATIVE); |
990 |
iu.setTouchpointType(TOUCHPOINT_NATIVE); |
991 |
resultantIUs.add(MetadataFactory.createInstallableUnit(iu)); |
991 |
resultantIUs.add(MetadataFactory.createInstallableUnit(iu)); |
992 |
|
992 |
|
Lines 995-1003
Link Here
|
995 |
String configUnitId = configurationFlavor + launcherId; |
995 |
String configUnitId = configurationFlavor + launcherId; |
996 |
cu.setId(configUnitId); |
996 |
cu.setId(configUnitId); |
997 |
cu.setVersion(LAUNCHER_VERSION); |
997 |
cu.setVersion(LAUNCHER_VERSION); |
998 |
cu.setHost(new RequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, launcherId, new VersionRange(LAUNCHER_VERSION, true, versionMax, true), null, false, false)}); |
998 |
cu.setHost(new IRequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, launcherId, new VersionRange(LAUNCHER_VERSION, true, versionMax, true), null, false, false)}); |
999 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
999 |
cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); |
1000 |
cu.setCapabilities(new ProvidedCapability[] {createSelfCapability(configUnitId, LAUNCHER_VERSION)}); |
1000 |
cu.setCapabilities(new IProvidedCapability[] {createSelfCapability(configUnitId, LAUNCHER_VERSION)}); |
1001 |
cu.setTouchpointType(TOUCHPOINT_NATIVE); |
1001 |
cu.setTouchpointType(TOUCHPOINT_NATIVE); |
1002 |
Map touchpointData = new HashMap(); |
1002 |
Map touchpointData = new HashMap(); |
1003 |
String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ |
1003 |
String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ |
Lines 1029-1035
Link Here
|
1029 |
iud.setId(iuId + '.' + launcherName); |
1029 |
iud.setId(iuId + '.' + launcherName); |
1030 |
iud.setVersion(version); |
1030 |
iud.setVersion(version); |
1031 |
iud.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_OSGI); |
1031 |
iud.setTouchpointType(MetadataGeneratorHelper.TOUCHPOINT_OSGI); |
1032 |
iud.setCapabilities(new ProvidedCapability[] {createSelfCapability(iuId + '.' + launcherName, version)}); |
1032 |
iud.setCapabilities(new IProvidedCapability[] {createSelfCapability(iuId + '.' + launcherName, version)}); |
1033 |
|
1033 |
|
1034 |
if (os != null || ws != null || arch != null) { |
1034 |
if (os != null || ws != null || arch != null) { |
1035 |
String filterOs = os != null ? "(osgi.os=" + os + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1035 |
String filterOs = os != null ? "(osgi.os=" + os + ")" : ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
Lines 1047-1053
Link Here
|
1047 |
return iu; |
1047 |
return iu; |
1048 |
} |
1048 |
} |
1049 |
|
1049 |
|
1050 |
public static ProvidedCapability createSelfCapability(String installableUnitId, Version installableUnitVersion) { |
1050 |
public static IProvidedCapability createSelfCapability(String installableUnitId, Version installableUnitVersion) { |
1051 |
return MetadataFactory.createProvidedCapability(IU_NAMESPACE, installableUnitId, installableUnitVersion); |
1051 |
return MetadataFactory.createProvidedCapability(IU_NAMESPACE, installableUnitId, installableUnitVersion); |
1052 |
} |
1052 |
} |
1053 |
|
1053 |
|
Lines 1075-1081
Link Here
|
1075 |
/** |
1075 |
/** |
1076 |
* @deprecated moved to JREAction |
1076 |
* @deprecated moved to JREAction |
1077 |
*/ |
1077 |
*/ |
1078 |
private static ProvidedCapability[] generateJRECapability(String installableUnitId, Version installableUnitVersion, InputStream profileStream) { |
1078 |
private static IProvidedCapability[] generateJRECapability(String installableUnitId, Version installableUnitVersion, InputStream profileStream) { |
1079 |
if (profileStream == null) { |
1079 |
if (profileStream == null) { |
1080 |
//use the 1.6 profile stored in the generator bundle |
1080 |
//use the 1.6 profile stored in the generator bundle |
1081 |
try { |
1081 |
try { |
Lines 1088-1094
Link Here
|
1088 |
try { |
1088 |
try { |
1089 |
p.load(profileStream); |
1089 |
p.load(profileStream); |
1090 |
ManifestElement[] jrePackages = ManifestElement.parseHeader("org.osgi.framework.system.packages", (String) p.get("org.osgi.framework.system.packages")); //$NON-NLS-1$ //$NON-NLS-2$ |
1090 |
ManifestElement[] jrePackages = ManifestElement.parseHeader("org.osgi.framework.system.packages", (String) p.get("org.osgi.framework.system.packages")); //$NON-NLS-1$ //$NON-NLS-2$ |
1091 |
ProvidedCapability[] exportedPackageAsCapabilities = new ProvidedCapability[jrePackages.length + 1]; |
1091 |
IProvidedCapability[] exportedPackageAsCapabilities = new IProvidedCapability[jrePackages.length + 1]; |
1092 |
exportedPackageAsCapabilities[0] = createSelfCapability(installableUnitId, installableUnitVersion); |
1092 |
exportedPackageAsCapabilities[0] = createSelfCapability(installableUnitId, installableUnitVersion); |
1093 |
for (int i = 1; i <= jrePackages.length; i++) { |
1093 |
for (int i = 1; i <= jrePackages.length; i++) { |
1094 |
exportedPackageAsCapabilities[i] = MetadataFactory.createProvidedCapability(CAPABILITY_NS_JAVA_PACKAGE, jrePackages[i - 1].getValue(), null); |
1094 |
exportedPackageAsCapabilities[i] = MetadataFactory.createProvidedCapability(CAPABILITY_NS_JAVA_PACKAGE, jrePackages[i - 1].getValue(), null); |
Lines 1109-1115
Link Here
|
1109 |
} |
1109 |
} |
1110 |
} |
1110 |
} |
1111 |
} |
1111 |
} |
1112 |
return new ProvidedCapability[0]; |
1112 |
return new IProvidedCapability[0]; |
1113 |
} |
1113 |
} |
1114 |
|
1114 |
|
1115 |
/** |
1115 |
/** |