com.ebmwebsourcing.easycommons.sca.helper.impl
Class SCAHelper

java.lang.Object
  extended by com.ebmwebsourcing.easycommons.sca.helper.impl.SCAHelper

public class SCAHelper
extends java.lang.Object

This class helps fractal management.

Author:
Nicolas Salatge - eBM WebSourcing

Field Summary
static java.lang.String CORE_EXPLORER_COMPOSITE
          the petals component name.
static java.lang.String EXPLORER_COMPOSITE
          the explorer composite component name.
static java.lang.String FCAPPL_BINDING
          the FCAPPL binding name.
 
Method Summary
 void addBindings(org.objectweb.fractal.api.Component component, java.util.List<Binding> listOfBindings)
          Add a component in a composite component.
 void addComponent(org.objectweb.fractal.api.Component newComponent, org.objectweb.fractal.api.Component parentComponent, java.util.List<Binding> listOfBindings)
          Add a component in a composite component.
 void changeName(org.objectweb.fractal.api.Component comp, java.lang.String name)
          Change the name of the component
 org.objectweb.fractal.api.Component createExplorer(java.lang.String fractalName, java.lang.String fractalDefinition)
          Create an explorer for the specified component (the component requires an explicit interface named fcAppl of type org.objectweb.fractal.api.Component).
 org.objectweb.fractal.api.Component createNewComponent(java.lang.String name, java.util.Map<java.lang.Object,java.lang.Object> ctxt)
          Create a new component.
 void deleteAllClientBindingsOfComponent(org.objectweb.fractal.api.Component component)
          Delete all client binding of component.
 void deleteBindings(org.objectweb.fractal.api.Component component, java.util.List<Binding> listOfBindings)
          Delete a component in a composite component.
 void deleteComponent(org.objectweb.fractal.api.Component oldComponent)
          Delete a component in a composite component.
 void deleteComponent(org.objectweb.fractal.api.Component oldComponent, org.objectweb.fractal.api.Component parentComponent, java.util.List<Binding> listOfBindings)
          Delete a component in a composite component.
 void deleteLinkWithAnItfClientOfComponent(org.objectweb.fractal.api.Component component, java.lang.String itfCLient)
          Delete all client binding of component.
 java.util.List<org.objectweb.fractal.api.Component> getAllSubComponents(org.objectweb.fractal.api.Component parent)
           
 org.objectweb.fractal.api.Interface getBoundInterface(org.oasisopen.sca.ServiceReference<?> sr)
          Return the server interface bound to the specified service reference.
 java.util.List<org.objectweb.fractal.api.Component> getClientComponentsLinkedToServerInterfacesOfComponent(org.objectweb.fractal.api.Component parentComponent, org.objectweb.fractal.api.Interface itfOfComponent)
          A utility function allowing to get components interface binding to the client interface of the component controller.
 org.objectweb.fractal.api.Component getComponentByInterface(org.objectweb.fractal.api.Component parent, org.objectweb.fractal.api.Interface itf, java.lang.String interfaceName)
          A utility function allowing to get a component from an interface
 org.objectweb.fractal.api.Component getComponentByInterface(org.objectweb.fractal.api.Component parent, org.oasisopen.sca.ServiceReference<?> sr, java.lang.String interfaceName)
           
 java.util.List<org.objectweb.fractal.api.Component> getComponents(org.objectweb.fractal.api.Component parent)
          A utility function allowing to get a component from any content controller.
 java.util.List<org.objectweb.fractal.api.Component> getComponentsByName(org.objectweb.fractal.api.Component parent, java.lang.String name)
          A utility function allowing to get a component from any content controller.
 org.objectweb.fractal.api.Component getFirstComponentByName(org.objectweb.fractal.api.Component parent, java.lang.String name)
          A utility function allowing to get the first component with the given name.
 org.objectweb.fractal.api.control.LifeCycleController getLifeCycleControllerByName(org.objectweb.fractal.api.Component parent, java.lang.String name)
          A utility function allowing to get a component LifeCycleController from a content controller.
 java.util.Map<java.lang.String,java.lang.Object> getListOfBindings(org.objectweb.fractal.api.Component component)
           
 java.util.List<java.lang.String> getListOfBinds(org.objectweb.fractal.api.Component component)
           
 java.lang.String getName(org.objectweb.fractal.api.Component comp)
           
 org.objectweb.fractal.api.Component getParent(org.objectweb.fractal.api.Component childrenComponent)
           
static SCAHelper getSCAHelper()
          Get a SCAHelper instance.
 java.util.Map<java.lang.String,org.objectweb.fractal.api.Interface> getServerInterfacesLinkedToClientInterfacesOfComponent(org.objectweb.fractal.api.Component component)
          A utility function allowing to get components interface binding to the client interface of the component controller.
 boolean isAlreadyBind(org.objectweb.fractal.api.Component component, java.lang.String clientItfName, org.objectweb.fractal.api.Interface itf)
           
 boolean isAlreadyBind(org.objectweb.fractal.api.Component component, java.lang.String clientItfName, org.oasisopen.sca.ServiceReference<?> sr)
           
 boolean isBinded(org.objectweb.fractal.api.Component component, java.lang.String clientItfName)
           
 boolean isStarted(org.objectweb.fractal.api.Component comp)
           
 boolean startComponent(org.objectweb.fractal.api.Component component)
          A utility function to start the given fractal component.
 boolean startComponentAndSubComponents(org.objectweb.fractal.api.Component component)
           
 void stopAllSubComponents(org.objectweb.fractal.api.Component composite)
          A utility function to stop the given fractal composite.
 boolean stopComponent(org.objectweb.fractal.api.Component component)
          A utility function to stop the given fractal component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPLORER_COMPOSITE

public static final java.lang.String EXPLORER_COMPOSITE
the explorer composite component name.

See Also:
Constant Field Values

CORE_EXPLORER_COMPOSITE

public static final java.lang.String CORE_EXPLORER_COMPOSITE
the petals component name.

See Also:
Constant Field Values

FCAPPL_BINDING

public static final java.lang.String FCAPPL_BINDING
the FCAPPL binding name.

See Also:
Constant Field Values
Method Detail

getSCAHelper

public static SCAHelper getSCAHelper()
                              throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Get a SCAHelper instance.

Returns:
the SCAHelper instance
Throws:
ADLException - : occurs when it is impossible to get the fractal explorer
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

createNewComponent

public org.objectweb.fractal.api.Component createNewComponent(java.lang.String name,
                                                              java.util.Map<java.lang.Object,java.lang.Object> ctxt)
                                                       throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Create a new component.

Parameters:
name - The class name of the component
Returns:
the new component
Throws:
ADLException - : occurs when the framework of Petals is incorrect
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

changeName

public void changeName(org.objectweb.fractal.api.Component comp,
                       java.lang.String name)
                throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Change the name of the component

Parameters:
name -
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

getName

public java.lang.String getName(org.objectweb.fractal.api.Component comp)

getComponentsByName

public java.util.List<org.objectweb.fractal.api.Component> getComponentsByName(org.objectweb.fractal.api.Component parent,
                                                                               java.lang.String name)
A utility function allowing to get a component from any content controller.

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getFirstComponentByName

public org.objectweb.fractal.api.Component getFirstComponentByName(org.objectweb.fractal.api.Component parent,
                                                                   java.lang.String name)
A utility function allowing to get the first component with the given name.

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getBoundInterface

public org.objectweb.fractal.api.Interface getBoundInterface(org.oasisopen.sca.ServiceReference<?> sr)
Return the server interface bound to the specified service reference. This method follows the delegation chain from the service reference to the client interface to the output interceptor to the bound server interface. This method is meant to be a bridge from the Fraclet/Julia world to the Tinfi one. With Fraclet/Julia, when injecting a reference in a @Required annotated field, the reference of the target bound interface is injected. With Tinfi, the ServiceReference of the source component is injected. Since EasyViper assumes the first mode, we provide this method to facilitate the transition between both modes.

Parameters:
sr - the service reference
Returns:
the bound server interface

getComponentByInterface

public org.objectweb.fractal.api.Component getComponentByInterface(org.objectweb.fractal.api.Component parent,
                                                                   org.oasisopen.sca.ServiceReference<?> sr,
                                                                   java.lang.String interfaceName)

getComponentByInterface

public org.objectweb.fractal.api.Component getComponentByInterface(org.objectweb.fractal.api.Component parent,
                                                                   org.objectweb.fractal.api.Interface itf,
                                                                   java.lang.String interfaceName)
A utility function allowing to get a component from an interface

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getComponents

public java.util.List<org.objectweb.fractal.api.Component> getComponents(org.objectweb.fractal.api.Component parent)
A utility function allowing to get a component from any content controller.

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getAllSubComponents

public java.util.List<org.objectweb.fractal.api.Component> getAllSubComponents(org.objectweb.fractal.api.Component parent)

getServerInterfacesLinkedToClientInterfacesOfComponent

public java.util.Map<java.lang.String,org.objectweb.fractal.api.Interface> getServerInterfacesLinkedToClientInterfacesOfComponent(org.objectweb.fractal.api.Component component)
A utility function allowing to get components interface binding to the client interface of the component controller.

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getClientComponentsLinkedToServerInterfacesOfComponent

public java.util.List<org.objectweb.fractal.api.Component> getClientComponentsLinkedToServerInterfacesOfComponent(org.objectweb.fractal.api.Component parentComponent,
                                                                                                                  org.objectweb.fractal.api.Interface itfOfComponent)
A utility function allowing to get components interface binding to the client interface of the component controller.

Parameters:
parentContentController - parentContentController
name - component name
Returns:
the component, null if not found

getLifeCycleControllerByName

public org.objectweb.fractal.api.control.LifeCycleController getLifeCycleControllerByName(org.objectweb.fractal.api.Component parent,
                                                                                          java.lang.String name)
                                                                                   throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
A utility function allowing to get a component LifeCycleController from a content controller.

Parameters:
parentContentController - the parent content controller
name - the name of the component
Returns:
the LifeCycleController of the component, null if not found
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

isStarted

public boolean isStarted(org.objectweb.fractal.api.Component comp)

startComponent

public boolean startComponent(org.objectweb.fractal.api.Component component)
                       throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
A utility function to start the given fractal component.

Parameters:
component - the fractal component
Returns:
true if the component was found and stopped, false otherwise
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : impossible to stop the component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : impossible to stop the component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

startComponentAndSubComponents

public boolean startComponentAndSubComponents(org.objectweb.fractal.api.Component component)
                                       throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

stopComponent

public boolean stopComponent(org.objectweb.fractal.api.Component component)
                      throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
A utility function to stop the given fractal component.

Parameters:
component - the fractal component to stop
Returns:
true if the component was found and stopped, false otherwise
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : impossible to stop the component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : impossible to stop the component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

stopAllSubComponents

public void stopAllSubComponents(org.objectweb.fractal.api.Component composite)
                          throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
A utility function to stop the given fractal composite.

Parameters:
composite -
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException
org.objectweb.fractal.api.control.IllegalLifeCycleException
org.objectweb.fractal.api.NoSuchInterfaceException
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

addComponent

public void addComponent(org.objectweb.fractal.api.Component newComponent,
                         org.objectweb.fractal.api.Component parentComponent,
                         java.util.List<Binding> listOfBindings)
                  throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Add a component in a composite component.

Parameters:
newComponent - The new component
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

deleteComponent

public void deleteComponent(org.objectweb.fractal.api.Component oldComponent)
                     throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Delete a component in a composite component.

Parameters:
oldComponent - The component to delete
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

deleteComponent

public void deleteComponent(org.objectweb.fractal.api.Component oldComponent,
                            org.objectweb.fractal.api.Component parentComponent,
                            java.util.List<Binding> listOfBindings)
                     throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Delete a component in a composite component.

Parameters:
oldComponent - The component to delete
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

addBindings

public void addBindings(org.objectweb.fractal.api.Component component,
                        java.util.List<Binding> listOfBindings)
                 throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Add a component in a composite component.

Parameters:
newComponent - The new component
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

isBinded

public boolean isBinded(org.objectweb.fractal.api.Component component,
                        java.lang.String clientItfName)
                 throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

isAlreadyBind

public boolean isAlreadyBind(org.objectweb.fractal.api.Component component,
                             java.lang.String clientItfName,
                             org.oasisopen.sca.ServiceReference<?> sr)
                      throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

isAlreadyBind

public boolean isAlreadyBind(org.objectweb.fractal.api.Component component,
                             java.lang.String clientItfName,
                             org.objectweb.fractal.api.Interface itf)
                      throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

getListOfBindings

public java.util.Map<java.lang.String,java.lang.Object> getListOfBindings(org.objectweb.fractal.api.Component component)
                                                                   throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

getListOfBinds

public java.util.List<java.lang.String> getListOfBinds(org.objectweb.fractal.api.Component component)
                                                throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

getParent

public org.objectweb.fractal.api.Component getParent(org.objectweb.fractal.api.Component childrenComponent)
                                              throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Throws:
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

deleteBindings

public void deleteBindings(org.objectweb.fractal.api.Component component,
                           java.util.List<Binding> listOfBindings)
                    throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Delete a component in a composite component.

Parameters:
newComponent - The new component
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

deleteAllClientBindingsOfComponent

public void deleteAllClientBindingsOfComponent(org.objectweb.fractal.api.Component component)
                                        throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Delete all client binding of component.

Parameters:
newComponent - The new component
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

deleteLinkWithAnItfClientOfComponent

public void deleteLinkWithAnItfClientOfComponent(org.objectweb.fractal.api.Component component,
                                                 java.lang.String itfCLient)
                                          throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Delete all client binding of component.

Parameters:
newComponent - The new component
parentComponent - The parent component
listOfBindings - the list of binding to create between this new component and the others
Throws:
org.objectweb.fractal.api.NoSuchInterfaceException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalLifeCycleException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalContentException - : Impossible to add a component
org.objectweb.fractal.api.control.IllegalBindingException - : Impossible to add a component
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException

createExplorer

public org.objectweb.fractal.api.Component createExplorer(java.lang.String fractalName,
                                                          java.lang.String fractalDefinition)
                                                   throws com.ebmwebsourcing.easycommons.sca.helper.api.SCAException
Create an explorer for the specified component (the component requires an explicit interface named fcAppl of type org.objectweb.fractal.api.Component).

Parameters:
component - the component to explore
Throws:
ADLException - : occurs when it is impossible to create the explorer
org.objectweb.fractal.api.NoSuchInterfaceException - : occurs when it is impossible to create the explorer
org.objectweb.fractal.api.control.IllegalBindingException - : occurs when it is impossible to create the explorer
org.objectweb.fractal.api.control.IllegalLifeCycleException - : occurs when it is impossible to create the explorer
org.objectweb.fractal.api.control.IllegalContentException - : occurs when it is impossible to create the explorer
com.ebmwebsourcing.easycommons.sca.helper.api.SCAException


Copyright © 2011 Petals Link. All Rights Reserved.