Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2008-02-28 18:49:56 +0000
committerSimon Kaegi2008-02-28 18:49:56 +0000
commit4ae6841a7aa0d0c0198d0cbb2ddb9d1e922932c3 (patch)
treed6b28abfe8951ae87ef485ed34c9894326f32d04 /bundles/org.eclipse.equinox.p2.directorywatcher
parentf19d4343c15d88e194d0231fb528ba2643adbf0e (diff)
downloadrt.equinox.p2-4ae6841a7aa0d0c0198d0cbb2ddb9d1e922932c3.tar.gz
rt.equinox.p2-4ae6841a7aa0d0c0198d0cbb2ddb9d1e922932c3.tar.xz
rt.equinox.p2-4ae6841a7aa0d0c0198d0cbb2ddb9d1e922932c3.zip
Adding support feature generation and support in the dropins folder
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.directorywatcher')
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java55
2 files changed, 43 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
index f0caa4434..85b1ed32b 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Version: 0.1.0.qualifier
Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
+ org.eclipse.equinox.internal.p2.metadata.generator.features,
org.eclipse.equinox.internal.provisional.p2.artifact.repository,
org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.core.repository,
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 527365b3c..be8bba7c5 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
@@ -14,13 +14,13 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
+import org.eclipse.equinox.internal.p2.metadata.generator.features.FeatureParser;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository;
import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.generator.BundleDescriptionFactory;
-import org.eclipse.equinox.internal.provisional.p2.metadata.generator.MetadataGeneratorHelper;
+import org.eclipse.equinox.internal.provisional.p2.metadata.generator.*;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
@@ -254,7 +254,7 @@ public class RepositoryListener extends DirectoryChangeListener {
lastModifed = System.currentTimeMillis();
}
- private IArtifactDescriptor generateArtifactDescriptor(File bundle) {
+ IArtifactDescriptor generateArtifactDescriptor(File bundle) {
BundleDescription bundleDescription = bundleDescriptionFactory.getBundleDescription(bundle);
IArtifactKey key = MetadataGeneratorHelper.createBundleArtifactKey(bundleDescription.getSymbolicName(), bundleDescription.getVersion().toString());
IArtifactDescriptor basicDescriptor = MetadataGeneratorHelper.createArtifactDescriptor(key, bundle, true, false);
@@ -276,22 +276,51 @@ public class RepositoryListener extends DirectoryChangeListener {
private IInstallableUnit[] generateIUs(Collection files, String repositoryId) {
List ius = new ArrayList();
for (Iterator it = files.iterator(); it.hasNext();) {
- File bundle = (File) it.next();
- IInstallableUnit iu = generateIU(bundle, repositoryId);
- if (iu != null)
- ius.add(iu);
+ File candidate = (File) it.next();
+
+ Properties props = new Properties();
+ props.setProperty("repository.id", repositoryId);
+ props.setProperty("file.name", candidate.getAbsolutePath());
+ props.setProperty("file.lastModified", Long.toString(candidate.lastModified()));
+
+ if (candidate.isDirectory() && candidate.getName().equals("eclipse"))
+ continue;
+
+ // feature check
+ String parentName = candidate.getParent();
+ if (parentName != null && parentName.equals("features")) {
+ IInstallableUnit[] featureIUs = generateFeatureIUs(candidate, props);
+ if (featureIUs != null)
+ ius.add(Arrays.asList(featureIUs));
+ } else {
+ IInstallableUnit bundleIU = generateBundleIU(candidate, props);
+ if (bundleIU != null)
+ ius.add(bundleIU);
+ }
}
return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
}
- private IInstallableUnit generateIU(File bundle, String repositoryId) {
- BundleDescription bundleDescription = bundleDescriptionFactory.getBundleDescription(bundle);
+ private IInstallableUnit[] generateFeatureIUs(File featureFile, Properties props) {
+
+ FeatureParser parser = new FeatureParser();
+ Feature feature = parser.parse(featureFile);
+
+ IInstallableUnit featureIU = MetadataGeneratorHelper.createFeatureJarIU(feature, true);
+ IInstallableUnit groupIU = MetadataGeneratorHelper.createGroupIU(feature, featureIU);
+
+ if (!Boolean.getBoolean("org.eclipse.p2.update.compatibility")) //$NON-NLS-1$
+ return new IInstallableUnit[] {groupIU};
+
+ return new IInstallableUnit[] {featureIU, groupIU};
+ }
+
+ private IInstallableUnit generateBundleIU(File bundleFile, Properties props) {
+
+ BundleDescription bundleDescription = bundleDescriptionFactory.getBundleDescription(bundleFile);
if (bundleDescription == null)
return null;
- Properties props = new Properties();
- props.setProperty("repository.id", repositoryId);
- props.setProperty("file.name", bundle.getAbsolutePath());
- props.setProperty("file.lastModified", Long.toString(bundle.lastModified()));
+
IArtifactKey key = MetadataGeneratorHelper.createBundleArtifactKey(bundleDescription.getSymbolicName(), bundleDescription.getVersion().toString());
IInstallableUnit iu = MetadataGeneratorHelper.createEclipseIU(bundleDescription, (Map) bundleDescription.getUserObject(), false, key, props);
return iu;

Back to the top