Package adams.flow.core
Class CallableActorHelper
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.flow.core.CallableActorHelper
-
- All Implemented Interfaces:
LoggingSupporter,SizeOfHandler,Serializable
public class CallableActorHelper extends LoggingObject
Helper class for callable actors.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description CallableActorHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ActorcreateCallableActor(Actor actor)Turns the specified actor into a callable actor.static CallableActorscreateCallableActors(Actor actor, boolean insert)Returns theCallableActorsinstance.static List<Actor>findAllCallableActors(Actor flow)Returns allCallableActorsinstances that can be located in the flowActorfindCallableActor(ActorHandler handler, CallableActorReference name)Checks a control actor's children whether they contain the callable actor that we're looking for.ActorfindCallableActor(Actor root, CallableActorReference name)Tries to find the callable actor referenced by its name.ActorfindCallableActor(ActorReferenceHandler handler, CallableActorReference name)Checks a reference handler's children whether they contain the callable actor that we're looking for.ActorfindCallableActorRecursive(Actor actor, CallableActorReference name)Tries to find the referenced callable actor.protected voidfindCallableActors(ActorHandler handler, List<Actor> collected)Locates callable actors.protected voidfindCallableActors(ActorReferenceHandler handler, List<Actor> collected)Locates callable actors.List<Actor>findCallableActorsRecursive(Actor actor)Locates all callable actors .ActorfindMultiView(ActorHandler handler, CallableActorReference name)Checks a control actor's children whether they contain the multi-view actor that we're looking for.ActorfindMultiViewRecursive(Actor actor, CallableActorReference name)Tries to find the referenced multi-view actor.static ObjectgetSetup(Class cls, CallableActorReference name, Actor start, MessageCollection errors)Returns the setup obtained from the callable actor, source or transformer.protected static ObjectgetSetup(Class cls, CallableActorReference name, Actor start, AbstractCallableActor callable, MessageCollection errors)Returns the setup obtained from the callable actor, source or transformer.static ObjectgetSetupFromSource(Class cls, CallableActorReference name, Actor start, MessageCollection errors)Returns the setup obtained from the callable source.static ObjectgetSetupFromTransformer(Class cls, CallableActorReference name, Actor start, MessageCollection errors)Returns the setup obtained from the callable transformer.-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
findCallableActor
public Actor findCallableActor(ActorReferenceHandler handler, CallableActorReference name)
Checks a reference handler's children whether they contain the callable actor that we're looking for.- Parameters:
handler- the reference handler to checkname- the name of the callable actor- Returns:
- the callable actor or null if not found
-
findCallableActor
public Actor findCallableActor(ActorHandler handler, CallableActorReference name)
Checks a control actor's children whether they contain the callable actor that we're looking for.- Parameters:
handler- the handler to checkname- the name of the callable actor- Returns:
- the callable actor or null if not found
-
findCallableActor
public Actor findCallableActor(Actor root, CallableActorReference name)
Tries to find the callable actor referenced by its name.- Parameters:
root- the root to search inname- the name of the callable actor- Returns:
- the callable actor or null if not found
-
findCallableActorRecursive
public Actor findCallableActorRecursive(Actor actor, CallableActorReference name)
Tries to find the referenced callable actor. First all possible actor handlers are located recursively (up to the root) that allow also singletons. This list of actors is then searched for the callable actor.- Parameters:
actor- the actor to start fromname- the name of the callable actor- Returns:
- the callable actor or null if not found
- See Also:
ActorUtils.findActorHandlers(Actor, boolean)
-
findCallableActors
protected void findCallableActors(ActorReferenceHandler handler, List<Actor> collected)
Locates callable actors.- Parameters:
handler- the handler to checkcollected- the actors collected so far
-
findCallableActors
protected void findCallableActors(ActorHandler handler, List<Actor> collected)
Locates callable actors.- Parameters:
handler- the handler to checkcollected- the actors collected so far
-
findCallableActorsRecursive
public List<Actor> findCallableActorsRecursive(Actor actor)
Locates all callable actors .- Parameters:
actor- the actor to start from- Returns:
- the callable actors
-
findMultiView
public Actor findMultiView(ActorHandler handler, CallableActorReference name)
Checks a control actor's children whether they contain the multi-view actor that we're looking for.- Parameters:
handler- the handler to checkname- the name of the callable actor- Returns:
- the callable actor or null if not found
-
findMultiViewRecursive
public Actor findMultiViewRecursive(Actor actor, CallableActorReference name)
Tries to find the referenced multi-view actor. First all possible actor handlers are located recursively (up to the root) that allow also singletons. This list of actors is then searched for the multi-view actor.- Parameters:
actor- the actor to start fromname- the name of the callable actor- Returns:
- the callable actor or null if not found
- See Also:
ActorUtils.findActorHandlers(Actor, boolean)
-
getSetup
protected static Object getSetup(Class cls, CallableActorReference name, Actor start, AbstractCallableActor callable, MessageCollection errors)
Returns the setup obtained from the callable actor, source or transformer. In the latter case, the transformer must output a setup if no input token is provided.- Parameters:
cls- the class that the output must match, null to ignorename- the callable actor referencedstart- where the search starts fromcallable- the callable actor (source or transformer) to useerrors- for storing any errors- Returns:
- the setup, null if not found or didn't match class
-
getSetup
public static Object getSetup(Class cls, CallableActorReference name, Actor start, MessageCollection errors)
Returns the setup obtained from the callable actor, source or transformer. In the latter case, the transformer must output a setup if no input token is provided.- Parameters:
cls- the class that the output must match, null to ignorename- the callable actor referencedstart- where the search starts fromerrors- for storing any errors- Returns:
- the setup, null if not found or didn't match class
-
getSetupFromSource
public static Object getSetupFromSource(Class cls, CallableActorReference name, Actor start, MessageCollection errors)
Returns the setup obtained from the callable source.- Parameters:
cls- the class that the output must match, null to ignorename- the callable actor referencedstart- where the search starts fromerrors- for storing any errors- Returns:
- the setup, null if not found or didn't match class
-
getSetupFromTransformer
public static Object getSetupFromTransformer(Class cls, CallableActorReference name, Actor start, MessageCollection errors)
Returns the setup obtained from the callable transformer. The transformer must output a setup if no input token is provided.- Parameters:
cls- the class that the output must match, null to ignorename- the callable actor referencedstart- where the search starts from- Returns:
- the setup, null if not found or didn't match class
-
findAllCallableActors
public static List<Actor> findAllCallableActors(Actor flow)
Returns allCallableActorsinstances that can be located in the flow- Parameters:
flow- the flow to use- Returns:
- the
CallableActorsinstances
-
createCallableActors
public static CallableActors createCallableActors(Actor actor, boolean insert)
Returns theCallableActorsinstance. Can insert one if required.- Parameters:
actor- the actor to start the search frominsert- whether to insert aCallableActorsinstance if none present- Returns:
- the
CallableActorsinstance, null in case of error
-
createCallableActor
public static Actor createCallableActor(Actor actor)
Turns the specified actor into a callable actor.- Parameters:
actor- the actor to turn into a callable actor- Returns:
- the replacement actor (
CallableSinketc.), null in case of error
-
-