Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDJ Houghton2010-09-09 14:38:04 +0000
committerDJ Houghton2010-09-09 14:38:04 +0000
commitba2edd3ba79e660ce96bab02dab8050795019130 (patch)
treeb1080131114da40bd23546c6372af9d430f19bf0
parent501f93f37e6a02393cc80b086a3623eff1ab0af5 (diff)
downloadrt.equinox.p2-ba2edd3ba79e660ce96bab02dab8050795019130.tar.gz
rt.equinox.p2-ba2edd3ba79e660ce96bab02dab8050795019130.tar.xz
rt.equinox.p2-ba2edd3ba79e660ce96bab02dab8050795019130.zip
Bug 315773 - content.xml is too big (20 MB+)
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java21
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java2
4 files changed, 27 insertions, 25 deletions
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 08a5d8fdc..132e5f410 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
@@ -25,7 +25,6 @@ import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction;
import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction;
import org.eclipse.equinox.p2.query.*;
-import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.artifact.*;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -53,12 +52,12 @@ public class RepositoryListener extends DirectoryChangeListener {
* Create a repository listener that watches the specified folder and generates repositories
* for its content.
* @param repositoryName the repository name to use for the repository
- * @param hidden <code>true</code> if the repository should be hidden, <code>false</code> if not.
+ * @param properties the map of repository properties or <code>null</code>
*/
- public RepositoryListener(String repositoryName, boolean hidden) {
+ public RepositoryListener(String repositoryName, Map<String, String> properties) {
URI location = Activator.getDefaultRepositoryLocation(this, repositoryName);
- metadataRepository = initializeMetadataRepository(repositoryName, location, hidden);
- artifactRepository = initializeArtifactRepository(repositoryName, location, hidden);
+ metadataRepository = initializeMetadataRepository(repositoryName, location, properties);
+ artifactRepository = initializeArtifactRepository(repositoryName, location, properties);
initializePublisher();
}
@@ -76,7 +75,7 @@ public class RepositoryListener extends DirectoryChangeListener {
info.setArtifactOptions(IPublisherInfo.A_INDEX | IPublisherInfo.A_NO_MD5);
}
- protected CachingArtifactRepository initializeArtifactRepository(String repositoryName, URI repositoryLocation, boolean hidden) {
+ protected CachingArtifactRepository initializeArtifactRepository(String name, URI repositoryLocation, Map<String, String> properties) {
IArtifactRepositoryManager manager = Activator.getArtifactRepositoryManager();
if (manager == null)
throw new IllegalStateException(Messages.artifact_repo_manager_not_registered);
@@ -88,12 +87,6 @@ public class RepositoryListener extends DirectoryChangeListener {
//fall through and create a new repository
}
try {
- String name = repositoryName;
- Map<String, String> properties = new HashMap<String, String>(1);
- if (hidden) {
- properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
- name = "artifact listener " + repositoryName; //$NON-NLS-1$
- }
IArtifactRepository result = manager.createRepository(repositoryLocation, name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
return result == null ? null : new CachingArtifactRepository(result);
} catch (ProvisionException e) {
@@ -102,7 +95,7 @@ public class RepositoryListener extends DirectoryChangeListener {
}
}
- protected IMetadataRepository initializeMetadataRepository(String repositoryName, URI repositoryLocation, boolean hidden) {
+ protected IMetadataRepository initializeMetadataRepository(String name, URI repositoryLocation, Map<String, String> properties) {
IMetadataRepositoryManager manager = Activator.getMetadataRepositoryManager();
if (manager == null)
throw new IllegalStateException(Messages.metadata_repo_manager_not_registered);
@@ -113,12 +106,6 @@ public class RepositoryListener extends DirectoryChangeListener {
//fall through and create new repository
}
try {
- String name = repositoryName;
- Map<String, String> properties = new HashMap<String, String>(1);
- if (hidden) {
- properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
- name = "metadata listener " + repositoryName; //$NON-NLS-1$
- }
return manager.createRepository(repositoryLocation, name, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
} catch (ProvisionException e) {
LogHelper.log(e);
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
index 3894dc184..6d5a536bf 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
@@ -70,7 +70,12 @@ public class Activator implements BundleActivator {
throw new IllegalStateException("MetadataRepositoryManager not registered."); //$NON-NLS-1$
ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
factory.setAgent(agent);
- IMetadataRepository repository = factory.create(location, name, ExtensionLocationMetadataRepository.TYPE, properties);
+ // always compress repositories that we are creating.
+ Map<String, String> repositoryProperties = new HashMap<String, String>();
+ repositoryProperties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
+ if (properties != null)
+ repositoryProperties.putAll(properties);
+ IMetadataRepository repository = factory.create(location, name, ExtensionLocationMetadataRepository.TYPE, repositoryProperties);
//we need to add the concrete repository to the repository manager, or its properties will not be correct
((MetadataRepositoryManager) manager).addRepository(repository);
manager.setRepositoryProperty(location, IRepository.PROP_SYSTEM, String.valueOf(true));
@@ -112,7 +117,12 @@ public class Activator implements BundleActivator {
throw new IllegalStateException("ArtifactRepositoryManager not registered."); //$NON-NLS-1$
ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory();
factory.setAgent(agent);
- IArtifactRepository repository = factory.create(location, name, ExtensionLocationArtifactRepository.TYPE, properties);
+ // always compress repositories that we are creating.
+ Map<String, String> repositoryProperties = new HashMap<String, String>();
+ repositoryProperties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
+ if (properties != null)
+ repositoryProperties.putAll(properties);
+ IArtifactRepository repository = factory.create(location, name, ExtensionLocationArtifactRepository.TYPE, repositoryProperties);
//we need to add the concrete repository to the repository manager, or its properties will not be correct
((ArtifactRepositoryManager) manager).addRepository(repository);
manager.setRepositoryProperty(location, IRepository.PROP_SYSTEM, String.valueOf(true));
@@ -514,7 +524,12 @@ public class Activator implements BundleActivator {
if (directories.isEmpty())
return;
- DropinsRepositoryListener listener = new DropinsRepositoryListener(getAgent(), DROPINS);
+ // we will compress the repositories and mark them hidden as "system" repos.
+ Map<String, String> properties = new HashMap<String, String>();
+ properties.put(IRepository.PROP_COMPRESSED, Boolean.TRUE.toString());
+ properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
+
+ DropinsRepositoryListener listener = new DropinsRepositoryListener(getAgent(), DROPINS, properties);
DirectoryWatcher watcher = new DirectoryWatcher(directories.toArray(new File[directories.size()]));
watcher.addListener(listener);
watcher.poll();
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index 642c7f0d2..d2cbd5622 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -78,8 +78,8 @@ public class DropinsRepositoryListener extends RepositoryListener {
private boolean optional = false;
}
- public DropinsRepositoryListener(IProvisioningAgent agent, String repositoryName) {
- super(repositoryName, true);
+ public DropinsRepositoryListener(IProvisioningAgent agent, String repositoryName, Map<String, String> properties) {
+ super(repositoryName, properties);
this.agent = agent;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
index 6813f2f55..6ef8ee5bc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/directorywatcher/TestRepositoryWatcher.java
@@ -35,7 +35,7 @@ class TestRepositoryWatcher extends DirectoryWatcher {
* Create and return a new test directory watcher class which will listen on the given folder.
*/
public static TestRepositoryWatcher createWatcher(File folder) {
- RepositoryListener listener = new RepositoryListener(AbstractProvisioningTest.getUniqueString(), false);
+ RepositoryListener listener = new RepositoryListener(AbstractProvisioningTest.getUniqueString(), null);
Map<String, String> props = new Hashtable<String, String>();
props.put(DirectoryWatcher.DIR, folder.getAbsolutePath());
props.put(DirectoryWatcher.POLL, "500");

Back to the top