Mail Archive Home | gotm-commits List | May 2005 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Monday, May 23, 2005 @ 13:20:55
Author: rouvoy
Path: /cvsroot/gotm/gotm
Added: src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal
src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal
src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal
src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal
src/java/org/objectweb/gotm/lib/coordination/AbortFeature.java
src/java/org/objectweb/gotm/lib/coordination/AutoAbortAttributeController.java
src/java/org/objectweb/gotm/lib/coordination/AutoAbortImpl.java
src/java/org/objectweb/gotm/lib/coordination/CommitFeature.java
src/java/org/objectweb/gotm/lib/coordination/TwoPCFeature.java
src/java/org/objectweb/gotm/lib/resource/Action.java
src/java/org/objectweb/gotm/lib/resource/RunnableAction.java
Modified: .classpath .settings/org.eclipse.core.resources.prefs
src/java/org/objectweb/gotm/GotmFactoryImpl.java
src/java/org/objectweb/gotm/lib/CurrentHandler.java
src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java
src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java
src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java
src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java
src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
src/java/org/objectweb/gotm/lib/event/PublishState.java
src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java
src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java
src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java
src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java
src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java
src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java
src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java
src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java
src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java
src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java
src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java
src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java
src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java
Removed:
src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java
src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java
src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java
src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java
src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java
src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java
* Logging improved,
* Performance improved,
* Cosmetic Updates.
-------------------------------------------------------------------------------------+
.classpath
| 64 +++-
.settings/org.eclipse.core.resources.prefs
| 6
src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal
| 39 ++
src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal
| 21 +
src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal
| 26 +
src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal
| 21 +
src/java/org/objectweb/gotm/GotmFactoryImpl.java
| 10
src/java/org/objectweb/gotm/lib/CurrentHandler.java
| 21 -
src/java/org/objectweb/gotm/lib/coordination/AbortFeature.java
| 54 +++
src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java
| 25 -
src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java
| 124 ---------
src/java/org/objectweb/gotm/lib/coordination/AutoAbortAttributeController.java
| 54 +++
src/java/org/objectweb/gotm/lib/coordination/AutoAbortImpl.java
| 129 +++++++++
src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java
| 47 ---
src/java/org/objectweb/gotm/lib/coordination/CommitFeature.java
| 55 ++++
src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java
| 53 ---
src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java
| 136 ----------
src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java
| 54 ---
src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java
| 52 ---
src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java
| 15 -
src/java/org/objectweb/gotm/lib/coordination/TwoPCFeature.java
| 114 ++++++++
src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java
| 59 ++--
src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java
| 28 +-
src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
| 65 +---
src/java/org/objectweb/gotm/lib/event/PublishState.java
| 16 -
src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java
| 19 -
src/java/org/objectweb/gotm/lib/resource/Action.java
| 47 +++
src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java
| 53 +++
src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java
| 23 -
src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java
| 59 ++--
src/java/org/objectweb/gotm/lib/resource/RunnableAction.java
| 63 ++++
src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java
| 21 -
src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java
| 14 -
src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java
| 18 -
src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java
| 15 -
src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java
| 8
src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java
| 16 -
src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java
| 16 -
src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java
| 17 -
src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java
| 6
40 files changed, 925 insertions(+), 758 deletions(-)
Index: gotm/.classpath
diff -u gotm/.classpath:1.7 gotm/.classpath:1.8
--- gotm/.classpath:1.7 Wed Mar 2 16:25:30 2005
+++ gotm/.classpath Mon May 23 13:20:55 2005
@@ -1,16 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="src" path="/ow-transaction"/>
- <classpathentry kind="lib"
path="lib/thread-manager/ow_util_thread.jar"/>
- <classpathentry kind="src" path="/fractal-pool"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/fractal/fractal.jar"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/utils/ow_util_trace.jar"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/fractal-adl/fractal-adl.jar"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/monolog/ow_monolog.jar"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/julia/julia-mixins.jar"/>
- <classpathentry kind="lib"
path="/fractal-import/lib/julia/julia-runtime.jar"/>
- <classpathentry kind="src" path="/fractal-template"/>
+ <classpathentry kind="src" path="src/java">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="src/fractal">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="/ow-transaction">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="lib/thread-manager/ow_util_thread.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="/fractal-pool">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/fractal/fractal.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/utils/ow_util_trace.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/fractal-adl/fractal-adl.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/monolog/ow_monolog.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/julia/julia-mixins.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib"
path="/fractal-import/lib/julia/julia-runtime.jar">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="/fractal-template">
+ <attributes>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
Index: gotm/.settings/org.eclipse.core.resources.prefs
diff -u /dev/null gotm/.settings/org.eclipse.core.resources.prefs:1.3
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/.settings/org.eclipse.core.resources.prefs Mon May 23 13:20:55
2005
@@ -0,0 +1,6 @@
+#Wed Apr 20 19:34:07 CEST 2005
+eclipse.preferences.version=1
+encoding//src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal=ISO-8859-1
Index: gotm/src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal
diff -u /dev/null
gotm/src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/fractal/org/objectweb/gotm/lib/coordination/Tp2PC.fractal Mon
May 23 13:20:55 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.gotm.lib.coordination.Tp2PC">
+ <interface name="commit" role="server"
+
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"/>
+ <interface name="abort" role="server"
+
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"/>
+
+ <interface name="publish" role="client"
+ signature="org.objectweb.transaction.api.event.PublishFeature"/>
+ <interface name="tx-state" role="client"
+
signature="org.objectweb.transaction.api.transaction.TransactionState"/>
+
+ <component name="Fc2PC"
+ definition="org.objectweb.gotm.lib.coordination.TpTwoPCFeature"/>
+ <component name="FcCommit"
+ definition="org.objectweb.gotm.lib.coordination.TpCommitFeature"/>
+ <component name="FcAbort"
+ definition="org.objectweb.gotm.lib.coordination.TpAbortFeature"/>
+
+ <binding client="this.commit" server="Fc2PC.coord-process"/>
+ <binding client="this.abort" server="FcAbort.coord-process"/>
+
+ <binding client="Fc2PC.commit" server="FcCommit.coord-process"/>
+ <binding client="Fc2PC.abort" server="FcAbort.coord-process"/>
+ <binding client="Fc2PC.publish" server="this.publish"/>
+ <binding client="Fc2PC.tx-state" server="this.tx-state"/>
+
+ <binding client="FcCommit.publish" server="this.publish"/>
+ <binding client="FcCommit.tx-state" server="this.tx-state"/>
+
+ <binding client="FcAbort.publish" server="this.publish"/>
+ <binding client="FcAbort.tx-state" server="this.tx-state"/>
+
+ <template-controller desc="compositeTemplate" />
+</definition>
Index: gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal
diff -u /dev/null
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBus.fractal Mon
May 23 13:20:54 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.gotm.lib.event.TpEventBus">
+ <interface name="subscribe" role="server"
+ signature="org.objectweb.transaction.api.event.SubscribeFeature"/>
+ <interface name="publish" role="server"
+ signature="org.objectweb.transaction.api.event.PublishFeature"/>
+
+ <component name="FcTopics"
+ definition="org.objectweb.gotm.lib.event.TpEventEngineSimple"/>
+
+ <binding client="this.subscribe"
+ server="FcTopics.subscribe"/>
+ <binding client="this.publish"
+ server="FcTopics.publish"/>
+
+ <template-controller desc="compositeTemplate" />
+</definition>
Index:
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal
diff -u /dev/null
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithPool.fractal
Mon May 23 13:20:54 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.gotm.lib.TpCoordinatorImpl">
+ <interface name="subscribe" role="server"
+ signature="org.objectweb.transaction.api.event.SubscribeFeature"/>
+ <interface name="publish" role="server"
+ signature="org.objectweb.transaction.api.event.PublishFeature"/>
+
+ <component name="FcTopics"
+ definition="org.objectweb.gotm.lib.event.TpEventEngineThreadPool"/>
+ <component name="FcThread"
+ definition="org.objectweb.util.thread.comp.TpThreadManager(10,100)"/>
+
+ <binding client="FcTopics.runnable-manager"
+ server="FcThread.runnable-manager"/>
+
+ <binding client="this.subscribe"
+ server="FcTopics.subscribe"/>
+ <binding client="this.publish"
+ server="FcTopics.publish"/>
+
+ <template-controller desc="compositeTemplate" />
+</definition>
Index:
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal
diff -u /dev/null
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++
gotm/src/fractal/org/objectweb/gotm/lib/event/TpEventBusWithThread.fractal
Mon May 23 13:20:54 2005
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE definition PUBLIC
+ "-//objectweb.org//DTD Fractal ADL 2.0//EN"
+ "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
+
+<definition name="org.objectweb.gotm.lib.TpCoordinatorImpl">
+ <interface name="subscribe" role="server"
+ signature="org.objectweb.transaction.api.event.SubscribeFeature"/>
+ <interface name="publish" role="server"
+ signature="org.objectweb.transaction.api.event.PublishFeature"/>
+
+ <component name="FcTopics"
+ definition="org.objectweb.gotm.lib.event.TpEventEngineSimple"/>
+
+ <binding client="this.subscribe"
+ server="FcTopics.subscribe"/>
+ <binding client="this.publish"
+ server="FcTopics.publish"/>
+
+ <template-controller desc="compositeTemplate" />
+</definition>
Index: gotm/src/java/org/objectweb/gotm/GotmFactoryImpl.java
diff -u gotm/src/java/org/objectweb/gotm/GotmFactoryImpl.java:1.3
gotm/src/java/org/objectweb/gotm/GotmFactoryImpl.java:1.4
--- gotm/src/java/org/objectweb/gotm/GotmFactoryImpl.java:1.3 Mon Jan 10
17:16:06 2005
+++ gotm/src/java/org/objectweb/gotm/GotmFactoryImpl.java Mon May 23
13:20:55 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: GotmFactoryImpl.java,v 1.3 2005/01/10 16:16:06 rouvoy Exp $
+$Id: GotmFactoryImpl.java,v 1.4 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm;
@@ -43,7 +43,7 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @fractal
*/
public class GotmFactoryImpl
@@ -109,10 +109,10 @@
Component cpt = (Component)
f.newComponent(this.default_component, context);
this.template = (org.objectweb.fractal.api.factory.Factory)
cpt.getFcInterface("factory");
} catch (ADLException e) {
- getTrace().debug(e.getMessage());
+ getLogger().log(DEBUG,e.getMessage());
throw new IllegalLifeCycleException(e.getMessage());
} catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
+ getLogger().log(DEBUG,e.getMessage());
throw new IllegalLifeCycleException(e.getMessage());
}
this.state = STARTED;
@@ -132,7 +132,7 @@
try {
return this.template.newFcInstance();
} catch (InstantiationException e) {
- getTrace().debug(e.getMessage());
+ getLogger().log(DEBUG,e.getMessage());
return null;
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/CurrentHandler.java
diff -u gotm/src/java/org/objectweb/gotm/lib/CurrentHandler.java:1.2
gotm/src/java/org/objectweb/gotm/lib/CurrentHandler.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/CurrentHandler.java:1.2 Wed
Feb 23 18:39:30 2005
+++ gotm/src/java/org/objectweb/gotm/lib/CurrentHandler.java Mon May 23
13:20:55 2005
@@ -23,27 +23,25 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: CurrentHandler.java,v 1.2 2005/02/23 17:39:30 rouvoy Exp $
+$Id: CurrentHandler.java,v 1.3 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.IllegalCacheException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.control.LifeCycleController;
import org.objectweb.fractal.api.factory.Factory;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.lib.BindablePrimitive;
-import org.objectweb.fractal.pool.util.FcCache;
import org.objectweb.fractal.util.Fractal;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 1 févr. 2005
- * @modified $Date: 2005/02/23 17:39:30 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="factory" role="client"
signature="org.objectweb.fractal.api.Component"
*/
public class CurrentHandler
@@ -68,11 +66,12 @@
* @return the transaction factory.
*/
private Factory getFactory() {
+ Component cpt = (Component) fcBindings.get(FACTORY);
try {
- Component cpt = (Component) lookupFc(FACTORY);
return (Factory) cpt.getFcInterface("factory");
} catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR,e.getMessage());
return null ;
}
}
@@ -102,11 +101,9 @@
try {
this.current = this.cleared ;
Fractal.getLifeCycleController(this.current).startFc();
- FcCache.getCacheController(this.current).initFc();
- } catch (IllegalCacheException e) {
- getTrace().error(e.getMessage());
} catch (IllegalLifeCycleException e) {
- getTrace().error(e.getMessage());
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR,e.getMessage());
} catch (NoSuchInterfaceException e) {
// Ignored
}
@@ -127,7 +124,7 @@
try {
Fractal.getLifeCycleController(this.current).stopFc();
} catch (IllegalLifeCycleException e) {
- getTrace().error(e.getMessage());
+ getLogger().log(ERROR,e.getMessage());
} catch (NoSuchInterfaceException e) {
// Ignored
}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/AbortFeature.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/coordination/AbortFeature.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/AbortFeature.java Mon
May 23 13:20:54 2005
@@ -0,0 +1,54 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: AbortFeature.java,v 1.1 2005/05/23 11:20:54 rouvoy Exp $
+====================================================================*/
+
+package org.objectweb.gotm.lib.coordination;
+
+import org.objectweb.transaction.lib.resource.ResourceEventRollback;
+import org.objectweb.transaction.lib.transaction.TransactionStatusRolledBack;
+import
org.objectweb.transaction.lib.transaction.TransactionStatusRollingBack;
+
+/**
+ * Implementation of the cancel process.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class AbortFeature
+ extends AbstractCoordinationFeature
+{
+ /* (non-Javadoc)
+ * @see
org.objectweb.transaction.api.coordination.CoordinationFeature#process()
+ */
+ public void process() {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Processing Abort.");
+ getTxState().setStatus(TransactionStatusRollingBack.status);
+ getPublisher().notify(ResourceEventRollback.event.hashCode(),null);
+ getTxState().setStatus(TransactionStatusRolledBack.status);
+ }
+}
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java:1.5
gotm/src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java:1.6
---
gotm/src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java:1.5
Fri Feb 4 18:44:33 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/AbstractCoordinationFeature.java
Mon May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: AbstractCoordinationFeature.java,v 1.5 2005/02/04 17:44:33 rouvoy Exp $
+ $Id: AbstractCoordinationFeature.java,v 1.6 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.coordination;
@@ -32,15 +32,14 @@
import org.objectweb.transaction.api.event.PublishFeature;
import org.objectweb.transaction.api.transaction.TransactionState;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
/**
* Abstract implementation of a validation engine.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.5 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.6 $
* @fractal.itf name="publish" role="client"
signature="org.objectweb.transaction.api.event.PublishFeature"
* @fractal.itf name="tx-state" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionState"
*/
@@ -61,21 +60,11 @@
/**
* @return Returns the notifier.
*/
- protected PublishFeature getPublisher() {
- try {
- return (PublishFeature) lookupFc(PublishFeature.PUBLISH_FEATURE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error("Interface Publish not bound");
- return null;
- }
+ protected final PublishFeature getPublisher() {
+ return (PublishFeature)
fcBindings.get(PublishFeature.PUBLISH_FEATURE);
}
- protected TransactionState getTxState() {
- try {
- return (TransactionState)
lookupFc(TransactionState.TRANSACTION_STATE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error("Interface TxState not bound");
- return null;
- }
+ protected final TransactionState getTxState() {
+ return (TransactionState)
fcBindings.get(TransactionState.TRANSACTION_STATE);
}
}
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java:1.6
gotm/src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java:removed
---
gotm/src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java:1.6
Fri Feb 4 18:44:33 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/AtomicTwoPCCoordinationFeature.java
Mon May 23 13:20:55 2005
@@ -1,124 +0,0 @@
-/*====================================================================
-
- GoTM: GoTM is an open Transaction Monitor
- Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
- Contact: gotm-team@xxxxxxxxxxxxx
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA
-
- Initial developer(s): Romain Rouvoy.
- Contributor(s): .
-
- ---------------------------------------------------------------------
- $Id: AtomicTwoPCCoordinationFeature.java,v 1.6 2005/02/04 17:44:33 rouvoy
Exp $
- ====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.transaction.api.coordination.CoordinationFeature;
-import org.objectweb.transaction.api.event.PublishFeature;
-import org.objectweb.transaction.api.transaction.TransactionState;
-import org.objectweb.transaction.lib.resource.ResourceEventVote;
-import org.objectweb.transaction.lib.resource.ResourceVoteCommit;
-import org.objectweb.transaction.lib.resource.ResourceVoteReadOnly;
-import org.objectweb.transaction.lib.resource.ResourceVoteRollback;
-import org.objectweb.transaction.lib.transaction.TransactionStatusPrepared;
-import org.objectweb.transaction.lib.transaction.TransactionStatusPreparing;
-
-
-/**
- * Implementation of a Two-Phase Commit Protocol.
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.6 $
- * @fractal.itf name="valid" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
- * @fractal.itf name="cancel" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
- */
-public class AtomicTwoPCCoordinationFeature
- extends AbstractCoordinationFeature
-{
- /** Client interface for validation operation. */
- public static final String VALIDATION = "valid";
- /** Client interface for cancel operation. */
- public static final String CANCEL = "cancel";
-
- /* (non-Javadoc)
- * @see org.objectweb.gotm.lib.BindingFeature#clientFc()
- */
- protected String[] clientFc() {
- return new String[] {
- PublishFeature.PUBLISH_FEATURE,
- TransactionState.TRANSACTION_STATE,
- VALIDATION,
- CANCEL
- };
- }
-
- /**
- * @return the validation interface
- */
- protected CoordinationFeature getValidation() {
- try {
- return (CoordinationFeature) lookupFc(VALIDATION);
- } catch (NoSuchInterfaceException e) {
- getTrace().error("Interface validation not bound!");
- return null;
- }
- }
-
- /**
- * @return the cancel interface
- */
- protected CoordinationFeature getCancel() {
- try {
- return (CoordinationFeature) lookupFc(CANCEL);
- } catch (NoSuchInterfaceException e) {
- getTrace().error("Interface cancel not bound!");
- return null;
- }
- }
-
-
- /* (non-Javadoc)
- * @see
org.objectweb.transaction.api.coordination.CoordinationFeature#process()
- */
- public void process() {
- getTrace().debug("Processing Atomic 2 Phases Validation");
- getTxState().setStatus(TransactionStatusPreparing.status);
- Map votes = new HashMap();
- votes.put(ResourceVoteRollback.vote, new LinkedList());
- votes.put(ResourceVoteCommit.vote, new LinkedList());
- votes.put(ResourceVoteReadOnly.vote, new LinkedList());
- getPublisher().notify(ResourceEventVote.event.getLabel(), votes);
- getTxState().setStatus(TransactionStatusPrepared.status);
-
- List enf_rollback = (List) votes.get(ResourceVoteRollback.vote);
- //List enf_commit = (List) votes.get(ResourceVoteCommit.vote);
- if (enf_rollback.size() == 0) {
- // if (enf_commit.length != 0)
- getValidation().process();
- } else {
- getCancel().process();
- }
- }
-}
\ No newline at end of file
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortAttributeController.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortAttributeController.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortAttributeController.java
Mon May 23 13:20:54 2005
@@ -0,0 +1,54 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: AutoAbortAttributeController.java,v 1.1 2005/05/23 11:20:54 rouvoy Exp $
+====================================================================*/
+
+package org.objectweb.gotm.lib.coordination;
+
+import org.objectweb.fractal.api.control.AttributeController;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 5 janv. 2005
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.1 $
+ * @fractal.controller name="attribute"
+ */
+public interface AutoAbortAttributeController
+ extends AttributeController
+{
+ /**
+ * Defines the delay before autocompletion.
+ * @param delay to apply in seconds (0 -> no delay).
+ */
+ public void setTimeout(int delay);
+
+ /**
+ * Provides the value of the autocompletion delay.
+ * @return the delay applied (0 -> no delay).
+ */
+ public int getTimeout();
+}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortImpl.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortImpl.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/AutoAbortImpl.java
Mon May 23 13:20:54 2005
@@ -0,0 +1,129 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: AutoAbortImpl.java,v 1.1 2005/05/23 11:20:54 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.gotm.lib.coordination;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Map;
+
+import javax.swing.Timer;
+
+import org.objectweb.gotm.lib.event.SubscribablePrimitive;
+import org.objectweb.transaction.api.coordination.CoordinationFeature;
+import org.objectweb.transaction.api.event.SubscribeFeature;
+import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
+import
org.objectweb.transaction.lib.transaction.TransactionStatusNoTransaction;
+import org.objectweb.transaction.lib.transaction.TransactionStatusRolledBack;
+import
org.objectweb.transaction.lib.transaction.TransactionStatusTransactionActive;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="coord-process" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
+ */
+public class AutoAbortImpl
+extends SubscribablePrimitive
+implements AutoAbortAttributeController
+{
+ /**
+ * @fractal.attr argument="timeout"
+ */
+ private int timeout = 0;
+
+ private Timer daemon ;
+
+ /**
+ * Default Constructor.
+ */
+ public AutoAbortImpl() {
+ ActionListener taskPerformer = new ActionListener() {
+ public void actionPerformed(ActionEvent evt) {
+ AutoAbortImpl.this.getTerminator().process();
+ }
+ };
+ this.daemon = new Timer(this.timeout, taskPerformer);
+ this.daemon.setRepeats(false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.lib.BindingFeature#clientFc()
+ */
+ protected String[] clientFc() {
+ return new String[] {
+ SubscribeFeature.SUBSCRIBE_FEATURE,
+ CoordinationFeature.PROCESS_FEATURE
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.lib.SubscribablePrimitive#getEvents()
+ */
+ protected int[] getEvents() {
+ return new int[] {
+ TransactionStatusTransactionActive.status.hashCode(),
+ TransactionStatusNoTransaction.status.hashCode(),
+ TransactionStatusRolledBack.status.hashCode(),
+ TransactionStatusCommitted.status.hashCode()
+ };
+ }
+
+ protected CoordinationFeature getTerminator() {
+ return (CoordinationFeature)
fcBindings.get(CoordinationFeature.PROCESS_FEATURE);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.lib.coordination.AutoAbortAttributeController#setTimeout(int)
+ */
+ public void setTimeout(int delay) {
+ this.timeout = delay ;
+ this.daemon.setInitialDelay(this.timeout*1000);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.lib.coordination.AutoAbortAttributeController#getTimeout()
+ */
+ public int getTimeout() {
+ return this.timeout;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
+ */
+ public void notify(int topic, Map context) {
+ if (topic == TransactionStatusTransactionActive.status.hashCode()) {
+ if (getTimeout() != 0) {
+ //getTrace().debug("Starting timeout for "+getTimeout()+".");
+ this.daemon.start();
+ }
+ } else if (getTimeout() != 0) {
+ //getTrace().debug("Stopping timeout.");
+ this.daemon.stop();
+ }
+ }
+}
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java:1.2
gotm/src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java:removed
---
gotm/src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java:1.2
Mon Jan 10 17:16:05 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/BusinessTwoPCCoordinationFeature.java
Mon May 23 13:20:55 2005
@@ -1,48 +0,0 @@
-/*====================================================================
-
-GoTM: GoTM is an open Transaction Monitor
-Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
-Contact: gotm-team@xxxxxxxxxxxxx
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-Initial developer(s): Romain Rouvoy.
-Contributor(s): .
-
----------------------------------------------------------------------
-$Id: BusinessTwoPCCoordinationFeature.java,v 1.2 2005/01/10 16:16:05 rouvoy
Exp $
-====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-
-/**
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:05 $
- * @version $Revision: 1.2 $
- */
-public class BusinessTwoPCCoordinationFeature
- extends AbstractCoordinationFeature
-{
-
- /* (non-Javadoc)
- * @see org.objectweb.gotm.api.engine.ValidationFeature#validate()
- */
- public void process() {
- // TODO Complete BusinessTwoPhaseCommit process() method content.
- }
-}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/CommitFeature.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/coordination/CommitFeature.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/CommitFeature.java
Mon May 23 13:20:54 2005
@@ -0,0 +1,55 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: CommitFeature.java,v 1.1 2005/05/23 11:20:54 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.gotm.lib.coordination;
+
+import org.objectweb.transaction.lib.resource.ResourceEventCommit;
+import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
+import org.objectweb.transaction.lib.transaction.TransactionStatusCommitting;
+
+
+/**
+ * One phase validation process.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @version $Revision: 1.1 $
+ * @fractal.itf
+ */
+public class CommitFeature
+ extends AbstractCoordinationFeature
+{
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.api.engine.ValidationFeature#validate()
+ */
+ public void process() {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Processing Commit.");
+ getTxState().setStatus(TransactionStatusCommitting.status);
+ getPublisher().notify(ResourceEventCommit.event.hashCode(),null);
+ getTxState().setStatus(TransactionStatusCommitted.status);
+ }
+}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java:1.2
gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java:removed
---
gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java:1.2
Mon Jan 10 17:16:05 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonAttributes.java
Mon May 23 13:20:55 2005
@@ -1,54 +0,0 @@
-/*====================================================================
-
-GoTM: GoTM is an open Transaction Monitor
-Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
-Contact: gotm-team@xxxxxxxxxxxxx
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-Initial developer(s): Romain Rouvoy.
-Contributor(s): .
-
----------------------------------------------------------------------
-$Id: DaemonAttributes.java,v 1.2 2005/01/10 16:16:05 rouvoy Exp $
-====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-import org.objectweb.fractal.api.control.AttributeController;
-
-/**
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:05 $
- * @version $Revision: 1.2 $
- * @fractal.controller name="attribute"
- */
-public interface DaemonAttributes
- extends AttributeController
-{
- /**
- * Defines the delay before autocompletion.
- * @param delay to apply in seconds (0 -> no delay).
- */
- public void setTimeout(int delay);
-
- /**
- * Provides the value of the autocompletion delay.
- * @return the delay applied (0 -> no delay).
- */
- public int getTimeout();
-}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java
diff -u gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java:1.6
gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java:removed
--- gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java:1.6
Fri Feb 4 18:44:33 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/DaemonImpl.java Mon
May 23 13:20:55 2005
@@ -1,136 +0,0 @@
-/*====================================================================
-
- GoTM: GoTM is an open Transaction Monitor
- Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
- Contact: gotm-team@xxxxxxxxxxxxx
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA
-
- Initial developer(s): Romain Rouvoy.
- Contributor(s): .
-
- ---------------------------------------------------------------------
- $Id: DaemonImpl.java,v 1.6 2005/02/04 17:44:33 rouvoy Exp $
- ====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Map;
-
-import javax.swing.Timer;
-
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.gotm.lib.event.SubscribablePrimitive;
-import org.objectweb.transaction.api.coordination.CoordinationFeature;
-import org.objectweb.transaction.api.event.SubscribeFeature;
-import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
-import
org.objectweb.transaction.lib.transaction.TransactionStatusNoTransaction;
-import org.objectweb.transaction.lib.transaction.TransactionStatusRolledBack;
-import
org.objectweb.transaction.lib.transaction.TransactionStatusTransactionActive;
-
-/**
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.6 $
- * @fractal.itf name="coord-process" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
- */
-public class DaemonImpl
-extends SubscribablePrimitive
-implements DaemonAttributes
-{
- /**
- * @fractal.attr argument="timeout"
- */
- private int timeout = 0;
-
- private Timer daemon ;
-
- /**
- * Default Constructor.
- */
- public DaemonImpl() {
- ActionListener taskPerformer = new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- DaemonImpl.this.getTerminator().process();
- }
- };
- this.daemon = new Timer(this.timeout, taskPerformer);
- this.daemon.setRepeats(false);
- }
-
- /* (non-Javadoc)
- * @see org.objectweb.gotm.lib.BindingFeature#clientFc()
- */
- protected String[] clientFc() {
- return new String[] {
- SubscribeFeature.SUBSCRIBE_FEATURE,
- CoordinationFeature.PROCESS_FEATURE
- };
- }
-
- /* (non-Javadoc)
- * @see org.objectweb.gotm.lib.SubscribablePrimitive#getEvents()
- */
- protected String[] getEvents() {
- return new String[] {
- TransactionStatusTransactionActive.status.getLabel(),
- TransactionStatusNoTransaction.status.getLabel(),
- TransactionStatusRolledBack.status.getLabel(),
- TransactionStatusCommitted.status.getLabel()
- };
- }
-
- protected CoordinationFeature getTerminator() {
- try {
- return (CoordinationFeature)
lookupFc(CoordinationFeature.PROCESS_FEATURE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
- }
-
- /* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.coordination.DaemonAttributes#setTimeout(int)
- */
- public void setTimeout(int delay) {
- this.timeout = delay ;
- this.daemon.setInitialDelay(this.timeout*1000);
- }
-
- /* (non-Javadoc)
- * @see org.objectweb.gotm.lib.coordination.DaemonAttributes#getTimeout()
- */
- public int getTimeout() {
- return this.timeout;
- }
-
- /* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
- */
- public void notify(String topic, Map context) {
- if
(topic.equals(TransactionStatusTransactionActive.status.getLabel())) {
- if (getTimeout() != 0) {
- //getTrace().debug("Starting timeout for "+getTimeout()+".");
- this.daemon.start();
- }
- } else if (getTimeout() != 0) {
- //getTrace().debug("Stopping timeout.");
- this.daemon.stop();
- }
- }
-
-}
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java:1.3
gotm/src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java:removed
---
gotm/src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java:1.3
Mon Jan 10 17:16:05 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/OnePCCoordinationFeature.java
Mon May 23 13:20:55 2005
@@ -1,54 +0,0 @@
-/*====================================================================
-
- GoTM: GoTM is an open Transaction Monitor
- Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
- Contact: gotm-team@xxxxxxxxxxxxx
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA
-
- Initial developer(s): Romain Rouvoy.
- Contributor(s): .
-
- ---------------------------------------------------------------------
- $Id: OnePCCoordinationFeature.java,v 1.3 2005/01/10 16:16:05 rouvoy Exp $
- ====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-import org.objectweb.transaction.lib.resource.ResourceEventCommit;
-import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
-import org.objectweb.transaction.lib.transaction.TransactionStatusCommitting;
-
-
-/**
- * One phase validation process.
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.3 $
- * @fractal.itf
- */
-public class OnePCCoordinationFeature
- extends AbstractCoordinationFeature
-{
- /* (non-Javadoc)
- * @see org.objectweb.gotm.api.engine.ValidationFeature#validate()
- */
- public void process() {
- getTrace().debug("Processing Validation.");
- getTxState().setStatus(TransactionStatusCommitting.status);
- getPublisher().notify(ResourceEventCommit.event.getLabel(),null);
- getTxState().setStatus(TransactionStatusCommitted.status);
- }
-}
Index:
gotm/src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java:1.3
gotm/src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java:removed
---
gotm/src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java:1.3
Mon Jan 10 17:16:05 2005
+++
gotm/src/java/org/objectweb/gotm/lib/coordination/RollbackCoordinationFeature.java
Mon May 23 13:20:55 2005
@@ -1,53 +0,0 @@
-/*====================================================================
-
-GoTM: GoTM is an open Transaction Monitor
-Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
-Contact: gotm-team@xxxxxxxxxxxxx
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-Initial developer(s): Romain Rouvoy.
-Contributor(s): .
-
----------------------------------------------------------------------
-$Id: RollbackCoordinationFeature.java,v 1.3 2005/01/10 16:16:05 rouvoy Exp $
-====================================================================*/
-
-package org.objectweb.gotm.lib.coordination;
-
-import org.objectweb.transaction.lib.resource.ResourceEventRollback;
-import org.objectweb.transaction.lib.transaction.TransactionStatusRolledBack;
-import
org.objectweb.transaction.lib.transaction.TransactionStatusRollingBack;
-
-/**
- * Implementation of the cancel process.
- * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.3 $
- * @fractal.itf
- */
-public class RollbackCoordinationFeature
- extends AbstractCoordinationFeature
-{
- /* (non-Javadoc)
- * @see
org.objectweb.transaction.api.coordination.CoordinationFeature#process()
- */
- public void process() {
- getTrace().debug("Processing Cancellation.");
- getTxState().setStatus(TransactionStatusRollingBack.status);
- getPublisher().notify(ResourceEventRollback.event.getLabel(),null);
- getTxState().setStatus(TransactionStatusRolledBack.status);
- }
-}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java:1.3
gotm/src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java:1.4
--- gotm/src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java:1.3
Fri Feb 4 18:44:33 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/StatusChecker.java
Mon May 23 13:20:54 2005
@@ -23,12 +23,11 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: StatusChecker.java,v 1.3 2005/02/04 17:44:33 rouvoy Exp $
+$Id: StatusChecker.java,v 1.4 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.coordination;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.transaction.api.coordination.CoordinationFeature;
import org.objectweb.transaction.api.transaction.TransactionStatusFeature;
@@ -36,7 +35,7 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @fractal.itf name="tx-status" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionStatusFeature"
* @fractal.itf name="commit" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
* @fractal.itf name="rollback" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
@@ -65,12 +64,8 @@
* @see
org.objectweb.transaction.api.coordination.CoordinationFeature#process()
*/
public void process() {
- try {
- TransactionStatusFeature status = (TransactionStatusFeature)
lookupFc(TransactionStatusFeature.TX_STATUS);
- CoordinationFeature delegate = (CoordinationFeature)
((status.getStatus()==TransactionStatusMarkedRollback.status)?lookupFc(ROLLBACK):lookupFc(COMMIT));
- delegate.process();
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- }
+ TransactionStatusFeature status = (TransactionStatusFeature)
fcBindings.get(TransactionStatusFeature.TX_STATUS);
+ CoordinationFeature delegate = (CoordinationFeature)
((status.getStatus()==TransactionStatusMarkedRollback.status)?fcBindings.get(ROLLBACK):fcBindings.get(COMMIT));
+ delegate.process();
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/coordination/TwoPCFeature.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/coordination/TwoPCFeature.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/coordination/TwoPCFeature.java Mon
May 23 13:20:54 2005
@@ -0,0 +1,114 @@
+/*====================================================================
+
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: TwoPCFeature.java,v 1.1 2005/05/23 11:20:54 rouvoy Exp $
+ ====================================================================*/
+
+package org.objectweb.gotm.lib.coordination;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.objectweb.transaction.api.coordination.CoordinationFeature;
+import org.objectweb.transaction.api.event.PublishFeature;
+import org.objectweb.transaction.api.transaction.TransactionState;
+import org.objectweb.transaction.lib.resource.ResourceEventVote;
+import org.objectweb.transaction.lib.resource.ResourceVoteCommit;
+import org.objectweb.transaction.lib.resource.ResourceVoteReadOnly;
+import org.objectweb.transaction.lib.resource.ResourceVoteRollback;
+import org.objectweb.transaction.lib.transaction.TransactionStatusPrepared;
+import org.objectweb.transaction.lib.transaction.TransactionStatusPreparing;
+
+
+/**
+ * Implementation of a Two-Phase Commit Protocol.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 5 janv. 2005
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf name="commit" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
+ * @fractal.itf name="abort" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
+ */
+public class TwoPCFeature
+ extends AbstractCoordinationFeature
+{
+ /** Client interface for validation operation. */
+ public static final String COMMIT = "commit";
+ /** Client interface for cancel operation. */
+ public static final String ABORT = "abort";
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.lib.BindingFeature#clientFc()
+ */
+ protected String[] clientFc() {
+ return new String[] {
+ PublishFeature.PUBLISH_FEATURE,
+ TransactionState.TRANSACTION_STATE,
+ COMMIT,
+ ABORT
+ };
+ }
+
+ /**
+ * @return the validation interface
+ */
+ protected CoordinationFeature commit() {
+ return (CoordinationFeature) fcBindings.get(COMMIT);
+ }
+
+ /**
+ * @return the cancel interface
+ */
+ protected CoordinationFeature abort() {
+ return (CoordinationFeature) fcBindings.get(ABORT);
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.objectweb.transaction.api.coordination.CoordinationFeature#process()
+ */
+ public void process() {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Processing Atomic 2 Phases Validation");
+ getTxState().setStatus(TransactionStatusPreparing.status);
+ Map votes = new HashMap();
+ votes.put(ResourceVoteRollback.vote, new LinkedList());
+ votes.put(ResourceVoteCommit.vote, new LinkedList());
+ votes.put(ResourceVoteReadOnly.vote, new LinkedList());
+ getPublisher().notify(ResourceEventVote.event.hashCode(), votes);
+ getTxState().setStatus(TransactionStatusPrepared.status);
+
+ List enf_rollback = (List) votes.get(ResourceVoteRollback.vote);
+ //List enf_commit = (List) votes.get(ResourceVoteCommit.vote);
+ if (enf_rollback.size() == 0) {
+ // if (enf_commit.length != 0)
+ commit().process();
+ } else {
+ abort().process();
+ }
+ }
+}
\ No newline at end of file
Index: gotm/src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java:1.1
gotm/src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java:1.2
---
gotm/src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java:1.1
Fri Feb 4 18:44:33 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/AbstractEventConverter.java
Mon May 23 13:20:55 2005
@@ -1,30 +1,30 @@
/*====================================================================
-GoTM: GoTM is an open Transaction Monitor
-Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
-Contact: gotm-team@xxxxxxxxxxxxx
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-USA
-
-Initial developer(s): Romain Rouvoy.
-Contributor(s): .
-
----------------------------------------------------------------------
-$Id: AbstractEventConverter.java,v 1.1 2005/02/04 17:44:33 rouvoy Exp $
-====================================================================*/
+ GoTM: GoTM is an open Transaction Monitor
+ Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+ Contact: gotm-team@xxxxxxxxxxxxx
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA
+
+ Initial developer(s): Romain Rouvoy.
+ Contributor(s): .
+
+ ---------------------------------------------------------------------
+ $Id: AbstractEventConverter.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
+ ====================================================================*/
package org.objectweb.gotm.lib.event;
import java.util.HashMap;
@@ -36,17 +36,17 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 1 févr. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.2 $
* @fractal.itf
*/
-public class AbstractEventConverter
+public abstract class AbstractEventConverter
extends LoggablePrimitive
implements EventConverter {
/** <code>values</code> that are handled by the converter. */
private Map values = new HashMap();
-
+
/**
* @return Returns the values.
*/
@@ -58,6 +58,6 @@
* @see
org.objectweb.gotm.lib.jta.EventConverter#toValue(org.objectweb.transaction.api.event.Event)
*/
public int toValue(Event evt) {
- return ((Integer)getValues().get(evt)).intValue();
+ return ((Integer) getValues().get(evt)).intValue();
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java
diff -u gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.3
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.4
--- gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.3
Wed Feb 23 18:39:31 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java Mon
May 23 13:20:55 2005
@@ -23,12 +23,12 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: EventEngineSimple.java,v 1.3 2005/02/23 17:39:31 rouvoy Exp $
+$Id: EventEngineSimple.java,v 1.4 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.event;
-import java.util.HashMap;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -41,8 +41,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 12 janv. 2005
- * @modified $Date: 2005/02/23 17:39:31 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.4 $
* @fractal.itf
*/
public class EventEngineSimple
@@ -52,17 +52,17 @@
/**
* Map containing all the available <code>topics</code>.
*/
- private Map topics = new HashMap();
+ private Map topics = new Hashtable();
/**
* @param topic the identifier of the requested topic
* @return the requested topic.
*/
- protected Set getTopic(String topic) {
- Set set = (Set) this.topics.get(topic) ;
+ protected Set getTopic(int topic) {
+ Set set = (Set) this.topics.get(new Integer(topic)) ;
if (set != null) return set;
set = new HashSet();
- this.topics.put(topic,set);
+ this.topics.put(new Integer(topic),set);
return set;
}
@@ -88,21 +88,23 @@
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.SubscribeFeature#suscribe(java.lang.String,
org.objectweb.gotm.lib.topic.PublishFeature)
*/
- public void subscribe(String topic, PublishFeature suscriber) {
+ public void subscribe(int topic, PublishFeature suscriber) {
getTopic(topic).add(suscriber);
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.SubscribeFeature#unsuscribe(java.lang.String,
org.objectweb.gotm.lib.topic.PublishFeature)
*/
- public void unsubscribe(String topic, PublishFeature suscriber) {
+ public void unsubscribe(int topic, PublishFeature suscriber) {
getTopic(topic).remove(suscriber);
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
*/
- public void notify(String topic, Map context) {
+ public void notify(int topic, Map context) {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Notifying of topic "+topic);
for(Iterator suscribers=getTopic(topic).iterator() ;
suscribers.hasNext() ; ) {
PublishFeature p = (PublishFeature)suscribers.next();
p.notify(topic, context);
@@ -112,7 +114,7 @@
/* (non-Javadoc)
* @see
org.objectweb.transaction.api.event.SubscribeFeature#subscribe(java.lang.String[],
org.objectweb.transaction.api.event.PublishFeature)
*/
- public void subscribe(String[] topic, PublishFeature suscriber) {
+ public void subscribe(int[] topic, PublishFeature suscriber) {
for(int i=0;i<topic.length;i++) {
subscribe(topic[i],suscriber);
}
@@ -121,7 +123,7 @@
/* (non-Javadoc)
* @see
org.objectweb.transaction.api.event.SubscribeFeature#unsubscribe(java.lang.String[],
org.objectweb.transaction.api.event.PublishFeature)
*/
- public void unsubscribe(String[] topic, PublishFeature suscriber) {
+ public void unsubscribe(int[] topic, PublishFeature suscriber) {
for(int i=0;i<topic.length;i++) {
unsubscribe(topic[i],suscriber);
}
Index: gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.1
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.2
--- gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.1
Fri Jan 14 17:50:03 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
Mon May 23 13:20:55 2005
@@ -23,18 +23,17 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: EventEngineThreadPool.java,v 1.1 2005/01/14 16:50:03 rouvoy Exp $
+ $Id: EventEngineThreadPool.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.event;
-import java.util.HashMap;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.Map;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.transaction.api.event.PublishFeature;
import org.objectweb.transaction.api.event.SubscribeFeature;
@@ -43,8 +42,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/14 16:50:03 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.2 $
* @fractal.itf name="runnable-manager" role="client"
signature="org.objectweb.util.thread.api.RunnableManager"
*/
public class EventEngineThreadPool
@@ -54,7 +53,7 @@
/**
* Map containing all the available <code>topics</code>.
*/
- private final Map topics ;
+ private final Map topics = new Hashtable();
/* (non-Javadoc)
* @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
@@ -64,22 +63,10 @@
}
/**
- * Default Constructor.
- */
- public EventEngineThreadPool() {
- this.topics = new HashMap();
- }
-
- /**
* @return the runnable manager bound to the current component
*/
protected final RunnableManager getRunnableManager() {
- try {
- return (RunnableManager)
lookupFc(RunnableManager.RUNNABLE_MANAGER);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (RunnableManager)
fcBindings.get(RunnableManager.RUNNABLE_MANAGER);
}
@@ -87,36 +74,38 @@
* @param topic the identifier of the requested topic
* @return the requested topic.
*/
- protected Set getTopic(String topic) {
- Set set = (Set) this.topics.get(topic) ;
- if (set != null)
- return set;
+ protected Set getTopic(int topic) {
+ Set set = (Set) this.topics.get(new Integer(topic)) ;
+ if (set != null) return set;
set = new HashSet();
- this.topics.put(topic,set);
+ this.topics.put(new Integer(topic),set);
return set;
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.SubscribeFeature#suscribe(java.lang.String,
org.objectweb.gotm.lib.topic.PublishFeature)
*/
- public void subscribe(String topic, PublishFeature suscriber) {
- getTrace().debug("Subscription to the "+topic+" topic.");
+ public void subscribe(int topic, PublishFeature suscriber) {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Subscription of "+suscriber+" to the
"+topic+" topic.");
getTopic(topic).add(suscriber);
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.SubscribeFeature#unsuscribe(java.lang.String,
org.objectweb.gotm.lib.topic.PublishFeature)
*/
- public void unsubscribe(String topic, PublishFeature suscriber) {
- getTrace().debug("Unsubscription from the "+topic+" topic.");
+ public void unsubscribe(int topic, PublishFeature suscriber) {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Unsubscription of "+suscriber+" from the
"+topic+" topic.");
getTopic(topic).remove(suscriber);
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
*/
- public void notify(String topic, Map context) {
- getTrace().debug("Notification of the "+topic+" topic.");
+ public void notify(int topic, Map context) {
+ if (getLogger().isLoggable(DEBUG))
+ getLogger().log(DEBUG,"Notification of the "+topic+" topic.");
for(Iterator suscribers=getTopic(topic).iterator() ;
suscribers.hasNext() ; ) {
getRunnableManager().submitRunnable(new
NotifyAction((PublishFeature)suscribers.next(),topic,context));
}
@@ -125,23 +114,21 @@
/* (non-Javadoc)
* @see
org.objectweb.transaction.api.event.SubscribeFeature#subscribe(java.lang.String[],
org.objectweb.transaction.api.event.PublishFeature)
*/
- public void subscribe(String[] topic, PublishFeature suscriber) {
- for(int i=0;i<topic.length;i++) {
+ public void subscribe(int[] topic, PublishFeature suscriber) {
+ for(int i=0;i<topic.length;i++)
subscribe(topic[i],suscriber);
- }
}
/* (non-Javadoc)
* @see
org.objectweb.transaction.api.event.SubscribeFeature#unsubscribe(java.lang.String[],
org.objectweb.transaction.api.event.PublishFeature)
*/
- public void unsubscribe(String[] topic, PublishFeature suscriber) {
- for(int i=0;i<topic.length;i++) {
+ public void unsubscribe(int[] topic, PublishFeature suscriber) {
+ for(int i=0;i<topic.length;i++)
unsubscribe(topic[i],suscriber);
- }
}
- private class NotifyAction implements Runnable {
- private String topic ;
+ private final class NotifyAction implements Runnable {
+ private int topic ;
private Map context ;
private PublishFeature suscriber ;
/**
@@ -149,7 +136,7 @@
* @param topic
* @param context
*/
- public NotifyAction(PublishFeature suscriber, String topic, Map
context) {
+ public NotifyAction(PublishFeature suscriber, int topic, Map
context) {
this.topic = topic ;
this.context = context ;
this.suscriber = suscriber;
Index: gotm/src/java/org/objectweb/gotm/lib/event/PublishState.java
diff -u gotm/src/java/org/objectweb/gotm/lib/event/PublishState.java:1.1
gotm/src/java/org/objectweb/gotm/lib/event/PublishState.java:1.2
--- gotm/src/java/org/objectweb/gotm/lib/event/PublishState.java:1.1 Fri
Feb 4 18:44:33 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/PublishState.java Mon
May 23 13:20:55 2005
@@ -23,20 +23,19 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: PublishState.java,v 1.1 2005/02/04 17:44:33 rouvoy Exp $
+$Id: PublishState.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.event;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.transaction.api.event.PublishFeature;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.2 $
* @fractal.itf name="publish" role="client"
signature="org.objectweb.transaction.api.event.PublishFeature"
*/
public abstract class PublishState
@@ -54,13 +53,8 @@
/**
* @return the publisher interface.
*/
- protected PublishFeature getPublisher() {
- try {
- return (PublishFeature) lookupFc(PublishFeature.PUBLISH_FEATURE);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ protected final PublishFeature getPublisher() {
+ return (PublishFeature)
fcBindings.get(PublishFeature.PUBLISH_FEATURE);
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java:1.1
gotm/src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java:1.2
--- gotm/src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java:1.1
Fri Feb 4 18:44:33 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/SubscribablePrimitive.java
Mon May 23 13:20:55 2005
@@ -23,12 +23,11 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: SubscribablePrimitive.java,v 1.1 2005/02/04 17:44:33 rouvoy Exp $
+$Id: SubscribablePrimitive.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.event;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.CacheController;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.transaction.api.event.PublishFeature;
@@ -37,8 +36,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 12 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.2 $
* @fractal.itf name="subscribe" role="client"
signature="org.objectweb.transaction.api.event.SubscribeFeature"
*/
public abstract class SubscribablePrimitive
@@ -49,7 +48,7 @@
* Provides the set of events handled by the component.
* @return the events handled by the current component.
*/
- protected abstract String[] getEvents() ;
+ protected abstract int[] getEvents() ;
/* (non-Javadoc)
* @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
@@ -61,19 +60,13 @@
}
protected SubscribeFeature getSubscriber() {
- try {
- return (SubscribeFeature)
lookupFc(SubscribeFeature.SUBSCRIBE_FEATURE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (SubscribeFeature)
fcBindings.get(SubscribeFeature.SUBSCRIBE_FEATURE);
}
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.CacheController#loadFc()
*/
public void initFc() {
- //System.err.println("FcCache SubscribablePrimitive");
getSubscriber().subscribe(getEvents(), this);
}
@@ -81,7 +74,7 @@
* @see org.objectweb.fractal.api.control.CacheController#unloadFc()
*/
public void clearFc() {
- //getSubscriber().unsubscribe(getEvents(), this);
+ // Nothing to do.
}
/* (non-Javadoc)
Index: gotm/src/java/org/objectweb/gotm/lib/resource/Action.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/resource/Action.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/Action.java Mon May 23
13:20:55 2005
@@ -0,0 +1,47 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: Action.java,v 1.1 2005/05/23 11:20:55 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.lib.resource;
+
+import java.util.Map;
+
+/**
+ * Interface Action used by the resource to propagate the incoming events.
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 22 avr. 2005
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.1 $
+ */
+public interface Action
+{
+ /**
+ * @param context
+ * @param resource
+ * @throws Exception
+ */
+ void execute(Map context, Object resource) throws Exception;
+}
Index: gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java
diff -u gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.2
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.2 Wed
Feb 23 18:39:30 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java Mon
May 23 13:20:55 2005
@@ -23,11 +23,12 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: ResourceImpl.java,v 1.2 2005/02/23 17:39:30 rouvoy Exp $
+$Id: ResourceImpl.java,v 1.3 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.resource;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -38,8 +39,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 1 févr. 2005
- * @modified $Date: 2005/02/23 17:39:30 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.3 $
* @fractal.itf
*/
public abstract class ResourceImpl
@@ -47,35 +48,65 @@
implements PublishFeature, Resource
{
/** list of registered observers for this kind of wrapper. */
- private Set observers = new HashSet();
+ private final Set observers = new HashSet();
+
+ /** list of available actions. */
+ private final Hashtable actions ;
+
+ /**
+ * Default constructor.
+ */
+ protected ResourceImpl() {
+ this.actions = declareActions();
+ }
+
+ protected Action getAction(int name) {
+ return (Action)this.actions.get(new Integer(name));
+ }
+ /**
+ * Defines the list of available actions for the associated resource.
+ * @return the list of labelled actions.
+ */
+ protected abstract Hashtable declareActions() ;
+
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.event.Resource#addResource(java.lang.Object)
*/
- public void addResource(Object wrapped) {
+ public void addResource(final Object wrapped) {
this.observers.add(wrapped);
}
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.resource.Resource#delResource(java.lang.Object)
*/
- public void delResource(Object wrapped) {
+ public void delResource(final Object wrapped) {
this.observers.remove(wrapped);
}
- protected abstract Runnable configureAction(String topic, Map context,
Object resource);
+ /* (non-Javadoc)
+ * @see org.objectweb.fractal.api.control.CacheController#clearFc()
+ */
+ public void clearFc() {
+ this.observers.clear() ;
+ }
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
*/
- public void notify(String topic, Map context) {
+ public void notify(final int topic, final Map context) {
+ Action action = getAction(topic);
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(DEBUG,"Propagating "+topic);
for (Iterator i = this.observers.iterator() ; i.hasNext() ;) {
try {
- configureAction(topic,context,i.next()).run();
+ action.execute(context,i.next());
+ } catch (NullPointerException ex) {
+ throw new RuntimeException("No Action available for "+topic);
} catch (Exception ex) {
- getTrace().error("Action.execute: "+ex.getMessage());
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR,"Resource.notify: ",ex);
}
}
}
-
}
Index: gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java:1.2
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java:1.2
Wed Feb 23 18:39:30 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithPool.java Mon
May 23 13:20:55 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: ResourceWithPool.java,v 1.2 2005/02/23 17:39:30 rouvoy Exp $
+$Id: ResourceWithPool.java,v 1.3 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.resource;
@@ -33,7 +33,6 @@
import java.util.Map;
import java.util.Set;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.gotm.lib.event.SubscribablePrimitive;
import org.objectweb.transaction.api.event.PublishFeature;
import org.objectweb.transaction.api.event.SubscribeFeature;
@@ -43,8 +42,8 @@
* Implementation of a wrapper.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 22 déc. 2004
- * @modified $Date: 2005/02/23 17:39:30 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="runnable-manager" role="client"
signature="org.objectweb.util.thread.api.RunnableManager"
*/
public abstract class ResourceWithPool
@@ -68,12 +67,7 @@
* @return the runnable manager bound to the current component
*/
protected final RunnableManager getRunnableManager() {
- try {
- return (RunnableManager)
lookupFc(RunnableManager.RUNNABLE_MANAGER);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (RunnableManager)
fcBindings.get(RunnableManager.RUNNABLE_MANAGER);
}
/* (non-Javadoc)
@@ -90,17 +84,18 @@
this.observers.remove(wrapped);
}
- protected abstract Runnable configureAction(String topic, Map context,
Object resource);
+ protected abstract Runnable configureAction(int topic, Map context,
Object resource);
/* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
+ * @see org.objectweb.transaction.api.event.PublishFeature#notify(int,
java.util.Map)
*/
- public void notify(String topic, Map context) {
+ public void notify(int topic, Map context) {
for (Iterator i = this.observers.iterator() ; i.hasNext() ;) {
try {
getRunnableManager().submitRunnable(configureAction(topic,context,i.next()));
} catch (Exception ex) {
- getTrace().error("Action.execute: "+ex.getMessage());
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR,"Action.execute: ",ex);
}
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java:1.1
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java:1.2
--- gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java:1.1
Tue Apr 19 11:35:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java
Mon May 23 13:20:55 2005
@@ -23,16 +23,16 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: ResourceWithThread.java,v 1.1 2005/04/19 09:35:55 rouvoy Exp $
+$Id: ResourceWithThread.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.resource;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import org.objectweb.gotm.lib.event.SubscribablePrimitive;
import org.objectweb.transaction.api.event.PublishFeature;
@@ -42,8 +42,8 @@
* Implementation of a wrapper.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 22 déc. 2004
- * @modified $Date: 2005/04/19 09:35:55 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.2 $
* @fractal.itf
*/
public abstract class ResourceWithThread
@@ -53,6 +53,9 @@
/** list of registered observers for this kind of wrapper. */
private Set observers = new HashSet();
+ /** list of available actions. */
+ private final Hashtable actions ;
+
/* (non-Javadoc)
* @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
*/
@@ -61,6 +64,24 @@
SubscribeFeature.SUBSCRIBE_FEATURE,
};
}
+
+ /**
+ * Default constructor.
+ */
+ protected ResourceWithThread() {
+ this.actions = declareActions();
+ }
+
+ protected Action getAction(int name) {
+ return (Action)this.actions.get(new Integer(name));
+ }
+
+ /**
+ * Defines the list of available actions for the associated resource.
+ * @return the list of labelled actions.
+ */
+ protected abstract Hashtable declareActions() ;
+
/* (non-Javadoc)
* @see
org.objectweb.gotm.lib.event.Resource#addResource(java.lang.Object)
@@ -76,28 +97,28 @@
this.observers.remove(wrapped);
}
- protected abstract Runnable configureAction(String topic, Map context,
Object resource);
-
/* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.topic.PublishFeature#notify(java.lang.String,
java.util.Map)
+ * @see org.objectweb.transaction.api.event.PublishFeature#notify(int,
java.util.Map)
*/
- public void notify(String topic, Map context) {
- Vector v = new Vector();
+ public void notify(int topic, Map context) {
+// Vector v = new Vector();
+ Action action = getAction(topic);
for (Iterator i = this.observers.iterator() ; i.hasNext() ;) {
try {
- Thread t = new
Thread(configureAction(topic,context,i.next()));
+ Thread t = new RunnableAction(action,context,i.next());
t.start();
- v.add(t);
+// v.add(t);
} catch (Exception ex) {
- getTrace().error("Action.execute: "+ex.getMessage());
- }
- }
- for (Iterator i = v.iterator();i.hasNext();) {
- try {
- ((Thread)i.next()).join();
- } catch (InterruptedException e) {
- e.printStackTrace();
+ if (getLogger().isLoggable(ERROR))
+ getLogger().log(ERROR,"Action.execute: ",ex);
}
}
+// for (Iterator i = v.iterator();i.hasNext();) {
+// try {
+// ((Thread)i.next()).join();
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
+// }
}
}
Index: gotm/src/java/org/objectweb/gotm/lib/resource/RunnableAction.java
diff -u /dev/null
gotm/src/java/org/objectweb/gotm/lib/resource/RunnableAction.java:1.1
--- /dev/null Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/RunnableAction.java Mon
May 23 13:20:55 2005
@@ -0,0 +1,63 @@
+/*====================================================================
+
+GoTM: GoTM is an open Transaction Monitor
+Copyright (C) 2003-2005 INRIA - Jacquard & USTL - LIFL - GOAL
+Contact: gotm-team@xxxxxxxxxxxxx
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+Initial developer(s): Romain Rouvoy.
+Contributor(s): .
+
+---------------------------------------------------------------------
+$Id: RunnableAction.java,v 1.1 2005/05/23 11:20:55 rouvoy Exp $
+====================================================================*/
+package org.objectweb.gotm.lib.resource;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
+ * @created 2 mai 2005
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.1 $
+ */
+public class RunnableAction
+ extends Thread {
+
+ private Action delegate ;
+ private Map context ;
+ private Object resource;
+
+ /**
+ * @param action
+ * @param ctx
+ * @param res
+ */
+ public RunnableAction(Action action, Map ctx, Object res) {
+ this.delegate = action ;
+ this.context = ctx ;
+ this.resource = res ;
+ }
+
+ public void run() {
+ try {
+ this.delegate.execute(this.context, this.resource);
+ }catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Index: gotm/src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java:1.5
gotm/src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java:1.6
--- gotm/src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java:1.5
Mon Jan 10 17:16:06 2005
+++ gotm/src/java/org/objectweb/gotm/lib/state/StateControllerImpl.java Mon
May 23 13:20:55 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: StateControllerImpl.java,v 1.5 2005/01/10 16:16:06 rouvoy Exp $
+ $Id: StateControllerImpl.java,v 1.6 2005/05/23 11:20:55 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.state;
@@ -45,8 +45,8 @@
*
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:06 $
- * @version $Revision: 1.5 $
+ * @modified $Date: 2005/05/23 11:20:55 $
+ * @version $Revision: 1.6 $
* @fractal.itf name="state" role="client"
signature="org.objectweb.gotm.lib.state.StateFeature"
* @fractal.itf name="before" role="client"
signature="org.objectweb.transaction.api.event.PublishFeature"
* @fractal.itf name="after" role="client"
signature="org.objectweb.transaction.api.event.PublishFeature"
@@ -83,12 +83,7 @@
protected StateFeature getState() {
- try {
- return (StateFeature) lookupFc(StateFeature.STATE_FEATURE);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (StateFeature) fcBindings.get(StateFeature.STATE_FEATURE);
}
@@ -106,7 +101,7 @@
return true;
}
} catch(NoSuchInterfaceException ex) {
- getTrace().info(ex.getMessage());
+ getLogger().log(ERROR,ex.getMessage());
}
return false ;
}
@@ -123,7 +118,7 @@
Map ctx = new HashMap();
ctx.put("state",list);
while (it.hasNext()) {
- ((PublishFeature)it.next()).notify(getEvent().getLabel(), ctx);
+ ((PublishFeature)it.next()).notify(getEvent().hashCode(), ctx);
}
}
@@ -134,7 +129,7 @@
public void requestEvent(Event incoming)
throws NoSuchTransitionException
{
- getTrace().debug("Requesting event " + incoming);
+ getLogger().log(DEBUG,"Requesting event " + incoming);
Component cpt = ((Interface)getState()).getFcItfOwner();
try {
Iterator it = new
FcCollectionIterator(Fractal.getBindingController(cpt),
@@ -149,7 +144,7 @@
}
}
} catch(NoSuchInterfaceException ex) {
- getTrace().debug(ex.getMessage());
+ getLogger().log(ERROR,ex.getMessage());
}
throw new NoSuchTransitionException(incoming.toString());
}
Index:
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java:1.6
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java:1.7
---
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java:1.6
Fri Feb 4 18:44:33 2005
+++
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionActivationFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: TransactionActivationFeatureImpl.java,v 1.6 2005/02/04 17:44:33 rouvoy
Exp $
+ $Id: TransactionActivationFeatureImpl.java,v 1.7 2005/05/23 11:20:54 rouvoy
Exp $
====================================================================*/
package org.objectweb.gotm.lib.transaction;
@@ -32,15 +32,14 @@
import org.objectweb.transaction.api.transaction.TransactionState;
import
org.objectweb.transaction.lib.transaction.TransactionStatusTransactionActive;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
/**
* Feature implementing the activation functionalities of a transaction.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.6 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.7 $
* @fractal.itf name="tx-state" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionState"
*/
public class TransactionActivationFeatureImpl
@@ -58,12 +57,7 @@
* @return Returns the transactionState.
*/
protected TransactionState getTransactionState() {
- try {
- return (TransactionState)
lookupFc(TransactionState.TRANSACTION_STATE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (TransactionState)
fcBindings.get(TransactionState.TRANSACTION_STATE);
}
/* (non-Javadoc)
Index:
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java:1.4
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java:1.5
---
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java:1.4
Fri Feb 4 18:44:33 2005
+++
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionInterruptionFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,11 +23,10 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: TransactionInterruptionFeatureImpl.java,v 1.4 2005/02/04 17:44:33
rouvoy Exp $
+ $Id: TransactionInterruptionFeatureImpl.java,v 1.5 2005/05/23 11:20:54
rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.transaction;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import
org.objectweb.transaction.api.transaction.TransactionInterruptionFeature;
import org.objectweb.transaction.api.transaction.TransactionState;
@@ -38,8 +37,8 @@
*
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="tx-state" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionState"
*/
public class TransactionInterruptionFeatureImpl
@@ -59,12 +58,7 @@
* @return Returns the transactionState.
*/
protected TransactionState getTransactionState() {
- try {
- return (TransactionState)
lookupFc(TransactionState.TRANSACTION_STATE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (TransactionState)
fcBindings.get(TransactionState.TRANSACTION_STATE);
}
/* (non-Javadoc)
@@ -73,7 +67,7 @@
public void suspend() {
//getTrace().info("Transaction suspending ...");
getTransactionState().setStatus(TransactionStatusNoTransaction.status);
- getTrace().info("Transaction suspended");
+ getLogger().log(INFO,"Transaction suspended");
}
/* (non-Javadoc)
@@ -82,6 +76,6 @@
public void resume() {
//getTrace().info("Transaction resuming ...");
getTransactionState().setStatus(TransactionStatusTransactionActive.status);
- getTrace().info("Transaction resumed");
+ getLogger().log(INFO,"Transaction resumed");
}
}
Index:
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java:1.6
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java:1.7
---
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java:1.6
Fri Feb 4 18:44:33 2005
+++
gotm/src/java/org/objectweb/gotm/lib/transaction/TransactionStateImpl.java
Mon May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: TransactionStateImpl.java,v 1.6 2005/02/04 17:44:33 rouvoy Exp $
+ $Id: TransactionStateImpl.java,v 1.7 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.transaction;
@@ -39,8 +39,8 @@
*
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/02/04 17:44:33 $
- * @version $Revision: 1.6 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.7 $
* @fractal.itf
*/
public class TransactionStateImpl
@@ -72,19 +72,12 @@
this.status_ = TransactionStatusNoTransaction.status;
}
-// /**
-// * Default Constructor
-// * @see java.lang.Object#Object()
-// */
-// public TransactionStateImpl() {
-// }
-
/* (non-Javadoc)
* @see
org.objectweb.gotm.api.transaction.TransactionState#setStatus(org.objectweb.gotm.api.transaction.Status)
*/
public void setStatus(TransactionStatus status) {
this.status_ = status ;
- getPublisher().notify(status.getLabel(),null);
+ getPublisher().notify(status.hashCode(),null);
}
/* (non-Javadoc)
Index: gotm/src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java
diff -u gotm/src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java:1.3
gotm/src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java:1.4
--- gotm/src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java:1.3
Mon Jan 10 17:16:06 2005
+++ gotm/src/java/org/objectweb/gotm/lib/utils/ComponentMapImpl.java Mon
May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: ComponentMapImpl.java,v 1.3 2005/01/10 16:16:06 rouvoy Exp $
+ $Id: ComponentMapImpl.java,v 1.4 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.utils;
@@ -41,8 +41,8 @@
* Generic Identity Map Implementation.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:06 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.4 $
* @fractal.itf
*/
public class ComponentMapImpl
@@ -79,7 +79,7 @@
* @see
org.objectweb.transaction.api.ComponentMap#putComponent(java.lang.String,
org.objectweb.transaction.api.Identity)
*/
public void putComponent(String key, Object value) {
- getTrace().debug("Adding component "+value+" with key "+key);
+ getLogger().log(DEBUG,"Adding component "+value+" with key "+key);
getMap().put(key,value);
}
Index:
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java:1.3
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java:1.4
---
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java:1.3
Mon Jan 10 17:16:06 2005
+++
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullFactoryFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,21 +23,20 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: StateFullFactoryFeatureImpl.java,v 1.3 2005/01/10 16:16:06 rouvoy Exp $
+ $Id: StateFullFactoryFeatureImpl.java,v 1.4 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.utils;
import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.gotm.api.utils.ComponentPool;
/**
* Basic implementation of a StateFull Factory.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:06 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.4 $
* @fractal.itf name="cpt-model" role="client"
signature="org.objectweb.fractal.api.Component"
* @fractal.itf name="cpt-pool" role="client"
signature="org.objectweb.gotm.api.utils.ComponentPool"
*/
@@ -47,7 +46,7 @@
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.BindingController#listFc()
*/
- public String[] listFc() {
+ public String[] clientFc() {
return new String[]{FACTORY_MODEL,ComponentPool.COMPONENT_POOL};
}
@@ -56,12 +55,7 @@
* @return the binded pool.
*/
protected ComponentPool getPool(){
- try {
- return (ComponentPool) lookupFc(ComponentPool.COMPONENT_POOL) ;
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (ComponentPool) fcBindings.get(ComponentPool.COMPONENT_POOL) ;
}
/* (non-Javadoc)
Index:
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java:1.4
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java:1.5
---
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java:1.4
Mon Jan 10 17:16:06 2005
+++
gotm/src/java/org/objectweb/gotm/lib/utils/StateFullStringFactoryFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,20 +23,19 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: StateFullStringFactoryFeatureImpl.java,v 1.4 2005/01/10 16:16:06
rouvoy Exp $
+ $Id: StateFullStringFactoryFeatureImpl.java,v 1.5 2005/05/23 11:20:54
rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.utils;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.gotm.api.utils.ComponentMap;
/**
* Implementation of a Factory Feature using string parameter.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:06 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="cpt-model" role="client"
signature="org.objectweb.fractal.api.Component"
* @fractal.itf name="cpt-pool" role="client"
signature="org.objectweb.gotm.api.utils.ComponentPool"
*/
@@ -46,7 +45,7 @@
/* (non-Javadoc)
* @see org.objectweb.fractal.api.control.BindingController#listFc()
*/
- public String[] listFc() {
+ public String[] clientFc() {
return new String[]{FACTORY_MODEL,ComponentMap.COMPONENT_MAP};
}
@@ -55,12 +54,7 @@
* @return reference to the component map used.
*/
protected ComponentMap getMap(){
- try {
- return (ComponentMap) lookupFc(ComponentMap.COMPONENT_MAP) ;
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (ComponentMap) fcBindings.get(ComponentMap.COMPONENT_MAP) ;
}
/* (non-Javadoc)
Index:
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java:1.4
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java:1.5
---
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java:1.4
Mon Jan 10 17:16:06 2005
+++
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessFactoryFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: StateLessFactoryFeatureImpl.java,v 1.4 2005/01/10 16:16:06 rouvoy Exp $
+ $Id: StateLessFactoryFeatureImpl.java,v 1.5 2005/05/23 11:20:54 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.utils;
@@ -40,8 +40,8 @@
* Implementation of a factory without persistent state.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 5 janv. 2005
- * @modified $Date: 2005/01/10 16:16:06 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:20:54 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="cpt-model" role="client"
signature="org.objectweb.fractal.api.Component"
*/
public class StateLessFactoryFeatureImpl
@@ -61,12 +61,7 @@
}
protected Component getTemplate() {
- try {
- return (Component) lookupFc(FACTORY_MODEL) ;
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (Component) fcBindings.get(FACTORY_MODEL) ;
}
/* (non-Javadoc)
@@ -76,9 +71,9 @@
try {
return Fractal.getFactory(getTemplate()).newFcInstance();
} catch (NoSuchInterfaceException e1) {
- getTrace().debug(e1.getMessage());
+ getLogger().log(ERROR,e1.getMessage());
} catch (InstantiationException e) {
- getTrace().debug(e.getMessage());
+ getLogger().log(ERROR,e.getMessage());
}
return null;
}
Index:
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java
diff -u
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java:1.4
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java:1.5
---
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java:1.4
Mon Jan 10 17:16:06 2005
+++
gotm/src/java/org/objectweb/gotm/lib/utils/StateLessStringFactoryFeatureImpl.java
Mon May 23 13:20:54 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
- $Id: StateLessStringFactoryFeatureImpl.java,v 1.4 2005/01/10 16:16:06
rouvoy Exp $
+ $Id: StateLessStringFactoryFeatureImpl.java,v 1.5 2005/05/23 11:20:54
rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.utils;
@@ -38,7 +38,7 @@
* Implementation of a factory with an identifier parameter but
* without persistent state.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @fractal.itf
*/
public class StateLessStringFactoryFeatureImpl
@@ -54,7 +54,7 @@
NameController nc = Fractal.getNameController(ci);
nc.setFcName(key);
} catch (NoSuchInterfaceException e) {
- getTrace().info(e.getMessage());
+ getLogger().log(ERROR,e.getMessage());
}
return ci;
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.