感谢西蒙的建议-我找到了使用这篇文章中的建议的更直接的方法-> http://www.eclipsezone.com/eclipse/forums/t97689.html
并添加了配置操作(IConfigureFeatureOperation)进行更新Lotus Notes 的 platform.xml 文件中的功能版本。以下是说明该方法的示例片段:
String updateSiteUrl = configuration.getUpdateSiteUrl();
IProgressMonitor monitor = new NullProgressMonitor();
ISite updateSite = SiteManager.getSite(new URL(updateSiteUrl),
monitor);
IFeatureReference[] siteFeatures = updateSite
.getFeatureReferences();
ILocalSite localSite = SiteManager.getLocalSite();
List<IInstallFeatureOperation> installOps = new ArrayList<IInstallFeatureOperation>();
List<IConfigFeatureOperation> configOps = new ArrayList<IConfigFeatureOperation>();
IConfiguredSite[] configuredSites = localSite
.getCurrentConfiguration().getConfiguredSites();
for (IConfiguredSite configuredSite : configuredSites) {
IFeatureReference[] localSiteFeatures = configuredSite
.getConfiguredFeatures();
for (IFeatureReference siteFeature : siteFeatures) {
for (IFeatureReference localSiteFeature : localSiteFeatures) {
VersionedIdentifier featureVi = siteFeature
.getVersionedIdentifier();
VersionedIdentifier localFeatureVi = localSiteFeature
.getVersionedIdentifier();
if (featureVi.getIdentifier().equals(
localFeatureVi.getIdentifier())) {
if (featureVi.getVersion().isGreaterThan(
localFeatureVi.getVersion())) {
installOps
.add(OperationsManager
.getOperationFactory()
.createInstallOperation(
configuredSite,
siteFeature
.getFeature(monitor),
null, null, null));
configOps
.add(OperationsManager
.getOperationFactory()
.createConfigOperation(
configuredSite,
siteFeature
.getFeature(monitor),
null, null));
}
}
}
}
}
if (installOps.size() > 0) {
// install new feature
for (Iterator<?> iter = installOps.iterator(); iter
.hasNext();) {
IInstallFeatureOperation op = (IInstallFeatureOperation) iter
.next();
op.execute(monitor, null);
}
// configure new feature
for (Iterator<?> iter = configOps.iterator(); iter
.hasNext();) {
IConfigFeatureOperation op = (IConfigFeatureOperation) iter
.next();
op.execute(monitor, null);
}
localSite.save();}