Package jadex.bridge.component.impl
Class ArgumentsResultsComponentFeature
- java.lang.Object
-
- jadex.bridge.component.impl.AbstractComponentFeature
-
- jadex.bridge.component.impl.ArgumentsResultsComponentFeature
-
- All Implemented Interfaces:
IArgumentsResultsFeature
,IComponentFeature
,IExternalArgumentsResultsFeature
,IExternalComponentFeature
,IInternalArgumentsResultsFeature
,jadex.commons.IValueFetcher
,jadex.javaparser.IMapAccess
public class ArgumentsResultsComponentFeature extends AbstractComponentFeature implements IArgumentsResultsFeature, jadex.commons.IValueFetcher, IInternalArgumentsResultsFeature, jadex.javaparser.IMapAccess
This feature provides arguments.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
arguments
The arguments.protected boolean
notified
Flag to remember when an exception was notified to a listener.protected java.util.Set<jadex.commons.future.SubscriptionIntermediateFuture<jadex.commons.Tuple2<java.lang.String,java.lang.Object>>>
resfuts
The result subscription, if any.protected java.util.Map<java.lang.String,java.lang.Object>
results
The results.-
Fields inherited from class jadex.bridge.component.impl.AbstractComponentFeature
cinfo, component, guesser
-
-
Constructor Summary
Constructors Constructor Description ArgumentsResultsComponentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
Create the feature.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doCleanup()
Perform cleanup in shutdown or kill.boolean
exceptionNotified()
Check if there is somebody waiting for this component to finish.java.lang.Object
fetchValue(java.lang.String name)
Fetch the arguments.java.lang.Object
get(java.lang.Object key)
Provide default values for basic types, if not set.java.util.Map<java.lang.String,java.lang.Object>
getArguments()
Get the arguments.jadex.commons.future.IFuture<java.util.Map<java.lang.String,java.lang.Object>>
getArgumentsAsync()
Get the arguments.jadex.commons.future.IFuture<java.lang.Exception>
getExceptionAsync()
Get the exception, if any.java.util.Map<java.lang.String,java.lang.Object>
getResults()
Get the current results.jadex.commons.future.IFuture<java.util.Map<java.lang.String,java.lang.Object>>
getResultsAsync()
Get the current results.static java.lang.String
getReverseName(java.lang.String dotname)
Get the reverse name of a dot name (component id).jadex.commons.IValueFetcher
getValueFetcher()
The feature can inject parameters for expression evaluation by providing an optional value fetcher.boolean
hasUserBody()
Check if the feature potentially executed user code in body.jadex.commons.future.IFuture<java.lang.Void>
init()
Initialize the feature.protected void
initDefaultArguments()
Init unset arguments from default values.protected void
initDefaultResults()
Init unset results from default values.void
kill()
Kill is only invoked, when shutdown of some (e.g.protected void
postEvent(java.lang.String result, java.lang.Object value)
Post an event to subscribed listeners.jadex.commons.future.IFuture<java.lang.Void>
shutdown()
Shutdown the feature.jadex.commons.future.ISubscriptionIntermediateFuture<jadex.commons.Tuple2<java.lang.String,java.lang.Object>>
subscribeToResults()
Subscribe to receive results.-
Methods inherited from class jadex.bridge.component.impl.AbstractComponentFeature
body, getClockService, getComponent, getExecutionService, getExternalFacade, getExternalFacadeType, getInternalAccess, getParameterGuesser
-
-
-
-
Field Detail
-
arguments
protected java.util.Map<java.lang.String,java.lang.Object> arguments
The arguments.
-
results
protected java.util.Map<java.lang.String,java.lang.Object> results
The results.
-
resfuts
protected java.util.Set<jadex.commons.future.SubscriptionIntermediateFuture<jadex.commons.Tuple2<java.lang.String,java.lang.Object>>> resfuts
The result subscription, if any.
-
notified
protected boolean notified
Flag to remember when an exception was notified to a listener.
-
-
Constructor Detail
-
ArgumentsResultsComponentFeature
public ArgumentsResultsComponentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
Create the feature.
-
-
Method Detail
-
init
public jadex.commons.future.IFuture<java.lang.Void> init()
Initialize the feature.- Specified by:
init
in interfaceIComponentFeature
- Overrides:
init
in classAbstractComponentFeature
-
getReverseName
public static java.lang.String getReverseName(java.lang.String dotname)
Get the reverse name of a dot name (component id).- Returns:
- The reverse name as string.
-
hasUserBody
public boolean hasUserBody()
Check if the feature potentially executed user code in body. Allows blocking operations in user bodies by using separate steps for each feature. Non-user-body-features are directly executed for speed. If unsure just return true. ;-)- Specified by:
hasUserBody
in interfaceIComponentFeature
- Overrides:
hasUserBody
in classAbstractComponentFeature
-
initDefaultArguments
protected void initDefaultArguments()
Init unset arguments from default values.
-
initDefaultResults
protected void initDefaultResults()
Init unset results from default values.
-
shutdown
public jadex.commons.future.IFuture<java.lang.Void> shutdown()
Shutdown the feature.- Specified by:
shutdown
in interfaceIComponentFeature
- Overrides:
shutdown
in classAbstractComponentFeature
-
kill
public void kill()
Kill is only invoked, when shutdown of some (e.g. other) feature does not return due to timeout. The feature should do any kind of possible cleanup, but no asynchronous operations.- Specified by:
kill
in interfaceIComponentFeature
- Overrides:
kill
in classAbstractComponentFeature
-
doCleanup
protected void doCleanup()
Perform cleanup in shutdown or kill.
-
getValueFetcher
public jadex.commons.IValueFetcher getValueFetcher()
The feature can inject parameters for expression evaluation by providing an optional value fetcher. The fetch order is the reverse init order, i.e., later features can override values from earlier features.- Specified by:
getValueFetcher
in interfaceIComponentFeature
- Overrides:
getValueFetcher
in classAbstractComponentFeature
-
fetchValue
public java.lang.Object fetchValue(java.lang.String name)
Fetch the arguments.- Specified by:
fetchValue
in interfacejadex.commons.IValueFetcher
-
get
public java.lang.Object get(java.lang.Object key)
Provide default values for basic types, if not set.- Specified by:
get
in interfacejadex.javaparser.IMapAccess
-
getArguments
public java.util.Map<java.lang.String,java.lang.Object> getArguments()
Get the arguments.- Specified by:
getArguments
in interfaceIArgumentsResultsFeature
- Returns:
- The arguments.
-
getResults
public java.util.Map<java.lang.String,java.lang.Object> getResults()
Get the current results.- Specified by:
getResults
in interfaceIArgumentsResultsFeature
- Returns:
- The current result values (if any).
-
getArgumentsAsync
public jadex.commons.future.IFuture<java.util.Map<java.lang.String,java.lang.Object>> getArgumentsAsync()
Get the arguments.- Specified by:
getArgumentsAsync
in interfaceIExternalArgumentsResultsFeature
- Returns:
- The arguments.
-
getResultsAsync
public jadex.commons.future.IFuture<java.util.Map<java.lang.String,java.lang.Object>> getResultsAsync()
Get the current results.- Specified by:
getResultsAsync
in interfaceIExternalArgumentsResultsFeature
- Returns:
- The current result values (if any).
-
getExceptionAsync
public jadex.commons.future.IFuture<java.lang.Exception> getExceptionAsync()
Get the exception, if any.- Specified by:
getExceptionAsync
in interfaceIExternalArgumentsResultsFeature
- Returns:
- The failure reason for use during cleanup, if any.
-
subscribeToResults
public jadex.commons.future.ISubscriptionIntermediateFuture<jadex.commons.Tuple2<java.lang.String,java.lang.Object>> subscribeToResults()
Subscribe to receive results.- Specified by:
subscribeToResults
in interfaceIExternalArgumentsResultsFeature
-
exceptionNotified
public boolean exceptionNotified()
Check if there is somebody waiting for this component to finish. Used to decide if a fatal error needs to be printed to the console.- Specified by:
exceptionNotified
in interfaceIInternalArgumentsResultsFeature
-
postEvent
protected void postEvent(java.lang.String result, java.lang.Object value)
Post an event to subscribed listeners.
-
-