jvanzyl 01/07/30 13:39:22
Modified: src/java/org/apache/turbine TurbineException.java
TurbineRuntimeException.java
src/java/org/apache/turbine/services
InstantiationException.java
src/java/org/apache/turbine/services/db DatabaseService.java
TurbineDatabaseService.java
src/java/org/apache/turbine/services/intake/model
ComboKeyField.java
src/java/org/apache/turbine/services/security/util
TurbineSecurityException.java
src/java/org/apache/turbine/services/upload
DefaultFileItem.java
src/java/org/apache/turbine/util/parser BaseValueParser.java
ValueParser.java
Log:
- removing ECS widget references from the base parsers.
Revision Changes Path
1.2 +2 -1
jakarta-turbine/src/java/org/apache/turbine/TurbineException.java
Index: TurbineException.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/TurbineException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineException.java 2001/07/13 19:31:09 1.1
+++ TurbineException.java 2001/07/30 20:39:21 1.2
@@ -123,7 +123,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
*/
-public class TurbineException extends Exception
+public class TurbineException
+ extends Exception
{
/**
* Holds the reference to the exception or error that caused
1.2 +2 -1
jakarta-turbine/src/java/org/apache/turbine/TurbineRuntimeException.java
Index: TurbineRuntimeException.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/TurbineRuntimeException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TurbineRuntimeException.java 2001/07/13 19:31:09 1.1
+++ TurbineRuntimeException.java 2001/07/30 20:39:21 1.2
@@ -74,7 +74,8 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
*/
-public class TurbineRuntimeException extends RuntimeException
+public class TurbineRuntimeException
+ extends RuntimeException
{
/**
* Holds the reference to the exception or error that caused
1.12 +2 -4
jakarta-turbine/src/java/org/apache/turbine/services/InstantiationException.java
Index: InstantiationException.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/InstantiationException.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- InstantiationException.java 2001/07/13 19:19:48 1.11
+++ InstantiationException.java 2001/07/30 20:39:21 1.12
@@ -54,8 +54,6 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.TurbineRuntimeException;
-
/**
* Thrown by <code>InitableBroker</code> and
* <code>ServiceBroker</code> classes to indicate problems with
@@ -63,11 +61,11 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Kevin Burton</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
- * @version $Id: InstantiationException.java,v 1.11 2001/07/13 19:19:48 jvanzyl Exp
$
+ * @version $Id: InstantiationException.java,v 1.12 2001/07/30 20:39:21 jvanzyl Exp
$
* @see org.apache.turbine.services.Initable
*/
public class InstantiationException
- extends TurbineRuntimeException
+ extends ServiceRuntimeException
{
/**
* Construct an InstantiationException with specified detail
1.6 +21 -28
jakarta-turbine/src/java/org/apache/turbine/services/db/DatabaseService.java
Index: DatabaseService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/db/DatabaseService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DatabaseService.java 2001/07/14 19:36:28 1.5
+++ DatabaseService.java 2001/07/30 20:39:21 1.6
@@ -55,7 +55,6 @@
*/
import org.apache.turbine.services.Service;
-import org.apache.turbine.services.ServiceException;
import org.apache.turbine.services.db.map.DatabaseMap;
import org.apache.turbine.services.db.pool.DBConnection;
import org.apache.turbine.services.db.adapter.DB;
@@ -84,27 +83,21 @@
* to the pool.<br>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
- * @version $Id: DatabaseService.java,v 1.5 2001/07/14 19:36:28 jvanzyl Exp $
+ * @version $Id: DatabaseService.java,v 1.6 2001/07/30 20:39:21 jvanzyl Exp $
*/
public interface DatabaseService extends Service
{
public static final String SERVICE_NAME = "DatabaseService";
/**
- * Name of property that specifies the default
- * map builder and map.
- */
- public static final String DATABASE_DEFAULT = "database.default";
-
- /**
* Returns the default database map information.
*
* @return A DatabaseMap.
- * @throws ServiceException Any exceptions caught during procssing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during procssing will be
+ * rethrown wrapped into a Exception.
*/
public DatabaseMap getDatabaseMap()
- throws ServiceException;
+ throws Exception;
/**
* Returns the database map information. Name relates to the name
@@ -113,18 +106,18 @@
* @param name The name of the <code>DatabaseMap</code> to
* retrieve.
* @return The named <code>DatabaseMap</code>.
- * @throws ServiceException Any exceptions caught during procssing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during procssing will be
+ * rethrown wrapped into a Exception.
*/
public DatabaseMap getDatabaseMap(String name)
- throws ServiceException;
+ throws Exception;
/**
* This method returns a DBConnection from the default pool.
*
* @return The requested connection.
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*/
public DBConnection getConnection()
throws Exception;
@@ -145,8 +138,8 @@
*
* @param name The name of the pool to get a connection from.
* @return The requested connection.
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*/
public DBConnection getConnection(String name)
throws Exception;
@@ -161,8 +154,8 @@
* @param username The name of the database user.
* @param password The password of the database user.
* @return A DBConnection.
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*
* @deprecated Database parameters should not be specified each
* time a DBConnection is fetched from the service.
@@ -176,8 +169,8 @@
/**
* Release a connection back to the database pool.
*
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
* @exception Exception A generic exception.
*/
public void releaseConnection(DBConnection dbconn)
@@ -192,8 +185,8 @@
* @param username The name of the database user.
* @param password The password of the database user.
*
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*/
public void registerPool( String name,
String driver,
@@ -207,8 +200,8 @@
* Returns the database adapter for the default connection pool.
*
* @return The database adapter.
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*/
public DB getDB()
throws Exception;
@@ -218,8 +211,8 @@
*
* @param name A pool name.
* @return The corresponding database adapter.
- * @throws ServiceException Any exceptions caught during processing will be
- * rethrown wrapped into a ServiceException.
+ * @throws Exception Any exceptions caught during processing will be
+ * rethrown wrapped into a Exception.
*/
public DB getDB(String name)
throws Exception;
1.10 +30 -352
jakarta-turbine/src/java/org/apache/turbine/services/db/TurbineDatabaseService.java
Index: TurbineDatabaseService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/db/TurbineDatabaseService.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TurbineDatabaseService.java 2001/07/17 20:36:04 1.9
+++ TurbineDatabaseService.java 2001/07/30 20:39:21 1.10
@@ -54,86 +54,42 @@
* <http://www.apache.org/>.
*/
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import org.apache.turbine.torque.Torque;
+import org.apache.turbine.torque.TorqueException;
import org.apache.turbine.services.BaseService;
import org.apache.turbine.services.InitializationException;
-import org.apache.turbine.services.ServiceException;
-import org.apache.turbine.services.db.util.AutoIncrementIdGenerator;
-import org.apache.turbine.services.db.util.SequenceIdGenerator;
-import org.apache.turbine.services.db.util.IDBroker;
import org.apache.turbine.services.db.adapter.DB;
-import org.apache.turbine.services.db.adapter.DBFactory;
import org.apache.turbine.services.db.map.DatabaseMap;
-import org.apache.turbine.services.db.map.TableMap;
-import org.apache.turbine.services.db.pool.ConnectionPool;
import org.apache.turbine.services.db.pool.DBConnection;
-import org.apache.turbine.services.db.util.BasePeer;
+import org.apache.turbine.services.TurbineServices;
/**
* Turbine's default implementation of {@link DatabaseService}.
*
- * @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Greg Ritter</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Magnús Þór Torfason</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
- * @version $Id: TurbineDatabaseService.java,v 1.9 2001/07/17 20:36:04 jmcnally Exp
$
+ * @version $Id: TurbineDatabaseService.java,v 1.10 2001/07/30 20:39:21 jvanzyl Exp
$
*/
public class TurbineDatabaseService
extends BaseService
implements DatabaseService
{
- /** The global cache of database maps */
- private Map dbMaps;
-
/**
- * The various connection pools this broker contains. Keyed by
- * database URL.
- */
- private Map pools;
-
- /**
- * The property tag which specifies which
- * log4j category to use for logging in BasePeer.
- */
- private static final String CATEGORY = "log4j.category";
-
- /**
- * The default log4j category to use if the
- * the log4j.category property isn't set.
- */
- private static final String DEFAULT_CATEGORY = "sql";
-
- /**
* Initializes the service.
*/
public void init()
throws InitializationException
{
- dbMaps = (Map)new HashMap();
-
- pools = (Map) new HashMap();
- // Create monitor thread
- Monitor monitor = new Monitor();
- // Indicate that this is a system thread. JVM will quit only when there
- // are no more active user threads. Settings threads spawned internally
- // by Turbine as daemons allows commandline applications using Turbine
- // to terminate in an orderly manner.
- monitor.setDaemon(true);
- monitor.start();
-
- DBFactory.setConfiguration(getConfiguration());
- DBFactory.setCategory(getCategory(getConfiguration()
- .getString(CATEGORY, DEFAULT_CATEGORY)));
-
- DBFactory.init();
+ Torque.setConfiguration(getConfiguration());
+ Torque.setCategory(getCategory());
- BasePeer.setCategory(getCategory(getConfiguration()
- .getString(CATEGORY, DEFAULT_CATEGORY)));
+ try
+ {
+ Torque.init();
+ }
+ catch (Exception e)
+ {
+ throw new InitializationException("Can't initialize Torque!", e);
+ }
// indicate that the service initialized correctly
setInit(true);
@@ -147,33 +103,7 @@
*/
public void shutdown()
{
- Iterator maps = dbMaps.values().iterator();
- while ( maps.hasNext() )
- {
- DatabaseMap map = (DatabaseMap) maps.next();
- IDBroker idBroker = map.getIDBroker();
- if (idBroker != null)
- {
- idBroker.stop();
- }
- }
-
- if ( pools != null )
- {
- // Release connections for each pool.
- Iterator pool = pools.values().iterator();
- while ( pool.hasNext() )
- {
- try
- {
- ((ConnectionPool)pool.next()).shutdown();
- }
- catch (Exception ignored)
- {
- // Unlikely.
- }
- }
- }
+ Torque.shutdown();
}
/**
@@ -184,10 +114,9 @@
* rethrown wrapped into a ServiceException.
*/
public DatabaseMap getDatabaseMap()
- throws ServiceException
+ throws Exception
{
- return getDatabaseMap(
- getConfiguration().getString(DATABASE_DEFAULT,"default"));
+ return Torque.getDatabaseMap();
}
/**
@@ -201,85 +130,9 @@
* rethrown wrapped into a ServiceException.
*/
public DatabaseMap getDatabaseMap(String name)
- throws ServiceException
+ throws Exception
{
- if ( name == null )
- {
- throw new ServiceException ("DatabaseMap name was null!");
- }
-
- // Quick (non-sync) check for the map we want.
- DatabaseMap map = (DatabaseMap)dbMaps.get(name);
- if ( map == null )
- {
- // Map not there...
- synchronized( dbMaps )
- {
- // ... sync and look again to avoid race condition.
- map = (DatabaseMap)dbMaps.get(name);
- if ( map == null )
- {
- // Still not there. Create and add.
- map = new DatabaseMap(name);
-
- // Add info about IDBroker's table.
- setupIdTable(map);
- // setup other id generators
- try
- {
- DB db = DBFactory.create(
- getDatabaseProperty(name, "driver") );
- map.addIdGenerator(TableMap.AUTOINCREMENT,
- new AutoIncrementIdGenerator(db) );
- map.addIdGenerator(TableMap.SEQUENCE,
- new SequenceIdGenerator(db) );
- }
- catch (java.lang.InstantiationException e)
- {
- throw new ServiceException(e);
- }
-
- dbMaps.put(name, map);
- }
- }
- }
- return map;
- }
-
- /**
- * Returns the specified property of the given database, or the empty
- * string if no value is set for the property.
- *
- * @param db The name of the database whose property to get.
- * @param prop The name of the property to get.
- * @return The property's value.
- */
- private final String getDatabaseProperty(String db, String prop)
- {
- return getConfiguration().getString( new StringBuffer("database.")
- .append(db)
- .append('.')
- .append(prop)
- .toString(), "" );
- }
-
- /**
- * Setup IDBroker's table information within given database map.
- *
- * This method should be called on all new database map to ensure that
- * IDBroker functionality is available in all databases userd by the
- * application.
- *
- * @param map the DataBaseMap to setup.
- */
- private void setupIdTable(DatabaseMap map)
- {
- map.setIdTable("ID_TABLE");
- TableMap tMap = map.getIdTable();
- tMap.addPrimaryKey("ID_TABLE_ID", new Integer(0));
- tMap.addColumn("TABLE_NAME", new String(""));
- tMap.addColumn("NEXT_ID", new Integer(0));
- tMap.addColumn("QUANTITY", new Integer(0));
+ return Torque.getDatabaseMap(name);
}
/**
@@ -292,8 +145,7 @@
public DBConnection getConnection()
throws Exception
{
- return getConnection(
- getConfiguration().getString(DATABASE_DEFAULT,"default"));
+ return Torque.getConnection();
}
/**
@@ -319,7 +171,7 @@
throws Exception
{
// The getPool method ensures the validity of the returned pool.
- return getPool(name).getConnection();
+ return Torque.getConnection(name);
}
/**
@@ -343,20 +195,7 @@
String password)
throws Exception
{
- ConnectionPool pool = null;
- url = url.trim();
-
- // Quick (non-sync) check for the pool we want.
- // NOTE: Here we must not call getPool(), since the pool
- // is almost certainly not defined in the properties file
- pool = (ConnectionPool) pools.get(url + username);
- if ( pool == null )
- {
- registerPool(url + username, driver, url, username, password);
- pool = (ConnectionPool) pools.get(url + username);
- }
-
- return pool.getConnection();
+ return Torque.getConnection(driver, url, username, password);
}
/**
@@ -370,14 +209,7 @@
public void releaseConnection(DBConnection dbconn)
throws Exception
{
- if ( dbconn != null )
- {
- ConnectionPool pool = dbconn.getPool();
- if ( pools.containsValue( pool ) )
- {
- pool.releaseConnection( dbconn );
- }
- }
+ Torque.releaseConnection(dbconn);
}
/**
@@ -399,24 +231,7 @@
String password )
throws Exception
{
- /**
- * Added so that the configuration file can define maxConnections &
- * expiryTime for each database pool that is defined in the
- * TurbineResources.properties
- * Was defined as: database.expiryTime=3600000
- * If you need per database, it is
- * now database.helpdesk.expiryTime=3600000
- */
- registerPool(
- name,
- driver,
- url,
- username,
- password,
- getConfiguration().getInt(getProperty(name, "maxConnections"), 10),
- getConfiguration().getLong(getProperty(name, "expiryTime"), 3600000),
- getConfiguration().getLong(getProperty(name, "maxConnectionAttempts"),
50),
- getConfiguration().getLong(getProperty(name, "connectionWaitTimeout"),
10000));
+ Torque.registerPool(name,driver,url,username,password);
}
/**
@@ -440,32 +255,8 @@
long connectionWaitTimeout)
throws Exception
{
-
- // Quick (non-sync) check for the pool we want.
- if ( !pools.containsKey(name) )
- {
- // Pool not there...
- synchronized ( pools )
- {
- // ... sync and look again to avoid race collisions.
- if ( !pools.containsKey(name) )
- {
- // Still not there. Create and add.
- ConnectionPool pool =
- new ConnectionPool(
- driver,
- url,
- username,
- password,
- maxCons,
- expiryTime,
- maxConnectionAttempts,
- connectionWaitTimeout);
-
- pools.put( name, pool );
- }
- }
- }
+ Torque.registerPool(name,driver,url,username,password,maxCons,expiryTime,
+ maxConnectionAttempts, connectionWaitTimeout);
}
/**
@@ -478,7 +269,7 @@
public DB getDB()
throws Exception
{
- return getDB(getConfiguration().getString(DATABASE_DEFAULT,"default"));
+ return Torque.getDB();
}
/**
@@ -492,129 +283,16 @@
public DB getDB(String name)
throws Exception
{
- return getPool(name).getDB();
- }
-
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * This method returns the default pool.
- *
- * @return The default pool.
- * @exception Exception A generic exception.
- */
- private ConnectionPool getPool()
- throws Exception
- {
- return getPool(getConfiguration().getString(DATABASE_DEFAULT,"default"));
- }
-
- /**
- * This method returns a pool with the specified name. The pool must
- * either have been registered with the
- * {@link #registerPool(String,String,String,String,String)} methd, or be
- * specified in the TurbineResources properties. This method is used
- * interanlly by the service.
- *
- * @param name The name of the pool to get.
- * @return The requested pool.
- *
- * @exception Exception A generic exception.
- */
- private ConnectionPool getPool(String name)
- throws Exception
- {
- ConnectionPool pool = (ConnectionPool) pools.get(name);
-
- // If the pool is not in the Hashtable, we must register it.
- if ( pool == null )
- {
- registerPool(
- name,
- getDatabaseProperty(name, "driver"),
- getDatabaseProperty(name, "url"),
- getDatabaseProperty(name, "username"),
- getDatabaseProperty(name, "password"));
-
- pool = (ConnectionPool) pools.get(name);
- }
-
- return pool;
- }
-
- /**
- * Returns the string for the specified property of the given database.
- *
- * @param db The name of the database whose property to get.
- * @param prop The name of the property to get.
- * @return The string of the property.
- */
- private String getProperty(String db, String prop)
- {
- return
- new StringBuffer("database.")
- .append(db)
- .append('.')
- .append(prop)
- .toString();
- }
-
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * This inner class monitors the <code>PoolBrokerService</code>.
- *
- * This class is capable of logging the number of connections available in
- * the pool periodically. This can prove useful if you application
- * frozes after certain amount of time/requests and you suspect
- * that you have connection leakage problem.
- *
- * Set the <code>database.logInterval</code> property to the number of
- * milliseconds you want to elapse between loging the number of
- * connections.
- */
- protected class Monitor extends Thread
- {
- public void run()
- {
- int logInterval = getConfiguration().getInt("database.logInterval",0);
- StringBuffer buf = new StringBuffer();
- while (logInterval > 0)
- {
- // Loop through all pools and log.
- Iterator poolIter = pools.keySet().iterator();
- while ( poolIter.hasNext() )
- {
- String poolName = (String) poolIter.next();
- ConnectionPool pool = (ConnectionPool) pools.get(poolName);
- buf.setLength(0);
- buf.append(poolName).append(" (in + out = total): ")
- .append(pool.getNbrAvailable()).append(" + ")
- .append(pool.getNbrCheckedOut()).append(" = ")
- .append(pool.getTotalCount());
- getCategory().info(buf.toString());
- }
-
- // Wait for a bit.
- try
- {
- Thread.sleep(logInterval);
- }
- catch (InterruptedException ignored)
- {
- // Don't care.
- }
- }
- }
+ return Torque.getDB(name);
}
public String getDefaultDB()
{
- return getConfiguration().getString(DATABASE_DEFAULT,"default");
+ return Torque.getDefaultDB();
}
public String getDefaultMap()
{
- return getConfiguration().getString(DATABASE_DEFAULT,"default");
+ return Torque.getDefaultMap();
}
}
1.10 +2 -1
jakarta-turbine/src/java/org/apache/turbine/services/intake/model/ComboKeyField.java
Index: ComboKeyField.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/intake/model/ComboKeyField.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ComboKeyField.java 2001/07/17 23:01:03 1.9
+++ ComboKeyField.java 2001/07/30 20:39:21 1.10
@@ -62,6 +62,7 @@
import org.apache.turbine.services.intake.xmlmodel.Rule;
import org.apache.turbine.services.intake.xmlmodel.XmlField;
import org.apache.turbine.services.Log;
+import org.apache.turbine.torque.TorqueException;
/** */
public class ComboKeyField extends Field
@@ -94,7 +95,7 @@
setTestValue( new ComboKey(pp.getString(getKey())) );
}
}
- catch (ServiceException e)
+ catch (TorqueException e)
{
valid_flag = false;
Log.error(e);
1.3 +3 -3
jakarta-turbine/src/java/org/apache/turbine/services/security/util/TurbineSecurityException.java
Index: TurbineSecurityException.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/security/util/TurbineSecurityException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineSecurityException.java 2001/07/15 18:03:42 1.2
+++ TurbineSecurityException.java 2001/07/30 20:39:21 1.3
@@ -54,16 +54,16 @@
* <http://www.apache.org/>.
*/
-import org.apache.turbine.util.TurbineException;
+import org.apache.turbine.services.ServiceException;
/**
* Thrown by SecurityService methods to indicate various problems.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
- * @version $Id: TurbineSecurityException.java,v 1.2 2001/07/15 18:03:42 mpoeschl
Exp $
+ * @version $Id: TurbineSecurityException.java,v 1.3 2001/07/30 20:39:21 jvanzyl
Exp $
*/
public class TurbineSecurityException
- extends TurbineException
+ extends ServiceException
{
/**
* Construct an SecurityException with specified detail message.
1.4 +3 -2
jakarta-turbine/src/java/org/apache/turbine/services/upload/DefaultFileItem.java
Index: DefaultFileItem.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/upload/DefaultFileItem.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultFileItem.java 2001/06/30 13:07:28 1.3
+++ DefaultFileItem.java 2001/07/30 20:39:21 1.4
@@ -91,9 +91,10 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: DefaultFileItem.java,v 1.3 2001/06/30 13:07:28 jvanzyl Exp $
+ * @version $Id: DefaultFileItem.java,v 1.4 2001/07/30 20:39:21 jvanzyl Exp $
*/
-public class DefaultFileItem implements FileItem
+public class DefaultFileItem
+ implements FileItem
{
/** The original filename in the user's filesystem. */
protected String fileName;
1.21 +8 -105
jakarta-turbine/src/java/org/apache/turbine/util/parser/BaseValueParser.java
Index: BaseValueParser.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/parser/BaseValueParser.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- BaseValueParser.java 2001/07/17 11:37:37 1.20
+++ BaseValueParser.java 2001/07/30 20:39:22 1.21
@@ -70,9 +70,7 @@
import org.apache.turbine.Turbine;
import org.apache.turbine.services.db.om.NumberKey;
import org.apache.turbine.services.db.om.StringKey;
-import org.apache.turbine.util.DateSelector;
import org.apache.turbine.util.StringUtils;
-import org.apache.turbine.util.TimeSelector;
import org.apache.turbine.services.pool.Recyclable;
import org.apache.turbine.services.pool.RecyclableSupport;
@@ -102,7 +100,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: BaseValueParser.java,v 1.20 2001/07/17 11:37:37 jvanzyl Exp $
+ * @version $Id: BaseValueParser.java,v 1.21 2001/07/30 20:39:22 jvanzyl Exp $
*/
public class BaseValueParser
extends RecyclableSupport
@@ -344,35 +342,6 @@
return parameters.containsKey(convert((String)key));
}
- /**
- * Check for existence of key_day, key_month and key_year
- * parameters (as returned by DateSelector generated HTML).
- *
- * @param key A String with the selector name.
- * @return True if keys are found.
- */
- public boolean containsDateSelectorKeys(String key)
- {
- return (containsKey(key + DateSelector.DAY_SUFFIX) &&
- containsKey(key + DateSelector.MONTH_SUFFIX) &&
- containsKey(key + DateSelector.YEAR_SUFFIX));
- }
-
- /**
- * Check for existence of key_hour, key_minute and key_second
- * parameters (as returned by TimeSelector generated HTML).
- *
- * @param key A String with the selector name.
- * @return True if keys are found.
- */
- public boolean containsTimeSelectorKeys(String key)
- {
- return (containsKey(key + TimeSelector.HOUR_SUFFIX) &&
- containsKey(key + TimeSelector.MINUTE_SUFFIX) &&
- containsKey(key + TimeSelector.SECOND_SUFFIX));
- }
-
-
/*
* Get an enumerator for the parameter keys. Wraps to the
* contained <code>Hashtable.keys()</code>.
@@ -1058,75 +1027,6 @@
}
/**
- * Returns a {@link java.util.Date} object. If there are DateSelector or
- * TimeSelector style parameters then these are used. If not and there
- * is a parameter 'name' then this is parsed by DateFormat. If the
- * name does not exist, return null.
- *
- * @param name A String with the name.
- * @return A Date.
- */
- public Date getDate(String name)
- {
- Date date = null;
-
- if (containsDateSelectorKeys(name))
- {
- try
- {
- Calendar cal = new GregorianCalendar(
- getInt(name + DateSelector.YEAR_SUFFIX),
- getInt(name + DateSelector.MONTH_SUFFIX),
- getInt(name + DateSelector.DAY_SUFFIX));
-
- // Reject invalid dates.
- cal.setLenient(false);
- date = cal.getTime();
- }
- catch (IllegalArgumentException e)
- {
- // Thrown if an invalid date.
- }
- }
- else if (containsTimeSelectorKeys(name))
- {
- try
- {
- String ampm = getString(name + TimeSelector.AMPM_SUFFIX);
- int hour = getInt(name + TimeSelector.HOUR_SUFFIX);
-
- // Convert from 12 to 24hr format if appropriate
- if (ampm != null)
- {
- if (Integer.parseInt(ampm) == Calendar.PM)
- {
- hour += 12;
- }
- }
- Calendar cal = new GregorianCalendar( 1, 1, 1,
- hour,
- getInt(name + TimeSelector.MINUTE_SUFFIX),
- getInt(name + TimeSelector.SECOND_SUFFIX));
-
- // Reject invalid dates.
- cal.setLenient(false);
- date = cal.getTime();
- }
- catch (IllegalArgumentException e)
- {
- // Thrown if an invalid date.
- }
- }
- else
- {
- DateFormat df = DateFormat.getDateInstance();
- date = getDate(name, df, null);
- }
-
- return date;
- }
-
- /**
* Returns a {@link java.util.Date} object. String is parsed by supplied
* DateFormat. If the name does not exist, return null.
*
@@ -1140,6 +1040,12 @@
return getDate(name, df, null);
}
+ public Date getDate(String name)
+ {
+ DateFormat df = DateFormat.getDateInstance();
+ return getDate(name, df, null);
+ }
+
/**
* Return an NumberKey for the given name. If the name does not
* exist, return null.
@@ -1209,10 +1115,7 @@
{
String propname = props[i].getName();
Method setter = props[i].getWriteMethod();
- if (setter != null &&
- (containsKey(propname) ||
- containsDateSelectorKeys(propname) ||
- containsTimeSelectorKeys(propname)))
+ if (setter != null && containsKey(propname))
{
setProperty(bean, props[i]);
}
1.4 +1 -10
jakarta-turbine/src/java/org/apache/turbine/util/parser/ValueParser.java
Index: ValueParser.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/parser/ValueParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ValueParser.java 2001/07/17 11:37:37 1.3
+++ ValueParser.java 2001/07/30 20:39:22 1.4
@@ -78,7 +78,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: ValueParser.java,v 1.3 2001/07/17 11:37:37 jvanzyl Exp $
+ * @version $Id: ValueParser.java,v 1.4 2001/07/30 20:39:22 jvanzyl Exp $
*/
public interface ValueParser
{
@@ -191,15 +191,6 @@
* @return True if the object is found.
*/
public boolean containsKey( Object key );
-
- /**
- * Check for existence of key_day, key_month and key_year
- * parameters (as returned by DateSelector generated HTML).
- *
- * @param key A String with the selector name.
- * @return True if keys are found.
- */
- public boolean containsDateSelectorKeys(String key);
/*
* Get an enumerator for the parameter keys. Wraps to the
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]