Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-12-10 02:31:10 +0000
committerJohn Arthorne2009-12-10 02:31:10 +0000
commit7f19b779295b1779c095f4234da61d96ce96a5fc (patch)
tree5a71a2bc8447297fb68cb04a7bfce9d740154c6f
parent7d3d45688d34308d79c51b02e42928eb029e477c (diff)
downloadrt.equinox.p2-7f19b779295b1779c095f4234da61d96ce96a5fc.tar.gz
rt.equinox.p2-7f19b779295b1779c095f4234da61d96ce96a5fc.tar.xz
rt.equinox.p2-7f19b779295b1779c095f4234da61d96ce96a5fc.zip
Bug 296280 - Composite Repositories use wrong agent
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java4
-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.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java26
10 files changed, 75 insertions, 42 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
index 4943dfe9e..c1978d309 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
@@ -18,7 +18,6 @@ import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.ArtifactComparatorFactory;
@@ -26,6 +25,7 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifact
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.AbstractArtifactRepository;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.repository.ICompositeRepository;
@@ -47,13 +47,16 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
private List childrenURIs = new ArrayList();
// keep a list of the repositories that we have successfully loaded
private List loadedRepos = new ArrayList();
+ private IArtifactRepositoryManager manager;
/**
* Create a Composite repository in memory.
* @return the repository or null if unable to create one
*/
- public static CompositeArtifactRepository createMemoryComposite() {
- IArtifactRepositoryManager manager = getManager();
+ public static CompositeArtifactRepository createMemoryComposite(IProvisioningAgent agent) {
+ if (agent == null)
+ return null;
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
if (manager == null)
return null;
try {
@@ -75,21 +78,23 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return null;
}
- static private IArtifactRepositoryManager getManager() {
- return (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.SERVICE_NAME);
+ private IArtifactRepositoryManager getManager() {
+ return manager;
}
/*
* This is only called by the parser when loading a repository.
*/
- public CompositeArtifactRepository(CompositeRepositoryState state) {
+ CompositeArtifactRepository(IArtifactRepositoryManager manager, CompositeRepositoryState state) {
super(state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties());
+ this.manager = manager;
for (int i = 0; i < state.getChildren().length; i++)
addChild(state.getChildren()[i], false);
}
- public CompositeArtifactRepository(URI location, String repositoryName, Map properties) {
+ CompositeArtifactRepository(IArtifactRepositoryManager manager, URI location, String repositoryName, Map properties) {
super(repositoryName, REPOSITORY_TYPE, REPOSITORY_VERSION.toString(), location, null, null, properties);
+ this.manager = manager;
save();
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
index 8d33d918c..c5a2deb75 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
@@ -25,10 +25,17 @@ import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.osgi.util.NLS;
public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactory {
+ private IArtifactRepositoryManager getManager() {
+ if (getAgent() != null)
+ return (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
+ return null;
+ }
+
public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
long time = 0;
@@ -95,7 +102,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
CompositeRepositoryState resultState = io.read(localFile.toURL(), descriptorStream, CompositeArtifactRepository.PI_REPOSITORY_TYPE, sub.newChild(100));
if (resultState.getLocation() == null)
resultState.setLocation(location);
- CompositeArtifactRepository result = new CompositeArtifactRepository(resultState);
+ CompositeArtifactRepository result = new CompositeArtifactRepository(getManager(), resultState);
if (Tracing.DEBUG_METADATA_PARSING) {
time += System.currentTimeMillis();
Tracing.debug(debugMsg + "time (ms): " + time); //$NON-NLS-1$
@@ -118,7 +125,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
}
public IArtifactRepository create(URI location, String name, String type, Map properties) {
- return new CompositeArtifactRepository(location, name, properties);
+ return new CompositeArtifactRepository(getManager(), location, name, properties);
}
private Transport getTransport() {
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 a698b5843..b6188f9ea 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
@@ -19,12 +19,12 @@ import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryIO;
import org.eclipse.equinox.internal.p2.persistence.CompositeRepositoryState;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.AbstractMetadataRepository;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.IQuery;
import org.eclipse.equinox.p2.repository.ICompositeRepository;
@@ -46,24 +46,27 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
private List childrenURIs = new ArrayList();
// keep a list of the repositories that we have successfully loaded
private List loadedRepos = new ArrayList();
+ private IMetadataRepositoryManager manager;
/**
* Create a Composite repository in memory.
* @return the repository or null if unable to create one
*/
- public static CompositeMetadataRepository createMemoryComposite() {
- IMetadataRepositoryManager manager = getManager();
- if (manager == null)
+ public static CompositeMetadataRepository createMemoryComposite(IProvisioningAgent agent) {
+ if (agent == null)
+ return null;
+ IMetadataRepositoryManager repoManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ if (repoManager == null)
return null;
try {
//create a unique opaque URI
long time = System.currentTimeMillis();
URI repositoryURI = new URI("memory:" + String.valueOf(time)); //$NON-NLS-1$
- while (manager.contains(repositoryURI))
+ while (repoManager.contains(repositoryURI))
repositoryURI = new URI("memory:" + String.valueOf(++time)); //$NON-NLS-1$
- CompositeMetadataRepository result = (CompositeMetadataRepository) manager.createRepository(repositoryURI, repositoryURI.toString(), IMetadataRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null);
- manager.removeRepository(repositoryURI);
+ CompositeMetadataRepository result = (CompositeMetadataRepository) repoManager.createRepository(repositoryURI, repositoryURI.toString(), IMetadataRepositoryManager.TYPE_COMPOSITE_REPOSITORY, null);
+ repoManager.removeRepository(repositoryURI);
return result;
} catch (ProvisionException e) {
// just return null
@@ -74,8 +77,8 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return null;
}
- static private IMetadataRepositoryManager getManager() {
- return (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
+ private IMetadataRepositoryManager getManager() {
+ return manager;
}
private boolean isLocal() {
@@ -86,8 +89,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
return isLocal();
}
- CompositeMetadataRepository(URI location, String name, Map properties) {
+ CompositeMetadataRepository(IMetadataRepositoryManager manager, 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$
+ this.manager = manager;
//when creating a repository, we must ensure it exists on disk so a subsequent load will succeed
save();
}
@@ -95,8 +99,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
/*
* This is only called by the parser when loading a repository.
*/
- CompositeMetadataRepository(CompositeRepositoryState state) {
+ CompositeMetadataRepository(IMetadataRepositoryManager manager, CompositeRepositoryState state) {
super(state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties());
+ this.manager = manager;
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 96bebd676..287a32aee 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
@@ -23,6 +23,7 @@ import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
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.osgi.util.NLS;
public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactory {
@@ -33,7 +34,13 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor
public static final String CONTENT_FILENAME = "compositeContent"; //$NON-NLS-1$
public IMetadataRepository create(URI location, String name, String type, Map properties) {
- return new CompositeMetadataRepository(location, name, properties);
+ return new CompositeMetadataRepository(getManager(), location, name, properties);
+ }
+
+ private IMetadataRepositoryManager getManager() {
+ if (getAgent() != null)
+ return (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ return null;
}
/**
@@ -127,7 +134,7 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor
CompositeRepositoryState resultState = io.read(localFile.toURL(), descriptorStream, CompositeMetadataRepository.PI_REPOSITORY_TYPE, sub.newChild(100));
if (resultState.getLocation() == null)
resultState.setLocation(location);
- CompositeMetadataRepository result = new CompositeMetadataRepository(resultState);
+ CompositeMetadataRepository result = new CompositeMetadataRepository(getManager(), resultState);
if (Tracing.DEBUG_METADATA_PARSING) {
time += System.currentTimeMillis();
Tracing.debug(debugMsg + "time (ms): " + time); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java
index a1e9c2faf..3d720cf14 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AbstractPublisherApplication.java
@@ -96,7 +96,7 @@ public abstract class AbstractPublisherApplication implements IApplication {
publisherInfo.setMetadataRepository(Publisher.createMetadataRepository(agent, metadataLocation, metadataRepoName, append, compress));
if (contextMetadataRepositories != null && contextMetadataRepositories.length > 0) {
- CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite();
+ CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(agent);
if (contextMetadata != null) {
for (int i = 0; i < contextMetadataRepositories.length; i++)
contextMetadata.addChild(contextMetadataRepositories[i]);
@@ -105,7 +105,7 @@ public abstract class AbstractPublisherApplication implements IApplication {
}
}
if (contextArtifactRepositories != null && contextArtifactRepositories.length > 0) {
- CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite();
+ CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite(agent);
if (contextArtifact != null) {
for (int i = 0; i < contextArtifactRepositories.length; i++)
contextArtifact.addChild(contextArtifactRepositories[i]);
@@ -171,7 +171,7 @@ public abstract class AbstractPublisherApplication implements IApplication {
if (list == null || list.length == 0)
return null;
- CompositeArtifactRepository result = CompositeArtifactRepository.createMemoryComposite();
+ CompositeArtifactRepository result = CompositeArtifactRepository.createMemoryComposite(agent);
if (result != null) {
for (int i = 0; i < list.length; i++) {
try {
@@ -190,7 +190,7 @@ public abstract class AbstractPublisherApplication implements IApplication {
if (list == null || list.length == 0)
return null;
- CompositeMetadataRepository result = CompositeMetadataRepository.createMemoryComposite();
+ CompositeMetadataRepository result = CompositeMetadataRepository.createMemoryComposite(agent);
if (result != null) {
for (int i = 0; i < list.length; i++) {
try {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
index 768b97d1e..6fd6c2e18 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java
@@ -13,7 +13,6 @@ package org.eclipse.equinox.p2.publisher;
import java.net.URI;
import java.util.Collection;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
@@ -57,7 +56,7 @@ public class Publisher {
}
// the given repo location is not an existing repo so we have to create something
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.context, IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
String repositoryName = name == null ? location + " - metadata" : name; //$NON-NLS-1$
IMetadataRepository result = manager.createRepository(location, repositoryName, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
if (result != null) {
@@ -115,7 +114,7 @@ public class Publisher {
//fall through and create a new repository
}
- IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.context, IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
String repositoryName = name != null ? name : location + " - artifacts"; //$NON-NLS-1$
IArtifactRepository result = manager.createRepository(location, repositoryName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
if (result != null) {
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
index c9578520e..989716458 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java
@@ -105,8 +105,8 @@ public abstract class AbstractPublishTask extends Task {
info.setMetadataRepository(Publisher.createMetadataRepository(getProvisioningAgent(), metadataLocation, metadataRepoName, append, compress));
if (contextRepositories.size() > 0) {
- CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite();
- CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite();
+ CompositeMetadataRepository contextMetadata = CompositeMetadataRepository.createMemoryComposite(getProvisioningAgent());
+ CompositeArtifactRepository contextArtifact = CompositeArtifactRepository.createMemoryComposite(getProvisioningAgent());
for (Iterator iterator = contextRepositories.iterator(); iterator.hasNext();) {
RepoEntry entry = (RepoEntry) iterator.next();
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 2e7c37029..96a37a4f2 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.artifact.repository,
org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
org.eclipse.equinox.p2.core,
org.eclipse.equinox.p2.engine,
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 d631e37dd..14e1ccfe4 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
@@ -15,6 +15,7 @@ import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepositoryFactory;
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;
@@ -269,7 +270,9 @@ public abstract class AbstractApplication {
public IArtifactRepository getCompositeArtifactRepository() {
if (compositeArtifactRepository == null) {
try {
- compositeArtifactRepository = new CompositeArtifactRepository(new URI("memory:/composite"), "parent artifact repo", null);//$NON-NLS-1$ //$NON-NLS-2$
+ CompositeArtifactRepositoryFactory factory = new CompositeArtifactRepositoryFactory();
+ factory.setAgent(agent);
+ compositeArtifactRepository = (CompositeArtifactRepository) factory.create(new URI("memory:/composite"), "parent artifact repo", CompositeArtifactRepository.REPOSITORY_TYPE, null);//$NON-NLS-1$ //$NON-NLS-2$
} catch (URISyntaxException e) {
//Can't happen
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
index 2a512f124..d11156adb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/CompositeArtifactRepositoryTest.java
@@ -848,7 +848,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
URI childOne = new URI("memory:/in/memory/one");
URI childTwo = new URI("memory:/in/memory/two");
URI childThree = new URI("memory:/in/memory/three");
- CompositeArtifactRepository repository = new CompositeArtifactRepository(location, "in memory test", null);
+ CompositeArtifactRepository repository = createRepository(location, "in memory test");
repository.addChild(childOne);
repository.addChild(childTwo);
repository.addChild(childThree);
@@ -876,7 +876,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
// create the composite repository and add the children
URI location = new File(temp, "comp").toURI();
- CompositeArtifactRepository repository = new CompositeArtifactRepository(location, "test", null);
+ CompositeArtifactRepository repository = createRepository(location, "test");
try {
repository.addChild(new URI("../one"));
repository.addChild(new URI("../two"));
@@ -906,7 +906,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
URI location = new URI("memory:/in/memory");
URI one = new URI("one");
URI two = new URI("two");
- CompositeArtifactRepository repository = new CompositeArtifactRepository(location, "in memory test", null);
+ CompositeArtifactRepository repository = createRepository(location, "in memory test");
repository.addChild(one);
repository.addChild(two);
List children = repository.getChildren();
@@ -933,7 +933,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
destination = new File(getTempFolder(), getUniqueString());
out = new FileOutputStream(destination);
- CompositeArtifactRepository repository = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ CompositeArtifactRepository repository = createRepository(new URI("memory:/in/memory"), "in memory test");
IArtifactRepository childOne = getArtifactRepositoryManager().loadRepository(childLocation, null);
TestArtifactRepository childTwo = new TestArtifactRepository(new URI("memory:/in/memory/two"));
@@ -1003,7 +1003,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
try {
destination = super.createArtifactRepository(getTempFolder().toURI(), null);
child = new BadMirrorSite(new URI("memory:/in/memory/child"));
- source = new CompositeArtifactRepository(new URI("memory:/in/memory/source"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory/source"), "in memory test");
source.addChild(child.getLocation());
// Create mirror request
@@ -1029,6 +1029,12 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
}
}
+ protected CompositeArtifactRepository createRepository(URI location, String name) {
+ CompositeArtifactRepositoryFactory factory = new CompositeArtifactRepositoryFactory();
+ factory.setAgent(getAgent());
+ return (CompositeArtifactRepository) factory.create(location, name, CompositeArtifactRepository.REPOSITORY_TYPE, null);
+ }
+
/*
* Test a child returning different bytes
*/
@@ -1069,7 +1075,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
destination = new File(getTempFolder(), getUniqueString());
out = new FileOutputStream(destination);
- source = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory"), "in memory test");
IArtifactDescriptor descriptor = new ArtifactDescriptor(new ArtifactKey("osgi.bundle", "missingSize.asdf", Version.create("1.5.1.v200803061910")));
// Create 'bad' child which returns an error in transfer
@@ -1129,7 +1135,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
IArtifactRepository childTwo = null;
try {
IArtifactDescriptor desc = new ArtifactDescriptor(new ArtifactKey("osgi", "a", Version.create("1.0.0")));
- source = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory"), "in memory test");
childOne = createChild();
source.addChild(childOne.getLocation());
@@ -1165,7 +1171,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
IArtifactRepository childTwo = null;
try {
IArtifactKey desc = new ArtifactKey("osgi", "a", Version.create("1.0.0"));
- source = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory"), "in memory test");
childOne = createChild();
source.addChild(childOne.getLocation());
@@ -1201,7 +1207,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
IArtifactRepository childTwo = null;
try {
- source = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory"), "in memory test");
IArtifactKey key = new ArtifactKey("classifier", "name", Version.create("1.0.0"));
childOne = createChild();
@@ -1238,7 +1244,7 @@ public class CompositeArtifactRepositoryTest extends AbstractProvisioningTest {
IArtifactRepository childTwo = null;
try {
- source = new CompositeArtifactRepository(new URI("memory:/in/memory"), "in memory test", null);
+ source = createRepository(new URI("memory:/in/memory"), "in memory test");
IArtifactKey key = new ArtifactKey("classifier", "name", Version.create("1.0.0"));
IArtifactDescriptor desc = new ArtifactDescriptor(key);

Back to the top