Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/QueryByCriteriaImpl.java Sat Jul 15 07:22:34 2006 @@ -42,8 +42,6 @@ * PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker(); * Collection col = broker.getCollectionByQuery(qry); * - * Creation date: (24.01.2001 21:45:46) - * @author Thomas Mahler * @version $Id$ */ public class QueryByCriteriaImpl extends AbstractQueryImpl implements QueryByCriteria @@ -248,12 +246,11 @@ public String toString() { StringBuffer buf = new StringBuffer("QueryByCriteria from "); - buf.append(getSearchClass() + " "); + buf.append(getSearchClass()).append(" "); if (getCriteria() != null && !getCriteria().isEmpty()) { - buf.append(" where " + getCriteria()); + buf.append(" where ").append(getCriteria()); } - return buf.toString(); } @@ -338,9 +335,6 @@ } } - /* (non-Javadoc) - * @see org.apache.ojb.broker.query.Query#getGroupBy() - */ /** * @see org.apache.ojb.broker.query.QueryByCriteria#getGroupBy() */ @@ -460,9 +454,6 @@ m_prefetchedRelationships.add(aName); } - /* (non-Javadoc) - * @see org.apache.ojb.broker.query.Query#getPrefetchedRelationships() - */ /** * @see org.apache.ojb.broker.query.QueryByCriteria#getPrefetchedRelationships() */
Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQuery.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQuery.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQuery.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/query/ReportQuery.java Sat Jul 15 07:22:34 2006 @@ -43,8 +43,8 @@ * @return Returns an int[] of Jdbc-Types * @see java.sql.Types */ - int[] getJdbcTypes(); - + int[] getJdbcTypes(); + /** * Sets the Jdbc-Types of the columns used for the Report. * If null the Jdbc-Type is taken from the ResultSet @@ -58,13 +58,12 @@ * @return Returns a String[] */ String[] getJoinAttributes(); - + /** * Sets the additional attributes used for building the Join. * These Attributes are not appended to the select-clause. * @param joinAttributes The joinAttributes to set. */ void setJoinAttributes(String[] joinAttributes); - } Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/BrokerHelper.java Sat Jul 15 07:22:34 2006 @@ -177,6 +177,54 @@ } /** + * Get the values of the fk-target-fields for an obj. + * @param rds + * @param objOrProxy + * @throws PersistenceBrokerException + */ + public ValueContainer[] getFkTargetValuesForObject(ObjectReferenceDescriptor rds, Object objOrProxy, boolean convertToSql) throws PersistenceBrokerException + { + Class refClass = m_broker.getProxyFactory().getRealClass(objOrProxy); + ClassDescriptor refCld = m_broker.getClassDescriptor(refClass); + FieldDescriptor pkFd[] = refCld.getPkFields(); + FieldDescriptor targetFd[] = rds.getForeignKeyTargetFieldDescriptors(refCld); + + // use the values of the key-fields + if (targetFd.length == 0 || Arrays.equals(pkFd, targetFd)) + { + return getKeyValues(refCld, objOrProxy, convertToSql); + } + + // use the values of the target-fields + Object obj = m_broker.getProxyFactory().getRealObject(objOrProxy); + return getValuesForObject(targetFd, obj, convertToSql); + } + + /** + * Get the values of the fk-fields for an obj. + * @param rds + * @param objOrProxy + * @throws PersistenceBrokerException + */ + public ValueContainer[] getFkValuesForObject(ObjectReferenceDescriptor rds, Object objOrProxy, boolean convertToSql) throws PersistenceBrokerException + { + Class refClass = m_broker.getProxyFactory().getRealClass(objOrProxy); + ClassDescriptor refCld = m_broker.getClassDescriptor(refClass); + FieldDescriptor pkFd[] = refCld.getPkFields(); + FieldDescriptor targetFd[] = rds.getForeignKeyFieldDescriptors(refCld); + + // use the values of the key-fields + if (targetFd.length == 0 || Arrays.equals(pkFd, targetFd)) + { + return getKeyValues(refCld, objOrProxy, convertToSql); + } + + // use the values of the target-fields + Object obj = m_broker.getProxyFactory().getRealObject(objOrProxy); + return getValuesForObject(targetFd, obj, convertToSql); + } + + /** * Return primary key values of given Identity object. * * @param cld @@ -239,42 +287,11 @@ } /** - * Decide if the given object value represents 'null'.<br/> - * - * - If given value is 'null' itself, true will be returned<br/> - * - * - If given value is instance of Number with value 0 and the field-descriptor - * represents a primitive field, true will be returned<br/> - * - * - If given value is instance of String with length 0 and the field-descriptor - * is a primary key, true will be returned<br/> + * Decide if the given object value represents 'null'. */ public boolean representsNull(FieldDescriptor fld, Object aValue) { - if(aValue == null) return true; - - boolean result = false; - if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0))) - { - Class type = fld.getPersistentField().getType(); - /* - AnonymousPersistentFields will *always* have a null type according to the - javadoc comments in AnonymousPersistentField.getType() and never represents - a primitve java field with value 0, thus we return always 'false' in this case. - (If the value object is null, the first check above return true) - */ - if(type != null) - { - result = type.isPrimitive(); - } - } - // TODO: Do we need this check?? String could be nullified, why should we assume - // it's 'null' on empty string? - else if((aValue instanceof String) && (((String) aValue).length() == 0)) - { - result = fld.isPrimaryKey(); - } - return result; + return fld.getNullCheck().representsNull(fld, aValue); } /** @@ -335,58 +352,6 @@ throw new PersistenceBrokerException("Could not get key value", e); } } - - /** - * Get the values of the fk-target-fields for an obj. - * @param rds - * @param objOrProxy - * @throws PersistenceBrokerException - */ - public ValueContainer[] getFkTargetValuesForObject(ObjectReferenceDescriptor rds, Object objOrProxy, boolean convertToSql) throws PersistenceBrokerException - { - Class refClass = m_broker.getProxyFactory().getRealClass(objOrProxy); - ClassDescriptor refCld = m_broker.getClassDescriptor(refClass); - FieldDescriptor pkFd[] = refCld.getPkFields(); - FieldDescriptor targetFd[] = rds.getForeignKeyTargetFieldDescriptors(refCld); - - // use the values of the key-fields - if (targetFd.length == 0 || Arrays.equals(pkFd,targetFd)) - { - return getKeyValues(refCld, objOrProxy, convertToSql); - } - // use the values of the target-fields - else - { - Object obj = m_broker.getProxyFactory().getRealObject(objOrProxy); - return getValuesForObject(targetFd, obj, convertToSql); - } - } - - /** - * Get the values of the fk-fields for an obj. - * @param rds - * @param objOrProxy - * @throws PersistenceBrokerException - */ - public ValueContainer[] getFkValuesForObject(ObjectReferenceDescriptor rds, Object objOrProxy, boolean convertToSql) throws PersistenceBrokerException - { - Class refClass = m_broker.getProxyFactory().getRealClass(objOrProxy); - ClassDescriptor refCld = m_broker.getClassDescriptor(refClass); - FieldDescriptor pkFd[] = refCld.getPkFields(); - FieldDescriptor targetFd[] = rds.getForeignKeyFieldDescriptors(refCld); - - // use the values of the key-fields - if (targetFd.length == 0 || Arrays.equals(pkFd,targetFd)) - { - return getKeyValues(refCld, objOrProxy, convertToSql); - } - // use the values of the target-fields - else - { - Object obj = m_broker.getProxyFactory().getRealObject(objOrProxy); - return getValuesForObject(targetFd, obj, convertToSql); - } - } /** * Get the values of the fields for an obj. @@ -395,7 +360,7 @@ * @param obj * @throws PersistenceBrokerException */ - public ValueContainer[] getValuesForObject(FieldDescriptor[] fields, Object obj, boolean convertToSql) throws PersistenceBrokerException + public ValueContainer[] getValuesForObject(FieldDescriptor[] fields, Object obj, boolean convertToSql, boolean assignAutoincrement) throws PersistenceBrokerException { ValueContainer[] result = new ValueContainer[fields.length]; @@ -412,7 +377,7 @@ - field represents a 'null' value, is nullified and generate a new value */ - if(fd.isAutoIncrement() && representsNull(fd, cv)) + if(assignAutoincrement && fd.isAutoIncrement() && representsNull(fd, cv)) { /* setAutoIncrementValue returns a value that is @@ -434,6 +399,11 @@ return result; } + public ValueContainer[] getValuesForObject(FieldDescriptor[] fields, Object obj, boolean convertToSql) throws PersistenceBrokerException + { + return getValuesForObject(fields, obj, convertToSql, false); + } + /** * Returns an array containing values for all non PK field READ/WRITE attributes of the object * based on the specified [EMAIL PROTECTED] org.apache.ojb.broker.metadata.ClassDescriptor}. @@ -468,15 +438,13 @@ /** * Extract an value array of the given [EMAIL PROTECTED] ValueContainer} array. - * - * @param containers The array of [EMAIL PROTECTED] org.apache.ojb.broker.core.ValueContainer}. - * @return The extracted object array. + * @param containers + * @return An object array */ public Object[] extractValueArray(ValueContainer[] containers) { - int length = containers.length; - Object[] result = new Object[length]; - for(int i = 0; i < length; i++) + Object[] result = new Object[containers.length]; + for(int i = 0; i < containers.length; i++) { result[i] = containers[i].getValue(); } @@ -562,7 +530,10 @@ } /** - * Create a Count-Query for QueryBySQL. + * Create a Count-Query for QueryBySQL + * + * @param aQuery + * @return The count query */ private Query getQueryBySqlCount(QueryBySQL aQuery) { @@ -614,6 +585,7 @@ // SELECT count(distinct (row1 + row2 + row3)) ms sql-server // FieldDescriptor[] pkFields = m_broker.getClassDescriptor(searchClass).getPkFields(); + String[] keyColumns = new String[pkFields.length]; if(pkFields.length > 1) @@ -789,14 +761,63 @@ } /** - * Unlink the specified reference from this object. + * This method concatenate the main object and the specified reference + * object (1:1 reference a referenced object, 1:n and m:n reference a + * collection of referenced objects) by hand. This method is needed when + * in the reference metadata definitions the auto-xxx setting was disabled. * More info see OJB doc. + * * @param obj Object with reference * @param attributeName field name of the reference + * @param reference The referenced object + * @param insert flag signals insert operation + * @return true if the specified reference was found and linking was successful */ - public boolean unlink(Object obj, String attributeName) + public boolean link(Object obj, String attributeName, Object reference, boolean insert) { - return linkOrUnlink(false, obj, attributeName, false); + ClassDescriptor cld = m_broker.getDescriptorRepository().getDescriptorFor(m_broker.getProxyFactory().getRealClass(obj)); + ObjectReferenceDescriptor ord; + boolean match = false; + // first look for reference then for collection + ord = cld.getObjectReferenceDescriptorByName(attributeName); + if (ord != null) + { + linkOrUnlinkOneToOne(true, obj, ord, insert); + match = true; + } + else + { + CollectionDescriptor cod = cld.getCollectionDescriptorByName(attributeName); + if (cod != null) + { + linkOrUnlinkXToMany(true, obj, cod, insert); + match = true; + } + } + return match; + } + + /** + * Unlink the specified reference object. + * More info see OJB doc. + * @param source The source object with the specified reference field. + * @param attributeName The field name of the reference to unlink. + * @param target The referenced object to unlink. + */ + public boolean unlink(Object source, String attributeName, Object target) + { + return linkOrUnlink(false, source, attributeName, false); + } + + /** + * Unlink all referenced objects of the specified field. + * More info see OJB doc. + * @param source The source object with the specified reference. + * @param attributeName The field name of the reference to unlink. + */ + public boolean unlink(Object source, String attributeName) + { + return linkOrUnlink(false, source, attributeName, false); } /** @@ -877,7 +898,11 @@ object. If the reference was declared within an interface (should never happen) we only can use the descriptor of the real class. */ - ClassDescriptor cld = m_broker.getDescriptorRepository().getDescriptorFor(m_broker.getProxyFactory().getRealClass(obj)); + ClassDescriptor cld = ord.getClassDescriptor(); + if(!cld.isMappedToTable()) + { + cld = m_broker.getDescriptorRepository().getDescriptorFor(m_broker.getProxyFactory().getRealClass(obj)); + } if (doLink) { Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/ClassHelper.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/ClassHelper.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/ClassHelper.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/ClassHelper.java Sat Jul 15 07:22:34 2006 @@ -16,12 +16,12 @@ */ import java.io.InputStream; -import java.io.Reader; import java.io.InputStreamReader; +import java.io.Reader; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.Field; -import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; import java.net.URL; @@ -30,7 +30,6 @@ import org.apache.ojb.broker.metadata.ClassDescriptor; import org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException; import org.apache.ojb.broker.metadata.CreationDescriptor; -import org.apache.commons.lang.ClassUtils; /** * Helper class with static methods for java class, method, and field handling. @@ -47,7 +46,7 @@ /** The class loader currently used by OJB */ private static ClassLoader _classLoader = null; /** A mutex for changing the class loader */ - private static Object _mutex = new Object(); + private static final Object _mutex = new Object(); /** * Prevents instatiation. @@ -259,7 +258,7 @@ if (makeAccessible) { con = target.getDeclaredConstructor(types); - if (makeAccessible && !con.isAccessible()) + if (!con.isAccessible()) { con.setAccessible(true); } @@ -438,7 +437,7 @@ */ public static Object buildNewObjectInstance(ClassDescriptor cld, Object[] args, Object enclosingObj) { - Object result = null; + Object result; // If either the factory class and/or factory method is null, // just follow the normal code path and create via constructor Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/ExceptionHelper.java Sat Jul 15 07:22:34 2006 @@ -40,17 +40,77 @@ * Method which support the conversion of [EMAIL PROTECTED] java.sql.SQLException} to * OJB's runtime exception (with additional message details). * + * @param message The error message to use, if <em>null</em> a standard message is used. + * @param ex The exception to convert (mandatory). + * @param sql The used sql-statement or <em>null</em>. + * @param logger The [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} to log an detailed message + * to the specified [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} or <em>null</em> to skip logging message. + * @return A new created [EMAIL PROTECTED] org.apache.ojb.broker.PersistenceBrokerSQLException} based on the specified + * arguments. + */ + public static PersistenceBrokerSQLException generateException(String message, SQLException ex, + String sql, Logger logger) + { + return generateException(message, ex, sql, null, null, logger, null); + } + + /** + * Method which support the conversion of [EMAIL PROTECTED] java.sql.SQLException} to + * OJB's runtime exception (with additional message details). + * + * @param ex The exception to convert (mandatory). + * @param sql The used sql-statement or <em>null</em>. + * @param cld The [EMAIL PROTECTED] org.apache.ojb.broker.metadata.ClassDescriptor} of the target object or <em>null</em>. + * @param logger The [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} to log an detailed message + * to the specified [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} or <em>null</em> to skip logging message. + * @param obj The target object or <em>null</em>. + * @return A new created [EMAIL PROTECTED] org.apache.ojb.broker.PersistenceBrokerSQLException} based on the specified + * arguments. + */ + public static PersistenceBrokerSQLException generateException(SQLException ex, String sql, + ClassDescriptor cld, Object obj, Logger logger) + { + return generateException(ex, sql, cld, null, obj, logger); + } + + /** + * Method which support the conversion of [EMAIL PROTECTED] java.sql.SQLException} to + * OJB's runtime exception (with additional message details). + * * @param ex The exception to convert (mandatory). * @param sql The used sql-statement or <em>null</em>. * @param cld The [EMAIL PROTECTED] org.apache.ojb.broker.metadata.ClassDescriptor} of the target object or <em>null</em>. * @param values The values set in prepared statement or <em>null</em>. + * @param logger The [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} to log an detailed message + * to the specified [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} or <em>null</em> to skip logging message. * @param obj The target object or <em>null</em>. + * @return A new created [EMAIL PROTECTED] org.apache.ojb.broker.PersistenceBrokerSQLException} based on the specified + * arguments. + */ + public static PersistenceBrokerSQLException generateException(SQLException ex, String sql, ClassDescriptor cld, + ValueContainer[] values, Object obj, Logger logger) + { + return generateException(null, ex, sql, cld, values, obj, logger); + } + + /** + * Method which support the conversion of [EMAIL PROTECTED] java.sql.SQLException} to + * OJB's runtime exception (with additional message details). + * + * @param message The error message to use, if <em>null</em> a standard message is used. + * @param ex The exception to convert (mandatory). + * @param sql The used sql-statement or <em>null</em>. + * @param cld The [EMAIL PROTECTED] org.apache.ojb.broker.metadata.ClassDescriptor} of the target object or <em>null</em>. + * @param values The values set in prepared statement or <em>null</em>. * @param logger The [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} to log an detailed message * to the specified [EMAIL PROTECTED] org.apache.ojb.broker.util.logging.Logger} or <em>null</em> to skip logging message. + * @param obj The target object or <em>null</em>. * @return A new created [EMAIL PROTECTED] org.apache.ojb.broker.PersistenceBrokerSQLException} based on the specified * arguments. */ - public static PersistenceBrokerSQLException generateException(SQLException ex, String sql, ClassDescriptor cld, ValueContainer[] values, Object obj, Logger logger) + public static PersistenceBrokerSQLException generateException(String message, SQLException ex, + String sql, ClassDescriptor cld, + ValueContainer[] values, Object obj, Logger logger) { /* X/OPEN codes within class 23: @@ -68,35 +128,60 @@ if(ex instanceof BatchUpdateException) { BatchUpdateException tmp = (BatchUpdateException) ex; - msg.append("* BatchUpdateException during execution of sql-statement:"); + if(message != null) + { + msg.append("* ").append(message); + } + else + { + msg.append("* BatchUpdateException during execution of sql-statement:"); + } msg.append(eol).append("Batch update count is '").append(tmp.getUpdateCounts()).append("'"); } else if(ex instanceof SQLWarning) { - msg.append("* SQLWarning during execution of sql-statement:"); + if(message != null) + { + msg.append("* ").append(message); + } + else + { + msg.append("* SQLWarning during execution of sql-statement:"); + } } else { - msg.append("* SQLException during execution of sql-statement:"); + if(message != null) + { + msg.append("* ").append(message); + } + else + { + msg.append("* SQLException during execution of sql-statement:"); + } } if(sql != null) { msg.append(eol).append("sql statement was '").append(sql).append("'"); } - msg.append(eol).append("Exception message is [").append(ex.getMessage()).append("]"); - msg.append(eol).append("Vendor error code [").append(ex.getErrorCode()).append("]"); - msg.append(eol).append("SQL state code ["); - - String stateCode = ex.getSQLState(); - if("23000".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=INTEGRITY CONSTRAINT VIOLATION"); - else if("23001".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=RESTRICT VIOLATION"); - else if("23502".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=NOT NULL VIOLATION"); - else if("23503".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=FOREIGN KEY VIOLATION"); - else if("23505".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=UNIQUE VIOLATION"); - else if("23514".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=CHECK VIOLATION"); - else msg.append(stateCode); - msg.append("]"); + String stateCode = null; + if(ex != null) + { + msg.append(eol).append("Exception message is [").append(ex.getMessage()).append("]"); + msg.append(eol).append("Vendor error code [").append(ex.getErrorCode()).append("]"); + msg.append(eol).append("SQL state code ["); + + stateCode = ex.getSQLState(); + if("23000".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=INTEGRITY CONSTRAINT VIOLATION"); + else if("23001".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=RESTRICT VIOLATION"); + else if("23502".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=NOT NULL VIOLATION"); + else if("23503".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=FOREIGN KEY VIOLATION"); + else if("23505".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=UNIQUE VIOLATION"); + else if("23514".equalsIgnoreCase(stateCode)) msg.append(stateCode).append("=CHECK VIOLATION"); + else msg.append(stateCode); + msg.append("]"); + } if(cld != null) { @@ -152,12 +237,15 @@ // message string for PB exception String shortMsg = msg.toString(); - // add causing stack trace - Throwable rootCause = ExceptionUtils.getRootCause(ex); - if(rootCause == null) rootCause = ex; - msg.append(eol).append("The root stack trace is --> "); - String rootStack = ExceptionUtils.getStackTrace(rootCause); - msg.append(eol).append(rootStack); + if(ex != null) + { + // add causing stack trace + Throwable rootCause = ExceptionUtils.getRootCause(ex); + if(rootCause == null) rootCause = ex; + msg.append(eol).append("The root stack trace is --> "); + String rootStack = ExceptionUtils.getStackTrace(rootCause); + msg.append(eol).append(rootStack); + } msg.append(SystemUtils.LINE_SEPARATOR).append("**"); // log error message Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java Sat Jul 15 07:22:34 2006 @@ -26,12 +26,14 @@ * 1. The IP-Address of the local machine. * 2. A java.rmi.server.UID * - * @author Thomas Mahler + * @deprecated will be replaced by [EMAIL PROTECTED] GUIDFactory}. * @version $Id$ */ public class GUID implements Serializable { - static final long serialVersionUID = -6163239155380515945L; /** + static final long serialVersionUID = -6163239155380515945L; + + /** * holds the hostname of the local machine. */ private static String localIPAddress; Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/IdentityArrayList.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/IdentityArrayList.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/IdentityArrayList.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/IdentityArrayList.java Sat Jul 15 07:22:34 2006 @@ -1,8 +1,6 @@ package org.apache.ojb.broker.util; -import java.util.ArrayList; - -/* Copyright 2004-2004 The Apache Software Foundation +/* Copyright 2004-2006 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +14,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Collection; + +/** + * Object identity based [EMAIL PROTECTED] java.util.List}, use <tt>"=="</tt> instead of + * <tt>element_1.equals(element_2)</tt> to compare objects. + * + * @version $Id$ + */ public class IdentityArrayList extends ArrayList { + + public IdentityArrayList() + { + } + + public IdentityArrayList(int initialCapacity) + { + super(initialCapacity); + } + + public IdentityArrayList(Collection c) + { + super(c); + } + public boolean contains(Object elem) { return indexOf(elem) >= 0; @@ -37,5 +61,19 @@ if(elem == get(i)) return i; return -1; + } + + public boolean remove(Object o) + { + Iterator e = iterator(); + while(e.hasNext()) + { + if(o == e.next()) + { + e.remove(); + return true; + } + } + return false; } } Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java?rev=422233&r1=422232&r2=422233&view=diff ============================================================================== --- db/ojb/trunk/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java (original) +++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/dbhandling/DatabaseHandlingTask.java Sat Jul 15 07:22:34 2006 @@ -776,7 +776,7 @@ _ojb = new OJB(); MetadataManager metadataManager = _ojb.getMetadataManager(); - RepositoryPersistor persistor = metadataManager.getRepositoryPersistor(); + RepositoryPersistor persistor = metadataManager.createRepositoryPersistor(); if (_repositoryFile != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
