User: dsundstrom
Date: 02/01/15 14:23:17
Modified: src/main/org/jboss/ejb/plugins/cmp/jdbc
JDBCQueryManager.java
Log:
Cleaned up code.
Revision Changes Path
1.3 +23 -29
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCQueryManager.java
Index: JDBCQueryManager.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCQueryManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JDBCQueryManager.java 2002/01/05 12:08:51 1.2
+++ JDBCQueryManager.java 2002/01/15 22:23:17 1.3
@@ -30,7 +30,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Joe Shevland</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Justin Forder</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class JDBCQueryManager {
private final Map knownQueries = new HashMap();
@@ -54,17 +54,16 @@
public void start() throws DeploymentException {
Logger log = Logger.getLogger(
- this.getClass().getName() +
- "." +
+ this.getClass().getName() +
+ "." +
manager.getMetaData().getName());
- boolean debug = log.isDebugEnabled();
-
- JDBCCommandFactory factory = manager.getCommandFactory();
-
+
+ JDBCCommandFactory factory = manager.getCommandFactory();
+
Class homeClass = manager.getContainer().getHomeClass();
Class localHomeClass = manager.getContainer().getLocalHomeClass();
- //
+ //
// findByPrimaryKey
//
JDBCEntityBridge entity = manager.getEntityBridge();
@@ -72,52 +71,50 @@
try {
// try to get the finder method on the home interface
Method method = homeClass.getMethod(
- "findByPrimaryKey",
+ "findByPrimaryKey",
new Class[] {entity.getPrimaryKeyClass()});
-
+
// got it add it to known finders
JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method);
knownQueries.put(
- method,
+ method,
factory.createFindByPrimaryKeyQuery(q));
- if (debug)
- log.debug("Added findByPrimaryKey query command for " +
+ log.debug("Added findByPrimaryKey query command for " +
"home interface");
} catch(NoSuchMethodException e) {
throw new DeploymentException("Home interface does not " +
"have a findByPrimaryKey method");
}
}
-
+
if(localHomeClass != null) {
try {
// try to get the finder method on the local home interface
Method method = localHomeClass.getMethod(
- "findByPrimaryKey",
+ "findByPrimaryKey",
new Class[] {entity.getPrimaryKeyClass()});
-
+
// got it add it to known finders
JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method);
knownQueries.put(
- method,
+ method,
factory.createFindByPrimaryKeyQuery(q));
- if (debug)
- log.debug("Added findByPrimaryKey query command for " +
+ log.debug("Added findByPrimaryKey query command for " +
"local home interface");
} catch(NoSuchMethodException e) {
throw new DeploymentException("Local home interface does " +
"not have a findByPrimaryKey method");
}
}
-
+
//
// Custom finders - Overrides defined and automatic finders.
//
Class ejbClass = manager.getMetaData().getEntityClass();
- Method[] customMethods = ejbClass.getMethods();
+ Method[] customMethods = ejbClass.getMethods();
for (int i = 0; i < customMethods.length; i++) {
Method m = customMethods[i];
String methodName = m.getName();
@@ -128,16 +125,15 @@
try {
// try to get the finder method on the home interface
Method interfaceMethod = homeClass.getMethod(
- interfaceName,
+ interfaceName,
m.getParameterTypes());
-
+
// got it add it to known finders
knownQueries.put(
- interfaceMethod,
+ interfaceMethod,
new JDBCCustomFinderQuery(manager, m));
- if (debug)
- log.debug("Added custom finder " + methodName +
+ log.debug("Added custom finder " + methodName +
" on home interface");
} catch(NoSuchMethodException e) {
// this is ok method may not be defined on this interface
@@ -156,8 +152,7 @@
interfaceMethod,
new JDBCCustomFinderQuery(manager, m));
- if (debug)
- log.debug("Added custom finder " + methodName +
+ log.debug("Added custom finder " + methodName +
" on local home interface");
} catch(NoSuchMethodException e) {
// this is ok method may not be defined on this interface
@@ -218,8 +213,7 @@
JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(m);
knownQueries.put(m, factory.createFindByQuery(q));
} catch (IllegalArgumentException e) {
- if (log.isDebugEnabled())
- log.debug("Could not create the finder " + name +
+ log.debug("Could not create the finder " + name +
", because no matching CMP field was found.");
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development