OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


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

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

CVS update of fractal-template/src/java/org/objectweb/fractal/lib (2 files)


    Date: Friday, August 12, 2005 @ 14:23:54
  Author: rouvoy
    Path: /cvsroot/gotm/fractal-template/src/java/org/objectweb/fractal/lib

   Added: FcCollection.java
Modified: BindablePrimitive.java

* Adding shortcut to support Client collection interfaces (new method 
collectionFc(String)).


------------------------+
 BindablePrimitive.java |   13 ++++++++-
 FcCollection.java      |   62 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 2 deletions(-)


Index: 
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java
diff -u 
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.8
 
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.9
--- 
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java:1.8
      Fri Aug  5 17:06:31 2005
+++ 
fractal-template/src/java/org/objectweb/fractal/lib/BindablePrimitive.java  
Fri Aug 12 14:23:54 2005
@@ -23,10 +23,11 @@
  Contributor(s): .
  
  ---------------------------------------------------------------------
- $Id: BindablePrimitive.java,v 1.8 2005/08/05 15:06:31 rouvoy Exp $
+ $Id: BindablePrimitive.java,v 1.9 2005/08/12 12:23:54 rouvoy Exp $
  ====================================================================*/
 package org.objectweb.fractal.lib;
 
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -41,7 +42,7 @@
  * Client interfaces are now retrieved via the 
  * <code>Object lookFc(String)</code> method.
  * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
  * @fractal.itf
  */
 public abstract class BindablePrimitive 
@@ -101,6 +102,14 @@
         return this.fcBindings.get(checkBinding(arg0));
     }
     
+    /**
+     * @param root the root name of the collection.
+     * @return a collection of client bindings whose name stars with 'root'. 
+     */
+    public Collection collectionFc(String root) {
+        return new FcCollection(this,root);
+    }
+    
     /* (non-Javadoc)
      * @see 
org.objectweb.fractal.api.control.BindingController#bindFc(java.lang.String, 
java.lang.Object)
      */
Index: fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java
diff -u /dev/null 
fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java:1.1
--- /dev/null   Fri Aug 12 14:23:54 2005
+++ fractal-template/src/java/org/objectweb/fractal/lib/FcCollection.java     
  Fri Aug 12 14:23:54 2005
@@ -0,0 +1,62 @@
+/*====================================================================
+
+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: FcCollection.java,v 1.1 2005/08/12 12:23:54 rouvoy Exp $
+====================================================================*/
+package org.objectweb.fractal.lib;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.objectweb.fractal.api.NoSuchInterfaceException;
+import org.objectweb.fractal.api.control.BindingController;
+
+/**
+ * @author <a href="mailto:Romain.Rouvoy@xxxxxxx";>Romain Rouvoy</a>
+ * @created 12 août 2005
+ * @modified $Date: 2005/08/12 12:23:54 $
+ * @version $Revision: 1.1 $
+ * @fractal.itf 
+ */
+public class FcCollection
+        extends ArrayList {
+    
+    /**
+     * @param bc the binding controller used to build the collection.
+     * @param name the root name of the collection.
+     */
+    public FcCollection(BindingController bc, String name){
+        for (Iterator itfs = 
Arrays.asList(bc.listFc()).iterator();itfs.hasNext();) {
+            String itf = (String) itfs.next();
+            if (itf.startsWith(name))
+                try {
+                    add(bc.lookupFc(itf));
+                } catch (NoSuchInterfaceException e) {
+                    //ignored
+                }
+        }
+    }
+}



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

Reply via email to:

Powered by MHonArc.

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