Mail Archive Home | fractal-commits List | Febuary 2006 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Saturday, February 25, 2006 @ 14:42:17
Author: seintur
Path: .../membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane
Modified: MPrimitiveImpl.java
Componentized membranes: control-components now supports collection
interfaces.
---------------------+
MPrimitiveImpl.java | 57 ++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 4 deletions(-)
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane/MPrimitiveImpl.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane/MPrimitiveImpl.java:1.2
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane/MPrimitiveImpl.java:1.3
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane/MPrimitiveImpl.java:1.2
Wed Feb 22 13:33:57 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/membrane/MPrimitiveImpl.java
Sat Feb 25 14:42:17 2006
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -114,6 +115,8 @@
}
}
+ // TODO support dynamically created collection interface instances
+
if( interfaceName.equals("/content") ) {
return content;
}
@@ -136,6 +139,35 @@
protected List fcInterfaces = new ArrayList();
+ private Set getFcSingletonClientItfTypeNames() {
+ if( singletonClientItfTypeNames == null ) {
+ singletonClientItfTypeNames = new HashSet();
+ InterfaceType[] its =
((ComponentType)type).getFcInterfaceTypes();
+ for (int i = 0; i < its.length; i++) {
+ if( its[i].isFcClientItf() && ! its[i].isFcCollectionItf() )
{
+ singletonClientItfTypeNames.add(its[i].getFcItfName());
+ }
+ }
+ }
+ return singletonClientItfTypeNames;
+ }
+
+ private Set getFcCollectionClientItfTypeNames() {
+ if( collectionClientItfTypeNames == null ) {
+ collectionClientItfTypeNames = new HashSet();
+ InterfaceType[] its =
((ComponentType)type).getFcInterfaceTypes();
+ for (int i = 0; i < its.length; i++) {
+ if( its[i].isFcClientItf() && its[i].isFcCollectionItf() ) {
+ collectionClientItfTypeNames.add(its[i].getFcItfName());
+ }
+ }
+ }
+ return collectionClientItfTypeNames;
+ }
+
+ private Set singletonClientItfTypeNames;
+ private Set collectionClientItfTypeNames;
+
// -----------------------------------------------------------------
// Implementation of the BindingController interface
@@ -151,15 +183,32 @@
private Map fcBindings = new HashMap();
public String[] listFc() {
- Set keys = fcBindings.keySet();
+ Set keys = getFcSingletonClientItfTypeNames();
return (String[]) keys.toArray( new String[keys.size()] );
}
public Object lookupFc(String arg0) throws NoSuchInterfaceException {
- if( ! fcBindings.containsKey(arg0) ) {
- throw new NoSuchInterfaceException(arg0);
+
+ // Singleton client interfaces
+ if( fcBindings.containsKey(arg0) ) {
+ return fcBindings.get(arg0);
}
- return fcBindings.get(arg0);
+
+ // Collection client interfaces
+ Set col = getFcCollectionClientItfTypeNames();
+ if( col.contains(arg0) ) {
+ List bound = new ArrayList();
+ for (Iterator iter = fcBindings.entrySet().iterator();
iter.hasNext();) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String itfName = (String) entry.getKey();
+ if( itfName.startsWith(arg0) ) {
+ bound.add( entry.getValue() );
+ }
+ }
+ return bound;
+ }
+
+ throw new NoSuchInterfaceException(arg0);
}
public void bindFc(String arg0, Object arg1)
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.