You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2002/07/11 09:18:13 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/schedule JobEntry.java JobEntryPeer.java TurbineNonPersistentSchedulerService.java TurbineSchedulerService.java
mpoeschl 2002/07/11 00:18:13
Modified: src/java/org/apache/turbine/services/intake/model
ComboKeyField.java NumberKeyField.java
StringKeyField.java
src/java/org/apache/turbine/services/intake/validator
NumberKeyValidator.java NumberValidator.java
src/java/org/apache/turbine/services/schedule JobEntry.java
JobEntryPeer.java
TurbineNonPersistentSchedulerService.java
TurbineSchedulerService.java
Log:
use org.apache.torque
Revision Changes Path
1.3 +3 -3 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/ComboKeyField.java
Index: ComboKeyField.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/ComboKeyField.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComboKeyField.java 9 Oct 2001 14:44:38 -0000 1.2
+++ ComboKeyField.java 11 Jul 2002 07:18:12 -0000 1.3
@@ -56,8 +56,8 @@
import java.util.Vector;
import org.apache.turbine.util.ParameterParser;
-import org.apache.turbine.om.ComboKey;
-import org.apache.turbine.om.ObjectKey;
+import org.apache.torque.om.ComboKey;
+import org.apache.torque.om.ObjectKey;
import org.apache.turbine.services.intake.xmlmodel.Rule;
import org.apache.turbine.services.intake.xmlmodel.XmlField;
import org.apache.turbine.util.Log;
@@ -76,7 +76,7 @@
/**
* Sets the default value for an ComboKeyField
*/
-
+
protected void setDefaultValue(String prop)
{
defaultValue = prop;
1.3 +5 -5 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/NumberKeyField.java
Index: NumberKeyField.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/NumberKeyField.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NumberKeyField.java 9 Oct 2001 14:44:38 -0000 1.2
+++ NumberKeyField.java 11 Jul 2002 07:18:12 -0000 1.3
@@ -55,8 +55,8 @@
*/
import java.util.Vector;
-import org.apache.turbine.om.NumberKey;
-import org.apache.turbine.om.ObjectKey;
+import org.apache.torque.om.NumberKey;
+import org.apache.torque.om.ObjectKey;
import org.apache.turbine.services.intake.xmlmodel.Rule;
import org.apache.turbine.services.intake.xmlmodel.XmlField;
import org.apache.turbine.util.ParameterParser;
@@ -79,13 +79,13 @@
try
{
defaultValue = new NumberKey(prop);
- }
- catch(RuntimeException e)
+ }
+ catch(RuntimeException e)
{
Log.error("Could not convert "+prop+" into a NumberKey. ("+name+")");
}
}
-
+
/**
* A suitable validator.
1.4 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/StringKeyField.java
Index: StringKeyField.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/model/StringKeyField.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StringKeyField.java 27 Oct 2001 16:47:50 -0000 1.3
+++ StringKeyField.java 11 Jul 2002 07:18:12 -0000 1.4
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.om.StringKey;
+import org.apache.torque.om.StringKey;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.services.intake.xmlmodel.XmlField;
@@ -71,7 +71,7 @@
/**
* Sets the default value for an StringKeyField
*/
-
+
protected void setDefaultValue(String prop)
{
defaultValue = new StringKey(prop);
1.2 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/NumberKeyValidator.java
Index: NumberKeyValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/NumberKeyValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NumberKeyValidator.java 16 Aug 2001 05:08:59 -0000 1.1
+++ NumberKeyValidator.java 11 Jul 2002 07:18:12 -0000 1.2
@@ -56,7 +56,7 @@
import java.math.BigDecimal;
import java.util.Map;
-import org.apache.turbine.om.NumberKey;
+import org.apache.torque.om.NumberKey;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.TurbineException;
1.2 +2 -2 jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/NumberValidator.java
Index: NumberValidator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/intake/validator/NumberValidator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NumberValidator.java 16 Aug 2001 05:08:59 -0000 1.1
+++ NumberValidator.java 11 Jul 2002 07:18:12 -0000 1.2
@@ -56,7 +56,7 @@
import java.math.BigDecimal;
import java.util.Map;
-import org.apache.turbine.om.NumberKey;
+import org.apache.torque.om.NumberKey;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.TurbineException;
1.7 +3 -3 jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntry.java
Index: JobEntry.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntry.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JobEntry.java 11 Mar 2002 17:22:51 -0000 1.6
+++ JobEntry.java 11 Jul 2002 07:18:13 -0000 1.7
@@ -58,8 +58,8 @@
import java.util.Date;
import java.util.Hashtable;
import org.apache.turbine.om.BaseObject;
-import org.apache.turbine.om.NumberKey;
-import org.apache.turbine.util.db.Criteria;
+import org.apache.torque.om.NumberKey;
+import org.apache.torque.util.Criteria;
/**
* This is a wrapper for a scheduled job. It is modeled after the
1.2 +62 -53 jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntryPeer.java
Index: JobEntryPeer.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/JobEntryPeer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JobEntryPeer.java 16 Aug 2001 05:09:14 -0000 1.1
+++ JobEntryPeer.java 11 Jul 2002 07:18:13 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -57,16 +57,18 @@
import com.workingdogs.village.Record;
import com.workingdogs.village.Value;
import java.util.Hashtable;
-import java.util.Vector;
+import java.util.*;
import org.apache.turbine.om.BaseObject;
-import org.apache.turbine.om.ObjectKey;
-import org.apache.turbine.om.peer.BasePeer;
+import org.apache.torque.om.ObjectKey;
+import org.apache.torque.util.BasePeer;
import org.apache.turbine.util.ObjectUtils;
-import org.apache.turbine.util.db.Criteria;
-import org.apache.turbine.util.db.map.DatabaseMap;
-import org.apache.turbine.util.db.map.MapBuilder;
+import org.apache.torque.util.Criteria;
+import org.apache.torque.map.DatabaseMap;
+import org.apache.torque.map.MapBuilder;
import org.apache.turbine.util.db.map.TurbineMapBuilder;
-import org.apache.turbine.util.db.pool.DBConnection;
+import java.sql.Connection;
+import org.apache.torque.TorqueException;
+import com.workingdogs.village.DataSetException;
/**
* Peer class for JobEntry database access.
@@ -78,7 +80,7 @@
{
/** Get the MapBuilder. */
private static final TurbineMapBuilder mapBuilder =
- (TurbineMapBuilder) getMapBuilder();
+ (TurbineMapBuilder) getMapBuilder("org.apache.turbine.util.db.map.TurbineMapBuilder");
/** Name of the table. */
private static final String TABLE_NAME = mapBuilder.getTableJobentry();
@@ -101,7 +103,7 @@
* @exception Exception, a generic exception.
*/
public static void doUpdate(Criteria criteria)
- throws Exception
+ throws TorqueException
{
Criteria selectCriteria = new Criteria(2);
selectCriteria.put( OID, criteria.remove(OID) );
@@ -116,68 +118,75 @@
* @return Vector of JobEntries.
* @exception Exception, a generic exception.
*/
- public static Vector doSelect(Criteria criteria)
- throws Exception
+ public static List doSelect(Criteria criteria)
+ throws TorqueException
{
addSelectColumns(criteria);
- Vector rows = BasePeer.doSelect(criteria);
- Vector results = new Vector();
+ List rows = BasePeer.doSelect(criteria);
+ List results = new ArrayList();
- // Populate the object(s).
- for ( int i=0; i<rows.size(); i++ )
+ try
{
- Record rec = (Record)rows.elementAt(i);
- int oid = rec.getValue(1).asInt();
- int sec = rec.getValue(2).asInt();
- int min = rec.getValue(3).asInt();
- int hr = rec.getValue(4).asInt();
- int wd = rec.getValue(5).asInt();
- int d_m = rec.getValue(6).asInt();
- String task = rec.getValue(7).asString();
- String email = rec.getValue(8).asString();
- byte[] objectData = (byte[])rec.getValue(9).asBytes();
- Hashtable tempHash = (Hashtable)ObjectUtils.deserialize(objectData);
-
- JobEntry je = new JobEntry(sec, min, hr, wd, d_m, task);
- je.setPrimaryKey(oid);
- je.setEmail(email);
- je.setProperty(tempHash);
- je.setModified(false);
+ // Populate the object(s).
+ for ( int i=0; i<rows.size(); i++ )
+ {
+ Record rec = (Record)rows.get(i);
+ int oid = rec.getValue(1).asInt();
+ int sec = rec.getValue(2).asInt();
+ int min = rec.getValue(3).asInt();
+ int hr = rec.getValue(4).asInt();
+ int wd = rec.getValue(5).asInt();
+ int d_m = rec.getValue(6).asInt();
+ String task = rec.getValue(7).asString();
+ String email = rec.getValue(8).asString();
+ byte[] objectData = (byte[]) rec.getValue(9).asBytes();
+ Hashtable tempHash = (Hashtable) ObjectUtils.deserialize(objectData);
+
+ JobEntry je = new JobEntry(sec, min, hr, wd, d_m, task);
+ je.setPrimaryKey(oid);
+ je.setEmail(email);
+ je.setProperty(tempHash);
+ je.setModified(false);
- results.addElement( je );
+ results.add(je);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new TorqueException(ex);
}
return results;
}
- /**
+ /**
* Perform a SQL <code>insert</code>, handling connection details
* internally.
*/
public static ObjectKey doInsert(Criteria criteria)
- throws Exception
+ throws TorqueException
{
criteria.setDbName(mapBuilder.getDatabaseMap().getName());
return BasePeer.doInsert(criteria);
}
-
- /**
- * Method to do inserts. This method is to be used during a transaction,
- * otherwise use the doInsert(Criteria) method. It will take care of
- * the connection details internally.
- */
- public static ObjectKey doInsert(Criteria criteria, DBConnection dbCon)
- throws Exception
+
+ /**
+ * Method to do inserts. This method is to be used during a transaction,
+ * otherwise use the doInsert(Criteria) method. It will take care of
+ * the connection details internally.
+ */
+ public static ObjectKey doInsert(Criteria criteria, Connection dbCon)
+ throws TorqueException
{
criteria.setDbName(mapBuilder.getDatabaseMap().getName());
return BasePeer.doInsert(criteria, dbCon);
}
-
+
/**
* Add all the columns needed to create a new object.
*/
protected static void addSelectColumns(Criteria criteria)
- throws Exception
+ throws TorqueException
{
criteria.addSelectColumn(OID)
.addSelectColumn(SECOND)
@@ -205,11 +214,11 @@
Criteria c = new Criteria(9);
c.add(OID,new Integer(oid));
- Vector results = JobEntryPeer.doSelect(c);
+ List results = JobEntryPeer.doSelect(c);
- if ( results != null )
+ if (results != null)
{
- je = (JobEntry)results.elementAt(0);
+ je = (JobEntry) results.get(0);
}
return je;
}
1.2 +6 -6 jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineNonPersistentSchedulerService.java
Index: TurbineNonPersistentSchedulerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineNonPersistentSchedulerService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineNonPersistentSchedulerService.java 16 Aug 2001 05:09:15 -0000 1.1
+++ TurbineNonPersistentSchedulerService.java 11 Jul 2002 07:18:13 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -57,8 +57,8 @@
import java.util.List;
import java.util.Vector;
import javax.servlet.ServletConfig;
-import org.apache.turbine.om.NumberKey;
-import org.apache.turbine.om.ObjectKey;
+import org.apache.torque.om.NumberKey;
+import org.apache.torque.om.ObjectKey;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.util.Log;
1.2 +7 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineSchedulerService.java
Index: TurbineSchedulerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/schedule/TurbineSchedulerService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineSchedulerService.java 16 Aug 2001 05:09:15 -0000 1.1
+++ TurbineSchedulerService.java 11 Jul 2002 07:18:13 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -61,7 +61,7 @@
import org.apache.turbine.services.TurbineBaseService;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.util.Log;
-import org.apache.turbine.util.db.Criteria;
+import org.apache.torque.util.Criteria;
/**
* Service for a cron like scheduler.
@@ -118,7 +118,7 @@
mainLoop = new MainLoop();
// Load all from cold storage.
- Vector jobs = JobEntryPeer.doSelect(new Criteria());
+ List jobs = JobEntryPeer.doSelect(new Criteria());
if ( jobs != null && jobs.size() > 0 )
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>