summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-08-21 01:48:00 (EDT)
committerEike Stepper2007-08-21 01:48:00 (EDT)
commitcde808f091c7b57dd8aa4ca6b38677619b1fbc27 (patch)
treef8336079f0582513fb64bafcd9845db5959be1b4
parent5662a0a75aebdd671ef460679ad20b565b98b097 (diff)
downloadcdo-cde808f091c7b57dd8aa4ca6b38677619b1fbc27.zip
cdo-cde808f091c7b57dd8aa4ca6b38677619b1fbc27.tar.gz
cdo-cde808f091c7b57dd8aa4ca6b38677619b1fbc27.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/Precedence.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/MappingPrecedence.java)4
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/StandardMappingStrategy.java72
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToMany.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToManyReferenceMapping.java)6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToOne.java (renamed from plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToOneReferenceMapping.java)4
4 files changed, 31 insertions, 55 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/MappingPrecedence.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/Precedence.java
index 8a0359f..f5354c6 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/MappingPrecedence.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/Precedence.java
@@ -8,12 +8,12 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.internal.db.mapping;
/**
* @author Eike Stepper
*/
-public enum MappingPrecedence
+public enum Precedence
{
MODEL, STRATEGY
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/StandardMappingStrategy.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/StandardMappingStrategy.java
index 3da10ce..f6704f8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/StandardMappingStrategy.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/StandardMappingStrategy.java
@@ -15,9 +15,6 @@ import org.eclipse.emf.cdo.protocol.model.CDOClass;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.server.IRepository;
-import org.eclipse.emf.cdo.server.db.MappingPrecedence;
-import org.eclipse.emf.cdo.server.db.ToManyReferenceMapping;
-import org.eclipse.emf.cdo.server.db.ToOneReferenceMapping;
import org.eclipse.emf.cdo.server.internal.db.bundle.OM;
import org.eclipse.emf.cdo.server.internal.db.info.ClassServerInfo;
import org.eclipse.emf.cdo.server.internal.db.info.FeatureServerInfo;
@@ -43,11 +40,11 @@ public abstract class StandardMappingStrategy extends MappingStrategy
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, StandardMappingStrategy.class);
- private MappingPrecedence mappingPrecedence;
+ private Precedence precedence;
- private ToManyReferenceMapping toManyReferenceMapping;
+ private ToMany toMany;
- private ToOneReferenceMapping toOneReferenceMapping;
+ private ToOne toOne;
private Map<CDOClass, ClassMapping> classMappings = new HashMap();
@@ -57,58 +54,37 @@ public abstract class StandardMappingStrategy extends MappingStrategy
{
}
- public MappingPrecedence getMappingPrecedence()
+ public Precedence getPrecedence()
{
- if (mappingPrecedence == null)
+ if (precedence == null)
{
String value = getProperties().get("mappingPrecedence");
- if (value == null)
- {
- mappingPrecedence = MappingPrecedence.STRATEGY;
- }
- else
- {
- mappingPrecedence = MappingPrecedence.valueOf(value);
- }
+ precedence = value == null ? Precedence.STRATEGY : Precedence.valueOf(value);
}
- return mappingPrecedence;
+ return precedence;
}
- public ToManyReferenceMapping getToManyReferenceMapping()
+ public ToMany getToMany()
{
- if (toManyReferenceMapping == null)
+ if (toMany == null)
{
String value = getProperties().get("toManyReferenceMapping");
- if (value == null)
- {
- toManyReferenceMapping = ToManyReferenceMapping.ONE_TABLE_PER_REFERENCE;
- }
- else
- {
- toManyReferenceMapping = ToManyReferenceMapping.valueOf(value);
- }
+ toMany = value == null ? ToMany.PER_REFERENCE : ToMany.valueOf(value);
}
- return toManyReferenceMapping;
+ return toMany;
}
- public ToOneReferenceMapping getToOneReferenceMapping()
+ public ToOne getToOne()
{
- if (toOneReferenceMapping == null)
+ if (toOne == null)
{
String value = getProperties().get("toOneReferenceMapping");
- if (value == null)
- {
- toOneReferenceMapping = ToOneReferenceMapping.LIKE_ATTRIBUTES;
- }
- else
- {
- toOneReferenceMapping = ToOneReferenceMapping.valueOf(value);
- }
+ toOne = value == null ? ToOne.LIKE_ATTRIBUTES : ToOne.valueOf(value);
}
- return toOneReferenceMapping;
+ return toOne;
}
public Set<IDBTable> map(CDOPackageImpl[] cdoPackages)
@@ -168,18 +144,18 @@ public abstract class StandardMappingStrategy extends MappingStrategy
{
if (cdoFeature.isMany())
{
- return mapReference(cdoClass, cdoFeature, getToManyReferenceMapping());
+ return mapReference(cdoClass, cdoFeature, getToMany());
}
else
{
- switch (getToOneReferenceMapping())
+ switch (getToOne())
{
case LIKE_ATTRIBUTES:
return mapAttribute(cdoClass, cdoFeature);
case LIKE_TO_MANY_REFERENCES:
- return mapReference(cdoClass, cdoFeature, getToManyReferenceMapping());
+ return mapReference(cdoClass, cdoFeature, getToMany());
default:
- throw new IllegalArgumentException("Invalid mapping: " + getToOneReferenceMapping());
+ throw new IllegalArgumentException("Invalid mapping: " + getToOne());
}
}
}
@@ -208,18 +184,18 @@ public abstract class StandardMappingStrategy extends MappingStrategy
return addField(cdoFeature, table);
}
- protected IDBField mapReference(CDOClass cdoClass, CDOFeature cdoFeature, ToManyReferenceMapping mapping)
+ protected IDBField mapReference(CDOClass cdoClass, CDOFeature cdoFeature, ToMany mapping)
{
switch (mapping)
{
- case ONE_TABLE_PER_REFERENCE:
+ case PER_REFERENCE:
return mapReferenceTable(cdoFeature, cdoClass.getName() + "_" + cdoFeature.getName() + "_refs", false);
- case ONE_TABLE_PER_CLASS:
+ case PER_CLASS:
return mapReferenceTable(cdoClass, cdoClass.getName() + "_refs", true);
- case ONE_TABLE_PER_PACKAGE:
+ case PER_PACKAGE:
CDOPackage cdoPackage = cdoClass.getContainingPackage();
return mapReferenceTable(cdoPackage, cdoPackage.getName() + "_refs", true);
- case ONE_TABLE_PER_REPOSITORY:
+ case PER_REPOSITORY:
IRepository repository = getStore().getRepository();
return mapReferenceTable(repository, repository.getName() + "_refs", true);
case LIKE_ATTRIBUTES:
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToManyReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToMany.java
index 07aeab0..54374c8 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToManyReferenceMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToMany.java
@@ -8,12 +8,12 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.internal.db.mapping;
/**
* @author Eike Stepper
*/
-public enum ToManyReferenceMapping
+public enum ToMany
{
- ONE_TABLE_PER_REFERENCE, ONE_TABLE_PER_CLASS, ONE_TABLE_PER_PACKAGE, ONE_TABLE_PER_REPOSITORY, LIKE_ATTRIBUTES
+ PER_REFERENCE, PER_CLASS, PER_PACKAGE, PER_REPOSITORY, LIKE_ATTRIBUTES
}
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToOneReferenceMapping.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToOne.java
index a9627a1..a4b2f84 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/db/ToOneReferenceMapping.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/mapping/ToOne.java
@@ -8,12 +8,12 @@
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
-package org.eclipse.emf.cdo.server.db;
+package org.eclipse.emf.cdo.server.internal.db.mapping;
/**
* @author Eike Stepper
*/
-public enum ToOneReferenceMapping
+public enum ToOne
{
LIKE_ATTRIBUTES, LIKE_TO_MANY_REFERENCES
}