From 84e7608273c259242bd2931661f6ffe929f0ceaf Mon Sep 17 00:00:00 2001 From: Ian Bull Date: Thu, 14 Apr 2011 22:08:18 +0000 Subject: NEW - bug 342902: blobstore name cannot be set https://bugs.eclipse.org/bugs/show_bug.cgi?id=342902 --- .../repository/simple/SimpleArtifactRepository.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository') 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 469e1255b..e0d96bfdc 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 @@ -73,6 +73,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme */ private Location lockLocation = null; + /** + * Allows an artifact repository to set the name of its blobstore. + */ + public static final String PROP_BLOBSTORE_NAME = "p2.blobstore.name"; //$NON-NLS-1$ + /** * Does this instance of the repository currently hold a lock */ @@ -261,8 +266,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme return URIUtil.append(base, CONTENT_FILENAME + extension); } - public static URI getBlobStoreLocation(URI base) { - return URIUtil.append(base, BLOBSTORE); + public static URI getBlobStoreLocation(URI base, String suffix) { + return URIUtil.append(base, suffix); } /* @@ -918,7 +923,8 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme private synchronized void initializeAfterLoad(URI repoLocation, boolean updateTimestamp) { setLocation(repoLocation); - blobStore = new BlobStore(getBlobStoreLocation(repoLocation), 128); + String suffix = getBlobStoreName(BLOBSTORE); + blobStore = new BlobStore(getBlobStoreLocation(repoLocation, suffix), 128); initializeMapper(); for (SimpleArtifactDescriptor desc : artifactDescriptors) desc.setRepository(this); @@ -926,6 +932,14 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme updateTimestamp(); } + private String getBlobStoreName(String defaultValue) { + String value = getProperty(PROP_BLOBSTORE_NAME); + if (value == null || value.length() == 0) { + return defaultValue; + } + return value; + } + private synchronized void initializeMapper() { mapper = new Mapper(); mapper.initialize(Activator.getContext(), mappingRules); -- cgit v1.2.3