Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-12-09 22:18:03 +0000
committerJohn Arthorne2009-12-09 22:18:03 +0000
commit0f9ecc4ecff4d01308aba6f03c26fb4411ff9bec (patch)
treeaa75abc09eae333f8db8bf00b3ff5a9643b63ba0
parent7e8159bf30f6e1b86153bcfd17e30a0ed3f90428 (diff)
downloadrt.equinox.p2-0f9ecc4ecff4d01308aba6f03c26fb4411ff9bec.tar.gz
rt.equinox.p2-0f9ecc4ecff4d01308aba6f03c26fb4411ff9bec.tar.xz
rt.equinox.p2-0f9ecc4ecff4d01308aba6f03c26fb4411ff9bec.zip
Bug 293606 - Repository factories assume global agent
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/DoesNotCacheStaleData.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java1
28 files changed, 131 insertions, 38 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java
index 8d1c3d70a..901457a8e 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java
@@ -25,6 +25,7 @@ public class ArtifactRepositoryComponent implements IAgentServiceFactory {
final ArtifactRepositoryManager manager = new ArtifactRepositoryManager();
manager.setEventBus((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME));
manager.setAgentLocation((IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME));
+ manager.setAgent(agent);
Activator.addManager(manager, agent);
return manager;
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
index 9227c5f37..45d3500c8 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
@@ -56,6 +56,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
+ factory.setAgent(agent);
return factory.create(location, name, type, properties);
}
@@ -63,6 +64,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager impleme
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
+ factory.setAgent(agent);
return factory.load(location, flags, monitor.newChild(10));
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
index 8ca963786..663b772fd 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/ArtifactRepositoryFactory.java
@@ -14,6 +14,7 @@ import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
@@ -24,6 +25,8 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
*/
public abstract class ArtifactRepositoryFactory {
+ private IProvisioningAgent agent;
+
/**
* Creates and returns a new empty artifact repository of the given type at
* the given location.
@@ -43,6 +46,15 @@ public abstract class ArtifactRepositoryFactory {
public abstract IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException;
/**
+ * Returns the provisioning agent associated with this factory, or <code>null</code>
+ * if this factory is not associated with an agent.
+ * @return The provisioning agent, or <code>null</code>
+ */
+ protected IProvisioningAgent getAgent() {
+ return agent;
+ }
+
+ /**
* Loads and returns the repository of this factory's type at the given location.
* <p>
* The error code returned in the case of failure is significant. In particular an
@@ -72,4 +84,12 @@ public abstract class ArtifactRepositoryFactory {
* </ul>
*/
public abstract IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException;
+
+ /**
+ * Sets the provisioning agent associated with this repository factory.
+ * @param agent The provisioning agent
+ */
+ public void setAgent(IProvisioningAgent agent) {
+ this.agent = agent;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
index f7a3e7eb2..208ff7848 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java
@@ -29,6 +29,9 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.osgi.util.NLS;
public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
+ public SimpleArtifactRepositoryFactory() {
+ super();
+ }
public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
index 6822dcad3..5912e3676 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
@@ -38,8 +38,10 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
// make sure that we aren't trying to create a repo at a location
// where one already exists
boolean failed = false;
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
try {
- new SimpleArtifactRepositoryFactory().load(repoLocation, 0, null);
+ simpleFactory.load(repoLocation, 0, null);
failed = true;
} catch (ProvisionException e) {
// expected
@@ -48,7 +50,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
String msg = NLS.bind(Messages.repo_already_exists, location);
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
- IFileArtifactRepository repo = (IFileArtifactRepository) new SimpleArtifactRepositoryFactory().create(repoLocation, name, type, properties);
+ IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.create(repoLocation, name, type, properties);
return new ExtensionLocationArtifactRepository(location, repo, null);
}
@@ -71,7 +73,9 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, Messages.failed_create_local_artifact_repository));
// TODO proper progress monitoring
try {
- IFileArtifactRepository repo = (IFileArtifactRepository) new SimpleArtifactRepositoryFactory().load(repoLocation, flags, null);
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.load(repoLocation, flags, null);
return new ExtensionLocationArtifactRepository(location, repo, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationArtifactRepository.TYPE, null);
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
index 7c92e23f8..f83d9a76c 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
@@ -37,8 +37,10 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
// ensure that we aren't trying to create a repository at a location
// where one already exists
boolean failed = false;
+ final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
try {
- new SimpleMetadataRepositoryFactory().load(repoLocation, 0, null);
+ simpleFactory.load(repoLocation, 0, null);
failed = true;
} catch (ProvisionException e) {
// expected
@@ -47,7 +49,7 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
String msg = NLS.bind(Messages.repo_already_exists, location.toString());
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
- IMetadataRepository repository = new SimpleMetadataRepositoryFactory().create(repoLocation, name, null, properties);
+ IMetadataRepository repository = simpleFactory.create(repoLocation, name, null, properties);
return new ExtensionLocationMetadataRepository(location, repository, null);
}
@@ -70,7 +72,9 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, Messages.failed_create_local_artifact_repository));
// TODO proper progress monitoring
try {
- IMetadataRepository repository = new SimpleMetadataRepositoryFactory().load(repoLocation, flags, null);
+ final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IMetadataRepository repository = simpleFactory.load(repoLocation, flags, null);
return new ExtensionLocationMetadataRepository(location, repository, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationMetadataRepository.TYPE, null);
diff --git a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java
index 8aea9d172..322d77905 100644
--- a/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java
+++ b/bundles/org.eclipse.equinox.p2.jarprocessor/src/org/eclipse/equinox/internal/p2/jarprocessor/verifier/Verifier.java
@@ -96,6 +96,7 @@ public class Verifier extends JarProcessorExecutor {
return super.processJar(inputFile);
}
};
+ verifier.setWorkingDirectory(workingDirectory.getAbsolutePath());
for (int i = 0; i < input.length; i++) {
File inputFile = new File(input[i]);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java
index e31d78d06..59e004922 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java
@@ -23,8 +23,6 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
public static final String REPO_PROVIDER_XPT = ID + '.' + "metadataRepositories"; //$NON-NLS-1$
private static BundleContext bundleContext;
- //hack - currently set by MetadataRepositoryComponent
- static CacheManager cacheManager;
private ServiceRegistration repositoryManagerRegistration;
private ServiceTracker tracker;
@@ -32,10 +30,6 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
return bundleContext;
}
- public static CacheManager getCacheManager() {
- return cacheManager;
- }
-
public Object addingService(ServiceReference reference) {
if (repositoryManagerRegistration == null) {
//TODO: eventually we shouldn't register a singleton manager automatically
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
index c22fbe041..e4fa76fc7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CacheManager.java
@@ -37,6 +37,11 @@ import org.eclipse.osgi.util.NLS;
* was created for the repository.
*/
public class CacheManager {
+ /**
+ * Service name for the internal cache manager service.
+ */
+ public static final String SERVICE_NAME = CacheManager.class.getName();
+
private final IAgentLocation agentLocation;
/**
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
index 3262ac44c..a698b5843 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java
@@ -86,7 +86,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return isLocal();
}
- public CompositeMetadataRepository(URI location, String name, Map properties) {
+ CompositeMetadataRepository(URI location, String name, Map properties) {
super(name == null ? (location != null ? location.toString() : "") : name, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties); //$NON-NLS-1$
//when creating a repository, we must ensure it exists on disk so a subsequent load will succeed
save();
@@ -95,7 +95,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
/*
* This is only called by the parser when loading a repository.
*/
- public CompositeMetadataRepository(CompositeRepositoryState state) {
+ CompositeMetadataRepository(CompositeRepositoryState state) {
super(state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties());
for (int i = 0; i < state.getChildren().length; i++)
addChild(state.getChildren()[i], false);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
index f662647f8..96bebd676 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java
@@ -58,7 +58,10 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null));
}
//file is not local, create a cache of the repository metadata
- localFile = Activator.getCacheManager().createCache(location, CONTENT_FILENAME, monitor);
+ CacheManager cache = (CacheManager) getAgent().getService(CacheManager.SERVICE_NAME);
+ if (cache == null)
+ throw new IllegalArgumentException("Cache manager service not available"); //$NON-NLS-1$
+ localFile = cache.createCache(location, CONTENT_FILENAME, monitor);
if (localFile == null) {
//there is no remote file in either form
String msg = NLS.bind(Messages.io_failedRead, location);
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java
index c1ee177ac..822be6365 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java
@@ -26,9 +26,10 @@ public class MetadataRepositoryComponent implements IAgentServiceFactory {
final IProvisioningEventBus eventBus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
manager.setEventBus(eventBus);
manager.setAgentLocation((IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME));
+ manager.setAgent(agent);
CacheManager cache = new CacheManager((IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME));
cache.setEventBus(eventBus);
- Activator.cacheManager = cache;//todo avoid global cache
+ agent.registerService(CacheManager.SERVICE_NAME, cache);
return manager;
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
index 2f26666ee..0579aca4d 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java
@@ -43,6 +43,7 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager impleme
MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
+ factory.setAgent(agent);
return factory.create(location, name, type, properties);
}
@@ -50,6 +51,7 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager impleme
MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
return null;
+ factory.setAgent(agent);
return factory.load(location, flags, monitor.newChild(10));
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
index f26a1204f..b622e8a51 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/MetadataRepositoryFactory.java
@@ -15,6 +15,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
@@ -24,6 +25,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
* <tt>org.eclipse.equinox.p2.metadata.repository.metadataRepositories</tt> extension point.
*/
public abstract class MetadataRepositoryFactory {
+ private IProvisioningAgent agent;
/**
* Creates and returns a new empty metadata repository of the given type at
@@ -43,6 +45,15 @@ public abstract class MetadataRepositoryFactory {
public abstract IMetadataRepository create(URI location, String name, String type, Map properties) throws ProvisionException;
/**
+ * Returns the provisioning agent associated with this factory, or <code>null</code>
+ * if this factory is not associated with an agent.
+ * @return The provisioning agent, or <code>null</code>
+ */
+ protected IProvisioningAgent getAgent() {
+ return agent;
+ }
+
+ /**
* Loads a repository corresponding to the given URL.
* <p>
* The error code returned in the case of failure is significant. In particular an
@@ -74,6 +85,14 @@ public abstract class MetadataRepositoryFactory {
public abstract IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException;
/**
+ * Sets the provisioning agent associated with this repository factory.
+ * @param agent The provisioning agent
+ */
+ public void setAgent(IProvisioningAgent agent) {
+ this.agent = agent;
+ }
+
+ /**
* Validates a candidate repository URL and returns a status indicating the
* likelihood of a valid repository being located at the location. Implementors
* should make all attempts to validate the URL that can be made without
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
index 449054f2b..90d757a79 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/metadata/repository/SimpleMetadataRepositoryFactory.java
@@ -57,7 +57,10 @@ public class SimpleMetadataRepositoryFactory extends MetadataRepositoryFactory {
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_NOT_FOUND, msg, null));
}
// file is not local, create a cache of the repository metadata
- localFile = Activator.getCacheManager().createCache(location, URLMetadataRepository.CONTENT_FILENAME, monitor);
+ CacheManager cache = (CacheManager) getAgent().getService(CacheManager.SERVICE_NAME);
+ if (cache == null)
+ throw new IllegalArgumentException("Cache manager service not available"); //$NON-NLS-1$
+ localFile = cache.createCache(location, URLMetadataRepository.CONTENT_FILENAME, monitor);
if (localFile == null) {
// there is no remote file in either form - this should not really happen as
// createCache should bail out with exception if something is wrong. This is an internal
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
index b83f1b80a..2e7c37029 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF
@@ -23,6 +23,7 @@ Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.metadata,
org.eclipse.equinox.internal.provisional.p2.metadata.query,
+ org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
org.eclipse.equinox.p2.core,
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.engine.spi,
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
index 0c09fb932..d631e37dd 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java
@@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository;
+import org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
@@ -250,7 +251,9 @@ public abstract class AbstractApplication {
public IMetadataRepository getCompositeMetadataRepository() {
if (compositeMetadataRepository == null) {
try {
- compositeMetadataRepository = new CompositeMetadataRepository(new URI("memory:/composite"), "parent metadata repo", null);//$NON-NLS-1$ //$NON-NLS-2$
+ CompositeMetadataRepositoryFactory factory = new CompositeMetadataRepositoryFactory();
+ factory.setAgent(agent);
+ compositeMetadataRepository = (CompositeMetadataRepository) factory.create(new URI("memory:/composite"), "parent metadata repo", CompositeMetadataRepository.REPOSITORY_TYPE, null);//$NON-NLS-1$ //$NON-NLS-2$
} catch (URISyntaxException e) {
//Can't happen
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
index c22fbe041..e4fa76fc7 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
@@ -37,6 +37,11 @@ import org.eclipse.osgi.util.NLS;
* was created for the repository.
*/
public class CacheManager {
+ /**
+ * Service name for the internal cache manager service.
+ */
+ public static final String SERVICE_NAME = CacheManager.class.getName();
+
private final IAgentLocation agentLocation;
/**
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index cc53eacc5..6e4d8c0fb 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -23,6 +23,7 @@ import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningLis
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
import org.eclipse.equinox.p2.core.IAgentLocation;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
@@ -88,6 +89,7 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
private Map loadLocks = new HashMap();
protected IProvisioningEventBus eventBus;
private IAgentLocation agentLocation;
+ protected IProvisioningAgent agent;
protected AbstractRepositoryManager() {
super();
@@ -963,6 +965,14 @@ public abstract class AbstractRepositoryManager implements IRepositoryManager, P
}
/**
+ * Injects the agent service to be used by this repository manager
+ * @param agent The agent for this repository manager
+ */
+ public void setAgent(IProvisioningAgent agent) {
+ this.agent = agent;
+ }
+
+ /**
* Injects the agent location service to be used by this repository manager
* @param location The agent location
*/
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
index e102bab2c..813fbc39a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java
@@ -161,6 +161,7 @@ public class SimpleArtifactRepositoryTest extends AbstractProvisioningTest {
public void test_248772() {
SimpleArtifactRepositoryFactory factory = new SimpleArtifactRepositoryFactory();
+ factory.setAgent(getAgent());
URI location = null;
location = new File(getTempFolder(), getUniqueString()).toURI();
factory.create(location, "test type", null, null);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java
index f9949c8b1..a2db9c96b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/ProfileMetadataRepositoryTest.java
@@ -126,10 +126,12 @@ public class ProfileMetadataRepositoryTest extends AbstractProvisioningTest {
// /p2/org.eclipse.equinox.p2.engine/profileRegistry");
File tempFolder = getTempFolder();
copy("0.2", testData, tempFolder);
- new SimpleArtifactRepositoryFactory().create(tempFolder.toURI(), "", "", null);
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ simpleFactory.create(tempFolder.toURI(), "", "", null);
File defaultAgenRepositoryDirectory = new File(tempFolder, "p2/org.eclipse.equinox.p2.core/cache");
- new SimpleArtifactRepositoryFactory().create(defaultAgenRepositoryDirectory.toURI(), "", "", null);
+ simpleFactory.create(defaultAgenRepositoryDirectory.toURI(), "", "", null);
File profileRegistryFolder = new File(tempFolder, "p2/org.eclipse.equinox.p2.engine/profileRegistry");
SimpleProfileRegistry registry = new SimpleProfileRegistry(profileRegistryFolder, null, false);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
index 213e35de8..96680471a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/CompositeMetadataRepositoryTest.java
@@ -585,11 +585,11 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
*/
public void testNonLocalRepo() {
try {
- URI location = new URI("memory:/in/memory");
- URI childOne = new URI("memory:/in/memory/one");
- URI childTwo = new URI("memory:/in/memory/two");
- URI childThree = new URI("memory:/in/memory/three");
- CompositeMetadataRepository repository = new CompositeMetadataRepository(location, "in memory test", null);
+ URI location = new URI("http://foo.org/in/memory");
+ URI childOne = new URI("http://foo.org/in/memory/one");
+ URI childTwo = new URI("http://foo.org/in/memory/two");
+ URI childThree = new URI("http://foo.org/in/memory/three");
+ CompositeMetadataRepository repository = createRepository(location, "in memory test");
repository.addChild(childOne);
repository.addChild(childTwo);
repository.addChild(childThree);
@@ -607,6 +607,12 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
}
}
+ protected CompositeMetadataRepository createRepository(URI location, String name) {
+ CompositeMetadataRepositoryFactory factory = new CompositeMetadataRepositoryFactory();
+ factory.setAgent(getAgent());
+ return (CompositeMetadataRepository) factory.create(location, name, CompositeMetadataRepository.REPOSITORY_TYPE, null);
+ }
+
public void testRelativeChildren() {
// setup
File one = getTestData("0.0", "testData/testRepos/simple.1");
@@ -617,7 +623,7 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
// create the composite repository and add the children
URI location = new File(temp, "comp").toURI();
- CompositeMetadataRepository repository = new CompositeMetadataRepository(location, "test", null);
+ CompositeMetadataRepository repository = createRepository(location, "test");
try {
repository.addChild(new URI("../one"));
repository.addChild(new URI("../two"));
@@ -645,10 +651,10 @@ public class CompositeMetadataRepositoryTest extends AbstractProvisioningTest {
public void testRelativeRemoveChild() {
try {
- URI location = new URI("memory:/in/memory");
+ URI location = new URI("http://foo.org/in/memory");
URI one = new URI("one");
URI two = new URI("two");
- CompositeMetadataRepository repository = new CompositeMetadataRepository(location, "in memory test", null);
+ CompositeMetadataRepository repository = createRepository(location, "in memory test");
repository.addChild(one);
repository.addChild(two);
List children = repository.getChildren();
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
index 2bff1c6d9..97667f01f 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/JarURLMetadataRepositoryTest.java
@@ -16,7 +16,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
@@ -28,12 +27,10 @@ import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
-import org.eclipse.equinox.p2.tests.TestActivator;
-import org.osgi.framework.ServiceReference;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
-public class JarURLMetadataRepositoryTest extends TestCase {
+public class JarURLMetadataRepositoryTest extends AbstractProvisioningTest {
- private ServiceReference managerRef;
private IMetadataRepositoryManager manager;
private File testRepoJar;
@@ -46,8 +43,7 @@ public class JarURLMetadataRepositoryTest extends TestCase {
}
protected void setUp() throws Exception {
- managerRef = TestActivator.getContext().getServiceReference(IMetadataRepositoryManager.SERVICE_NAME);
- manager = (IMetadataRepositoryManager) TestActivator.getContext().getService(managerRef);
+ manager = getMetadataRepositoryManager();
String tempDir = System.getProperty("java.io.tmpdir");
File testRepo = new File(tempDir, "testRepo");
@@ -71,7 +67,6 @@ public class JarURLMetadataRepositoryTest extends TestCase {
protected void tearDown() throws Exception {
manager = null;
FileUtils.deleteAll(testRepoJar.getParentFile());
- TestActivator.getContext().ungetService(managerRef);
}
public void testJarURLRepository() throws ProvisionException {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
index 872e25278..ac11ae5f9 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerExceptionsTest.java
@@ -64,6 +64,7 @@ public class MetadataRepositoryManagerExceptionsTest extends AbstractProvisionin
MetadataRepositoryFactory factory;
factory = new SimpleMetadataRepositoryFactory();
+ factory.setAgent(getAgent());
try {
factory.load(location, 0, new NullProgressMonitor());
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
index 9f9f4e1af..f4d51223c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java
@@ -123,6 +123,7 @@ public class MetadataRepositoryManagerTest extends AbstractProvisioningTest {
MetadataRepositoryFactory factory;
factory = new SimpleMetadataRepositoryFactory();
+ factory.setAgent(getAgent());
try {
factory.load(location, 0, new NullProgressMonitor());
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/DoesNotCacheStaleData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/DoesNotCacheStaleData.java
index 4fab1db6f..18a5c7f9b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/DoesNotCacheStaleData.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/DoesNotCacheStaleData.java
@@ -39,7 +39,9 @@ public class DoesNotCacheStaleData extends AbstractProvisioningTest {
assertNotNull(e);
assertTrue(new File(URIUtil.toFile(UpdateSiteMetadataRepositoryFactory.getLocalRepositoryLocation(siteURI)), "content.xml").exists());
try {
- IMetadataRepository repo = new SimpleMetadataRepositoryFactory().load(f.toURI(), 0, new NullProgressMonitor());
+ final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IMetadataRepository repo = simpleFactory.load(f.toURI(), 0, new NullProgressMonitor());
assertEquals("0", repo.getProperties().get("site.checksum"));
} catch (ProvisionException e1) {
fail("3.0", e1);
@@ -60,7 +62,9 @@ public class DoesNotCacheStaleData extends AbstractProvisioningTest {
assertNotNull(e);
assertTrue(new File(URIUtil.toFile(UpdateSiteMetadataRepositoryFactory.getLocalRepositoryLocation(siteURI)), "artifacts.xml").exists());
try {
- IArtifactRepository repo = new SimpleArtifactRepositoryFactory().load(f.toURI(), 0, new NullProgressMonitor());
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IArtifactRepository repo = simpleFactory.load(f.toURI(), 0, new NullProgressMonitor());
assertEquals("0", repo.getProperties().get("site.checksum"));
} catch (ProvisionException e1) {
fail("3.0", e1);
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
index 29cd66e16..6767b73c3 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java
@@ -74,6 +74,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto
public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) {
URI localRepositoryURL = UpdateSiteMetadataRepositoryFactory.getLocalRepositoryLocation(location);
SimpleArtifactRepositoryFactory factory = new SimpleArtifactRepositoryFactory();
+ factory.setAgent(getAgent());
try {
return factory.load(localRepositoryURL, 0, monitor);
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
index df716179c..f1f2f4e01 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java
@@ -91,6 +91,7 @@ public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFacto
public IMetadataRepository loadRepository(URI location, IProgressMonitor monitor) {
URI localRepositoryURL = getLocalRepositoryLocation(location);
SimpleMetadataRepositoryFactory factory = new SimpleMetadataRepositoryFactory();
+ factory.setAgent(getAgent());
try {
return factory.load(localRepositoryURL, 0, monitor);
} catch (ProvisionException e) {

Back to the top