You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2013/06/22 21:05:05 UTC
svn commit: r1495771 - in
/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src:
main/java/org/apache/cayenne/map/ test/java/org/apache/cayenne/map/
test/java/org/apache/cayenne/merge/
Author: aadamchik
Date: Sat Jun 22 19:05:05 2013
New Revision: 1495771
URL: http://svn.apache.org/r1495771
Log:
CAY-1789 Lock-free EntityResolver
refactoring to use MappingNamespace for cache and everything else
Added:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java
- copied, changed from r1495760, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingCache.java
Removed:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DefaultMappingCache.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingCache.java
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DataMap.java Sat Jun 22 19:05:05 2013
@@ -45,12 +45,13 @@ import org.apache.cayenne.util.XMLEncode
import org.apache.cayenne.util.XMLSerializable;
/**
- * Stores a collection of related mapping objects that describe database and object layers
- * of an application. DataMap contains DbEntities mapping database tables, ObjEntities -
- * mapping persistent Java classes, Procedures - mapping database stored procedures.
+ * Stores a collection of related mapping objects that describe database and
+ * object layers of an application. DataMap contains DbEntities mapping database
+ * tables, ObjEntities - mapping persistent Java classes, Procedures - mapping
+ * database stored procedures.
*/
-public class DataMap implements Serializable, ConfigurationNode, XMLSerializable,
- MappingNamespace, DbEntityListener, ObjEntityListener, Comparable<DataMap> {
+public class DataMap implements Serializable, ConfigurationNode, XMLSerializable, MappingNamespace, DbEntityListener,
+ ObjEntityListener, Comparable<DataMap> {
/**
* Defines whether a DataMap supports client entities.
@@ -79,7 +80,7 @@ public class DataMap implements Serializ
* @since 3.2
*/
public static final String DEFAULT_CATALOG_PROPERTY = "defaultCatalog";
-
+
/**
* Defines the name of the property for default DB schema.
*
@@ -111,8 +112,8 @@ public class DataMap implements Serializ
public static final String DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY = "quoteSqlIdentifiers";
/**
- * The namespace in which the data map XML file will be created. This is also the URI
- * to locate a copy of the schema document.
+ * The namespace in which the data map XML file will be created. This is
+ * also the URI to locate a copy of the schema document.
*/
public static final String SCHEMA_XSD = "http://cayenne.apache.org/schema/3.0/modelMap";
@@ -184,10 +185,10 @@ public class DataMap implements Serializ
public DataChannelDescriptor getDataChannelDescriptor() {
return dataChannelDescriptor;
}
-
+
/**
* @since 3.1
- */
+ */
public void setDataChannelDescriptor(DataChannelDescriptor dataChannelDescriptor) {
this.dataChannelDescriptor = dataChannelDescriptor;
}
@@ -208,11 +209,9 @@ public class DataMap implements Serializ
if (o1 == null) {
return (o2 != null) ? -1 : 0;
- }
- else if (o2 == null) {
+ } else if (o2 == null) {
return 1;
- }
- else {
+ } else {
return o1.compareTo(o2);
}
}
@@ -232,8 +231,8 @@ public class DataMap implements Serializ
}
/**
- * Performs DataMap initialization from a set of properties, using defaults for the
- * missing properties.
+ * Performs DataMap initialization from a set of properties, using defaults
+ * for the missing properties.
*
* @since 1.1
*/
@@ -251,31 +250,27 @@ public class DataMap implements Serializ
Object clientEntities = properties.get(CLIENT_SUPPORTED_PROPERTY);
Object clientPackageName = properties.get(DEFAULT_CLIENT_PACKAGE_PROPERTY);
Object clientSuperclass = properties.get(DEFAULT_CLIENT_SUPERCLASS_PROPERTY);
- Object quoteSqlIdentifier = properties
- .get(DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY);
+ Object quoteSqlIdentifier = properties.get(DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY);
- this.defaultLockType = "optimistic".equals(lockType)
- ? ObjEntity.LOCK_TYPE_OPTIMISTIC
+ this.defaultLockType = "optimistic".equals(lockType) ? ObjEntity.LOCK_TYPE_OPTIMISTIC
: ObjEntity.LOCK_TYPE_NONE;
this.defaultPackage = (packageName != null) ? packageName.toString() : null;
- this.quotingSQLIdentifiers = (quoteSqlIdentifier != null) ? "true"
- .equalsIgnoreCase(quoteSqlIdentifier.toString()) : false;
+ this.quotingSQLIdentifiers = (quoteSqlIdentifier != null) ? "true".equalsIgnoreCase(quoteSqlIdentifier
+ .toString()) : false;
this.defaultSchema = (schema != null) ? schema.toString() : null;
this.defaultCatalog = (catalog != null) ? catalog.toString() : null;
this.defaultSuperclass = (superclass != null) ? superclass.toString() : null;
- this.clientSupported = (clientEntities != null) ? "true"
- .equalsIgnoreCase(clientEntities.toString()) : false;
- this.defaultClientPackage = (clientPackageName != null) ? clientPackageName
- .toString() : null;
- this.defaultClientSuperclass = (clientSuperclass != null) ? clientSuperclass
- .toString() : null;
+ this.clientSupported = (clientEntities != null) ? "true".equalsIgnoreCase(clientEntities.toString()) : false;
+ this.defaultClientPackage = (clientPackageName != null) ? clientPackageName.toString() : null;
+ this.defaultClientSuperclass = (clientSuperclass != null) ? clientSuperclass.toString() : null;
}
/**
- * Returns a DataMap stripped of any server-side information, such as DbEntity
- * mapping, or ObjEntities that are not allowed in the client tier. Returns null if
- * this DataMap as a whole does not support client tier persistence.
+ * Returns a DataMap stripped of any server-side information, such as
+ * DbEntity mapping, or ObjEntities that are not allowed in the client tier.
+ * Returns null if this DataMap as a whole does not support client tier
+ * persistence.
*
* @since 1.2
*/
@@ -299,7 +294,8 @@ public class DataMap implements Serializ
proxy.setName(q.getName());
proxy.setDataMap(clientMap);
- // resolve metadata so that client can have access to it without knowing about
+ // resolve metadata so that client can have access to it without
+ // knowing about
// the server query.
proxy.initMetadata(q.getMetaData(serverResolver));
clientMap.addQuery(proxy);
@@ -314,16 +310,11 @@ public class DataMap implements Serializ
* @since 1.1
*/
public void encodeAsXML(XMLEncoder encoder) {
- encoder
- .println("<data-map xmlns=\"http://cayenne.apache.org/schema/3.0/modelMap\"");
+ encoder.println("<data-map xmlns=\"http://cayenne.apache.org/schema/3.0/modelMap\"");
encoder.indent(1);
encoder.println(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
- encoder.println(" xsi:schemaLocation=\""
- + SCHEMA_XSD
- + " "
- + SCHEMA_XSD
- + ".xsd\"");
+ encoder.println(" xsi:schemaLocation=\"" + SCHEMA_XSD + " " + SCHEMA_XSD + ".xsd\"");
encoder.printProjectVersion();
encoder.println(">");
@@ -336,7 +327,7 @@ public class DataMap implements Serializ
if (!Util.isEmptyString(defaultPackage)) {
encoder.printProperty(DEFAULT_PACKAGE_PROPERTY, defaultPackage);
}
-
+
if (!Util.isEmptyString(defaultCatalog)) {
encoder.printProperty(DEFAULT_CATALOG_PROPERTY, defaultCatalog);
}
@@ -350,9 +341,7 @@ public class DataMap implements Serializ
}
if (quotingSQLIdentifiers) {
- encoder.printProperty(
- DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY,
- quotingSQLIdentifiers);
+ encoder.printProperty(DEFAULT_QUOTE_SQL_IDENTIFIERS_PROPERTY, quotingSQLIdentifiers);
}
if (clientSupported) {
@@ -364,9 +353,7 @@ public class DataMap implements Serializ
}
if (!Util.isEmptyString(defaultClientSuperclass)) {
- encoder.printProperty(
- DEFAULT_CLIENT_SUPERCLASS_PROPERTY,
- defaultClientSuperclass);
+ encoder.printProperty(DEFAULT_CLIENT_SUPERCLASS_PROPERTY, defaultClientSuperclass);
}
// embeddables
@@ -385,15 +372,14 @@ public class DataMap implements Serializ
encodeDBRelationshipsAsXML(getDbEntityMap(), encoder);
encodeOBJRelationshipsAsXML(getObjEntityMap(), encoder);
- // since Queries are not XMLSerializable by default, check for non-serilaizable
+ // since Queries are not XMLSerializable by default, check for
+ // non-serilaizable
// queries and throws if they are not..
for (Query query : getQueries()) {
if (query instanceof XMLSerializable) {
((XMLSerializable) query).encodeAsXML(encoder);
- }
- else {
- throw new CayenneRuntimeException("Query is not XMLSerilaizable: "
- + query);
+ } else {
+ throw new CayenneRuntimeException("Query is not XMLSerilaizable: " + query);
}
}
@@ -402,9 +388,7 @@ public class DataMap implements Serializ
}
// stores relationships for the map of entities
- private final void encodeDBRelationshipsAsXML(
- Map<String, DbEntity> entityMap,
- XMLEncoder encoder) {
+ private final void encodeDBRelationshipsAsXML(Map<String, DbEntity> entityMap, XMLEncoder encoder) {
for (Entity entity : entityMap.values()) {
for (Relationship relationship : entity.getRelationships()) {
// filter out synthetic
@@ -416,9 +400,7 @@ public class DataMap implements Serializ
}
// stores relationships for the map of entities
- private final void encodeOBJRelationshipsAsXML(
- Map<String, ObjEntity> entityMap,
- XMLEncoder encoder) {
+ private final void encodeOBJRelationshipsAsXML(Map<String, ObjEntity> entityMap, XMLEncoder encoder) {
for (ObjEntity entity : entityMap.values()) {
for (Relationship relationship : entity.getDeclaredRelationships()) {
// filter out synthetic
@@ -452,8 +434,8 @@ public class DataMap implements Serializ
* Adds all Object and DB entities and Queries from another map to this map.
* Overwrites all existing entities and queries with the new ones.
* <p>
- * <i>TODO: will need to implement advanced merge that allows different policies for
- * overwriting entities / queries. </i>
+ * <i>TODO: will need to implement advanced merge that allows different
+ * policies for overwriting entities / queries. </i>
* </p>
*/
public void mergeWithDataMap(DataMap map) {
@@ -474,9 +456,9 @@ public class DataMap implements Serializ
}
/**
- * Returns "location" property value. Location is abstract and can depend on how the
- * DataMap was loaded. E.g. location can be a File on the filesystem or a location
- * within a JAR.
+ * Returns "location" property value. Location is abstract and can depend on
+ * how the DataMap was loaded. E.g. location can be a File on the filesystem
+ * or a location within a JAR.
*/
public String getLocation() {
return location;
@@ -490,16 +472,16 @@ public class DataMap implements Serializ
}
/**
- * Returns a sorted unmodifiable map of ObjEntities contained in this DataMap, keyed
- * by ObjEntity name.
+ * Returns a sorted unmodifiable map of ObjEntities contained in this
+ * DataMap, keyed by ObjEntity name.
*/
public SortedMap<String, ObjEntity> getObjEntityMap() {
return Collections.unmodifiableSortedMap(objEntityMap);
}
/**
- * Returns a sorted unmodifiable map of DbEntities contained in this DataMap, keyed by
- * DbEntity name.
+ * Returns a sorted unmodifiable map of DbEntities contained in this
+ * DataMap, keyed by DbEntity name.
*/
public SortedMap<String, DbEntity> getDbEntityMap() {
return Collections.unmodifiableSortedMap(dbEntityMap);
@@ -533,16 +515,15 @@ public class DataMap implements Serializ
throw new NullPointerException("Query name can't be null.");
}
- // TODO: change method signature to return replaced procedure and make sure the
+ // TODO: change method signature to return replaced procedure and make
+ // sure the
// Modeler handles it...
Object existingQuery = queryMap.get(query.getName());
if (existingQuery != null) {
if (existingQuery == query) {
return;
- }
- else {
- throw new IllegalArgumentException("An attempt to override entity '"
- + query.getName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override entity '" + query.getName());
}
}
@@ -629,20 +610,18 @@ public class DataMap implements Serializ
}
if (embeddable.getClassName() == null) {
- throw new NullPointerException(
- "Attempt to add Embeddable with no class name.");
+ throw new NullPointerException("Attempt to add Embeddable with no class name.");
}
- // TODO: change method signature to return replaced entity and make sure the
+ // TODO: change method signature to return replaced entity and make sure
+ // the
// Modeler handles it...
Object existing = embeddablesMap.get(embeddable.getClassName());
if (existing != null) {
if (existing == embeddable) {
return;
- }
- else {
- throw new IllegalArgumentException("An attempt to override embeddable '"
- + embeddable.getClassName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override embeddable '" + embeddable.getClassName());
}
}
@@ -661,18 +640,15 @@ public class DataMap implements Serializ
}
if (result.getName() == null) {
- throw new NullPointerException(
- "Attempt to add resultSetMapping with no name.");
+ throw new NullPointerException("Attempt to add resultSetMapping with no name.");
}
Object existing = results.get(result.getName());
if (existing != null) {
if (existing == result) {
return;
- }
- else {
- throw new IllegalArgumentException(
- "An attempt to override resultSetMapping '" + result.getName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override resultSetMapping '" + result.getName());
}
}
@@ -687,16 +663,15 @@ public class DataMap implements Serializ
throw new NullPointerException("Attempt to add ObjEntity with no name.");
}
- // TODO: change method signature to return replaced entity and make sure the
+ // TODO: change method signature to return replaced entity and make sure
+ // the
// Modeler handles it...
Object existingEntity = objEntityMap.get(entity.getName());
if (existingEntity != null) {
if (existingEntity == entity) {
return;
- }
- else {
- throw new IllegalArgumentException("An attempt to override entity '"
- + entity.getName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override entity '" + entity.getName());
}
}
@@ -712,16 +687,15 @@ public class DataMap implements Serializ
throw new NullPointerException("Attempt to add DbEntity with no name.");
}
- // TODO: change method signature to return replaced entity and make sure the
+ // TODO: change method signature to return replaced entity and make sure
+ // the
// Modeler handles it...
Object existingEntity = dbEntityMap.get(entity.getName());
if (existingEntity != null) {
if (existingEntity == entity) {
return;
- }
- else {
- throw new IllegalArgumentException("An attempt to override entity '"
- + entity.getName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override entity '" + entity.getName());
}
}
@@ -744,7 +718,8 @@ public class DataMap implements Serializ
}
/**
- * Returns a collection of {@link Embeddable} mappings stored in the DataMap.
+ * Returns a collection of {@link Embeddable} mappings stored in the
+ * DataMap.
*
* @since 3.0
*/
@@ -791,9 +766,9 @@ public class DataMap implements Serializ
}
/**
- * Returns an unmodifiable list of default {@link EntityListener} objects. Note that
- * since the order of listeners is significant a list, not just a generic Collection
- * is returned.
+ * Returns an unmodifiable list of default {@link EntityListener} objects.
+ * Note that since the order of listeners is significant a list, not just a
+ * generic Collection is returned.
*
* @since 3.0
*/
@@ -805,14 +780,13 @@ public class DataMap implements Serializ
* Adds a new EntityListener.
*
* @since 3.0
- * @throws IllegalArgumentException if a listener for the same class name is already
- * registered.
+ * @throws IllegalArgumentException
+ * if a listener for the same class name is already registered.
*/
public void addDefaultEntityListener(EntityListener listener) {
for (EntityListener next : defaultEntityListeners) {
if (listener.getClassName().equals(next.getClassName())) {
- throw new IllegalArgumentException("Duplicate default listener for "
- + next.getClassName());
+ throw new IllegalArgumentException("Duplicate default listener for " + next.getClassName());
}
}
@@ -856,8 +830,8 @@ public class DataMap implements Serializ
}
/**
- * Returns DbEntity matching the <code>name</code> parameter. No dependencies will be
- * searched.
+ * Returns DbEntity matching the <code>name</code> parameter. No
+ * dependencies will be searched.
*/
public DbEntity getDbEntity(String dbEntityName) {
DbEntity entity = dbEntityMap.get(dbEntityName);
@@ -889,8 +863,8 @@ public class DataMap implements Serializ
}
/**
- * Returns an ObjEntity for a given name. If it is not found in this DataMap, it will
- * search a parent EntityNamespace.
+ * Returns an ObjEntity for a given name. If it is not found in this
+ * DataMap, it will search a parent EntityNamespace.
*/
public ObjEntity getObjEntity(String objEntityName) {
ObjEntity entity = objEntityMap.get(objEntityName);
@@ -909,8 +883,7 @@ public class DataMap implements Serializ
return Collections.EMPTY_LIST;
}
- Collection<ObjEntity> allEntities = (namespace != null) ? namespace
- .getObjEntities() : getObjEntities();
+ Collection<ObjEntity> allEntities = (namespace != null) ? namespace.getObjEntities() : getObjEntities();
if (allEntities.isEmpty()) {
return Collections.EMPTY_LIST;
@@ -932,7 +905,8 @@ public class DataMap implements Serializ
* @since 3.0
*/
public void removeEmbeddable(String className) {
- // TODO: andrus, 1/25/2007 - clean up references like removeDbEntity does.
+ // TODO: andrus, 1/25/2007 - clean up references like removeDbEntity
+ // does.
embeddablesMap.remove(className);
}
@@ -951,9 +925,9 @@ public class DataMap implements Serializ
}
/**
- * Removes DbEntity from the DataMap. If <code>clearDependencies</code> is true, all
- * DbRelationships that reference this entity are also removed. ObjEntities that rely
- * on this entity are cleaned up.
+ * Removes DbEntity from the DataMap. If <code>clearDependencies</code> is
+ * true, all DbRelationships that reference this entity are also removed.
+ * ObjEntities that rely on this entity are cleaned up.
*
* @since 1.1
*/
@@ -963,8 +937,7 @@ public class DataMap implements Serializ
if (dbEntityToDelete != null && clearDependencies) {
for (DbEntity dbEnt : this.getDbEntities()) {
// take a copy since we're going to modify the entity
- for (Relationship rel : new ArrayList<Relationship>(dbEnt
- .getRelationships())) {
+ for (Relationship rel : new ArrayList<Relationship>(dbEnt.getRelationships())) {
if (dbEntityName.equals(rel.getTargetEntityName())) {
dbEnt.removeRelationship(rel.getName());
}
@@ -975,11 +948,9 @@ public class DataMap implements Serializ
for (ObjEntity objEnt : this.getObjEntities()) {
if (dbEntityToDelete.getName().equals(objEnt.getDbEntityName())) {
objEnt.clearDbMapping();
- }
- else {
+ } else {
for (Relationship rel : objEnt.getRelationships()) {
- for (DbRelationship dbRel : ((ObjRelationship) rel)
- .getDbRelationships()) {
+ for (DbRelationship dbRel : ((ObjRelationship) rel).getDbRelationships()) {
if (dbRel.getTargetEntity() == dbEntityToDelete) {
((ObjRelationship) rel).clearDbRelationships();
break;
@@ -999,8 +970,8 @@ public class DataMap implements Serializ
}
/**
- * Removes ObjEntity from the DataMap. If <code>clearDependencies</code> is true, all
- * ObjRelationships that reference this entity are also removed.
+ * Removes ObjEntity from the DataMap. If <code>clearDependencies</code> is
+ * true, all ObjRelationships that reference this entity are also removed.
*
* @since 1.1
*/
@@ -1012,8 +983,7 @@ public class DataMap implements Serializ
// remove relationships that point to this entity
for (ObjEntity ent : getObjEntities()) {
// take a copy since we're going to modify the entity
- for (Relationship relationship : new ArrayList<Relationship>(ent
- .getRelationships())) {
+ for (Relationship relationship : new ArrayList<Relationship>(ent.getRelationships())) {
if (objEntityName.equals(relationship.getTargetEntityName())
|| objEntityName.equals(relationship.getTargetEntityName())) {
ent.removeRelationship(relationship.getName());
@@ -1031,8 +1001,9 @@ public class DataMap implements Serializ
}
/**
- * Returns a Procedure for a given name or null if no such procedure exists. If
- * Procedure is not found in this DataMap, a parent EntityNamcespace is searched.
+ * Returns a Procedure for a given name or null if no such procedure exists.
+ * If Procedure is not found in this DataMap, a parent EntityNamcespace is
+ * searched.
*/
public Procedure getProcedure(String procedureName) {
Procedure procedure = procedureMap.get(procedureName);
@@ -1044,24 +1015,24 @@ public class DataMap implements Serializ
}
/**
- * Adds stored procedure to the list of procedures. If there is another procedure
- * registered under the same name, throws an IllegalArgumentException.
+ * Adds stored procedure to the list of procedures. If there is another
+ * procedure registered under the same name, throws an
+ * IllegalArgumentException.
*/
public void addProcedure(Procedure procedure) {
if (procedure.getName() == null) {
throw new NullPointerException("Attempt to add procedure with no name.");
}
- // TODO: change method signature to return replaced procedure and make sure the
+ // TODO: change method signature to return replaced procedure and make
+ // sure the
// Modeler handles it...
Object existingProcedure = procedureMap.get(procedure.getName());
if (existingProcedure != null) {
if (existingProcedure == procedure) {
return;
- }
- else {
- throw new IllegalArgumentException("An attempt to override procedure '"
- + procedure.getName());
+ } else {
+ throw new IllegalArgumentException("An attempt to override procedure '" + procedure.getName());
}
}
@@ -1074,15 +1045,17 @@ public class DataMap implements Serializ
}
/**
- * Returns a sorted unmodifiable map of Procedures in this DataMap keyed by name.
+ * Returns a sorted unmodifiable map of Procedures in this DataMap keyed by
+ * name.
*/
public SortedMap<String, Procedure> getProcedureMap() {
return Collections.unmodifiableSortedMap(procedureMap);
}
/**
- * Returns a parent namespace where this DataMap resides. Parent EntityNamespace is
- * used to establish relationships with entities in other DataMaps.
+ * Returns a parent namespace where this DataMap resides. Parent
+ * EntityNamespace is used to establish relationships with entities in other
+ * DataMaps.
*
* @since 1.1
*/
@@ -1091,8 +1064,9 @@ public class DataMap implements Serializ
}
/**
- * Sets a parent namespace where this DataMap resides. Parent EntityNamespace is used
- * to establish relationships with entities in other DataMaps.
+ * Sets a parent namespace where this DataMap resides. Parent
+ * EntityNamespace is used to establish relationships with entities in other
+ * DataMaps.
*
* @since 1.1
*/
@@ -1203,9 +1177,9 @@ public class DataMap implements Serializ
}
/**
- * DbEntity property changed. May be name, attribute or relationship added or removed,
- * etc. Attribute and relationship property changes are handled in respective
- * listeners.
+ * DbEntity property changed. May be name, attribute or relationship added
+ * or removed, etc. Attribute and relationship property changes are handled
+ * in respective listeners.
*
* @since 1.2
*/
@@ -1246,9 +1220,9 @@ public class DataMap implements Serializ
}
/**
- * ObjEntity property changed. May be name, attribute or relationship added or
- * removed, etc. Attribute and relationship property changes are handled in respective
- * listeners.
+ * ObjEntity property changed. May be name, attribute or relationship added
+ * or removed, etc. Attribute and relationship property changes are handled
+ * in respective listeners.
*
* @since 1.2
*/
@@ -1314,4 +1288,38 @@ public class DataMap implements Serializ
public void setDefaultCatalog(String defaultCatalog) {
this.defaultCatalog = defaultCatalog;
}
+
+ /**
+ * @since 3.2
+ */
+ public EntityInheritanceTree getInheritanceTree(String entityName) {
+ // TODO: we should support that
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @since 3.2
+ */
+ public ObjEntity getObjEntity(Class<?> entityClass) {
+ if (entityClass == null) {
+ return null;
+ }
+
+ String className = entityClass.getName();
+
+ for (ObjEntity e : objEntityMap.values()) {
+ if (className.equals(e.getClassName())) {
+ return e;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @since 3.2
+ */
+ public Collection<SQLResult> getResultSets() {
+ return results.values();
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityResolver.java Sat Jun 22 19:05:05 2013
@@ -38,7 +38,6 @@ import org.apache.cayenne.reflect.Single
import org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory;
import org.apache.cayenne.reflect.valueholder.ValueHolderDescriptorFactory;
import org.apache.cayenne.util.Util;
-import org.apache.commons.collections.collection.CompositeCollection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -60,7 +59,7 @@ public class EntityResolver implements M
protected boolean indexedByClass;
protected Collection<DataMap> maps;
- protected transient MappingCache mappingCache;
+ protected transient MappingNamespace mappingCache;
protected EntityResolver clientEntityResolver;
// must be transient, as resolver may get deserialized in another VM, and
@@ -319,63 +318,33 @@ public class EntityResolver implements M
* Returns all DbEntities.
*/
public Collection<DbEntity> getDbEntities() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getDbEntities());
- }
-
- return c;
+ return mappingCache.getDbEntities();
}
public Collection<ObjEntity> getObjEntities() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getObjEntities());
- }
-
- return c;
+ return mappingCache.getObjEntities();
}
/**
* @since 3.0
*/
public Collection<Embeddable> getEmbeddables() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getEmbeddables());
- }
-
- return c;
+ return mappingCache.getEmbeddables();
}
/**
* @since 3.0
*/
public Collection<SQLResult> getResultSets() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getResults());
- }
-
- return c;
+ return mappingCache.getResultSets();
}
public Collection<Procedure> getProcedures() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getProcedures());
- }
-
- return c;
+ return mappingCache.getProcedures();
}
public Collection<Query> getQueries() {
- CompositeCollection c = new CompositeCollection();
- for (DataMap map : getDataMaps()) {
- c.addComposited(map.getQueries());
- }
-
- return c;
+ return mappingCache.getQueries();
}
public DbEntity getDbEntity(String name) {
@@ -481,14 +450,14 @@ public class EntityResolver implements M
* @since 3.2
*/
public void refreshMappingCache() {
- mappingCache = new ProxiedMappingCache() {
+ mappingCache = new ProxiedMappingNamespace() {
@Override
protected MappingCache createDelegate() {
- return new DefaultMappingCache(maps);
+ return new MappingCache(maps);
}
};
-
+
clientEntityResolver = null;
}
@@ -523,14 +492,9 @@ public class EntityResolver implements M
}
/**
- * Returns EntityInheritanceTree representing inheritance hierarchy that
- * starts with a given ObjEntity as root, and includes all its subentities.
- * Returns non-null object for all existing entities, even those that don't
- * have super or subclasses.
- *
- * @since 3.0
+ * @since 3.2
*/
- public EntityInheritanceTree lookupInheritanceTree(String entityName) {
+ public EntityInheritanceTree getInheritanceTree(String entityName) {
EntityInheritanceTree tree = mappingCache.getInheritanceTree(entityName);
@@ -545,6 +509,15 @@ public class EntityResolver implements M
}
return tree;
+
+ }
+
+ /**
+ * @deprecated since 3.2 use {@link #getInheritanceTree(String)}.
+ */
+ @Deprecated
+ public EntityInheritanceTree lookupInheritanceTree(String entityName) {
+ return getInheritanceTree(entityName);
}
/**
@@ -553,20 +526,29 @@ public class EntityResolver implements M
*
* @return the required ObjEntity or null if there is none that matches the
* specifier
+ *
+ * @since 3.2
*/
- public ObjEntity lookupObjEntity(Class<?> aClass) {
- ObjEntity result = mappingCache.getObjEntity(aClass);
+ public ObjEntity getObjEntity(Class<?> entityClass) {
+ ObjEntity result = mappingCache.getObjEntity(entityClass);
if (result == null) {
// reconstruct cache just in case some of the datamaps
// have changed and now contain the required information
refreshMappingCache();
- result = mappingCache.getObjEntity(aClass);
+ result = mappingCache.getObjEntity(entityClass);
}
return result;
}
/**
+ * @deprecated since 3.2, use {@link #getObjEntity(Class)}.
+ */
+ public ObjEntity lookupObjEntity(Class<?> entityClass) {
+ return getObjEntity(entityClass);
+ }
+
+ /**
* Looks in the DataMap's that this object was created with for the
* ObjEntity that services the specified data Object
*
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingCache.java Sat Jun 22 19:05:05 2013
@@ -18,23 +18,267 @@
****************************************************************/
package org.apache.cayenne.map;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cayenne.CayenneRuntimeException;
import org.apache.cayenne.query.Query;
+import org.apache.commons.collections.collection.CompositeCollection;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @since 3.2
+ */
+class MappingCache implements MappingNamespace {
+
+ private static final ObjEntity OBJ_DUPLICATE_MARKER = new ObjEntity();
+
+ protected static final Log logger = LogFactory.getLog(MappingCache.class);
+
+ protected Collection<DataMap> maps;
+ protected Map<String, Query> queryCache;
+ protected Map<String, Embeddable> embeddableCache;
+ protected Map<String, SQLResult> resultsCache;
+ protected Map<String, DbEntity> dbEntityCache;
+ protected Map<String, ObjEntity> objEntityCache;
+ protected Map<String, ObjEntity> objEntityClassCache;
+ protected Map<String, Procedure> procedureCache;
+ protected Map<String, EntityInheritanceTree> entityInheritanceCache;
+
+ MappingCache(Collection<DataMap> maps) {
+
+ this.maps = maps;
+
+ this.embeddableCache = new HashMap<String, Embeddable>();
+ this.queryCache = new HashMap<String, Query>();
+ this.dbEntityCache = new HashMap<String, DbEntity>();
+ this.objEntityCache = new HashMap<String, ObjEntity>();
+ this.objEntityClassCache = new HashMap<String, ObjEntity>();
+ this.procedureCache = new HashMap<String, Procedure>();
+ this.entityInheritanceCache = new HashMap<String, EntityInheritanceTree>();
+ this.resultsCache = new HashMap<String, SQLResult>();
+
+ index();
+ }
+
+ private void index() {
+
+ // index DbEntities separately and before ObjEntities to avoid infinite
+ // loops when looking up DbEntities during ObjEntity index op
+
+ for (DataMap map : maps) {
+ for (DbEntity de : map.getDbEntities()) {
+ dbEntityCache.put(de.getName(), de);
+ }
+ }
+
+ for (DataMap map : maps) {
+
+ // index ObjEntities
+ for (ObjEntity oe : map.getObjEntities()) {
+
+ // index by name
+ objEntityCache.put(oe.getName(), oe);
+
+ // index by class.. use class name as a key to avoid class
+ // loading here...
+ String className = oe.getJavaClassName();
+ if (className == null) {
+ continue;
+ }
+
+ // allow duplicates, but put a special marker indicating
+ // that this entity can't be looked up by class
+ Object existing = objEntityClassCache.get(className);
+ if (existing != null) {
+
+ if (existing != OBJ_DUPLICATE_MARKER) {
+ objEntityClassCache.put(className, OBJ_DUPLICATE_MARKER);
+ }
+ } else {
+ objEntityClassCache.put(className, oe);
+ }
+ }
+
+ // index stored procedures
+ for (Procedure proc : map.getProcedures()) {
+ procedureCache.put(proc.getName(), proc);
+ }
+
+ // index embeddables
+ embeddableCache.putAll(map.getEmbeddableMap());
+
+ // index queries
+ for (Query query : map.getQueries()) {
+ String name = query.getName();
+ Object existingQuery = queryCache.put(name, query);
+
+ if (existingQuery != null && query != existingQuery) {
+ throw new CayenneRuntimeException("More than one Query for name" + name);
+ }
+ }
+ }
+
+ // restart the map iterator to index inheritance
+ for (DataMap map : maps) {
+
+ // index ObjEntity inheritance
+ for (ObjEntity oe : map.getObjEntities()) {
+
+ // build inheritance tree
+ EntityInheritanceTree node = entityInheritanceCache.get(oe.getName());
+ if (node == null) {
+ node = new EntityInheritanceTree(oe);
+ entityInheritanceCache.put(oe.getName(), node);
+ }
+
+ String superOEName = oe.getSuperEntityName();
+ if (superOEName != null) {
+ EntityInheritanceTree superNode = entityInheritanceCache.get(superOEName);
+
+ if (superNode == null) {
+ // do direct entity lookup to avoid recursive cache
+ // rebuild
+ ObjEntity superOE = objEntityCache.get(superOEName);
+ if (superOE != null) {
+ superNode = new EntityInheritanceTree(superOE);
+ entityInheritanceCache.put(superOEName, superNode);
+ } else {
+ // bad mapping? Or most likely some classloader
+ // issue
+ logger.warn("No super entity mapping for '" + superOEName + "'");
+ continue;
+ }
+ }
+
+ superNode.addChildNode(node);
+ }
+ }
+ }
+ }
+
+ public Embeddable getEmbeddable(String className) {
+ return embeddableCache.get(className);
+ }
+
+ public SQLResult getResult(String name) {
+ return resultsCache.get(name);
+ }
+
+ public EntityInheritanceTree getInheritanceTree(String entityName) {
+ return entityInheritanceCache.get(entityName);
+ }
+
+ public Procedure getProcedure(String procedureName) {
+ return procedureCache.get(procedureName);
+ }
+
+ public Query getQuery(String queryName) {
+ return queryCache.get(queryName);
+ }
+
+ public DbEntity getDbEntity(String name) {
+ return dbEntityCache.get(name);
+ }
+
+ public ObjEntity getObjEntity(Class<?> entityClass) {
+ ObjEntity entity = objEntityClassCache.get(entityClass.getName());
+
+ if (entity == OBJ_DUPLICATE_MARKER) {
+ throw new CayenneRuntimeException("Can't perform lookup. There is more than one ObjEntity mapped to "
+ + entityClass.getName());
+ }
+
+ return entity;
+ }
+
+ public ObjEntity getObjEntity(String name) {
+ return objEntityCache.get(name);
+ }
+
+ public Collection<DbEntity> getDbEntities() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getDbEntities());
+ }
+
+ return c;
+ }
+
+ public Collection<Procedure> getProcedures() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getProcedures());
+ }
-interface MappingCache {
+ return c;
+ }
- Embeddable getEmbeddable(String className);
+ public Collection<Query> getQueries() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getQueries());
+ }
- SQLResult getResult(String name);
+ return c;
+ }
- EntityInheritanceTree getInheritanceTree(String entityName);
+ public Collection<ObjEntity> getObjEntities() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getObjEntities());
+ }
- Procedure getProcedure(String procedureName);
+ return c;
+ }
- Query getQuery(String queryName);
+ public Collection<Embeddable> getEmbeddables() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getEmbeddables());
+ }
- DbEntity getDbEntity(String name);
+ return c;
+ }
- ObjEntity getObjEntity(Class<?> entityClass);
+ public Collection<SQLResult> getResultSets() {
+ // TODO: LEGACY SUPPORT:
+ // some downstream code (like Modeler and merge framework) expect
+ // always fresh list here, so instead of doing the right thing of
+ // refreshing the cache and returning cache.entries(), we are scanning
+ // the list of DataMaps.
+ CompositeCollection c = new CompositeCollection();
+ for (DataMap map : maps) {
+ c.addComposited(map.getResultSets());
+ }
- ObjEntity getObjEntity(String name);
+ return c;
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/MappingNamespace.java Sat Jun 22 19:05:05 2013
@@ -24,20 +24,25 @@ import java.util.Collection;
import org.apache.cayenne.query.Query;
/**
- * Defines API of a container of DbEntities, ObjEntities, Procedures, Queries and other
- * mapping objects.
+ * Defines API of a container of DbEntities, ObjEntities, Procedures, Queries
+ * and other mapping objects.
*
* @since 1.1
*/
public interface MappingNamespace {
/**
- * Returns an {@link Embeddable} matching class name or null if such Embeddable is not
- * mapped.
+ * Returns an {@link Embeddable} matching class name or null if such
+ * Embeddable is not mapped.
*
* @since 3.0
*/
Embeddable getEmbeddable(String className);
+
+ /**
+ * @since 3.2
+ */
+ Collection<Embeddable> getEmbeddables();
/**
* Returns a named result set mapping.
@@ -45,22 +50,27 @@ public interface MappingNamespace {
* @since 3.0
*/
SQLResult getResult(String name);
+
+ /**
+ * @since 3.2
+ */
+ Collection<SQLResult> getResultSets();
/**
- * Returns DbEntity for a given name, or null if no such DbEntity is found in the
- * MappingNamespace.
+ * Returns DbEntity for a given name, or null if no such DbEntity is found
+ * in the MappingNamespace.
*/
DbEntity getDbEntity(String name);
/**
- * Returns ObjEntity for a given name, or null if no such ObjEntity is found in the
- * MappingNamespace.
+ * Returns ObjEntity for a given name, or null if no such ObjEntity is found
+ * in the MappingNamespace.
*/
ObjEntity getObjEntity(String name);
/**
- * Returns Procedure for a given name, or null if no such Procedure is found in the
- * MappingNamespace.
+ * Returns Procedure for a given name, or null if no such Procedure is found
+ * in the MappingNamespace.
*/
Procedure getProcedure(String name);
@@ -89,4 +99,14 @@ public interface MappingNamespace {
* Returns all Queries in the namespace.
*/
Collection<Query> getQueries();
+
+ /**
+ * @since 3.2
+ */
+ EntityInheritanceTree getInheritanceTree(String entityName);
+
+ /**
+ * @since 3.2
+ */
+ ObjEntity getObjEntity(Class<?> entityClass);
}
Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java (from r1495760, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingCache.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingCache.java&r1=1495760&r2=1495771&rev=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingCache.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ProxiedMappingNamespace.java Sat Jun 22 19:05:05 2013
@@ -18,16 +18,18 @@
****************************************************************/
package org.apache.cayenne.map;
+import java.util.Collection;
+
import org.apache.cayenne.query.Query;
/**
* A proxy for lazy on-demand initialization of the mapping cache.
*/
-abstract class ProxiedMappingCache implements MappingCache {
+abstract class ProxiedMappingNamespace implements MappingNamespace {
- private volatile MappingCache delegate;
+ private volatile MappingNamespace delegate;
- MappingCache getDelegate() {
+ MappingNamespace getDelegate() {
if (delegate == null) {
@@ -41,7 +43,7 @@ abstract class ProxiedMappingCache imple
return delegate;
}
- protected abstract MappingCache createDelegate();
+ protected abstract MappingNamespace createDelegate();
public Embeddable getEmbeddable(String className) {
return getDelegate().getEmbeddable(className);
@@ -75,4 +77,28 @@ abstract class ProxiedMappingCache imple
return getDelegate().getObjEntity(name);
}
+ public Collection<DbEntity> getDbEntities() {
+ return getDelegate().getDbEntities();
+ }
+
+ public Collection<ObjEntity> getObjEntities() {
+ return getDelegate().getObjEntities();
+ }
+
+ public Collection<Procedure> getProcedures() {
+ return getDelegate().getProcedures();
+ }
+
+ public Collection<Query> getQueries() {
+ return getDelegate().getQueries();
+ }
+
+ public Collection<Embeddable> getEmbeddables() {
+ return getDelegate().getEmbeddables();
+ }
+
+ public Collection<SQLResult> getResultSets() {
+ return getDelegate().getResultSets();
+ }
+
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/MockMappingNamespace.java Sat Jun 22 19:05:05 2013
@@ -97,4 +97,24 @@ public class MockMappingNamespace implem
public Collection<Query> getQueries() {
return queries.values();
}
+
+ public Collection<Embeddable> getEmbeddables() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public EntityInheritanceTree getInheritanceTree(String entityName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ObjEntity getObjEntity(Class<?> entityClass) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Collection<SQLResult> getResultSets() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java?rev=1495771&r1=1495770&r2=1495771&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/merge/CreateTableToModelTest.java Sat Jun 22 19:05:05 2013
@@ -61,13 +61,9 @@ public class CreateTableToModelTest exte
execute(token);
ObjEntity objEntity = null;
- for (ObjEntity candiate : map.getObjEntities()) {
- if (candiate.getDbEntity() == null) {
- continue;
- }
- if (candiate.getDbEntity().getName()
- .equalsIgnoreCase(dbEntity.getName())) {
- objEntity = candiate;
+ for (ObjEntity candidate : map.getObjEntities()) {
+ if (dbEntity.getName().equalsIgnoreCase(candidate.getDbEntityName())) {
+ objEntity = candidate;
break;
}
}
@@ -98,5 +94,4 @@ public class CreateTableToModelTest exte
assertTokensAndExecute(1, 0);
assertTokensAndExecute(0, 0);
}
-
}