Mail Archive Home | fractal-commits List | Febuary 2006 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Friday, February 24, 2006 @ 14:22:16
Author: seintur
Path: /cvsroot/fractal/aokell
Modified:
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java
src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java
src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java
src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java
src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java
src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java
Removed:
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java
Unify helper methods (now all of them are located in FractalHelper) for
working with level 0 components and control components.
----------------------------------------------------------------------------------------------+
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java
| 6
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java
| 161 ----------
features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
| 8
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java
| 2
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java
| 4
features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java
| 4
src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java
| 8
src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java
| 2
src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java
| 4
src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java
| 2
src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java
| 126 ++++++-
11 files changed, 124 insertions(+), 203 deletions(-)
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java:1.3
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java:1.4
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java:1.3
Thu Feb 23 22:06:39 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/factory/MembraneFactoryImpl.java
Fri Feb 24 14:22:15 2006
@@ -31,7 +31,7 @@
import org.objectweb.fractal.aokell.lib.membrane.MembraneDef;
import org.objectweb.fractal.aokell.lib.membrane.Membranes;
import org.objectweb.fractal.aokell.lib.type.InterfaceTypeImpl;
-import org.objectweb.fractal.aokell.lib.util.MFractalHelper;
+import org.objectweb.fractal.aokell.lib.util.FractalHelper;
import org.objectweb.fractal.aokell.lib.util.MembraneHelper;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.Interface;
@@ -118,9 +118,9 @@
/*
* Initialize controllers.
*/
- Component[] subs = MFractalHelper.getAllSubComponents(membrane);
+ Component[] subs = FractalHelper.getAllSubComponents(membrane);
for (int i = 0; i < subs.length; i++) {
- Object subcontent = MFractalHelper.getContent(subs[i]);
+ Object subcontent = FractalHelper.getContent(subs[i]);
if( subcontent != null ) {
// subcontent may be null for composites
if( subcontent instanceof Controller ) {
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java:1.3
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java:removed
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java:1.3
Wed Feb 22 13:33:57 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MFractalHelper.java
Fri Feb 24 14:22:16 2006
@@ -1,161 +0,0 @@
-/***
- * AOKell
- * Copyright (C) 2005 INRIA, France Telecom
- *
- * 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 of the License, or (at your option) 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
- *
- * Contact: Lionel.Seinturier@xxxxxxx
- *
- * Author: Lionel Seinturier
- */
-
-package org.objectweb.fractal.aokell.lib.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.objectweb.fractal.aokell.lib.control.superc.SuperControllerItf;
-import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.Interface;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.BindingController;
-import org.objectweb.fractal.api.control.ContentController;
-import org.objectweb.fractal.api.control.NameController;
-import org.objectweb.fractal.api.control.SuperController;
-
-
-/**
- * Helper class for control components.
- *
- * @author Lionel Seinturier <Lionel.Seinturier@xxxxxxx>
- */
-public class MFractalHelper {
-
- /**
- * Returns the {@link BindingController} interface of the given
- * control component.
- */
- public static BindingController getBindingController(Component c) {
- return (BindingController)
- FractalHelper.getFcInterface(c,"binding-controller");
- }
-
- /**
- * Returns the {@link ContentController} interface of the given
- * control component.
- */
- public static ContentController getContentController(Component c) {
- return (ContentController)
- FractalHelper.getFcInterface(c,"content-controller");
- }
-
- /**
- * Returns the {@link SuperControllerItf} interface of the give
- * control component.
- */
- public static SuperControllerItf getSuperController(Component c) {
- return (SuperControllerItf)
- FractalHelper.getFcInterface(c,"super-controller");
- }
-
- /**
- * Returns the {@link NameController} interface of the given
- * control component.
- */
- public static NameController getNameController(Component c) {
- return (NameController)
- FractalHelper.getFcInterface(c,"name-controller");
- }
-
- public static Object getContent(Component c) {
- return FractalHelper.getFcInterface(c,"/content");
- }
-
- /**
- * Follow bindings and return the interface associated to the component
- * located at the end of the binding chain.
- */
- public static Interface followBindingsUpToLastInterface( Interface start
) {
-
- Object next = null;
- Component comp = null;
-
- do {
- comp = start.getFcItfOwner();
- BindingController bc = getBindingController(comp);
- try {
- next = bc.lookupFc(start.getFcItfName());
- if( next != null ) {
- start = (Interface) next;
- }
- }
- catch( NoSuchInterfaceException nsie ) {
- next = null;
- }
- }
- while( next != null );
-
- return start;
- }
-
- /**
- * Return all sub-components of the given component.
- */
- public static Component[] getAllSubComponents( Component c ) {
- List l = new ArrayList();
- addAllSubComponents(c,l);
- return (Component[]) l.toArray( new Component[l.size()] );
- }
-
- /**
- * Add all sub-components of the given component to the list.
- */
- public static void addAllSubComponents( Component c, List l ) {
-
- if( l == null ) {
- throw new IllegalArgumentException(
- "The given list (2nd parameter) must be non null");
- }
-
- l.add(c);
-
- try {
- ContentController cc =
- (ContentController) c.getFcInterface("content-controller");
- Component[] subs = cc.getFcSubComponents();
- for (int i = 0; i < subs.length; i++) {
- addAllSubComponents(subs[i],l);
- }
- }
- catch( NoSuchInterfaceException nsie ) {
- // A non composite component has been reached
- }
- }
-
- /**
- * Traverse the super-hierarchy to return the root component.
- */
- public static Component getTopMostComponent( Component c ) {
-
- SuperController sc = MFractalHelper.getSuperController(c);
- Component[] sups = sc.getFcSuperComponents();
- if( sups.length == 0 ) {
- // No more supers. We have reached the top.
- return c;
- }
-
- return getTopMostComponent(sups[0]);
- }
-}
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.6
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.7
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.6
Thu Feb 23 22:06:39 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
Fri Feb 24 14:22:15 2006
@@ -50,9 +50,9 @@
Interface itf =
(Interface) FractalHelper.getFcInterface(comp,"//component");
- Interface last = MFractalHelper.followBindingsUpToLastInterface(itf);
+ Interface last = FractalHelper.followBindingsUpToLastInterface(itf);
Component c = last.getFcItfOwner();
- Object content = MFractalHelper.getContent(c);
+ Object content = FractalHelper.getContent(c);
return (Component) content;
}
@@ -67,10 +67,10 @@
for (int i = 0; i < ctrls.length; i++) {
if( ctrls[i] instanceof Interface ) {
Interface itf =
- MFractalHelper.followBindingsUpToLastInterface(
+ FractalHelper.followBindingsUpToLastInterface(
(Interface) ctrls[i] );
Component c = itf.getFcItfOwner();
- Object content = MFractalHelper.getContent(c);
+ Object content = FractalHelper.getContent(c);
impls.add(content);
}
}
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java:1.1
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java:1.2
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java:1.1
Sat Feb 11 06:43:53 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/BindingBuilder.java
Fri Feb 24 14:22:15 2006
@@ -110,7 +110,7 @@
}
if (server != null) {
// if (client.startsWith("P") ){
- pw.print("MFractalHelper.getBindingController(");
+ pw.print("FractalHelper.getBindingController(");
pw.print(client);
pw.print(").bindFc(");
pw.print("\"");
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java:1.1
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java:1.2
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java:1.1
Sat Feb 11 06:43:53 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/ComponentBuilder.java
Fri Feb 24 14:22:15 2006
@@ -47,13 +47,13 @@
final Object context)
{
PrintWriter pw = (PrintWriter)((Map)context).get("printwriter");
- pw.print("MFractalHelper.getContentController(");
+ pw.print("FractalHelper.getContentController(");
pw.print(superComponent);
pw.print(").addFcSubComponent(");
pw.print(subComponent);
pw.println(");");
- pw.print("MFractalHelper.getSuperController(");
+ pw.print("FractalHelper.getSuperController(");
pw.print(subComponent);
pw.print(").addFcSuperComponent(");
pw.print(superComponent);
Index:
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java
diff -u
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java:1.1
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java:1.2
---
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java:1.1
Sat Feb 11 06:43:53 2006
+++
aokell/features/membrane/comp/src/org/objectweb/fractal/aokell/tools/membrane/MembraneCompiler.java
Fri Feb 24 14:22:15 2006
@@ -40,7 +40,7 @@
import org.objectweb.fractal.aokell.lib.factory.TypeFactoryImpl;
import org.objectweb.fractal.aokell.lib.membrane.MembraneDef;
import org.objectweb.fractal.aokell.lib.membrane.StaticFactoryItf;
-import org.objectweb.fractal.aokell.lib.util.MFractalHelper;
+import org.objectweb.fractal.aokell.lib.util.FractalHelper;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.factory.GenericFactory;
import org.objectweb.fractal.api.type.ComponentType;
@@ -180,7 +180,7 @@
pw.println("import "+TypeFactory.class.getName()+";");
pw.println("import "+GenericFactoryImpl.class.getName()+";");
pw.println("import "+TypeFactoryImpl.class.getName()+";");
- pw.println("import "+MFractalHelper.class.getName()+";");
+ pw.println("import "+FractalHelper.class.getName()+";");
pw.println();
pw.print("public class "+classname);
Index:
aokell/src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java
diff -u
aokell/src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java:1.5
aokell/src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java:1.6
---
aokell/src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java:1.5
Wed Feb 22 13:33:57 2006
+++
aokell/src/org/objectweb/fractal/aokell/lib/control/binding/AbstractBindingControllerImpl.java
Fri Feb 24 14:22:15 2006
@@ -221,7 +221,7 @@
Interface dstItf = (Interface) arg1;
Component dstItfOwner = dstItf.getFcItfOwner();
BindingControllerItf bc =
- FractalHelper.getBindingController(dstItfOwner);
+ FractalHelper.getBindingControllerItf(dstItfOwner);
bc.reverseBindFc( dstItf.getFcItfName(), itf );
}
@@ -301,7 +301,7 @@
// Remove the reverse binding
Interface dstItf = (Interface) arg1;
Component dstItfOwner = dstItf.getFcItfOwner();
- BindingControllerItf bc =
FractalHelper.getBindingController(dstItfOwner);
+ BindingControllerItf bc =
FractalHelper.getBindingControllerItf(dstItfOwner);
bc.reverseUnbindFc( dstItf.getFcItfName(), itf );
}
@@ -602,7 +602,7 @@
* created component.
*/
Map newContent = (Map) hints;
- BindingController newBc = FractalHelper.getBindingController(dst);
+ BindingController newBc = FractalHelper.getBindingControllerItf(dst);
for (Iterator iter = bindings.entrySet().iterator();
iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
@@ -655,7 +655,7 @@
// interface
Object dstBoundItf = null;
if( boundItf.isFcInternalItf() ) {
- ContentController cc =
FractalHelper.getContentController(dstBound);
+ ContentController cc =
FractalHelper.getContentControllerItf(dstBound);
dstBoundItf = cc.getFcInternalInterface(boundItfName);
}
else {
Index:
aokell/src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java
diff -u
aokell/src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java:1.3
aokell/src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java:1.4
---
aokell/src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java:1.3
Thu Feb 23 21:37:51 2006
+++
aokell/src/org/objectweb/fractal/aokell/lib/control/component/ComponentImpl.java
Fri Feb 24 14:22:16 2006
@@ -199,7 +199,7 @@
// Add client collection interfaces currently bound
List colItfs = new ArrayList();
- BindingControllerItf bc = FractalHelper.getBindingController(this);
+ BindingControllerItf bc =
FractalHelper.getBindingControllerItf(this);
List collectionInterfaces = getFcCollectionInterfaces();
List boundedCollectionInterfaceNames = new ArrayList();
Index:
aokell/src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java
diff -u
aokell/src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java:1.3
aokell/src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java:1.4
---
aokell/src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java:1.3
Wed Feb 15 02:53:02 2006
+++
aokell/src/org/objectweb/fractal/aokell/lib/control/content/ContentControllerImpl.java
Fri Feb 24 14:22:16 2006
@@ -176,7 +176,7 @@
}
// Test on bindings
- BindingControllerItf bc = FractalHelper.getBindingController(arg0);
+ BindingControllerItf bc =
FractalHelper.getBindingControllerItf(arg0);
boolean isBound = bc.isFcBound();
boolean isRBound = bc.isFcReverseBound();
if( isBound || isRBound ) {
@@ -458,7 +458,7 @@
// Get the content of the composite.
// Recursively instantiate contained component and add them to dst.
- ContentController newCc = FractalHelper.getContentController(dst);
+ ContentController newCc = FractalHelper.getContentControllerItf(dst);
// Map storing associations between components in contained in the
// current composite and their associated newly created component.
Index:
aokell/src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java
diff -u
aokell/src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java:1.1
aokell/src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java:1.2
---
aokell/src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java:1.1
Sat Feb 11 06:43:54 2006
+++
aokell/src/org/objectweb/fractal/aokell/lib/control/factory/CompositeFactoryImpl.java
Fri Feb 24 14:22:15 2006
@@ -80,7 +80,7 @@
newContent.put( cdi, newComponent );
// Recursively instantiate sub-components
- ContentController cc = FractalHelper.getContentController(component);
+ ContentController cc =
FractalHelper.getContentControllerItf(component);
Component[] content = cc.getFcSubComponents();
for (int i = 0; i < content.length; i++) {
FactoryItf f = FractalHelper.getFactory(content[i]);
Index: aokell/src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java
diff -u
aokell/src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java:1.3
aokell/src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java:1.4
--- aokell/src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java:1.3
Wed Feb 15 03:03:03 2006
+++ aokell/src/org/objectweb/fractal/aokell/lib/util/FractalHelper.java Fri
Feb 24 14:22:15 2006
@@ -23,6 +23,9 @@
package org.objectweb.fractal.aokell.lib.util;
+import java.util.ArrayList;
+import java.util.List;
+
import org.objectweb.fractal.aokell.lib.control.binding.BindingControllerItf;
import org.objectweb.fractal.aokell.lib.control.content.ContentControllerItf;
import org.objectweb.fractal.aokell.lib.control.factory.FactoryItf;
@@ -33,6 +36,7 @@
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.AttributeController;
import org.objectweb.fractal.api.control.BindingController;
+import org.objectweb.fractal.api.control.ContentController;
import org.objectweb.fractal.api.control.IllegalBindingException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.api.control.LifeCycleController;
@@ -40,6 +44,7 @@
import org.objectweb.fractal.api.control.SuperController;
import org.objectweb.fractal.api.factory.GenericFactory;
import org.objectweb.fractal.api.type.TypeFactory;
+import org.objectweb.fractal.util.Fractal;
/**
@@ -71,22 +76,43 @@
}
/**
+ * Returns the {@link BindingController} interface of the given
component.
+ *
+ * @param c a component.
+ * @return the {@link BindingController} interface of the given
component.
+ */
+ public static BindingController getBindingController(Component c) {
+ return (BindingController)
+ getFcInterface(c,"binding-controller");
+ }
+
+ /**
* Returns the {@link BindingControllerItf} interface of the given
component.
*
* @param c a component.
* @return the {@link BindingControllerItf} interface of the given
component.
*/
- public static BindingControllerItf getBindingController(Component c) {
+ public static BindingControllerItf getBindingControllerItf(Component c) {
return (BindingControllerItf) getFcInterface(c,"binding-controller");
}
/**
+ * Returns the {@link ContentController} interface of the given
component.
+ *
+ * @param c a component.
+ * @return the {@link ContentController} interface of the given
component.
+ */
+ public static ContentController getContentController(Component c) {
+ return (ContentController) getFcInterface(c,"content-controller");
+ }
+
+ /**
* Returns the {@link ContentControllerItf} interface of the given
component.
*
* @param c a component.
* @return the {@link ContentControllerItf} interface of the given
component.
*/
- public static ContentControllerItf getContentController(Component c) {
+ public static ContentControllerItf getContentControllerItf(Component c) {
return (ContentControllerItf) getFcInterface(c,"content-controller");
}
@@ -152,10 +178,6 @@
return (TypeFactory) getFcInterface(c,"type-factory");
}
- public static Object getContent(Component c) {
- return getFcInterface(c,"/content");
- }
-
/**
* Bind the given destination interface to the given client interface
name.
*
@@ -216,6 +238,72 @@
}
/**
+ * Return the fully-qualified name of a component, i.e. a slash-separated
+ * string of names reflecting the hierarchy of nested components.
+ */
+ public static String getFcFullyQualifiedName( Component comp ) {
+
+ SuperController sc = getSuperController(comp);
+ Component[] supers = sc.getFcSuperComponents();
+ if( supers.length == 0 ) {
+ return "/"+getNameController(comp).getFcName();
+ }
+
+ return
+ getFcFullyQualifiedName(supers[0])+"/"+
+ getNameController(comp).getFcName();
+ }
+
+ /**
+ * Traverse the super-hierarchy to return the root component.
+ */
+ public static Component getTopMostComponent( Component c ) {
+
+ SuperController sc = getSuperController(c);
+ Component[] sups = sc.getFcSuperComponents();
+ if( sups.length == 0 ) {
+ // No more supers. We have reached the top.
+ return c;
+ }
+
+ return getTopMostComponent(sups[0]);
+ }
+
+ /**
+ * Return all sub-components of the given component.
+ */
+ public static Component[] getAllSubComponents( Component c ) {
+ List l = new ArrayList();
+ FractalHelper.addAllSubComponents(c,l);
+ return (Component[]) l.toArray( new Component[l.size()] );
+ }
+
+ /**
+ * Add all sub-components of the given component to the list.
+ */
+ public static void addAllSubComponents( Component c, List l ) {
+
+ if( l == null ) {
+ throw new IllegalArgumentException(
+ "The given list (2nd parameter) must be non null");
+ }
+
+ l.add(c);
+
+ try {
+ ContentController cc =
+ (ContentController) c.getFcInterface("content-controller");
+ Component[] subs = cc.getFcSubComponents();
+ for (int i = 0; i < subs.length; i++) {
+ addAllSubComponents(subs[i],l);
+ }
+ }
+ catch( NoSuchInterfaceException nsie ) {
+ // A non composite component has been reached
+ }
+ }
+
+ /**
* Follow bindings and return the interface associated to the component
* located at the end of the binding chain.
*/
@@ -226,8 +314,14 @@
do {
comp = start.getFcItfOwner();
- BindingController bc = getBindingController(comp);
try {
+ /*
+ * Fractal.getBindingController() is more general than than
+ * getBindingController() defined in this class. It works
also
+ * for componentized membrane which "simply" implements
+ * BindingController (and not BindingControllerItf).
+ */
+ BindingController bc = Fractal.getBindingController(comp);
next = bc.lookupFc(start.getFcItfName());
if( next != null ) {
start = (Interface) next;
@@ -242,20 +336,8 @@
return start;
}
- /**
- * Return the fully-qualified name of a component, i.e. a slash-separated
- * string of names reflecting the hierarchy of nested components.
- */
- public static String getFcFullyQualifiedName( Component comp ) {
-
- SuperController sc = getSuperController(comp);
- Component[] supers = sc.getFcSuperComponents();
- if( supers.length == 0 ) {
- return "/"+getNameController(comp).getFcName();
- }
-
- return
- getFcFullyQualifiedName(supers[0])+"/"+
- getNameController(comp).getFcName();
+ public static Object getContent(Component c) {
+ return getFcInterface(c,"/content");
}
+
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.