Author: tv
Date: Sun Jul 23 13:03:33 2006
New Revision: 424793
URL: http://svn.apache.org/viewvc?rev=424793&view=rev
Log:
- Derive TorqueComponent from TorqueInstance
- Provide a test and its dependencies to check it works
Added:
db/torque/runtime/trunk/src/test/TestComponentConfig.xml
db/torque/runtime/trunk/src/test/TestRoleConfig.xml
db/torque/runtime/trunk/src/test/org/apache/torque/avalon/AvalonTest.java
Modified:
db/torque/runtime/trunk/project.xml
db/torque/runtime/trunk/src/java/org/apache/torque/Torque.java
db/torque/runtime/trunk/src/java/org/apache/torque/avalon/TorqueComponent.java
Modified: db/torque/runtime/trunk/project.xml
URL:
http://svn.apache.org/viewvc/db/torque/runtime/trunk/project.xml?rev=424793&r1=424792&r2=424793&view=diff
==
--- db/torque/runtime/trunk/project.xml (original)
+++ db/torque/runtime/trunk/project.xml Sun Jul 23 13:03:33 2006
@@ -187,6 +187,29 @@
+
+
+ avalon-framework
+ avalon-framework-impl
+ 4.3
+ jar
+
+ true
+
+
+
+
+ fulcrum
+ fulcrum-testcontainer
+ 1.0.5
+
+
+
+ fulcrum
+ fulcrum-yaafi
+ 1.0.4
+
+
junit
junit
Modified: db/torque/runtime/trunk/src/java/org/apache/torque/Torque.java
URL:
http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/Torque.java?rev=424793&r1=424792&r2=424793&view=diff
==
--- db/torque/runtime/trunk/src/java/org/apache/torque/Torque.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/Torque.java Sun Jul 23
13:03:33 2006
@@ -111,6 +111,18 @@
}
/**
+ * Sets the single [EMAIL PROTECTED] org.apache.torque.TorqueInstance}
+ * used by this class. This is used by the Avalon component
+ * to make sure that only one instance of Torque exists
+ *
+ * @param instance Our singleton.
+ */
+public synchronized static void setInstance(TorqueInstance instance)
+{
+torqueSingleton = instance;
+}
+
+/**
* Initialization of Torque with a properties file.
*
* @param configFile The absolute path to the configuration file.
Modified:
db/torque/runtime/trunk/src/java/org/apache/torque/avalon/TorqueComponent.java
URL:
http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/avalon/TorqueComponent.java?rev=424793&r1=424792&r2=424793&view=diff
==
---
db/torque/runtime/trunk/src/java/org/apache/torque/avalon/TorqueComponent.java
(original)
+++
db/torque/runtime/trunk/src/java/org/apache/torque/avalon/TorqueComponent.java
Sun Jul 23 13:03:33 2006
@@ -1,7 +1,7 @@
package org.apache.torque.avalon;
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Copyright 2001-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.
@@ -17,8 +17,6 @@
*/
import java.io.File;
-import java.sql.Connection;
-import java.util.Map;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
@@ -28,15 +26,11 @@
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.LogEnabled;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.commons.lang.StringUtils;
-import org.apache.torque.Database;
-import org.apache.torque.TorqueException;
import org.apache.torque.TorqueInstance;
-import org.apache.torque.adapter.DB;
-import org.apache.torque.manager.AbstractBaseManager;
-import org.apache.torque.map.DatabaseMap;
/**
* Avalon component for Torque.
@@ -47,8 +41,9 @@
* @version $Id$
*/
public class TorqueComponent
-extends AbstractLogEnabled
+extends TorqueInstance
implements Torque,
+ LogEnabled,
Configurable,
Initializable,
Contextualizable,
@@ -57,11 +52,11 @@
{
/** The Avalon Application Root */
private String appRoot = null;
-
-/** The instance of Torque used by this component. */
-private TorqueInstance torqueInstance = null;
-
-/** The configuration file for Torque. */
+
+/** The Avalon Logger */
+private Logger logger = null;
+
+/** The configuration file name. */
private String configFile = null;
@@ -70,40 +65,35 @@
*/
public TorqueComponent()
{
-// If we simply do a "new