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 Actor
createCallableActor(Actor actor)
Turns the specified actor into a callable actor.static CallableActors
createCallableActors(Actor actor, boolean insert)
Returns theCallableActors
instance.static List<Actor>
findAllCallableActors(Actor flow)
Returns allCallableActors
instances that can be located in the flowActor
findCallableActor(ActorHandler handler, CallableActorReference name)
Checks a control actor's children whether they contain the callable actor that we're looking for.Actor
findCallableActor(Actor root, CallableActorReference name)
Tries to find the callable actor referenced by its name.Actor
findCallableActor(ActorReferenceHandler handler, CallableActorReference name)
Checks a reference handler's children whether they contain the callable actor that we're looking for.Actor
findCallableActorRecursive(Actor actor, CallableActorReference name)
Tries to find the referenced callable actor.protected void
findCallableActors(ActorHandler handler, List<Actor> collected)
Locates callable actors.protected void
findCallableActors(ActorReferenceHandler handler, List<Actor> collected)
Locates callable actors.List<Actor>
findCallableActorsRecursive(Actor actor)
Locates all callable actors .Actor
findMultiView(ActorHandler handler, CallableActorReference name)
Checks a control actor's children whether they contain the multi-view actor that we're looking for.Actor
findMultiViewRecursive(Actor actor, CallableActorReference name)
Tries to find the referenced multi-view actor.static Object
getSetup(Class cls, CallableActorReference name, Actor start, MessageCollection errors)
Returns the setup obtained from the callable actor, source or transformer.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.static Object
getSetupFromSource(Class cls, CallableActorReference name, Actor start, MessageCollection errors)
Returns the setup obtained from the callable source.static Object
getSetupFromTransformer(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 allCallableActors
instances that can be located in the flow- Parameters:
flow
- the flow to use- Returns:
- the
CallableActors
instances
-
createCallableActors
public static CallableActors createCallableActors(Actor actor, boolean insert)
Returns theCallableActors
instance. Can insert one if required.- Parameters:
actor
- the actor to start the search frominsert
- whether to insert aCallableActors
instance if none present- Returns:
- the
CallableActors
instance, 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 (
CallableSink
etc.), null in case of error
-
-