Package jadex.bdiv3x.features
Class BDIXAgentFeature
- java.lang.Object
- 
- jadex.bridge.component.impl.AbstractComponentFeature
- 
- jadex.bdiv3x.features.BDIXAgentFeature
 
 
- 
- All Implemented Interfaces:
- jadex.bdiv3.features.impl.IInternalBDIAgentFeature,- IBDIXAgentFeature,- ICapability,- IComponentFeature
 
 public class BDIXAgentFeature extends jadex.bridge.component.impl.AbstractComponentFeature implements IBDIXAgentFeature, jadex.bdiv3.features.impl.IInternalBDIAgentFeature BDI agent feature version for XML agents.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBDIXAgentFeature.ChangeInfoEntryMapperMap a change info as Map:Entry.static classBDIXAgentFeature.GoalsExistConditionCondition that tests if goal instances of an mgoal exist.static classBDIXAgentFeature.LifecycleStateConditionCondition for checking the lifecycle state of a goal.static classBDIXAgentFeature.PlansExistConditionCondition that tests if goal instances of an mplan exist.
 - 
Field SummaryFields Modifier and Type Field Description protected IBDIModelbdimodelThe bdi model.protected jadex.bdiv3.runtime.impl.RCapabilitycapaThe bdi state.static IComponentFeatureFactoryFACTORYprotected RuleSystemrulesystemThe rule system.
 - 
Constructor SummaryConstructors Constructor Description BDIXAgentFeature(IInternalAccess component, ComponentCreationInfo cinfo)Factory method constructor for instance level.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.lang.ObjectadaptToCapability(java.lang.Object obj, java.lang.String capa, IBDIModel bdimodel)Adapt element for use in inner capabilities.static voidaddBeliefEvents(IInternalAccess ia, java.util.List<EventType> events, java.lang.String belname)Create belief events from a belief name.voidaddBeliefListener(java.lang.String name, IBeliefListener listener)Add a belief listener.static voidaddInitArgs(java.lang.Object obj, java.lang.Class<?> clazz, java.lang.Class<?>[] argtypes, java.lang.Object[] args)Add an entry to the init calls.static voidcreateChangeEvent(java.lang.Object val, java.lang.Object oldval, java.lang.Object info, IInternalAccess agent, java.lang.String belname)Caution: this method is used from byte engineered code, change signature with caution Create a belief changed event.static EventTypecreateEventType(RawEvent rawev)protected voiddoCleanup()Cleanup the beliefs in kill and shutdown.IModelInfogetAgentModel()Get the agent model.java.lang.StringgetAgentName()Get the agent name.static IBDIXAgentFeaturegetBDIAgentFeature(IInternalAccess agent)Get the feature from the agent.IBDIModelgetBDIModel()Get the bdimodel.IBeliefbasegetBeliefbase()Get the belief base.protected static java.lang.StringgetBeliefName(java.lang.Object obj, java.lang.String fieldname)jadex.bdiv3.runtime.impl.RCapabilitygetCapability()Get the state.java.lang.ClassLoadergetClassLoader()Get the classloader.IComponentDescriptiongetComponentDescription()Get the component description.IComponentIdentifiergetComponentIdentifier()Get the agent identifier.java.lang.StringgetConfigurationName()Get the configuration name.java.util.List<IMonitoringEvent>getCurrentStateEvents()Get the current state as events.java.util.Map<EventType,IResultCommand<IFuture<java.lang.Void>,PropertyChangeEvent>>getEventAdders()Get the event type.IEventbasegetEventbase()Get the event base.IExpressionbasegetExpressionbase()Get the expression base.IExternalAccessgetExternalAccess()Get the scope.IGoalbasegetGoalbase()Get the goal base.static java.util.List<EventType>getGoalEvents(MGoal mgoal)Create goal events for a goal name.static java.lang.Object[]getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, jadex.bdiv3.runtime.impl.RPlan rplan, jadex.bdiv3.runtime.impl.RProcessableElement rpe, IInternalAccess component)Get parameter values for injection into method and constructor calls.static java.lang.Object[]getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, jadex.bdiv3.runtime.impl.RPlan rplan, jadex.bdiv3.runtime.impl.RProcessableElement rpe, java.util.Collection<java.lang.Object> vs, IInternalAccess component)Get parameter values for injection into method and constructor calls.java.util.logging.LoggergetLogger()Get the logger.IModelInfogetModel()Get the capability model.IPlanbasegetPlanbase()Get the plan base.RuleSystemgetRuleSystem()Get the rulesystem.longgetTime()Get the current time.IValueFetchergetValueFetcher()Get the value fetcher.booleanhasUserBody()Check if the feature potentially executed user code in body.IFuture<java.lang.Void>init()Initialize the feature.protected booleanisComponentThread()voidkill()Called on init failure.IFuture<java.util.Map<java.lang.String,java.lang.Object>>killAgent()Kill the agent.static voidpublishToolBeliefEvent(IInternalAccess ia, MBelief mbel)static java.util.List<EventType>readAnnotationEvents(IInternalAccess ia, java.lang.annotation.Annotation[][] annos)Read the annotation events from method annotations.voidremoveBeliefListener(java.lang.String name, IBeliefListener listener)Remove a belief listener.IFuture<java.lang.Void>shutdown()Called on shutdown after successful init.ISubscriptionIntermediateFuture<IMonitoringEvent>subscribeToEvents(IFilter<IMonitoringEvent> filter, boolean initial, IMonitoringService.PublishEventLevel elm)Subscribe to monitoring events.protected voidtestBodyAborted(jadex.bdiv3.runtime.impl.RPlan rplan)Check if plan is already aborted.protected voidwrapCollections(MCapability mcapa, java.lang.Object agent)
 
- 
- 
- 
Field Detail- 
FACTORYpublic static final IComponentFeatureFactory FACTORY 
 - 
bdimodelprotected IBDIModel bdimodel The bdi model.
 - 
rulesystemprotected RuleSystem rulesystem The rule system.
 - 
capaprotected jadex.bdiv3.runtime.impl.RCapability capa The bdi state.
 
- 
 - 
Constructor Detail- 
BDIXAgentFeaturepublic BDIXAgentFeature(IInternalAccess component, ComponentCreationInfo cinfo) Factory method constructor for instance level.
 
- 
 - 
Method Detail- 
initpublic IFuture<java.lang.Void> init() Initialize the feature.- Specified by:
- initin interface- IComponentFeature
- Overrides:
- initin class- jadex.bridge.component.impl.AbstractComponentFeature
 
 - 
hasUserBodypublic 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:
- hasUserBodyin interface- IComponentFeature
- Overrides:
- hasUserBodyin class- jadex.bridge.component.impl.AbstractComponentFeature
 
 - 
shutdownpublic IFuture<java.lang.Void> shutdown() Called on shutdown after successful init.- Specified by:
- shutdownin interface- IComponentFeature
- Overrides:
- shutdownin class- jadex.bridge.component.impl.AbstractComponentFeature
 
 - 
killpublic void kill() Called on init failure.- Specified by:
- killin interface- IComponentFeature
- Overrides:
- killin class- jadex.bridge.component.impl.AbstractComponentFeature
 
 - 
doCleanupprotected void doCleanup() Cleanup the beliefs in kill and shutdown.
 - 
addInitArgspublic static void addInitArgs(java.lang.Object obj, java.lang.Class<?> clazz, java.lang.Class<?>[] argtypes, java.lang.Object[] args)Add an entry to the init calls.- Parameters:
- obj- object instance that owns the field __initargs
- clazz- Class definition of the obj object
- argtypes- Signature of the init method
- args- Actual argument values for the init method
 
 - 
createChangeEventpublic static void createChangeEvent(java.lang.Object val, java.lang.Object oldval, java.lang.Object info, IInternalAccess agent, java.lang.String belname)Caution: this method is used from byte engineered code, change signature with caution Create a belief changed event.- Parameters:
- val- The new value.
- agent- The agent.
- belname- The belief name.
 
 - 
publishToolBeliefEventpublic static void publishToolBeliefEvent(IInternalAccess ia, MBelief mbel) 
 - 
getBeliefNameprotected static java.lang.String getBeliefName(java.lang.Object obj, java.lang.String fieldname)
 - 
isComponentThreadprotected boolean isComponentThread() 
 - 
adaptToCapabilityprotected static java.lang.Object adaptToCapability(java.lang.Object obj, java.lang.String capa, IBDIModel bdimodel)Adapt element for use in inner capabilities.- Parameters:
- obj- The object to adapt (e.g. a change event)
- capa- The capability name or null for agent.
 
 - 
wrapCollectionsprotected void wrapCollections(MCapability mcapa, java.lang.Object agent) 
 - 
addBeliefListenerpublic void addBeliefListener(java.lang.String name, IBeliefListener listener)Add a belief listener.- Specified by:
- addBeliefListenerin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Parameters:
- name- The belief name.
- listener- The belief listener.
 
 - 
removeBeliefListenerpublic void removeBeliefListener(java.lang.String name, IBeliefListener listener)Remove a belief listener.- Specified by:
- removeBeliefListenerin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Parameters:
- name- The belief name.
- listener- The belief listener.
 
 - 
testBodyAbortedprotected void testBodyAborted(jadex.bdiv3.runtime.impl.RPlan rplan) Check if plan is already aborted.
 - 
getInjectionValuespublic static java.lang.Object[] getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, jadex.bdiv3.runtime.impl.RPlan rplan, jadex.bdiv3.runtime.impl.RProcessableElement rpe, IInternalAccess component)Get parameter values for injection into method and constructor calls.
 - 
getInjectionValuespublic static java.lang.Object[] getInjectionValues(java.lang.Class<?>[] ptypes, java.lang.annotation.Annotation[][] anns, MElement melement, ChangeEvent event, jadex.bdiv3.runtime.impl.RPlan rplan, jadex.bdiv3.runtime.impl.RProcessableElement rpe, java.util.Collection<java.lang.Object> vs, IInternalAccess component)Get parameter values for injection into method and constructor calls.- Returns:
- A valid assigment or null if no assignment could be found.
 
 - 
getRuleSystempublic RuleSystem getRuleSystem() Get the rulesystem.- Specified by:
- getRuleSystemin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Returns:
- The rulesystem.
 
 - 
getBDIModelpublic IBDIModel getBDIModel() Get the bdimodel.- Specified by:
- getBDIModelin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Returns:
- the bdimodel.
 
 - 
getCapabilitypublic jadex.bdiv3.runtime.impl.RCapability getCapability() Get the state.- Specified by:
- getCapabilityin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Returns:
- the state.
 
 - 
addBeliefEventspublic static void addBeliefEvents(IInternalAccess ia, java.util.List<EventType> events, java.lang.String belname) Create belief events from a belief name. For normal beliefs beliefchanged.belname and factchanged.belname and for multi beliefs additionally factadded.belname and factremoved are created.
 - 
getGoalEventspublic static java.util.List<EventType> getGoalEvents(MGoal mgoal) Create goal events for a goal name. creates goaladopted, goaldropped goaloption, goalactive, goalsuspended goalinprocess, goalnotinprocess events.
 - 
readAnnotationEventspublic static java.util.List<EventType> readAnnotationEvents(IInternalAccess ia, java.lang.annotation.Annotation[][] annos) Read the annotation events from method annotations.
 - 
getCurrentStateEventspublic java.util.List<IMonitoringEvent> getCurrentStateEvents() Get the current state as events.
 - 
getBDIAgentFeaturepublic static IBDIXAgentFeature getBDIAgentFeature(IInternalAccess agent) Get the feature from the agent.
 - 
getValueFetcherpublic IValueFetcher getValueFetcher() Get the value fetcher.- Specified by:
- getValueFetcherin interface- IComponentFeature
- Overrides:
- getValueFetcherin class- jadex.bridge.component.impl.AbstractComponentFeature
 
 - 
getEventAdderspublic java.util.Map<EventType,IResultCommand<IFuture<java.lang.Void>,PropertyChangeEvent>> getEventAdders() Get the event type.- Specified by:
- getEventAddersin interface- jadex.bdiv3.features.impl.IInternalBDIAgentFeature
- Returns:
- The event adder.
 
 - 
getExternalAccesspublic IExternalAccess getExternalAccess() Get the scope. Method with IExternalAccess return value included for compatibility with IInternalAccess.- Specified by:
- getExternalAccessin interface- ICapability
- Returns:
- The scope.
 
 - 
getBeliefbasepublic IBeliefbase getBeliefbase() Get the belief base.- Specified by:
- getBeliefbasein interface- ICapability
- Returns:
- The belief base.
 
 - 
getEventbasepublic IEventbase getEventbase() Get the event base.- Specified by:
- getEventbasein interface- ICapability
- Returns:
- The event base.
 
 - 
getGoalbasepublic IGoalbase getGoalbase() Get the goal base.- Specified by:
- getGoalbasein interface- ICapability
- Returns:
- The goal base.
 
 - 
getPlanbasepublic IPlanbase getPlanbase() Get the plan base.- Specified by:
- getPlanbasein interface- ICapability
- Returns:
- The plan base.
 
 - 
getExpressionbasepublic IExpressionbase getExpressionbase() Get the expression base.- Specified by:
- getExpressionbasein interface- ICapability
- Returns:
- The expression base.
 
 - 
getLoggerpublic java.util.logging.Logger getLogger() Get the logger.- Specified by:
- getLoggerin interface- ICapability
- Returns:
- The logger.
 
 - 
getAgentModelpublic IModelInfo getAgentModel() Get the agent model.- Specified by:
- getAgentModelin interface- ICapability
- Returns:
- The agent model.
 
 - 
getModelpublic IModelInfo getModel() Get the capability model.- Specified by:
- getModelin interface- ICapability
- Returns:
- The capability model.
 
 - 
getAgentNamepublic java.lang.String getAgentName() Get the agent name.- Specified by:
- getAgentNamein interface- ICapability
- Returns:
- The agent name.
 
 - 
getConfigurationNamepublic java.lang.String getConfigurationName() Get the configuration name.- Specified by:
- getConfigurationNamein interface- ICapability
- Returns:
- The configuration name.
 
 - 
getComponentIdentifierpublic IComponentIdentifier getComponentIdentifier() Get the agent identifier.- Specified by:
- getComponentIdentifierin interface- ICapability
- Returns:
- The agent identifier.
 
 - 
getComponentDescriptionpublic IComponentDescription getComponentDescription() Get the component description.- Specified by:
- getComponentDescriptionin interface- ICapability
- Returns:
- The component description.
 
 - 
getTimepublic long getTime() Get the current time. The time unit depends on the currently running clock implementation. For the default system clock, the time value adheres to the time representation as used bySystem.currentTimeMillis(), i.e., the value of milliseconds passed since 0:00 'o clock, January 1st, 1970, UTC. For custom simulation clocks, arbitrary representations can be used.- Specified by:
- getTimein interface- ICapability
- Returns:
- The current time.
 
 - 
getClassLoaderpublic java.lang.ClassLoader getClassLoader() Get the classloader.- Specified by:
- getClassLoaderin interface- ICapability
- Returns:
- The classloader.
 
 - 
killAgentpublic IFuture<java.util.Map<java.lang.String,java.lang.Object>> killAgent() Kill the agent.- Specified by:
- killAgentin interface- ICapability
 
 - 
subscribeToEventspublic ISubscriptionIntermediateFuture<IMonitoringEvent> subscribeToEvents(IFilter<IMonitoringEvent> filter, boolean initial, IMonitoringService.PublishEventLevel elm) Subscribe to monitoring events.- Specified by:
- subscribeToEventsin interface- ICapability
- Parameters:
- filter- An optional filter.
 
 
- 
 
-