summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2013-03-12 05:46:23 (EDT)
committerTobias Oberlies2013-03-12 05:46:23 (EDT)
commit43d03cdba58ef6cb0c94b0e5a23ddf101778c7cd (patch)
tree4e9316f0f9075f0ef954120affc966776cbc70f4
parent82481b8cc624dcb849b30fc4bb5426db301bb59d (diff)
downloadrt.equinox.p2-43d03cdba58ef6cb0c94b0e5a23ddf101778c7cd.zip
rt.equinox.p2-43d03cdba58ef6cb0c94b0e5a23ddf101778c7cd.tar.gz
rt.equinox.p2-43d03cdba58ef6cb0c94b0e5a23ddf101778c7cd.tar.bz2
391962 Create atomic repositories by defaultI20130313-2000I20130313-0800I20130312-2000
- Bug 344851 already added the possibility to set the atomic flag on composite repositories. As follow-up of the discussion on bug 356561, the default for newly created repositories is changed to atomic=true. Bug: 391962
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java5
2 files changed, 12 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
index 03d3a1f..7ae1a45 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java
@@ -122,8 +122,6 @@ public class CompositeRepositoryApplication extends AbstractApplication {
//No existing repository; create a new repository at destinationLocation but with source's attributes.
IArtifactRepository repo = mgr.createRepository(toInit.getRepoLocation(), toInit.getName() != null ? toInit.getName() : (source != null ? source.getName() : Messages.CompositeRepository_default_artifactRepo_name), IArtifactRepositoryManager.TYPE_COMPOSITE_REPOSITORY, source != null ? source.getProperties() : null);
initRepository(repo, toInit);
- if (toInit.getAtomic() != null)
- repo.setProperty(CompositeMetadataRepository.PROP_ATOMIC_LOADING, Boolean.toString(Boolean.valueOf(toInit.getAtomic())));
return repo;
} catch (IllegalStateException e) {
mgr.removeRepository(toInit.getRepoLocation());
@@ -162,8 +160,6 @@ public class CompositeRepositoryApplication extends AbstractApplication {
//No existing repository; create a new repository at destinationLocation but with source's attributes.
IMetadataRepository repo = mgr.createRepository(toInit.getRepoLocation(), toInit.getName() != null ? toInit.getName() : (source != null ? source.getName() : Messages.CompositeRepository_default_metadataRepo_name), IMetadataRepositoryManager.TYPE_COMPOSITE_REPOSITORY, source != null ? source.getProperties() : null);
initRepository(repo, toInit);
- if (toInit.getAtomic() != null)
- repo.setProperty(CompositeMetadataRepository.PROP_ATOMIC_LOADING, Boolean.toString(Boolean.valueOf(toInit.getAtomic())));
return repo;
} catch (IllegalStateException e) {
mgr.removeRepository(toInit.getRepoLocation());
@@ -194,6 +190,16 @@ public class CompositeRepositoryApplication extends AbstractApplication {
RepositoryHelper.validDestinationRepository(repository);
if (desc.isCompressed() && !repository.getProperties().containsKey(IRepository.PROP_COMPRESSED))
repository.setProperty(IRepository.PROP_COMPRESSED, String.valueOf(true));
+
+ setAtomicLoadingProperty(repository, desc);
+ }
+
+ private void setAtomicLoadingProperty(IRepository<?> repository, RepositoryDescriptor desc) {
+ // bug 356561: newly created repositories shall be atomic (by default)
+ boolean atomic = true;
+ if (desc.getAtomic() != null)
+ atomic = Boolean.valueOf(desc.getAtomic());
+ repository.setProperty(CompositeMetadataRepository.PROP_ATOMIC_LOADING, Boolean.toString(atomic));
}
public void setComparator(String value) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java
index 5cfac91..000d325 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java
@@ -31,7 +31,7 @@ public class CreateCompositeArtifactRepositoryTask extends Task {
URI location; // desired location of the composite repository
String name = "Composite Artifact Repository";
- boolean atomic = false;
+ boolean atomic = true; // bug 356561: newly created repositories shall be atomic (by default)
boolean compressed = true;
boolean failOnExists = false; // should we fail if a repo already exists?
Map<String, String> properties = new HashMap<String, String>();
@@ -69,8 +69,7 @@ public class CreateCompositeArtifactRepositoryTask extends Task {
// set the properties
if (compressed)
properties.put(IRepository.PROP_COMPRESSED, Boolean.toString(true));
- if (atomic)
- properties.put(CompositeArtifactRepository.PROP_ATOMIC_LOADING, Boolean.toString(true));
+ properties.put(CompositeArtifactRepository.PROP_ATOMIC_LOADING, Boolean.toString(atomic));
// create the repository
try {