Package adams.flow.core
Class ObjectRetriever
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.ObjectRetriever
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,FlowContextHandler
,Serializable
public class ObjectRetriever extends AbstractOptionHandler implements FlowContextHandler
For retrieving objects from storage or source actors.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ObjectRetriever.RetrievalType
The enumeration for the retrieval type.
-
Field Summary
Fields Modifier and Type Field Description protected Actor
m_FlowContext
the flow context.protected CallableActorHelper
m_Helper
for locating callable actors.protected CallableActorReference
m_ObjectActor
the object actor.protected StorageName
m_ObjectStorage
the object storage.protected BaseClassname
m_ObjectType
the superclass or interface to restrict to.protected ObjectRetriever.RetrievalType
m_RetrievalType
the retrieval type.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ObjectRetriever()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.Actor
getFlowContext()
Returns the flow context, if any.Object
getObject(MessageCollection errors)
Retrieves the object.CallableActorReference
getObjectActor()
Returns the callable actor to retrieve the object from.StorageName
getObjectStorage()
Returns the storage item name to get the object from.BaseClassname
getObjectType()
Returns the interface or superclass to restrict the objects to.ObjectRetriever.RetrievalType
getRetrievalType()
Returns the retrieval type.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
objectActorTipText()
Returns the tip text for this property.String
objectStorageTipText()
Returns the tip text for this property.String
objectTypeTipText()
Returns the tip text for this property.String
retrievalTypeTipText()
Returns the tip text for this property.protected Object
retrieveAutomatically(MessageCollection errors)
Retrieves the object automatically from file/callable actor/storage.protected Object
retrieveFromCallableActor(MessageCollection errors)
Retrieves the object from the callable actor.protected Object
retrieveFromStorage(MessageCollection errors)
Retrieves the object from the storage item.void
setFlowContext(Actor value)
Sets the flow context.void
setObjectActor(CallableActorReference value)
Sets the callable actor to retrieve the object from.void
setObjectStorage(StorageName value)
Sets the storage item name to get the object from.void
setObjectType(BaseClassname value)
Sets the interface or superclass to restrict the objects to.void
setRetrievalType(ObjectRetriever.RetrievalType value)
Sets the retrieval type.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_FlowContext
protected Actor m_FlowContext
the flow context.
-
m_RetrievalType
protected ObjectRetriever.RetrievalType m_RetrievalType
the retrieval type.
-
m_ObjectActor
protected CallableActorReference m_ObjectActor
the object actor.
-
m_ObjectStorage
protected StorageName m_ObjectStorage
the object storage.
-
m_ObjectType
protected BaseClassname m_ObjectType
the superclass or interface to restrict to.
-
m_Helper
protected CallableActorHelper m_Helper
for locating callable actors.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
setFlowContext
public void setFlowContext(Actor value)
Sets the flow context.- Specified by:
setFlowContext
in interfaceFlowContextHandler
- Parameters:
value
- the actor
-
getFlowContext
public Actor getFlowContext()
Returns the flow context, if any.- Specified by:
getFlowContext
in interfaceFlowContextHandler
- Returns:
- the actor, null if none available
-
setRetrievalType
public void setRetrievalType(ObjectRetriever.RetrievalType value)
Sets the retrieval type. In case ofObjectRetriever.RetrievalType.AUTO
, first file, then callable actor, then storage.- Parameters:
value
- the type
-
getRetrievalType
public ObjectRetriever.RetrievalType getRetrievalType()
Returns the retrieval type. In case ofObjectRetriever.RetrievalType.AUTO
, first file, then callable actor, then storage.- Returns:
- the type
-
retrievalTypeTipText
public String retrievalTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setObjectActor
public void setObjectActor(CallableActorReference value)
Sets the callable actor to retrieve the object from.- Parameters:
value
- the actor reference
-
getObjectActor
public CallableActorReference getObjectActor()
Returns the callable actor to retrieve the object from.- Returns:
- the actor reference
-
objectActorTipText
public String objectActorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setObjectStorage
public void setObjectStorage(StorageName value)
Sets the storage item name to get the object from.- Parameters:
value
- the storage name
-
getObjectStorage
public StorageName getObjectStorage()
Returns the storage item name to get the object from.- Returns:
- the storage name
-
objectStorageTipText
public String objectStorageTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setObjectType
public void setObjectType(BaseClassname value)
Sets the interface or superclass to restrict the objects to.- Parameters:
value
- the class
-
getObjectType
public BaseClassname getObjectType()
Returns the interface or superclass to restrict the objects to.- Returns:
- the class
-
objectTypeTipText
public String objectTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
retrieveFromCallableActor
protected Object retrieveFromCallableActor(MessageCollection errors)
Retrieves the object from the callable actor.- Parameters:
errors
- for collecting errors- Returns:
- the object, null if failed to retrieve
-
retrieveFromStorage
protected Object retrieveFromStorage(MessageCollection errors)
Retrieves the object from the storage item.- Parameters:
errors
- for collecting errors- Returns:
- the object, null if failed to load
-
retrieveAutomatically
protected Object retrieveAutomatically(MessageCollection errors)
Retrieves the object automatically from file/callable actor/storage.- Parameters:
errors
- for collecting errors- Returns:
- the object, null if failed
-
getObject
public Object getObject(MessageCollection errors)
Retrieves the object.- Parameters:
errors
- for collecting errors- Returns:
- the object, null if failed to load
-
-