private Version getVersionAdvice(String iuID) { if (versionAdvice == null) { versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); if (versionAdvice == null) return null; } for (IVersionAdvice advice : versionAdvice) { // TODO have to figure a way to know the namespace here. for now just look everywhere Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_BUNDLE, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_FEATURE, iuID); if (result != null) return result; } return null; } }
private Version getVersionAdvice(String iuID) { if (versionAdvice == null) { versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); if (versionAdvice == null) return null; } for (IVersionAdvice advice : versionAdvice) { // TODO have to figure a way to know the namespace here. for now just look everywhere Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_BUNDLE, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_FEATURE, iuID); if (result != null) return result; } return null; } }
private Version getVersionAdvice(String iuID) { if (versionAdvice == null) { versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); if (versionAdvice == null) return null; } for (IVersionAdvice advice : versionAdvice) { // TODO have to figure a way to know the namespace here. for now just look everywhere Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_BUNDLE, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_FEATURE, iuID); if (result != null) return result; } return null; } }
private Version getVersionAdvice(String iuID) { if (versionAdvice == null) { versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); if (versionAdvice == null) return null; } for (IVersionAdvice advice : versionAdvice) { // TODO have to figure a way to know the namespace here. for now just look everywhere Version result = advice.getVersion(IInstallableUnit.NAMESPACE_IU_ID, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_BUNDLE, iuID); if (result == null) result = advice.getVersion(IVersionAdvice.NS_FEATURE, iuID); if (result != null) return result; } return null; } }
private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) { Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); List<IVersionedId> result = new ArrayList<IVersionedId>(); for (IVersionedId element : elements) { Version elementVersion = element.getVersion(); if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) { Iterator<IVersionAdvice> advice = versionAdvice.iterator(); while (advice.hasNext()) { elementVersion = advice.next().getVersion(namespace, element.getId()); break; } } // if advisedVersion is null, we get the highest version IInstallableUnit unit = queryForIU(publisherResults, element.getId(), elementVersion); if (unit != null) { result.add(unit); } else if (elementVersion != null) { //best effort result.add(new VersionedId(element.getId(), elementVersion)); } //TODO we could still add a requirement on version 0.0.0 to get any version, but if the //bundle is platform specific we will have broken metadata due to a missing filter } return result; }
private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) { Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); List<IVersionedId> result = new ArrayList<IVersionedId>(); for (IVersionedId element : elements) { Version elementVersion = element.getVersion(); if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) { Iterator<IVersionAdvice> advice = versionAdvice.iterator(); while (advice.hasNext()) { elementVersion = advice.next().getVersion(namespace, element.getId()); break; } } // if advisedVersion is null, we get the highest version IInstallableUnit unit = queryForIU(publisherResults, element.getId(), elementVersion); if (unit != null) { result.add(unit); } else { // if the bundle is platform specific we will have broken metadata due to a missing filter finalStatus.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.message_cannotDetermineFilterOnInclusion, element.getId(), elementVersion))); // preserve legacy behaviour for callers who choose to ignore the error status: // include element without filter, but only if there was an IVersionAdvice with "no advice" for this bundle (see bug 398066) if (elementVersion != null) { result.add(new VersionedId(element.getId(), elementVersion)); } } } return result; }
private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) { Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); List<IVersionedId> result = new ArrayList<>(); for (IVersionedId element : elements) { Version elementVersion = element.getVersion(); if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) { Iterator<IVersionAdvice> advice = versionAdvice.iterator(); while (advice.hasNext()) { elementVersion = advice.next().getVersion(namespace, element.getId()); break; } } // if advisedVersion is null, we get the highest version IInstallableUnit unit = queryForIU(publisherResults, element.getId(), elementVersion); if (unit != null) { result.add(unit); } else { // if the bundle is platform specific we will have broken metadata due to a missing filter finalStatus.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.message_cannotDetermineFilterOnInclusion, element.getId(), elementVersion))); // preserve legacy behaviour for callers who choose to ignore the error status: // include element without filter, but only if there was an IVersionAdvice with "no advice" for this bundle (see bug 398066) if (elementVersion != null) { result.add(new VersionedId(element.getId(), elementVersion)); } } } return result; }
/** * Publish a CU for the IU of the given id in the given config spec. If the IU is the * launcher bundle iu then set it up as the startup JAR. If it is a launcher fragment then * configure it in as the launcher.library for this configuration. */ private void publishCU(String id, String configSpec, IPublisherResult results) { Collection<IVersionAdvice> advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class); for (IVersionAdvice versionSpec : advice) { Version version = versionSpec.getVersion(IInstallableUnit.NAMESPACE_IU_ID, id); if (version == null) continue; GeneratorBundleInfo bundle = new GeneratorBundleInfo(); bundle.setSymbolicName(id); bundle.setVersion(version.toString()); if (id.equals(ORG_ECLIPSE_EQUINOX_LAUNCHER)) { bundle.setSpecialConfigCommands("addProgramArg(programArg:-startup);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:-startup);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } else { bundle.setSpecialConfigCommands("addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:--launcher.library);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } IMatchExpression<IInstallableUnit> filter = configSpec == null ? null : createFilterSpec(configSpec); IInstallableUnit cu = BundlesAction.createBundleConfigurationUnit(id, version, false, bundle, flavor, filter); if (cu != null) results.addIU(cu, IPublisherResult.ROOT); } } }
/** * Publish a CU for the IU of the given id in the given config spec. If the IU is the * launcher bundle iu then set it up as the startup JAR. If it is a launcher fragment then * configure it in as the launcher.library for this configuration. */ private void publishCU(String id, String configSpec, IPublisherResult results) { Collection<IVersionAdvice> advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class); for (IVersionAdvice versionSpec : advice) { Version version = versionSpec.getVersion(IInstallableUnit.NAMESPACE_IU_ID, id); if (version == null) continue; GeneratorBundleInfo bundle = new GeneratorBundleInfo(); bundle.setSymbolicName(id); bundle.setVersion(version.toString()); if (id.equals(ORG_ECLIPSE_EQUINOX_LAUNCHER)) { bundle.setSpecialConfigCommands("addProgramArg(programArg:-startup);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:-startup);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } else { bundle.setSpecialConfigCommands("addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:--launcher.library);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } IMatchExpression<IInstallableUnit> filter = configSpec == null ? null : createFilterSpec(configSpec); IInstallableUnit cu = BundlesAction.createBundleConfigurationUnit(id, version, false, bundle, flavor, filter); if (cu != null) results.addIU(cu, IPublisherResult.ROOT); } } }
/** * Publish a CU for the IU of the given id in the given config spec. If the IU is the * launcher bundle iu then set it up as the startup JAR. If it is a launcher fragment then * configure it in as the launcher.library for this configuration. */ private void publishCU(String id, String configSpec, IPublisherResult results) { Collection<IVersionAdvice> advice = info.getAdvice(configSpec, true, id, null, IVersionAdvice.class); for (IVersionAdvice versionSpec : advice) { Version version = versionSpec.getVersion(IInstallableUnit.NAMESPACE_IU_ID, id); if (version == null) continue; GeneratorBundleInfo bundle = new GeneratorBundleInfo(); bundle.setSymbolicName(id); bundle.setVersion(version.toString()); if (id.equals(ORG_ECLIPSE_EQUINOX_LAUNCHER)) { bundle.setSpecialConfigCommands("addProgramArg(programArg:-startup);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:-startup);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } else { bundle.setSpecialConfigCommands("addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"); //$NON-NLS-1$ bundle.setSpecialUnconfigCommands("removeProgramArg(programArg:--launcher.library);removeProgramArg(programArg:@artifact);"); //$NON-NLS-1$ } IMatchExpression<IInstallableUnit> filter = configSpec == null ? null : createFilterSpec(configSpec); IInstallableUnit cu = BundlesAction.createBundleConfigurationUnit(id, version, false, bundle, flavor, filter); if (cu != null) results.addIU(cu, IPublisherResult.ROOT); } } }