Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2010-03-05 17:32:23 -0500
committerJohn Arthorne2010-03-05 17:32:23 -0500
commit9fe7fc7078564daa547dc308fff7bc5ee15d4eaa (patch)
treec0df702c26b00d50a3e9397f9b07855c3af11845
parent6681d1baf3a6f5152768995ecca95e2238cbadd4 (diff)
downloadrt.equinox.p2-9fe7fc7078564daa547dc308fff7bc5ee15d4eaa.tar.gz
rt.equinox.p2-9fe7fc7078564daa547dc308fff7bc5ee15d4eaa.tar.xz
rt.equinox.p2-9fe7fc7078564daa547dc308fff7bc5ee15d4eaa.zip
Bug 293340 - [api][repository] Review of the repository package
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java72
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java102
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java4
21 files changed, 269 insertions, 133 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 d3aba9d0f..a1de069d8 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
@@ -147,7 +147,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private boolean isLocal() {
- return "file".equalsIgnoreCase(location.getScheme()); //$NON-NLS-1$
+ return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$
}
public boolean isModifiable() {
@@ -159,7 +159,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private void addChild(URI childURI, boolean save) {
- URI absolute = URIUtil.makeAbsolute(childURI, location);
+ URI absolute = URIUtil.makeAbsolute(childURI, getLocation());
if (childrenURIs.contains(childURI) || childrenURIs.contains(absolute))
return;
childrenURIs.add(childURI);
@@ -193,7 +193,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
boolean removed = childrenURIs.remove(childURI);
// if the child wasn't there make sure and try the other permutation
// (absolute/relative) to see if it really is in the list.
- URI other = childURI.isAbsolute() ? URIUtil.makeRelative(childURI, location) : URIUtil.makeAbsolute(childURI, location);
+ URI other = childURI.isAbsolute() ? URIUtil.makeRelative(childURI, getLocation()) : URIUtil.makeAbsolute(childURI, getLocation());
if (!removed)
childrenURIs.remove(other);
@@ -222,7 +222,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
public List<URI> getChildren() {
List<URI> result = new ArrayList<URI>();
for (URI uri : childrenURIs)
- result.add(URIUtil.makeAbsolute(uri, location));
+ result.add(URIUtil.makeAbsolute(uri, getLocation()));
return result;
}
@@ -408,12 +408,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return;
if (!isModifiable())
return;
- boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(getProperty(PROP_COMPRESSED)); //$NON-NLS-1$
OutputStream os = null;
try {
- URI actualLocation = getActualLocation(location, false);
+ URI actualLocation = getActualLocation(getLocation(), false);
File artifactsFile = URIUtil.toFile(actualLocation);
- File jarFile = URIUtil.toFile(getActualLocation(location, true));
+ File jarFile = URIUtil.toFile(getActualLocation(getLocation(), true));
if (!compress) {
if (jarFile.exists()) {
jarFile.delete();
@@ -439,13 +439,13 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
super.setProperty(IRepository.PROP_TIMESTAMP, Long.toString(System.currentTimeMillis()));
new CompositeRepositoryIO().write(toState(), os, PI_REPOSITORY_TYPE);
} catch (IOException e) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, NLS.bind(Messages.io_failedWrite, location), e));
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, NLS.bind(Messages.io_failedWrite, getLocation()), e));
}
}
private IArtifactRepository load(URI repoURI) throws ProvisionException {
// make sure we are dealing with an absolute location
- repoURI = URIUtil.makeAbsolute(repoURI, location);
+ repoURI = URIUtil.makeAbsolute(repoURI, getLocation());
boolean loaded = getManager().contains(repoURI);
IArtifactRepository repo = getManager().loadRepository(repoURI, null);
if (!loaded) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 91faff8f4..929c9c4b1 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -419,7 +419,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
if (descriptor.getProcessingSteps().length == 0) {
descriptor.setProperty(ARTIFACT_UUID, null);
IArtifactKey key = descriptor.getArtifactKey();
- URI result = mapper.map(location, key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
+ URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
if (result != null) {
if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION)) {
return URIUtil.removeFileExtension(result);
@@ -661,7 +661,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
*/
private URI getLocationForPackedButFlatArtifacts(IArtifactDescriptor descriptor) {
IArtifactKey key = descriptor.getArtifactKey();
- return mapper.map(location, key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
+ return mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
}
public synchronized URI getLocation(IArtifactDescriptor descriptor) {
@@ -690,7 +690,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
// if the descriptor is complete then use the mapping rules...
if (descriptor.getProcessingSteps().length == 0) {
IArtifactKey key = descriptor.getArtifactKey();
- URI result = mapper.map(location, key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
+ URI result = mapper.map(getLocation(), key.getClassifier(), key.getId(), key.getVersion().toString(), descriptor.getProperty(IArtifactDescriptor.FORMAT));
if (result != null) {
if (isFolderBased(descriptor) && URIUtil.lastSegment(result).endsWith(JAR_EXTENSION))
return URIUtil.removeFileExtension(result);
@@ -801,7 +801,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
// use this method to setup any transient fields etc after the object has been restored from a stream
public synchronized void initializeAfterLoad(URI repoLocation) {
- this.location = repoLocation;
+ setLocation(repoLocation);
blobStore = new BlobStore(getBlobStoreLocation(repoLocation), 128);
initializeMapper();
for (SimpleArtifactDescriptor desc : artifactDescriptors)
@@ -816,7 +816,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
private boolean isFolderBased(IArtifactDescriptor descriptor) {
// This is called from createInternalDescriptor, so if we aren't a
// SimpleArtifactDescriptor then just check the descriptor properties instead
- // of creating the interla descriptor.
+ // of creating the internal descriptor.
SimpleArtifactDescriptor internalDescriptor = null;
if (descriptor instanceof SimpleArtifactDescriptor)
internalDescriptor = (SimpleArtifactDescriptor) descriptor;
@@ -833,7 +833,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private boolean isLocal() {
- return "file".equalsIgnoreCase(location.getScheme()); //$NON-NLS-1$
+ return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$
}
public boolean isModifiable() {
@@ -842,7 +842,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
public OutputStream processDestination(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
destination = addPostSteps(handler, descriptor, destination, monitor);
- destination = handler.createAndLink(agent, descriptor.getProcessingSteps(), descriptor, destination, monitor);
+ destination = handler.createAndLink(getProvisioningAgent(), descriptor.getProcessingSteps(), descriptor, destination, monitor);
destination = addPreSteps(handler, descriptor, destination, monitor);
return destination;
}
@@ -914,7 +914,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
public void save() {
if (disableSave)
return;
- boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ boolean compress = "true".equalsIgnoreCase(getProperty(PROP_COMPRESSED)); //$NON-NLS-1$
save(compress);
}
@@ -923,9 +923,9 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
OutputStream os = null;
try {
try {
- URI actualLocation = getActualLocation(location, false);
+ URI actualLocation = getActualLocation(getLocation(), false);
File artifactsFile = URIUtil.toFile(actualLocation);
- File jarFile = URIUtil.toFile(getActualLocation(location, true));
+ File jarFile = URIUtil.toFile(getActualLocation(getLocation(), true));
if (!compress) {
if (jarFile.exists()) {
jarFile.delete();
@@ -948,7 +948,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
os = jOs;
}
super.setProperty(IRepository.PROP_TIMESTAMP, Long.toString(System.currentTimeMillis()));
- new SimpleArtifactRepositoryIO(agent).write(this, os);
+ new SimpleArtifactRepositoryIO(getProvisioningAgent()).write(this, os);
} catch (IOException e) {
// TODO proper exception handling
e.printStackTrace();
@@ -977,7 +977,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
save();
//force repository manager to reload this repository because it caches properties
- ArtifactRepositoryManager manager = (ArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
+ ArtifactRepositoryManager manager = (ArtifactRepositoryManager) getProvisioningAgent().getService(IArtifactRepositoryManager.SERVICE_NAME);
if (manager.removeRepository(getLocation()))
manager.addRepository(this);
return oldValue;
@@ -988,7 +988,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
public String toString() {
- return location.toString();
+ return getLocation().toString();
}
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
index 692f692f8..c6ea72751 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
@@ -181,6 +181,10 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return innerRepo.getProperties();
}
+ public String getProperty(String key) {
+ return innerRepo.getProperty(key);
+ }
+
public String getProvider() {
return innerRepo.getProvider();
}
@@ -201,24 +205,12 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return innerRepo.isModifiable();
}
- public void setDescription(String description) {
- innerRepo.setDescription(description);
- }
-
- public void setName(String name) {
- innerRepo.setName(name);
- }
-
public String setProperty(String key, String value) {
String result = getProperties().get(key);
propertyChanges.put(key, value == null ? NULL : value);
return result;
}
- public void setProvider(String provider) {
- innerRepo.setProvider(provider);
- }
-
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
return innerRepo.getAdapter(adapter);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
index bfa0a431d..6d99aa28b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
@@ -55,7 +55,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
private void publishArtifactRepos() {
List<URI> artifactRepos = findArtifactRepos();
- IProvisioningEventBus bus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = (IProvisioningEventBus) getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
if (bus == null)
return;
for (URI repo : artifactRepos) {
@@ -136,7 +136,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
}
private File findP2Directory() {
- File target = new File(location);
+ File target = new File(getLocation());
if (target.isFile())
target = target.getParentFile();
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
index 954bef02b..3d6353455 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
@@ -67,7 +67,7 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository<IArt
void reload() {
try {
ExtensionLocationArtifactRepositoryFactory factory = new ExtensionLocationArtifactRepositoryFactory();
- factory.setAgent(agent);
+ factory.setAgent(getProvisioningAgent());
ExtensionLocationArtifactRepository repo = (ExtensionLocationArtifactRepository) factory.load(getLocation(), 0, null);
artifactRepository = repo.artifactRepository;
base = repo.base;
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
index ec96f35e7..55f0d0c13 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
@@ -69,7 +69,7 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
void reload() {
try {
ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
- factory.setAgent(agent);
+ factory.setAgent(getProvisioningAgent());
ExtensionLocationMetadataRepository repo = (ExtensionLocationMetadataRepository) factory.load(getLocation(), 0, null);
metadataRepository = repo.metadataRepository;
base = repo.base;
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 a7cf5447c..836dba576 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
@@ -80,7 +80,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
private boolean isLocal() {
- return "file".equalsIgnoreCase(location.getScheme()); //$NON-NLS-1$
+ return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$
}
public boolean isModifiable() {
@@ -139,7 +139,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
}
private void addChild(URI childURI, boolean save) {
- URI absolute = URIUtil.makeAbsolute(childURI, location);
+ URI absolute = URIUtil.makeAbsolute(childURI, getLocation());
if (childrenURIs.contains(childURI) || childrenURIs.contains(absolute))
return;
// always add the URI to the list of child URIs (even if we can't load it later)
@@ -177,7 +177,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
boolean removed = childrenURIs.remove(childURI);
// if the child wasn't there make sure and try the other permutation
// (absolute/relative) to see if it really is in the list.
- URI other = childURI.isAbsolute() ? URIUtil.makeRelative(childURI, location) : URIUtil.makeAbsolute(childURI, location);
+ URI other = childURI.isAbsolute() ? URIUtil.makeRelative(childURI, getLocation()) : URIUtil.makeAbsolute(childURI, getLocation());
if (!removed)
removed = childrenURIs.remove(other);
@@ -270,9 +270,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
private void save() {
if (!isModifiable())
return;
- File file = getActualLocation(location);
- File jarFile = getActualLocation(location, JAR_EXTENSION);
- boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ File file = getActualLocation(getLocation());
+ File jarFile = getActualLocation(getLocation(), JAR_EXTENSION);
+ boolean compress = "true".equalsIgnoreCase(getProperty(PROP_COMPRESSED)); //$NON-NLS-1$
try {
OutputStream output = null;
if (!compress) {
@@ -302,7 +302,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
super.setProperty(IRepository.PROP_TIMESTAMP, Long.toString(System.currentTimeMillis()));
new CompositeRepositoryIO().write(toState(), output, PI_REPOSITORY_TYPE);
} catch (IOException e) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, NLS.bind(Messages.io_failedWrite, location), e));
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, NLS.bind(Messages.io_failedWrite, getLocation()), e));
}
}
@@ -312,7 +312,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
public List<URI> getChildren() {
List<URI> result = new ArrayList<URI>();
for (URI childURI : childrenURIs)
- result.add(URIUtil.makeAbsolute(childURI, location));
+ result.add(URIUtil.makeAbsolute(childURI, getLocation()));
return result;
}
@@ -324,12 +324,12 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl
//TODO this should never be called. What do we do?
public void initialize(RepositoryState state) {
- this.name = state.Name;
- this.type = state.Type;
- this.version = state.Version.toString();
- this.provider = state.Provider;
- this.description = state.Description;
- this.location = state.Location;
- this.properties = state.Properties;
+ setName(state.Name);
+ setType(state.Type);
+ setVersion(state.Version.toString());
+ setProvider(state.Provider);
+ setDescription(state.Description);
+ setLocation(state.Location);
+ setProperties(state.Properties);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
index 615985be5..e2a8bc3ef 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java
@@ -159,13 +159,13 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
@Override
public void initialize(RepositoryState state) {
synchronized (this) {
- this.name = state.Name;
- this.type = state.Type;
- this.version = state.Version.toString();
- this.provider = state.Provider;
- this.description = state.Description;
- this.location = state.Location;
- this.properties = state.Properties;
+ setName(state.Name);
+ setType(state.Type);
+ setVersion(state.Version.toString());
+ setProvider(state.Provider);
+ setDescription(state.Description);
+ setLocation(state.Location);
+ setProperties(state.Properties);
this.units.addAll(state.Units);
this.repositories.addAll(Arrays.asList(state.Repositories));
}
@@ -176,7 +176,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
* Broadcast discovery events for all repositories referenced by this repository.
*/
public void publishRepositoryReferences() {
- IProvisioningEventBus bus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = (IProvisioningEventBus) getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
if (bus == null)
return;
@@ -195,7 +195,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
// use this method to setup any transient fields etc after the object has been restored from a stream
public synchronized void initializeAfterLoad(URI aLocation) {
- this.location = aLocation;
+ setLocation(aLocation);
}
/* (non-Javadoc)
@@ -248,9 +248,9 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
// caller should be synchronized
private void save() {
- File file = getActualLocation(location);
- File jarFile = getActualLocation(location, JAR_EXTENSION);
- boolean compress = "true".equalsIgnoreCase(properties.get(PROP_COMPRESSED)); //$NON-NLS-1$
+ File file = getActualLocation(getLocation());
+ File jarFile = getActualLocation(getLocation(), JAR_EXTENSION);
+ boolean compress = "true".equalsIgnoreCase(getProperty(PROP_COMPRESSED)); //$NON-NLS-1$
try {
OutputStream output = null;
if (!compress) {
@@ -278,9 +278,9 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
output = jOutput;
}
super.setProperty(IRepository.PROP_TIMESTAMP, Long.toString(System.currentTimeMillis()));
- new MetadataRepositoryIO(agent).write(this, output);
+ new MetadataRepositoryIO(getProvisioningAgent()).write(this, output);
} catch (IOException e) {
- LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, "Error saving metadata repository: " + location, e)); //$NON-NLS-1$
+ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_WRITE, "Error saving metadata repository: " + getLocation(), e)); //$NON-NLS-1$
}
}
@@ -297,7 +297,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen
save();
}
//force repository manager to reload this repository because it caches properties
- MetadataRepositoryManager manager = (MetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ MetadataRepositoryManager manager = (MetadataRepositoryManager) getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
if (manager.removeRepository(getLocation()))
manager.addRepository(this);
return oldValue;
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
index 04cd5ee32..c07bf3bb7 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java
@@ -71,21 +71,21 @@ public class URLMetadataRepository extends AbstractMetadataRepository implements
}
public synchronized void initialize(RepositoryState state) {
- this.name = state.Name;
- this.type = state.Type;
- this.version = state.Version.toString();
- this.provider = state.Provider;
- this.description = state.Description;
- this.location = state.Location;
- this.properties = state.Properties;
+ setName(state.Name);
+ setType(state.Type);
+ setVersion(state.Version.toString());
+ setProvider(state.Provider);
+ setDescription(state.Description);
+ setLocation(state.Location);
+ setProperties(state.Properties);
this.units.addAll(state.Units);
this.references = CollectionUtils.unmodifiableList(state.Repositories);
}
// Use this method to setup any transient fields etc after the object has been restored from a stream
public synchronized void initializeAfterLoad(URI repoLocation) {
- this.location = repoLocation;
- content = getActualLocation(location);
+ setLocation(repoLocation);
+ content = getActualLocation(repoLocation);
}
public Collection<IRepositoryReference> getReferences() {
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 0954692db..aab938753 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
@@ -235,7 +235,7 @@ public abstract class AbstractApplication {
protected boolean initDestinationRepository(IRepository<?> repository, RepositoryDescriptor descriptor) {
if (repository != null && repository.isModifiable()) {
if (descriptor.getName() != null)
- repository.setName(descriptor.getName());
+ repository.setProperty(IRepository.PROP_NAME, descriptor.getName());
if (repository instanceof ICompositeRepository<?> && !descriptor.isAppend())
((ICompositeRepository<?>) repository).removeAllChildren();
else if (repository instanceof IMetadataRepository && !descriptor.isAppend())
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
index 69128c9bf..dd5c01f67 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepository.java
@@ -20,6 +20,7 @@ import org.eclipse.equinox.p2.query.IQueryable;
* A p2 repository contains either metadata or artifacts related to software
* provisioning. This base interface defines properties common to all types
* of repositories.
+ * @param <T> The type of contents contained in this repository
*
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
@@ -171,6 +172,14 @@ public interface IRepository<T> extends IAdaptable, IQueryable<T> {
public Map<String, String> getProperties();
/**
+ * Returns the repository property with the given key, or <code>null</code>
+ * if no such property is defined
+ * @param key the property key
+ * @return the property value, or <code>null</code>
+ */
+ public String getProperty(String key);
+
+ /**
* Returns the provisioning agent that manages this repository
* @return A provisioning agent.
*/
@@ -185,16 +194,6 @@ public interface IRepository<T> extends IAdaptable, IQueryable<T> {
public boolean isModifiable();
/**
- * Set the name of the repository.
- */
- public void setName(String name);
-
- /**
- * Sets the description of the repository.
- */
- public void setDescription(String description);
-
- /**
* Sets the value of the property with the given key. Returns the old property
* associated with that key, if any. Setting a value of <code>null</code> will
* remove the corresponding key from the properties of this repository.
@@ -204,9 +203,4 @@ public interface IRepository<T> extends IAdaptable, IQueryable<T> {
* @return The old property value, or <code>null</code> if there was no old value
*/
public String setProperty(String key, String value);
-
- /**
- * Sets the name of the provider of the repository.
- */
- public void setProvider(String provider);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
index 908c1bc93..fd65f00ed 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/IRepositoryManager.java
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.query.IQueryable;
* <p>
* All {@link URI} instances provided to a repository manager must be absolute.
* </p>
- *
+ * @param <T> the type of contents in the repositories controlled by this manager
* @noimplement This interface is not intended to be implemented by clients.
* @since 2.0
*/
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
index a75359e26..56458b8eb 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/IMetadataRepositoryManager.java
@@ -36,6 +36,10 @@ public interface IMetadataRepositoryManager extends IRepositoryManager<IInstalla
* Repository type for a simple repository based on a URL or local file system location.
*/
public static final String TYPE_SIMPLE_REPOSITORY = "org.eclipse.equinox.p2.metadata.repository.simpleRepository"; //$NON-NLS-1$
+
+ /**
+ * Repository type for a composite repository based on a URL or local file system location.
+ */
public static final String TYPE_COMPOSITE_REPOSITORY = "org.eclipse.equinox.p2.metadata.repository.compositeRepository"; //$NON-NLS-1$
/**
@@ -59,6 +63,7 @@ public interface IMetadataRepositoryManager extends IRepositoryManager<IInstalla
* <li>There was an error writing to the given repository location.</li>
* <li>A repository already exists at that location.</li>
* </ul>
+ * @throws OperationCanceledException if this operation has been canceled
*/
public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException, OperationCanceledException;
@@ -77,6 +82,7 @@ public interface IMetadataRepositoryManager extends IRepositoryManager<IInstalla
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting is not desired
* @return The loaded metadata repository
+ * @throws OperationCanceledException if this operation has been canceled
* @throws ProvisionException if the repository could not be created. Reasons include:
* <ul>
* <li>There is no existing repository at that location.</li>
@@ -105,6 +111,7 @@ public interface IMetadataRepositoryManager extends IRepositoryManager<IInstalla
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting is not desired
* @return The loaded metadata repository
+ * @throws OperationCanceledException if this operation has been canceled
* @throws ProvisionException if the repository could not be created. Reasons include:
* <ul>
* <li>There is no existing repository at that location.</li>
@@ -124,6 +131,7 @@ public interface IMetadataRepositoryManager extends IRepositoryManager<IInstalla
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting is not desired
* @return The refreshed metadata repository
+ * @throws OperationCanceledException if this operation has been canceled
* @throws ProvisionException if the repository could not be refreshed. Reasons include:
* <ul>
* <li>The location is not known to the repository manager.</li>
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
index ce9bcf149..f86fd03d0 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/metadata/spi/AbstractMetadataRepository.java
@@ -29,53 +29,105 @@ import org.eclipse.equinox.p2.repository.spi.AbstractRepository;
*/
public abstract class AbstractMetadataRepository extends AbstractRepository<IInstallableUnit> implements IMetadataRepository {
- //TODO Consider removing from abstract class, this is currently an implementation detail of the simple metadata repo parser
+ /**
+ * A class that encapsulates the persisted state of a repository. This is used as a convenience
+ * when loading and storing repositories.
+ * @see AbstractMetadataRepository#initialize(RepositoryState)
+ */
public static class RepositoryState {
+ /**
+ * The persisted name of the repository.
+ */
public String Name;
+ /**
+ * The persisted type of the repository.
+ */
public String Type;
+ /**
+ * The persisted version of the repository.
+ */
public Version Version;
+ /**
+ * The persisted provider of the repository.
+ */
public String Provider;
+ /**
+ * The persisted description of the repository.
+ */
public String Description;
+ /**
+ * The persisted location of the repository.
+ */
public URI Location;
+ /**
+ * The persisted properties of the repository.
+ */
public Map<String, String> Properties;
+ /**
+ * The persisted set of installable units of the repository.
+ */
public IInstallableUnit[] Units;
+ /**
+ * The persisted array of repository references
+ */
public IRepositoryReference[] Repositories;
}
+ /**
+ * Creates a new metadata repository that uses the provided agent.
+ *
+ * @param agent the provisioning agent to be used by this repository
+ */
public AbstractMetadataRepository(IProvisioningAgent agent) {
super(agent, "noName", "noType", "noVersion", null, null, null, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- //TODO Consider removing from abstract class, this is currently an implementation detail of the simple metadata repo parser
+ /**
+ * Initializes this class based on the provided previously persisted state
+ *
+ * @param state the persisted repository state
+ */
public abstract void initialize(RepositoryState state);
+ /**
+ * Creates a new metadata repository with the provided repository information
+ *
+ * @param agent the provisioning agent to be used by this repository
+ * @param name the repository name
+ * @param type the repository type
+ * @param version the repository version
+ * @param location the repository location
+ * @param description the repository description
+ * @param provider the repository provider
+ * @param properties the repository properties
+ */
protected AbstractMetadataRepository(IProvisioningAgent agent, String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) {
super(agent, name, type, version, location, description, provider, properties);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection)
+ /**
+ * {@inheritDoc}
*/
public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) {
assertModifiable();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReference(java.net.URI, java.lang.String, int, int)
+ /**
+ * {@inheritDoc}
*/
public void addReferences(Collection<? extends IRepositoryReference> references) {
assertModifiable();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll()
+ /**
+ * {@inheritDoc}
*/
public void removeAll() {
assertModifiable();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection)
+ /**
+ * {@inheritDoc}
*/
public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
assertModifiable();
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
index e8bcdc6ae..e833c1cb8 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/p2/repository/spi/AbstractRepository.java
@@ -27,15 +27,27 @@ import org.eclipse.equinox.p2.repository.IRepository;
* @since 2.0
*/
public abstract class AbstractRepository<T> extends PlatformObject implements IRepository<T> {
- protected final IProvisioningAgent agent;
- protected String description;
- protected transient URI location;
- protected String name;
- protected Map<String, String> properties = new OrderedProperties();
- protected String provider;
- protected String type;
- protected String version;
+ private final IProvisioningAgent agent;
+ private String description;
+ private transient URI location;
+ private String name;
+ private Map<String, String> properties = new OrderedProperties();
+ private String provider;
+ private String type;
+ private String version;
+ /**
+ * Creates a new repository with the given attributes.
+ *
+ * @param agent the provisioning agent to be used by this repository
+ * @param name the repository name
+ * @param type the repository type
+ * @param version the repository version
+ * @param location the repository location
+ * @param description the repository description
+ * @param provider the repository provider
+ * @param properties the repository properties
+ */
protected AbstractRepository(IProvisioningAgent agent, String name, String type, String version, URI location, String description, String provider, Map<String, String> properties) {
this.agent = agent;
this.name = name;
@@ -93,6 +105,13 @@ public abstract class AbstractRepository<T> extends PlatformObject implements IR
}
/**
+ * {@inheritDoc}
+ */
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ /**
* Returns the name of the provider of the repository.
* @return the provider of this repository.
*/
@@ -100,6 +119,11 @@ public abstract class AbstractRepository<T> extends PlatformObject implements IR
return provider;
}
+ /**
+ * Returns the provisioning agent used by this repository
+ *
+ * @return the provisioning agent
+ */
public IProvisioningAgent getProvisioningAgent() {
return agent;
}
@@ -120,24 +144,86 @@ public abstract class AbstractRepository<T> extends PlatformObject implements IR
return version;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isModifiable() {
return false;
}
+ /**
+ * Sets the description of this repository
+ *
+ * @param description the repository description
+ */
public synchronized void setDescription(String description) {
this.description = description;
}
+ /**
+ * Sets the name of this repository
+ *
+ * @param value the repository name
+ */
public synchronized void setName(String value) {
this.name = value;
}
+ /**
+ * {@inheritDoc}
+ */
public synchronized String setProperty(String key, String value) {
assertModifiable();
+ if (key.equals(IRepository.PROP_NAME)) {
+ String oldName = getName();
+ setName(value);
+ return oldName;
+ }
return (value == null ? properties.remove(key) : properties.put(key, value));
}
+ /**
+ * Sets the provider of this repository
+ *
+ * @param provider the repository provider
+ */
public synchronized void setProvider(String provider) {
this.provider = provider;
}
+
+ /**
+ * Sets the type of this repository
+ *
+ * @param type the repository type
+ */
+ protected synchronized void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the location of this repository
+ *
+ * @param location the repository location
+ */
+ protected synchronized void setLocation(URI location) {
+ this.location = location;
+ }
+
+ /**
+ * Sets the version of this repository
+ *
+ * @param version the repository version
+ */
+ protected synchronized void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the properties of this repository
+ *
+ * @param properties the repository provider
+ */
+ protected synchronized void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
index 701d97765..b96c52d6c 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractWrappedArtifactRepository.java
@@ -93,6 +93,10 @@ public class AbstractWrappedArtifactRepository implements IArtifactRepository {
return delegate.getProperties();
}
+ public String getProperty(String key) {
+ return delegate.getProperty(key);
+ }
+
public String getProvider() {
return delegate.getProvider();
}
@@ -113,22 +117,10 @@ public class AbstractWrappedArtifactRepository implements IArtifactRepository {
return delegate.isModifiable();
}
- public void setDescription(String description) {
- delegate.setDescription(description);
- }
-
- public void setName(String name) {
- delegate.setName(name);
- }
-
public String setProperty(String key, String value) {
return delegate.setProperty(key, value);
}
- public void setProvider(String provider) {
- delegate.setProvider(provider);
- }
-
public Object getAdapter(Class adapter) {
return delegate.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
index d7fcb5bfb..0a3815173 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestArtifactRepository.java
@@ -129,7 +129,7 @@ public class TestArtifactRepository extends AbstractArtifactRepository {
}
public void initialize(URI repoURL, InputStream descriptorFile) {
- location = repoURL;
+ setLocation(repoURL);
}
public boolean contains(IArtifactDescriptor descriptor) {
@@ -142,7 +142,7 @@ public class TestArtifactRepository extends AbstractArtifactRepository {
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
ProcessingStepHandler handler = new ProcessingStepHandler();
- destination = handler.createAndLink(agent, descriptor.getProcessingSteps(), null, destination, monitor);
+ destination = handler.createAndLink(getProvisioningAgent(), descriptor.getProcessingSteps(), null, destination, monitor);
testhandler.download(keysToLocations.get(descriptor.getArtifactKey()), destination, monitor);
return Status.OK_STATUS;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
index d6b0c733c..fc3a7c1fd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestMetadataRepository.java
@@ -93,13 +93,13 @@ public class TestMetadataRepository extends AbstractMetadataRepository {
}
public void initialize(RepositoryState state) {
- this.name = state.Name;
- this.type = state.Type;
- this.version = state.Version.toString();
- this.provider = state.Provider;
- this.description = state.Description;
- this.location = state.Location;
- this.properties = state.Properties;
+ setName(state.Name);
+ setType(state.Type);
+ setVersion(state.Version.toString());
+ setProvider(state.Provider);
+ setDescription(state.Description);
+ setLocation(state.Location);
+ setProperties(state.Properties);
this.units.addAll(Arrays.asList(state.Units));
this.repositories.addAll(Arrays.asList(state.Repositories));
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
index 042ae4dee..0e97e1009 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/TestArtifactRepository.java
@@ -222,6 +222,10 @@ public class TestArtifactRepository implements IArtifactRepository {
return OrderedProperties.unmodifiableProperties(properties);
}
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
public String getProvider() {
return provider;
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
index 42e927fef..91a74198e 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
@@ -99,6 +99,10 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository {
return delegate.getProperties();
}
+ public String getProperty(String key) {
+ return delegate.getProperty(key);
+ }
+
public String getProvider() {
return delegate.getProvider();
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
index 17194b552..bb8347443 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
@@ -107,6 +107,10 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
return delegate.getProperties();
}
+ public String getProperty(String key) {
+ return delegate.getProperty(key);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.repository.IRepository#getProvider()
*/

Back to the top