OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | gotm-commits List | June 2005 Index

<--  Date Index  --> <--  Thread Index  -->

CVS update of gotm (6 files)


    Date: Tuesday, June 28, 2005 @ 10:15:39
  Author: rouvoy
    Path: /cvsroot/gotm/gotm

Modified: .cvsignore build.xml
          src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java
          src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
          src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java
          src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java

* improving the propagation strategies of EventEngine and ResourceManager
* updating the ant build.xml file.


------------------------------------------------------------------+
 .cvsignore                                                       |    2 
 build.xml                                                        |  104 
++++------
 src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java     |   18 -
 src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java |   17 -
 src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java       |   17 -
 src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java |   17 -
 6 files changed, 82 insertions(+), 93 deletions(-)


Index: gotm/.cvsignore
diff -u gotm/.cvsignore:1.3 gotm/.cvsignore:1.4
--- gotm/.cvsignore:1.3 Fri Feb  4 18:44:33 2005
+++ gotm/.cvsignore     Tue Jun 28 10:15:39 2005
@@ -1,3 +1,5 @@
 build
 dist
 output
+alias.xml
+build.properties
Index: gotm/build.xml
diff -u gotm/build.xml:1.6 gotm/build.xml:1.7
--- gotm/build.xml:1.6  Wed Mar  2 16:25:30 2005
+++ gotm/build.xml      Tue Jun 28 10:15:39 2005
@@ -21,36 +21,67 @@
 <!-- Initial developer(s): Romain Rouvoy.                                 -->
 <!-- Contributor(s): ______________________________________.              -->
 
-<!-- $Id: build.xml,v 1.6 2005/03/02 15:25:30 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.7 2005/06/28 08:15:39 rouvoy Exp $ -->
 <!-- ==================================================================== -->
 
 <project name="GoTM" default="all">
   <description>GoTM Project [gotm.objectweb.org] - GoTM is an open 
Transaction Monitor</description>
 
+
   <!-- ==================== -->
   <!-- PROPERTY DEFINITIONS -->
   <!-- ==================== -->
-  <import file="${basedir}/../fractal-import/build.xml"/>
+
+  <import file="${basedir}/../fractal-import/build.xml" optional="on"/>
   <property name="gotm.jar"     value="ow-gotm.jar"/>
   <property name="gotm.dist"    value="GoTM"/>
   <property name="gotm.version" value="0.3"/>
 
+  <property name="dist-src" value="${gotm.dist}-${gotm.version}-src" />
+  <property name="dist-bin" value="${gotm.dist}-${gotm.version}-bin" />
+
+  <property name="dist-src.dir" value="${dist.dir}/${dist-src}" />
+  <property name="dist-bin.dir" value="${dist.dir}/${dist-bin}" />
+
+
   <!-- ================ -->
   <!-- PATH DEFINITIONS -->
   <!-- ================ -->
+
   <path id="classpath">
-    <fileset dir="${build.dir}/${lib.dir}" includes="**/*.jar"/>
+    <fileset dir="${basedir}" includes="${lib.dir}/**/*.jar"/>
+    <fileset dir="${build.dir}" includes="${lib.dir}/**/*.jar"/>
   </path>
 
-  <!-- ================== -->
-  <!-- TARGET DEFINITIONS -->
-  <!-- ================== -->
+
+  <!-- ======================= -->
+  <!-- MAIN TARGET DEFINITIONS -->
+  <!-- ======================= -->
+
   <target name="all" description="clean + import">
     <antcall target="clean"/>
     <antcall target="import"/>
   </target>
 
-  <target name="-gotm-prepare" depends="-fractal.pool">
+  <target name="import" depends="gotm-build,clear"/>
+
+  <target name="export" depends="-gotm-prepare"
+          description="Exports the module into the ${dist.dir} directory">
+    <mkdir dir="${dist-src.dir}" />
+    <copy todir="${dist-src.dir}">
+      <fileset dir="${basedir}" includes="**/*.*" excludes="output/**"/>
+      <fileset dir="${build.dir}" includes="**/*.*"/>
+    </copy>
+  </target>
+
+  <target name="distrib" depends="gotm-dist-src,gotm-dist-bin" 
+   description="build all distributions"/>
+
+  <!-- ====================== -->
+  <!-- SUB TARGET DEFINITIONS -->
+  <!-- ====================== -->
+
+  <target name="-gotm-prepare" depends="copy-alias,-fractal.pool">
     <ant dir="${basedir}/../ow-transaction" target="tx-build"/>
     <copy todir="${build.dir}/${lib.dir}">
       <mapper type="flatten"/>
@@ -58,75 +89,36 @@
     </copy>
   </target>
 
-  <target name="gotm-compile" depends="-gotm-prepare,-fc.xdoclet">
+  <target name="gotm-compile" depends="-gotm-prepare,-fcDoclet">
     <mkdir dir="${build.dir}/${class.dir}"/>
     <java.c srcdir="${basedir}/${src.dir}/${java.dir}" />
-    <fc.xdoclet>
+    <fcDoclet>
       <fileset dir="${basedir}/../ow-transaction/${src.dir}/${java.dir}" 
           includes="**/*.java"/>
-    </fc.xdoclet>
+    </fcDoclet>
   </target>
 
-  <target name="gotm-build" depends="gotm-compile,fractal-adl" 
-   description="Builds GoTM framework.">
+  <target name="gotm-build" depends="gotm-compile,fractal-adl">
     <jar destfile="${build.dir}/${lib.dir}/${gotm.jar}">
       <fileset dir="${build.dir}/${class.dir}"/>
     </jar>
   </target>
 
-  <target name="import" depends="gotm-build,clear"/>
-  
   <target name="gotm-jdoc" depends="-gotm-prepare"
    description="Generates the javadoc.">
     <java.doc/>
   </target>
 
-  <target name="gotm-dist-src" description="Builds the source distribution.">
-    <property name="dist-src" value="${gotm.dist}-${gotm.version}-src" />
-    <property name="dist-src.dir" value="${dist.dir}/${dist-src}" />
-    <mkdir dir="${dist-src.dir}" />
-    <copy todir="${dist-src.dir}" file="${basedir}/build.xml" />
-    <mkdir dir="${dist-src.dir}/${src.dir}" />
-    <copy todir="${dist-src.dir}/${src.dir}">
-      <fileset dir="${basedir}/${src.dir}" includes="**/*" />
-    </copy>
-    <mkdir dir="${dist-src.dir}/${doc.dir}" />
-    <copy todir="${dist-src.dir}/${doc.dir}">
-      <fileset dir="${basedir}/${doc.dir}" includes="**/*" />
-    </copy>
-    <zip zipfile="${dist.dir}/${dist-src}.zip">
-      <fileset dir="${dist.dir}" includes="${dist-src}/**/*" />
-    </zip>
-    <tar destfile="${dist.dir}/${dist-src}.tar" longfile="gnu">
-      <tarfileset dir="${dist.dir}" includes="${dist-src}/**/*" />
-    </tar>
-    <gzip src="${dist.dir}/${dist-src}.tar" 
-      zipfile="${dist.dir}/${dist-src}.tar.gz" />
-    <bzip2 src="${dist.dir}/${dist-src}.tar" 
-       zipfile="${dist.dir}/${dist-src}.tar.bz2" />
-  </target>
-
-  <target name="gotm-dist-bin" depends="gotm-build,gotm-jdoc" 
-   description="Builds the binary distribution.">
-    <property name="dist-bin"     value="${gotm.dist}-${gotm.version}-bin"/>
-    <property name="dist-bin.dir" value="${dist.dir}/${dist-bin}"/>
+  <target name="gotm-dist-src" depends="export">
+    <archive dir="${dist.dir}" includes="${dist-src}"/>
+  </target>
+
+  <target name="gotm-dist-bin" depends="gotm-build,gotm-jdoc">
     <mkdir dir="${dist-bin.dir}"/>
     <copy todir="${dist-bin.dir}">
       <fileset dir="${build.dir}" includes="${doc.dir}/**/*"/>
       <fileset dir="${build.dir}" includes="${lib.dir}/**/*"/>
     </copy>
-    <zip zipfile="${dist.dir}/${dist-bin}.zip">
-      <fileset dir="${dist.dir}" includes="${dist-bin}/**/*"/>
-    </zip>
-    <tar destfile="${dist.dir}/${dist-bin}.tar" longfile="gnu">
-      <tarfileset dir="${dist.dir}" includes="${dist-bin}/**/*"/>
-    </tar>
-    <gzip src="${dist.dir}/${dist-bin}.tar" 
-      zipfile="${dist.dir}/${dist-bin}.tar.gz"/>
-    <bzip2 src="${dist.dir}/${dist-bin}.tar" 
-       zipfile="${dist.dir}/${dist-bin}.tar.bz2"/>
+    <archive dir="${dist.dir}" includes="${dist-bin}"/>
   </target>
-
-  <target name="gotm-dist" depends="gotm-dist-src,gotm-dist-bin" 
-   description="build all distributions"/>
 </project>
Index: gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java
diff -u gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.4 
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.5
--- gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java:1.4     
  Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/EventEngineSimple.java   Tue 
Jun 28 10:15:39 2005
@@ -23,13 +23,12 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: EventEngineSimple.java,v 1.4 2005/05/23 11:20:55 rouvoy Exp $
+$Id: EventEngineSimple.java,v 1.5 2005/06/28 08:15:39 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 +40,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 12 janv. 2005
- * @modified $Date: 2005/05/23 11:20:55 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/06/28 08:15:39 $
+ * @version $Revision: 1.5 $
  * @fractal.itf
  */
 public class EventEngineSimple
@@ -52,7 +51,7 @@
         /**
          * Map containing all the available <code>topics</code>.
          */
-        private Map topics = new Hashtable();
+        private Map topics = new HashMap();
 
         /**
          * @param topic the identifier of the requested topic
@@ -105,10 +104,9 @@
         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);
-            }
+            Object[] listeners = getTopic(topic).toArray(); // Iterators are 
less performing than arrays
+            for(int i=0 ; i <listeners.length;i++)
+                ((PublishFeature)listeners[i]).notify(topic, context);
         }
 
         /* (non-Javadoc)
Index: gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java
diff -u 
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.2 
gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java:1.2 
  Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/event/EventEngineThreadPool.java     
  Tue Jun 28 10:15:39 2005
@@ -23,14 +23,13 @@
  Contributor(s): .
  
  ---------------------------------------------------------------------
- $Id: EventEngineThreadPool.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
+ $Id: EventEngineThreadPool.java,v 1.3 2005/06/28 08:15:39 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;
 
@@ -42,8 +41,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 5 janv. 2005
- * @modified $Date: 2005/05/23 11:20:55 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/06/28 08:15:39 $
+ * @version $Revision: 1.3 $
  * @fractal.itf name="runnable-manager" role="client" 
signature="org.objectweb.util.thread.api.RunnableManager"
  */
 public class EventEngineThreadPool 
@@ -53,7 +52,7 @@
     /**
      * Map containing all the available <code>topics</code>.
      */
-    private final Map topics = new Hashtable();
+    private final Map topics = new HashMap();
     
     /* (non-Javadoc)
      * @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
@@ -106,9 +105,9 @@
     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));
-        }
+        Object[] listeners = getTopic(topic).toArray(); // Iterators are 
less performing than arrays
+        for(int i=0 ; i <listeners.length;i++)
+            getRunnableManager().submitRunnable(new 
NotifyAction((PublishFeature)listeners[i],topic,context));
     }
 
     /* (non-Javadoc)
Index: gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java
diff -u gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.3 
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.4
--- gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java:1.3 Mon 
May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/ResourceImpl.java     Tue 
Jun 28 10:15:39 2005
@@ -23,13 +23,11 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: ResourceImpl.java,v 1.3 2005/05/23 11:20:55 rouvoy Exp $
+$Id: ResourceImpl.java,v 1.4 2005/06/28 08:15:39 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;
 
@@ -39,8 +37,8 @@
 /**
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 1 févr. 2005
- * @modified $Date: 2005/05/23 11:20:55 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/06/28 08:15:39 $
+ * @version $Revision: 1.4 $
  * @fractal.itf
  */
 public abstract class ResourceImpl              
@@ -51,7 +49,7 @@
     private final Set observers = new HashSet();
 
     /** list of available actions. */
-    private final Hashtable actions ;
+    private final Map actions ;
     
     /**
      * Default constructor.
@@ -68,7 +66,7 @@
      * Defines the list of available actions for the associated resource.
      * @return the list of labelled actions.
      */
-    protected abstract Hashtable declareActions() ;
+    protected abstract Map declareActions() ;
 
     /* (non-Javadoc)
      * @see 
org.objectweb.gotm.lib.event.Resource#addResource(java.lang.Object)
@@ -98,9 +96,10 @@
         Action action = getAction(topic);
         if (getLogger().isLoggable(ERROR))
             getLogger().log(DEBUG,"Propagating "+topic);
-        for (Iterator i = this.observers.iterator() ; i.hasNext() ;) {
+        Object[] listeners = this.observers.toArray();
+        for (int i=0 ; i < listeners.length ; i++) {
             try {
-                action.execute(context,i.next());
+                action.execute(context,listeners[i]);
             } catch (NullPointerException ex) {
                 throw new RuntimeException("No Action available for "+topic);
             } catch (Exception 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.2 
gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java:1.3
--- gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java:1.2 
  Mon May 23 13:20:55 2005
+++ gotm/src/java/org/objectweb/gotm/lib/resource/ResourceWithThread.java     
  Tue Jun 28 10:15:39 2005
@@ -23,14 +23,12 @@
 Contributor(s): .
 
 ---------------------------------------------------------------------
-$Id: ResourceWithThread.java,v 1.2 2005/05/23 11:20:55 rouvoy Exp $
+$Id: ResourceWithThread.java,v 1.3 2005/06/28 08:15:39 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;
 
@@ -42,8 +40,8 @@
  * Implementation of a wrapper.
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
  * @created 22 déc. 2004
- * @modified $Date: 2005/05/23 11:20:55 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/06/28 08:15:39 $
+ * @version $Revision: 1.3 $
  * @fractal.itf
  */
 public abstract class ResourceWithThread 
@@ -54,7 +52,7 @@
     private Set observers = new HashSet();
     
     /** list of available actions. */
-    private final Hashtable actions ;
+    private final Map actions ;
     
     /* (non-Javadoc)
      * @see org.objectweb.fractal.lib.BindablePrimitive#clientFc()
@@ -80,7 +78,7 @@
      * Defines the list of available actions for the associated resource.
      * @return the list of labelled actions.
      */
-    protected abstract Hashtable declareActions() ;
+    protected abstract Map declareActions() ;
 
 
     /* (non-Javadoc)
@@ -103,9 +101,10 @@
     public void notify(int topic, Map context) {
 //        Vector v = new Vector();
         Action action = getAction(topic);
-        for (Iterator i = this.observers.iterator() ; i.hasNext() ;) {
+        Object[] listeners = this.observers.toArray();
+        for (int i=0 ; i < listeners.length ; i++) {
             try {
-                Thread t = new RunnableAction(action,context,i.next());
+                Thread t = new RunnableAction(action,context,listeners[i]);
                 t.start();
 //                v.add(t);
             } catch (Exception ex) {



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.