Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 55768 invoked from network); 11 Jan 2004 01:26:33 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 11 Jan 2004 01:26:33 -0000 Received: (qmail 43502 invoked by uid 500); 11 Jan 2004 01:26:16 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 43477 invoked by uid 500); 11 Jan 2004 01:26:15 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 43461 invoked by uid 500); 11 Jan 2004 01:26:15 -0000 Received: (qmail 43457 invoked from network); 11 Jan 2004 01:26:15 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 11 Jan 2004 01:26:15 -0000 Received: (qmail 55755 invoked by uid 1510); 11 Jan 2004 01:26:31 -0000 Date: 11 Jan 2004 01:26:31 -0000 Message-ID: <20040111012631.55754.qmail@minotaur.apache.org> From: arminw@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata RepositoryXmlHandler.java ConnectionDescriptorXmlHandler.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N arminw 2004/01/10 17:26:31 Modified: src/test/org/apache/ojb OJB.properties src/java/org/apache/ojb/broker/metadata RepositoryXmlHandler.java ConnectionDescriptorXmlHandler.java Log: - fix debug/info messages of ConnectionDescriptorXmlHandler/RepositoryXmlHandler - add log entry for ConnectionDescriptorXmlHandler Revision Changes Path 1.61 +5 -1 db-ojb/src/test/org/apache/ojb/OJB.properties Index: OJB.properties =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/OJB.properties,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- OJB.properties 9 Jan 2004 19:29:37 -0000 1.60 +++ OJB.properties 11 Jan 2004 01:26:31 -0000 1.61 @@ -277,7 +277,11 @@ # Logger for PersistenceBrokerFactory class PersistenceBrokerFactoryDefaultImpl org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.LogLevel=WARN # Logger for RepositoryXmlHandler, useful for debugging parsing of repository.xml! +# persistence capable object metadata org.apache.ojb.broker.metadata.RepositoryXmlHandler.LogLevel=WARN +# Logger for ConnectionDescriptorXmlHandler, useful for debugging parsing of repository.xml! +# connection specific metadata +org.apache.ojb.broker.metadata.ConnectionDescriptorXmlHandler.LogLevel=WARN # Logger for JdbcAccess, useful for debugging JDBC related problems org.apache.ojb.broker.accesslayer.JdbcAccessImpl.LogLevel=WARN # Logger for RsIterator, useful for debugging problems with Object materialization 1.52 +84 -53 db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java Index: RepositoryXmlHandler.java =================================================================== RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/RepositoryXmlHandler.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- RepositoryXmlHandler.java 19 Dec 2003 16:34:32 -0000 1.51 +++ RepositoryXmlHandler.java 11 Jan 2004 01:26:31 -0000 1.52 @@ -68,7 +68,12 @@ * The handler catches Parsing events raised by the xml-parser * and builds up the DescriptorRepository that is used within the * OJB PersistenceBroker System. - * + *

+ * TODO: Reading of metadata are split in two classes {@link RepositoryXmlHandler} and + * {@link ConnectionDescriptorXmlHandler}. Thus we should only read relevant tags in this + * classes. In further versions we should split repository.dtd in two parts, one for connetion + * metadata, one for pc object metadata. + *

* @author Thomas Mahler * @author Jakob Br�uchi * @version $Id$ @@ -178,8 +183,10 @@ { case MAPPING_REPOSITORY: { + if (isDebug) logger.debug(" > " + tags.getTagById(MAPPING_REPOSITORY)); this.m_CurrentAttrContainer = m_repository; String defIso = atts.getValue(tags.getTagById(ISOLATION_LEVEL)); + if (isDebug) logger.debug(" " + tags.getTagById(ISOLATION_LEVEL) + ": " + defIso); if (defIso != null) { defIsoLevel = getIsoLevel(defIso); @@ -196,6 +203,7 @@ String version = atts.getValue(tags.getTagById(REPOSITORY_VERSION)); if (DescriptorRepository.getVersion().equals(version)) { + if (isDebug) logger.debug(" " + tags.getTagById(REPOSITORY_VERSION) + ": " + version); } else { @@ -204,9 +212,6 @@ version+". Please update your repository.dtd and your repository.xml"+ " version attribute entry"); } - - if (isDebug) logger.debug(" > " + tags.getTagById(MAPPING_REPOSITORY)); - break; } case CLASS_DESCRIPTOR: @@ -267,10 +272,10 @@ String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); if (proxyPrefetchingLimit == null) - { + { m_CurrentCLD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); - } - else + } + else { m_CurrentCLD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); } @@ -347,22 +352,26 @@ } case OBJECT_CACHE: { - String className = atts.getValue(tags.getTagById(CLASS_NAME)); - if(checkString(className)) + // we only interessted in object-cache tags declared within + // an class-descriptor + if(m_CurrentCLD != null) { - ObjectCacheDescriptor ocd = new ObjectCacheDescriptor(); - this.m_CurrentAttrContainer = ocd; - ocd.setObjectCache(ClassHelper.getClass(className)); - if(m_CurrentCLD != null) + String className = atts.getValue(tags.getTagById(CLASS_NAME)); + if(checkString(className)) { - m_CurrentCLD.setObjectCacheDescriptor(ocd); + if (isDebug) logger.debug(" > " + tags.getTagById(OBJECT_CACHE)); + ObjectCacheDescriptor ocd = new ObjectCacheDescriptor(); + this.m_CurrentAttrContainer = ocd; + ocd.setObjectCache(ClassHelper.getClass(className)); + if(m_CurrentCLD != null) + { + m_CurrentCLD.setObjectCacheDescriptor(ocd); + } + if (isDebug) logger.debug(" " + tags.getTagById(CLASS_NAME) + ": " + className); } - if (isDebug) logger.debug(" > " + tags.getTagById(OBJECT_CACHE)); - if (isDebug) logger.debug(" " + tags.getTagById(CLASS_NAME) + ": " + className); } break; } - case CLASS_EXTENT: { String classname = atts.getValue("class-ref"); @@ -536,10 +545,10 @@ String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); if (proxyPrefetchingLimit == null) - { + { m_CurrentCLD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); - } - else + } + else { m_CurrentCLD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); } @@ -661,10 +670,10 @@ String proxyPrefetchingLimit = atts.getValue(tags.getTagById(PROXY_PREFETCHING_LIMIT)); if (isDebug) logger.debug(" " + tags.getTagById(PROXY_PREFETCHING_LIMIT) + ": " + proxyPrefetchingLimit); if (proxyPrefetchingLimit == null) - { + { m_CurrentCLD.setProxyPrefetchingLimit(defProxyPrefetchingLimit); - } - else + } + else { m_CurrentCLD.setProxyPrefetchingLimit(Integer.parseInt(proxyPrefetchingLimit)); } @@ -770,19 +779,27 @@ // If we have a container to store this attribute in, then do so. if (this.m_CurrentAttrContainer != null) { - if (isDebug) logger.debug(" > " + tags.getTagById(ATTRIBUTE)); - if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_NAME) + ": " + attributeName); - if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_VALUE) + ": " + attributeValue); + if (isDebug) logger.debug(" > " + tags.getTagById(ATTRIBUTE)); + if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_NAME) + ": " + attributeName); + if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_VALUE) + ": " + attributeValue); this.m_CurrentAttrContainer.addAttribute(attributeName, attributeValue); -// logger.info("attribute ["+attributeName+"="+attributeValue+"] add to "+m_CurrentAttrContainer.getClass()); } else { - logger.info("Found attribute (name="+attributeName+", value="+attributeValue+ - ") but I can not assign them to a descriptor"); +// logger.debug("Found attribute (name="+attributeName+", value="+attributeValue+ +// ") but I can not assign them to a descriptor"); } break; } +// case SEQUENCE_MANAGER: +// { +// if (isDebug) logger.debug(" > " + tags.getTagById(SEQUENCE_MANAGER)); +// // currently it's not possible to specify SM on class-descriptor level +// // thus we use a dummy object to prevent ATTRIBUTE container report +// // unassigned attributes +// this.m_CurrentAttrContainer = new SequenceDescriptor(null); +// break; +// } case QUERY_CUSTOMIZER: { // set collection-class attribute @@ -981,7 +998,10 @@ } case OBJECT_CACHE: { - if (isDebug) logger.debug(" < " + tags.getTagById(OBJECT_CACHE)); + if(m_CurrentAttrContainer != null) + { + if (isDebug) logger.debug(" < " + tags.getTagById(OBJECT_CACHE)); + } this.m_CurrentAttrContainer = m_CurrentCLD; break; } @@ -1037,7 +1057,10 @@ } case ATTRIBUTE: { - if (isDebug) logger.debug(" < " + tags.getTagById(ATTRIBUTE)); + if(m_CurrentAttrContainer != null) + { + if (isDebug) logger.debug(" < " + tags.getTagById(ATTRIBUTE)); + } break; } case DOCUMENTATION: @@ -1045,24 +1068,27 @@ if (isDebug) logger.debug(" < " + tags.getTagById(DOCUMENTATION)); break; } - case SEQUENCE_MANAGER: - { - // if (isDebug) logger.debug(" < " + tags.getTagById(DOCUMENTATION)); - this.m_CurrentAttrContainer = null; - break; - } - case CONNECTION_POOL: - { - // if (isDebug) logger.debug(" < " + tags.getTagById(DOCUMENTATION)); - this.m_CurrentAttrContainer = null; - break; - } - case JDBC_CONNECTION_DESCRIPTOR: - { - if (isDebug) logger.debug(" < " + tags.getTagById(DOCUMENTATION)); - this.m_CurrentAttrContainer = null; - break; - } +// case SEQUENCE_MANAGER: +// { +// // currently not used on class-descriptor level +// // if (isDebug) logger.debug(" < " + tags.getTagById(SEQUENCE_MANAGER)); +// this.m_CurrentAttrContainer = null; +// break; +// } +// case CONNECTION_POOL: +// { +// // not used on class-descriptor level +// // if (isDebug) logger.debug(" < " + tags.getTagById(CONNECTION_POOL)); +// this.m_CurrentAttrContainer = null; +// break; +// } +// case JDBC_CONNECTION_DESCRIPTOR: +// { +// // not used on class-descriptor level +// // if (isDebug) logger.debug(" < " + tags.getTagById(JDBC_CONNECTION_DESCRIPTOR)); +// this.m_CurrentAttrContainer = null; +// break; +// } case QUERY_CUSTOMIZER: { m_CurrentAttrContainer = m_CurrentCOD; @@ -1114,7 +1140,7 @@ // handle failure: default : { - logger.info("Ignoring unused Element " + qName); + logger.debug("Ignoring unused Element " + qName); } } } @@ -1171,6 +1197,11 @@ */ private int getIsoLevel(String isoLevel) { + if(isoLevel == null) + { + logger.debug("isolation level is 'null', using default isolation level: " + defIsoLevel); + return defIsoLevel; + } if (isoLevel.equalsIgnoreCase(LITERAL_IL_READ_UNCOMMITTED)) { return IL_READ_UNCOMMITTED; @@ -1191,7 +1222,7 @@ { return IL_OPTIMISTIC; } - logger.warn("unknown isolation-level: " + isoLevel + " using RW_UNCOMMITTED as default"); + logger.warn("unknown isolation-level: " + isoLevel + " using default isolation level: " + defIsoLevel); return defIsoLevel; } @@ -1202,7 +1233,7 @@ /** * Check inheritance - * @author Houar TINE + * author Houar TINE */ private void checkThis(String classRef) { 1.8 +21 -9 db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionDescriptorXmlHandler.java Index: ConnectionDescriptorXmlHandler.java =================================================================== RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ConnectionDescriptorXmlHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ConnectionDescriptorXmlHandler.java 16 Dec 2003 21:29:01 -0000 1.7 +++ ConnectionDescriptorXmlHandler.java 11 Jan 2004 01:26:31 -0000 1.8 @@ -70,7 +70,13 @@ /** * The handler catches Parsing events raised by the xml-parser * and builds up the {@link ConnectionRepository} that is used - * within the OJB PersistenceBroker System. + * within the OJB. + *

+ * TODO: Reading of metadata are split in two classes {@link RepositoryXmlHandler} and + * {@link ConnectionDescriptorXmlHandler}. Thus we should only read relevant tags in this + * classes. In further versions we should split repository.dtd in two parts, one for connetion + * metadata, one for pc object metadata. + *

* * @author
Armin Waibel * @version $Id$ @@ -353,9 +359,9 @@ if (checkString(attributeName)) { - if (isDebug) logger.debug(" > " + tags.getTagById(ATTRIBUTE)); - if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_NAME) + ": " + attributeName); - if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_VALUE) + ": " + attributeValue); + if (isDebug) logger.debug(" > " + tags.getTagById(ATTRIBUTE)); + if (isDebug) logger.debug(" " + tags.getTagById(ATTRIBUTE_NAME) + ": " + attributeName + + " "+tags.getTagById(ATTRIBUTE_VALUE) + ": " + attributeValue); this.currentAttributeContainer.addAttribute(attributeName, attributeValue); // logger.info("attribute ["+attributeName+"="+attributeValue+"] add to "+currentAttributeContainer.getClass()); } @@ -456,14 +462,20 @@ } case OBJECT_CACHE: { - if (isDebug) logger.debug(" < " + tags.getTagById(OBJECT_CACHE)); - // set to null or previous element level at the end of the tag!! - currentAttributeContainer = m_CurrentJCD; + if(currentAttributeContainer != null) + { + if (isDebug) logger.debug(" < " + tags.getTagById(OBJECT_CACHE)); + // set to null or previous element level at the end of the tag!! + currentAttributeContainer = m_CurrentJCD; + } break; } case ATTRIBUTE: { - if (isDebug) logger.debug(" < " + tags.getTagById(ATTRIBUTE)); + if(currentAttributeContainer != null) + { + if (isDebug) logger.debug(" < " + tags.getTagById(ATTRIBUTE)); + } break; } default : --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org