Mail Archive Home | fractal-commits List | March 2006 Index
| <-- Date Index --> | <-- Thread Index --> |
Date: Friday, March 24, 2006 @ 13:30:44
Author: seintur
Path: .../features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util
Modified: MembraneHelper.java
New helper method duplicateMembraneDef.
Feature requested by Guillaume Dufrene.
---------------------+
MembraneHelper.java | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+)
Index:
aokell/features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
diff -u
aokell/features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.10
aokell/features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.11
---
aokell/features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java:1.10
Fri Feb 24 14:43:06 2006
+++
aokell/features/membrane/oo/src/org/objectweb/fractal/aokell/lib/util/MembraneHelper.java
Fri Mar 24 13:30:43 2006
@@ -23,11 +23,13 @@
package org.objectweb.fractal.aokell.lib.util;
+import org.objectweb.fractal.aokell.Membranes;
import org.objectweb.fractal.aokell.lib.control.binding.BindingControllerItf;
import org.objectweb.fractal.aokell.lib.control.component.ComponentItf;
import org.objectweb.fractal.aokell.lib.control.content.ContentControllerItf;
import
org.objectweb.fractal.aokell.lib.control.lifecycle.LifeCycleControllerItf;
import org.objectweb.fractal.aokell.lib.control.superc.SuperControllerItf;
+import org.objectweb.fractal.aokell.lib.membrane.MembraneDef;
import org.objectweb.fractal.api.Component;
@@ -102,4 +104,34 @@
public static Object getFcContent( Component comp ) {
return FractalHelper.getContent(comp);
}
+
+ /**
+ * Duplicate an existing membrane definition.
+ * The purpose of this method is to facilitate the creation of new
membrane
+ * definitions based on existing ones. The duplicated membrane
definition is
+ * registered with the membrane repository.
+ *
+ * @param srcControllerDesc the membrane to duplicate
+ * @param newControllerDesc the controller description of the new
membrane
+ * @param newType the type of the new membrane
+ * @return the defintion of the new membrane
+ *
+ * @exception IllegalArgumentException
+ * if the source membrane does not exists
+ */
+ public static MembraneDef duplicateMembraneDef(
+ Object srcControllerDesc, Object newControllerDesc, Class
newType ) {
+
+ Membranes mrepository = Membranes.get();
+ MembraneDef md = mrepository.getMembraneDef(srcControllerDesc);
+ if( md == null ) {
+ throw new IllegalArgumentException(
+ "Membrane "+srcControllerDesc+" does not exist");
+ }
+
+ MembraneDef newmd =
+ new MembraneDef( newControllerDesc, md.getCtrls(), newType );
+ mrepository.register(newmd);
+ return newmd;
+ }
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.