summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-26 01:20:03 (EDT)
committerEike Stepper2007-08-26 01:20:03 (EDT)
commit64fbe42aeec1544d701cc58de9b911be75dac7fb (patch)
treed5c39057cd8693075746b878e95b867ed8e8befd
parent4f7ad34a3beb24d2e4081bece71da22e9c8a7a87 (diff)
downloadcdo-64fbe42aeec1544d701cc58de9b911be75dac7fb.zip
cdo-64fbe42aeec1544d701cc58de9b911be75dac7fb.tar.gz
cdo-64fbe42aeec1544d701cc58de9b911be75dac7fb.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java49
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java4
6 files changed, 96 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
index 7be55e0..46e0b61 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStoreFactory.java
@@ -66,7 +66,7 @@ public class DBStoreFactory implements IStoreFactory
Element mappingStrategyConfig = (Element)mappingStrategyConfigs.item(0);
String mappingStrategyType = mappingStrategyConfig.getAttribute("type");
IMappingStrategy mappingStrategy = CDODBUtil.createMappingStrategy(mappingStrategyType);
- Map<String, String> properties = RepositoryConfigurator.getProperties(mappingStrategyConfig);
+ Map<String, String> properties = RepositoryConfigurator.getProperties(mappingStrategyConfig, 1);
mappingStrategy.setProperties(properties);
return mappingStrategy;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
index df694ca..e8fde26 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/MappingStrategy.java
@@ -34,6 +34,12 @@ import java.util.Map;
*/
public abstract class MappingStrategy implements IMappingStrategy
{
+ public static final String PROP_MAPPING_PRECEDENCE = "mappingPrecedence";
+
+ public static final String PROP_TO_MANY_REFERENCE_MAPPING = "toManyReferenceMapping";
+
+ public static final String PROP_TO_ONE_REFERENCE_MAPPING = "toOneReferenceMapping";
+
private IDBStore store;
private Map<String, String> properties;
@@ -81,7 +87,7 @@ public abstract class MappingStrategy implements IMappingStrategy
{
if (precedence == null)
{
- String value = getProperties().get("mappingPrecedence");
+ String value = getProperties().get(PROP_MAPPING_PRECEDENCE);
precedence = value == null ? Precedence.STRATEGY : Precedence.valueOf(value);
}
@@ -92,7 +98,7 @@ public abstract class MappingStrategy implements IMappingStrategy
{
if (toMany == null)
{
- String value = getProperties().get("toManyReferenceMapping");
+ String value = getProperties().get(PROP_TO_MANY_REFERENCE_MAPPING);
toMany = value == null ? ToMany.PER_REFERENCE : ToMany.valueOf(value);
}
@@ -103,7 +109,7 @@ public abstract class MappingStrategy implements IMappingStrategy
{
if (toOne == null)
{
- String value = getProperties().get("toOneReferenceMapping");
+ String value = getProperties().get(PROP_TO_ONE_REFERENCE_MAPPING);
toOne = value == null ? ToOne.LIKE_ATTRIBUTES : ToOne.valueOf(value);
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index dd904ca..c323100 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -22,6 +22,8 @@ import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
/**
@@ -29,6 +31,10 @@ import java.util.UUID;
*/
public class Repository extends Container implements IRepository
{
+ public static final String PROP_SUPPORTING_AUDITS = "supportingAudits";
+
+ public static final String PROP_VERIFYING_REVISIONS = "verifyingRevisions";
+
private static final long INITIAL_OID_VALUE = 2;
private static final long INITIAL_META_ID_VALUE = 1;
@@ -39,6 +45,12 @@ public class Repository extends Container implements IRepository
private String uuid;
+ private Map<String, String> properties;
+
+ private Boolean supportingAudits;
+
+ private Boolean verifyingRevisions;
+
private TypeManager typeManager = new TypeManager(this);
private PackageManager packageManager = new PackageManager(this);
@@ -89,6 +101,43 @@ public class Repository extends Container implements IRepository
return uuid;
}
+ public Map<String, String> getProperties()
+ {
+ if (properties == null)
+ {
+ properties = new HashMap();
+ }
+
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties)
+ {
+ this.properties = properties;
+ }
+
+ public boolean isSupportingAudits()
+ {
+ if (supportingAudits == null)
+ {
+ String value = getProperties().get(PROP_SUPPORTING_AUDITS);
+ supportingAudits = value == null ? false : Boolean.valueOf(value);
+ }
+
+ return supportingAudits;
+ }
+
+ public boolean isVerifyingRevisions()
+ {
+ if (verifyingRevisions == null)
+ {
+ String value = getProperties().get(PROP_VERIFYING_REVISIONS);
+ verifyingRevisions = value == null ? false : Boolean.valueOf(value);
+ }
+
+ return verifyingRevisions;
+ }
+
public TypeManager getTypeManager()
{
return typeManager;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
index 47b70b4..eebf607 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RepositoryConfigurator.java
@@ -67,15 +67,12 @@ public class RepositoryConfigurator
protected IRepository configureRepository(Element repositoryConfig) throws CoreException
{
String repositoryName = repositoryConfig.getAttribute("name");
- NodeList storeConfigs = repositoryConfig.getElementsByTagName("store");
- if (storeConfigs.getLength() != 1)
- {
- throw new IllegalStateException("Exactly one store must be configured for repository " + repositoryName);
- }
-
- Element storeConfig = (Element)storeConfigs.item(0);
+ Element storeConfig = getStoreConfig(repositoryConfig);
IStore store = configureStore(storeConfig);
+ Map<String, String> properties = RepositoryConfigurator.getProperties(repositoryConfig, 1);
+
Repository repository = new Repository(repositoryName, store);
+ repository.setProperties(properties);
store.setRepository(repository);
return repository;
}
@@ -114,14 +111,26 @@ public class RepositoryConfigurator
return document;
}
- public static Map<String, String> getProperties(Element element)
+ protected Element getStoreConfig(Element repositoryConfig)
+ {
+ NodeList storeConfigs = repositoryConfig.getElementsByTagName("store");
+ if (storeConfigs.getLength() != 1)
+ {
+ String repositoryName = repositoryConfig.getAttribute("name");
+ throw new IllegalStateException("Exactly one store must be configured for repository " + repositoryName);
+ }
+
+ return (Element)storeConfigs.item(0);
+ }
+
+ public static Map<String, String> getProperties(Element element, int levels)
{
Map<String, String> properties = new HashMap();
- collectProperties(element, "", properties);
+ collectProperties(element, "", properties, levels);
return properties;
}
- private static void collectProperties(Element element, String prefix, Map<String, String> properties)
+ private static void collectProperties(Element element, String prefix, Map<String, String> properties, int levels)
{
if ("property".equals(element.getNodeName()))
{
@@ -131,13 +140,16 @@ public class RepositoryConfigurator
prefix += name + ".";
}
- NodeList childNodes = element.getChildNodes();
- for (int i = 0; i < childNodes.getLength(); i++)
+ if (levels > 0)
{
- Node childNode = childNodes.item(i);
- if (childNode instanceof Element)
+ NodeList childNodes = element.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++)
{
- collectProperties((Element)childNode, prefix, properties);
+ Node childNode = childNodes.item(i);
+ if (childNode instanceof Element)
+ {
+ collectProperties((Element)childNode, prefix, properties, levels - 1);
+ }
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
index 7a71396..acf5dc1 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/RevisionManager.java
@@ -47,6 +47,12 @@ public class RevisionManager extends CDORevisionResolverImpl implements IRevisio
}
@Override
+ protected void verifyRevision(CDORevisionImpl revision)
+ {
+ super.verifyRevision(revision);
+ }
+
+ @Override
protected CDORevisionImpl loadRevision(CDOID id)
{
IStoreReader storeReader = StoreUtil.getReader();
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
index 22b6b06..29aa00c 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/IRepository.java
@@ -25,6 +25,10 @@ public interface IRepository extends IContainer
public String getUUID();
+ public boolean isSupportingAudits();
+
+ public boolean isVerifyingRevisions();
+
public TypeManager getTypeManager();
public IPackageManager getPackageManager();