mpoeschl 2002/07/16 07:57:28
Modified: src/java/org/apache/torque/engine/database/model
AppData.java JavaNameGenerator.java Table.java
src/java/org/apache/torque/manager MethodCacheKey.java
src/java/org/apache/torque/oid SequenceIdGenerator.java
src/java/org/apache/torque/om ComboKey.java
src/java/org/apache/torque/task TorqueSQLExec.java
Log:
match commons-lang HEAD
i hope they will keep the classnames now!!
Revision Changes Path
1.12 +3 -3
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/AppData.java
Index: AppData.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/AppData.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AppData.java 8 May 2002 19:45:45 -0000 1.11
+++ AppData.java 16 Jul 2002 14:57:27 -0000 1.12
@@ -65,7 +65,7 @@
import org.xml.sax.Attributes;
-import org.apache.commons.lang.Strings;
+import org.apache.commons.lang.StringUtils;
import org.apache.torque.Torque;
import org.apache.torque.engine.EngineException;
@@ -205,7 +205,7 @@
*/
public String getShortName()
{
- return Strings.replace(name, "-schema", "");
+ return StringUtils.replace(name, "-schema", "");
}
/**
1.8 +4 -4
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/JavaNameGenerator.java
Index: JavaNameGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/JavaNameGenerator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JavaNameGenerator.java 8 Jul 2002 21:33:27 -0000 1.7
+++ JavaNameGenerator.java 16 Jul 2002 14:57:27 -0000 1.8
@@ -57,7 +57,7 @@
import java.util.List;
import java.util.StringTokenizer;
-import org.apache.commons.lang.Strings;
+import org.apache.commons.lang.StringUtils;
/**
* A <code>NameGenerator</code> implementation for Java-esque names.
@@ -132,7 +132,7 @@
while (tok.hasMoreTokens())
{
String namePart = ((String) tok.nextElement()).toLowerCase();
- name.append(Strings.capitalise(namePart));
+ name.append(StringUtils.capitalise(namePart));
}
return name.toString();
}
@@ -155,7 +155,7 @@
while (tok.hasMoreTokens())
{
String namePart = (String) tok.nextElement();
- name.append(Strings.capitalise(namePart));
+ name.append(StringUtils.capitalise(namePart));
}
return name.toString();
}
1.32 +14 -14
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java
Index: Table.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Table.java 20 Jun 2002 23:55:14 -0000 1.31
+++ Table.java 16 Jul 2002 14:57:27 -0000 1.32
@@ -59,7 +59,7 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.lang.Strings;
+import org.apache.commons.lang.StringUtils;
import org.apache.torque.engine.EngineException;
import org.apache.torque.adapter.IDMethod;
@@ -102,7 +102,7 @@
private boolean abstractValue;
private String alias;
private String enterface;
- private String pkg;
+ private String pkg;
private String baseClass;
private String basePeer;
private Hashtable columnsByName;
@@ -263,7 +263,7 @@
{
ForeignKey fk = (ForeignKey) foreignKeys.get(i);
name = fk.getName();
- if (Strings.isEmpty(name))
+ if (StringUtils.isEmpty(name))
{
name = acquireConstraintName("FK", i + 1);
fk.setName(name);
@@ -274,7 +274,7 @@
{
Index index = (Index) indices.get(i);
name = index.getName();
- if (Strings.isEmpty(name))
+ if (StringUtils.isEmpty(name))
{
name = acquireConstraintName("I", i + 1);
index.setName(name);
@@ -782,20 +782,20 @@
* Get the value of package.
* @return value of package.
*/
- public String getPackage()
+ public String getPackage()
{
return pkg;
}
-
+
/**
* Set the value of package.
* @param v Value to assign to package.
*/
- public void setPackage(String v)
+ public void setPackage(String v)
{
this.pkg = v;
}
-
+
/**
* Returns an Array containing all the columns in the table
*/
@@ -963,27 +963,27 @@
return tableParent;
}
-
+
/**
* Flag to determine if code/sql gets created for this table.
* Table will be skipped, if return true.
* @return value of forReferenceOnly.
*/
- public boolean isForReferenceOnly()
+ public boolean isForReferenceOnly()
{
return forReferenceOnly;
}
-
+
/**
* Flag to determine if code/sql gets created for this table.
* Table will be skipped, if set to true.
* @param v Value to assign to forReferenceOnly.
*/
- public void setForReferenceOnly(boolean v)
+ public void setForReferenceOnly(boolean v)
{
this.forReferenceOnly = v;
}
-
+
/**
* Returns a XML representation of this table.
*
1.7 +55 -56
jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java
Index: MethodCacheKey.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/MethodCacheKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MethodCacheKey.java 19 May 2002 20:53:55 -0000 1.6
+++ MethodCacheKey.java 16 Jul 2002 14:57:28 -0000 1.7
@@ -56,14 +56,13 @@
*/
import java.io.Serializable;
-import org.apache.commons.lang.Objects;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.pool.BasePoolableObjectFactory;
import org.apache.torque.TorqueException;
-public class MethodCacheKey
- implements Serializable
+public class MethodCacheKey implements Serializable
{
- //private static final Category log =
+ //private static final Category log =
// Category.getInstance("org.apache.torque");
int n;
@@ -78,13 +77,13 @@
public MethodCacheKey()
{
}
-
+
public MethodCacheKey(Serializable instanceOrClass, String method)
{
init(instanceOrClass, method);
}
- public MethodCacheKey(Serializable instanceOrClass, String method,
+ public MethodCacheKey(Serializable instanceOrClass, String method,
Serializable arg1)
{
init(instanceOrClass, method, arg1);
@@ -97,7 +96,7 @@
}
public MethodCacheKey(Serializable instanceOrClass, String method,
- Serializable arg1, Serializable arg2,
+ Serializable arg1, Serializable arg2,
Serializable arg3)
{
init(instanceOrClass, method, arg1, arg2, arg3);
@@ -111,11 +110,11 @@
/**
* Initialize key for method with no arguments.
*
- * @param instanceOrClass the Object on which the method is invoked. if
+ * @param instanceOrClass the Object on which the method is invoked. if
* the method is static, a String representing the class name is used.
* @param method the method name
*/
- public void init(Serializable instanceOrClass, String method)
+ public void init(Serializable instanceOrClass, String method)
{
n = 0;
this.instanceOrClass = instanceOrClass;
@@ -126,12 +125,12 @@
/**
* Initialize key for method with one argument.
*
- * @param instanceOrClass the Object on which the method is invoked. if
+ * @param instanceOrClass the Object on which the method is invoked. if
* the method is static, a String representing the class name is used.
* @param method the method name
* @param arg1 first method arg, may be null
*/
- public void init(Serializable instanceOrClass, String method,
+ public void init(Serializable instanceOrClass, String method,
Serializable arg1)
{
init(instanceOrClass, method);
@@ -142,13 +141,13 @@
/**
* Initialize key for method with two arguments.
*
- * @param instanceOrClass the Object on which the method is invoked. if
+ * @param instanceOrClass the Object on which the method is invoked. if
* the method is static, a String representing the class name is used.
* @param method the method name
* @param arg1 first method arg, may be null
* @param arg2 second method arg, may be null
*/
- public void init(Serializable instanceOrClass, String method,
+ public void init(Serializable instanceOrClass, String method,
Serializable arg1, Serializable arg2)
{
init(instanceOrClass, method);
@@ -161,13 +160,13 @@
/**
* Initialize key for method with two arguments.
*
- * @param instanceOrClass the Object on which the method is invoked. if
+ * @param instanceOrClass the Object on which the method is invoked. if
* the method is static, a String representing the class name is used.
* @param method the method name
* @param arg1 first method arg, may be null
* @param arg2 second method arg, may be null
*/
- public void init(Serializable instanceOrClass, String method,
+ public void init(Serializable instanceOrClass, String method,
Serializable arg1, Serializable arg2,
Serializable arg3)
{
@@ -189,20 +188,20 @@
*/
public void init(Serializable[] keys)
{
- init(keys[0], (String)keys[1]);
- n = keys.length-2;
- if (n>0)
+ init(keys[0], (String) keys[1]);
+ n = keys.length - 2;
+ if (n > 0)
{
this.arg1 = keys[2];
- if (n>1)
+ if (n > 1)
{
this.arg2 = keys[3];
- if (n>2)
+ if (n > 2)
{
this.arg2 = keys[4];
- if (n>3)
+ if (n > 3)
{
- this.moreThanThree = keys;
+ this.moreThanThree = keys;
}
}
}
@@ -217,33 +216,33 @@
public boolean equals(Object obj)
{
boolean equal = false;
- if ( obj instanceof MethodCacheKey )
+ if (obj instanceof MethodCacheKey)
{
- MethodCacheKey sck = (MethodCacheKey)obj;
+ MethodCacheKey sck = (MethodCacheKey) obj;
equal = (sck.n == n);
- equal &= Objects.equals(sck.method, method);
- equal &= Objects.equals(sck.instanceOrClass, instanceOrClass);
- if (equal && n > 0)
+ equal &= ObjectUtils.equals(sck.method, method);
+ equal &= ObjectUtils.equals(sck.instanceOrClass, instanceOrClass);
+ if (equal && n > 0)
{
- equal &= Objects.equals(sck.arg1, arg1);
- if (equal && n > 1)
+ equal &= ObjectUtils.equals(sck.arg1, arg1);
+ if (equal && n > 1)
{
- equal &= Objects.equals(sck.arg2, arg2);
- if (equal && n > 2)
+ equal &= ObjectUtils.equals(sck.arg2, arg2);
+ if (equal && n > 2)
{
- equal &= Objects.equals(sck.arg3, arg3);
- if (equal && n > 3)
+ equal &= ObjectUtils.equals(sck.arg3, arg3);
+ if (equal && n > 3)
{
- for (int i=5; i<n+2; i++)
+ for (int i = 5; i < n + 2; i++)
{
- equal &= Objects.equals(sck.moreThanThree[i],
- moreThanThree[i]);
+ equal &= ObjectUtils.equals(
+ sck.moreThanThree[i], moreThanThree[i]);
}
}
}
}
}
- }
+ }
return equal;
}
@@ -252,24 +251,24 @@
{
int h = instanceOrClass.hashCode();
h += method.hashCode();
- if (n > 0)
+ if (n > 0)
{
h += (arg1 == null ? 0 : arg1.hashCode());
- if (n > 1)
+ if (n > 1)
{
h += (arg2 == null ? 0 : arg2.hashCode());
- if (n > 2)
+ if (n > 2)
{
h += (arg3 == null ? 0 : arg3.hashCode());
- if (n > 3)
+ if (n > 3)
{
- for (int i=5; i<n+2; i++)
+ for (int i = 5; i < n + 2; i++)
{
h+= (moreThanThree[i] == null ?
0 : moreThanThree[i].hashCode());
}
- }
- }
+ }
+ }
}
}
return h;
@@ -281,18 +280,18 @@
sb.append(instanceOrClass);
sb.append("::");
sb.append(method).append('(');
- if (n > 0)
+ if (n > 0)
{
sb.append(arg1);
- if (n > 1)
+ if (n > 1)
{
sb.append(", ").append(arg2);
- if (n > 2)
+ if (n > 2)
{
sb.append(", ").append(arg3);
- if (n > 3)
+ if (n > 3)
{
- for (int i=5; i<n+2; i++)
+ for (int i = 5; i < n + 2; i++)
{
sb.append(", ").append(moreThanThree[i]);
}
@@ -306,32 +305,32 @@
// ************* PoolableObjectFactory implementation *******************
- public static class Factory
+ public static class Factory
extends BasePoolableObjectFactory
{
/**
* Creates an instance that can be returned by the pool.
* @return an instance that can be returned by the pool.
*/
- public Object makeObject()
+ public Object makeObject()
throws Exception
{
return new MethodCacheKey();
}
-
+
/**
* Uninitialize an instance to be returned to the pool.
* @param obj the instance to be passivated
*/
- public void passivateObject(Object obj)
+ public void passivateObject(Object obj)
throws Exception
{
MethodCacheKey key = (MethodCacheKey)obj;
- if (key.instanceOrClass == null && key.method == null)
+ if (key.instanceOrClass == null && key.method == null)
{
throw new TorqueException(
- "Attempted to return key to pool twice.");
- }
+ "Attempted to return key to pool twice.");
+ }
key.instanceOrClass = null;
key.method = null;
key.arg1 = null;
1.5 +2 -1
jakarta-turbine-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java
Index: SequenceIdGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/SequenceIdGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SequenceIdGenerator.java 7 May 2002 17:13:22 -0000 1.4
+++ SequenceIdGenerator.java 16 Jul 2002 14:57:28 -0000 1.5
@@ -182,6 +182,7 @@
throws Exception
{
String idSql = dbAdapter.getIDMethodSQL(keyInfo);
+ System.out.println(idSql);
// Execute the query.
QueryDataSet qds = new QueryDataSet( connection, idSql );
1.7 +35 -35
jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java
Index: ComboKey.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ComboKey.java 30 Apr 2002 09:22:38 -0000 1.6
+++ ComboKey.java 16 Jul 2002 14:57:28 -0000 1.7
@@ -57,7 +57,7 @@
import java.util.ArrayList;
import org.apache.torque.TorqueException;
-import org.apache.commons.lang.Objects;
+import org.apache.commons.lang.ObjectUtils;
/**
* This class can be used as an ObjectKey to uniquely identify an
@@ -133,15 +133,15 @@
*/
public void setValue(SimpleKey[] keys)
{
- if ( this.key == null )
+ if (this.key == null)
{
this.key = keys;
}
else
{
- for ( int i = 0; i < this.key.length; i++ )
+ for (int i = 0; i < this.key.length; i++)
{
- if ( this.key[i] == null )
+ if (this.key[i] == null)
{
this.key[i] = keys[i];
}
@@ -154,7 +154,7 @@
*/
public void setValue(String[] keys) throws TorqueException
{
- if ( this.key == null )
+ if (this.key == null)
{
throw new TorqueException(ERROR_MSG);
/*
@@ -167,16 +167,16 @@
}
else
{
- for ( int i = 0; i < this.key.length; i++ )
+ for (int i = 0; i < this.key.length; i++)
{
- if ( this.key[i] == null && keys[i] != null )
+ if (this.key[i] == null && keys[i] != null)
{
throw new TorqueException(ERROR_MSG);
// this.key[i] = new SimpleKey( keys[i] );
}
else
{
- this.key[i].setValue( keys[i] );
+ this.key[i].setValue(keys[i]);
}
}
}
@@ -190,24 +190,24 @@
{
int previousIndex = -1;
int indexOfSep = keys.indexOf(SEPARATOR);
- while ( indexOfSep != -1 )
+ while (indexOfSep != -1)
{
- if ( indexOfSep == 0)
+ if (indexOfSep == 0)
{
tmpKeys.add(null);
}
- else if ( indexOfSep > 0 && indexOfSep < keys.length() - 1 )
+ else if (indexOfSep > 0 && indexOfSep < keys.length() - 1)
{
- tmpKeys.add( keys.substring(previousIndex + 1, indexOfSep) );
+ tmpKeys.add(keys.substring(previousIndex + 1, indexOfSep));
}
- else if ( indexOfSep == keys.length() - 1 )
+ else if (indexOfSep == keys.length() - 1)
{
tmpKeys.add(null);
}
indexOfSep = keys.indexOf(SEPARATOR);
}
- if ( this.key == null )
+ if (this.key == null)
{
throw new TorqueException(ERROR_MSG);
/*
@@ -220,9 +220,9 @@
}
else
{
- for ( int i = 0; i < this.key.length; i++ )
+ for (int i = 0; i < this.key.length; i++)
{
- if ( this.key[i] == null && tmpKeys.get(i) != null )
+ if (this.key[i] == null && tmpKeys.get(i) != null)
{
throw new TorqueException(ERROR_MSG);
// this.key[i] = new SimpleKey( (String)tmpKeys.get(i) );
@@ -259,12 +259,12 @@
{
boolean isEqual = false;
- if ( key != null )
+ if (key != null)
{
// check that all keys are not null
isEqual = true;
SimpleKey[] keys = (SimpleKey []) key;
- for ( int i = 0; i < keys.length && isEqual; i++ )
+ for (int i = 0; i < keys.length && isEqual; i++)
{
isEqual &= keys[i] != null && keys[i].getValue() != null;
}
@@ -294,7 +294,7 @@
{
boolean isEqual = false;
- if ( key != null )
+ if (key != null)
{
// Checks a compound key (ObjectKey[] or String[]
// based) with the delimited String created by the
@@ -302,11 +302,11 @@
// than parsing the String into its constituents.
if (keyObj instanceof String)
{
- isEqual = toString().equals(keyObj);
+ isEqual = toString().equals(keyObj);
}
// check against a ObjectKey. Two keys are equal, if their
// internal keys equivalent.
- else if ( keyObj instanceof ComboKey)
+ else if (keyObj instanceof ComboKey)
{
SimpleKey[] obj = (SimpleKey[])
((ComboKey) keyObj).getValue();
@@ -314,20 +314,20 @@
SimpleKey[] keys1 = (SimpleKey[]) key;
SimpleKey[] keys2 = (SimpleKey[]) obj;
isEqual = keys1.length == keys2.length;
- for ( int i = 0; i < keys1.length && isEqual; i++)
+ for (int i = 0; i < keys1.length && isEqual; i++)
{
- isEqual &= Objects.equals(keys1[i], keys2[i]);
+ isEqual &= ObjectUtils.equals(keys1[i], keys2[i]);
}
}
- else if ( keyObj instanceof SimpleKey[]
- && key instanceof SimpleKey[] )
+ else if (keyObj instanceof SimpleKey[]
+ && key instanceof SimpleKey[])
{
SimpleKey[] keys1 = (SimpleKey[]) key;
SimpleKey[] keys2 = (SimpleKey[]) keyObj;
isEqual = keys1.length == keys2.length;
- for ( int i = 0; i < keys1.length && isEqual; i++)
+ for (int i = 0; i < keys1.length && isEqual; i++)
{
- isEqual &= Objects.equals(keys1[i], keys2[i]);
+ isEqual &= ObjectUtils.equals(keys1[i], keys2[i]);
}
}
}
@@ -336,16 +336,16 @@
public void appendTo(StringBuffer sb)
{
- if ( key != null )
+ if (key != null)
{
SimpleKey[] keys = (SimpleKey[]) key;
- for ( int i = 0; i < keys.length; i++)
+ for (int i = 0; i < keys.length; i++)
{
- if ( i != 0 )
+ if (i != 0)
{
sb.append(SEPARATOR);
}
- if ( keys[i] != null )
+ if (keys[i] != null)
{
keys[i].appendTo(sb);
}
@@ -362,13 +362,13 @@
*/
public int hashCode()
{
- if ( key == null )
+ if (key == null)
{
return super.hashCode();
}
SimpleKey sk = ((SimpleKey[]) key)[0];
- if ( sk == null )
+ if (sk == null)
{
return super.hashCode();
}
@@ -382,7 +382,7 @@
*/
public String toString()
{
- if ( sbuf.length() > 0 )
+ if (sbuf.length() > 0)
{
sbuf.delete(0, sbuf.length());
}
1.12 +5 -5
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java
Index: TorqueSQLExec.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TorqueSQLExec.java 15 Jul 2002 18:09:04 -0000 1.11
+++ TorqueSQLExec.java 16 Jul 2002 14:57:28 -0000 1.12
@@ -79,7 +79,7 @@
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
-import org.apache.commons.lang.Strings;
+import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -517,9 +517,9 @@
{
String fileName = (String) eachFileName.next();
File file = new File(srcDir, fileName);
-
+
if (file.exists())
- {
+ {
Transaction transaction = new Transaction();
transaction.setSrc(file);
transactions.add(transaction);
@@ -540,7 +540,7 @@
*/
private void insertDatabaseSqlFiles(String url, String database, List
transactions)
{
- url = Strings.replace(url, "@DB@", database);
+ url = StringUtils.replace(url, "@DB@", database);
System.out.println("Our new url -> " + url);
Driver driverInstance = null;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>