Package jadex.bridge.component.impl
Class MonitoringComponentFeature
- java.lang.Object
-
- jadex.bridge.component.impl.AbstractComponentFeature
-
- jadex.bridge.component.impl.MonitoringComponentFeature
-
- All Implemented Interfaces:
IComponentFeature
,IExternalComponentFeature
,IExternalMonitoringComponentFeature
,IMonitoringComponentFeature
public class MonitoringComponentFeature extends AbstractComponentFeature implements IMonitoringComponentFeature
Implementation of the monitoring feature.
-
-
Field Summary
Fields Modifier and Type Field Description protected IMonitoringService.PublishEventLevel
emitlevelsub
The event emit level for subscriptions.protected IMonitoringService
monser
The monitoring service getter.protected java.util.Map<jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent>,jadex.commons.Tuple2<jadex.commons.IFilter<IMonitoringEvent>,IMonitoringService.PublishEventLevel>>
subscriptions
The subscriptions (subscription future -> subscription info).-
Fields inherited from class jadex.bridge.component.impl.AbstractComponentFeature
cinfo, component, guesser
-
-
Constructor Summary
Constructors Constructor Description MonitoringComponentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
Create the feature.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSubscription(jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> future, jadex.commons.IFilter<IMonitoringEvent> filter, IMonitoringService.PublishEventLevel emitlevel)
Add a new subscription.jadex.commons.future.IFuture<java.lang.Void>
body()
Execute the main activity of the feature.java.util.List<IMonitoringEvent>
getCurrentStateEvents()
Get the current state as events.IMonitoringService.PublishEventLevel
getPublishEmitLevelMonitoring()
Get the monitoring event emit level.IMonitoringService.PublishEventLevel
getPublishEmitLevelSubscriptions()
Get the monitoring event emit level for subscriptions.boolean
hasEventTargets(IMonitoringService.PublishTarget pt, IMonitoringService.PublishEventLevel pi)
Check if event targets exist.boolean
hasUserBody()
Check if the feature potentially executed user code in body.static jadex.commons.future.IFuture<java.lang.Void>
publishEvent(IMonitoringEvent event, IMonitoringService monser)
Publish a monitoring event to the monitoring service.jadex.commons.future.IFuture<java.lang.Void>
publishEvent(IMonitoringEvent event, IMonitoringService.PublishTarget pt)
Publish a monitoring event.void
publishLocalEvent(IMonitoringEvent event)
Forward event to all currently registered subscribers.protected void
publishLocalEvent(IMonitoringEvent event, jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> sub)
Forward event to one subscribers.protected void
removeSubscription(jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> fut)
Remove an existing subscription.jadex.commons.future.ISubscriptionIntermediateFuture<IMonitoringEvent>
subscribeToEvents(jadex.commons.IFilter<IMonitoringEvent> filter, boolean initial, IMonitoringService.PublishEventLevel emitlevel)
Subscribe to monitoring events.-
Methods inherited from class jadex.bridge.component.impl.AbstractComponentFeature
getClockService, getComponent, getExecutionService, getExternalFacade, getExternalFacadeType, getInternalAccess, getParameterGuesser, getValueFetcher, init, kill, shutdown
-
-
-
-
Field Detail
-
subscriptions
protected java.util.Map<jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent>,jadex.commons.Tuple2<jadex.commons.IFilter<IMonitoringEvent>,IMonitoringService.PublishEventLevel>> subscriptions
The subscriptions (subscription future -> subscription info).
-
monser
protected IMonitoringService monser
The monitoring service getter.
-
emitlevelsub
protected IMonitoringService.PublishEventLevel emitlevelsub
The event emit level for subscriptions.
-
-
Constructor Detail
-
MonitoringComponentFeature
public MonitoringComponentFeature(IInternalAccess component, ComponentCreationInfo cinfo)
Create the feature.
-
-
Method Detail
-
body
public jadex.commons.future.IFuture<java.lang.Void> body()
Execute the main activity of the feature.- Specified by:
body
in interfaceIComponentFeature
- Overrides:
body
in classAbstractComponentFeature
-
publishEvent
public jadex.commons.future.IFuture<java.lang.Void> publishEvent(IMonitoringEvent event, IMonitoringService.PublishTarget pt)
Publish a monitoring event. This event is automatically send to the monitoring service of the platform (if any).- Specified by:
publishEvent
in interfaceIExternalMonitoringComponentFeature
-
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
-
publishEvent
public static jadex.commons.future.IFuture<java.lang.Void> publishEvent(IMonitoringEvent event, IMonitoringService monser)
Publish a monitoring event to the monitoring service.
-
getPublishEmitLevelSubscriptions
public IMonitoringService.PublishEventLevel getPublishEmitLevelSubscriptions()
Get the monitoring event emit level for subscriptions. Is the maximum level of all subscriptions (cached for speed).
-
publishLocalEvent
public void publishLocalEvent(IMonitoringEvent event)
Forward event to all currently registered subscribers.
-
publishLocalEvent
protected void publishLocalEvent(IMonitoringEvent event, jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> sub)
Forward event to one subscribers.
-
hasEventTargets
public boolean hasEventTargets(IMonitoringService.PublishTarget pt, IMonitoringService.PublishEventLevel pi)
Check if event targets exist.- Specified by:
hasEventTargets
in interfaceIMonitoringComponentFeature
-
getPublishEmitLevelMonitoring
public IMonitoringService.PublishEventLevel getPublishEmitLevelMonitoring()
Get the monitoring event emit level.
-
subscribeToEvents
public jadex.commons.future.ISubscriptionIntermediateFuture<IMonitoringEvent> subscribeToEvents(jadex.commons.IFilter<IMonitoringEvent> filter, boolean initial, IMonitoringService.PublishEventLevel emitlevel)
Subscribe to monitoring events.- Specified by:
subscribeToEvents
in interfaceIExternalMonitoringComponentFeature
- Parameters:
filter
- An optional filter.initial
- True, for receiving the current state.
-
addSubscription
protected void addSubscription(jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> future, jadex.commons.IFilter<IMonitoringEvent> filter, IMonitoringService.PublishEventLevel emitlevel)
Add a new subscription.- Parameters:
future
- The subscription future.si
- The subscription info.
-
removeSubscription
protected void removeSubscription(jadex.commons.future.SubscriptionIntermediateFuture<IMonitoringEvent> fut)
Remove an existing subscription.- Parameters:
fut
- The subscription future to remove.
-
getCurrentStateEvents
public java.util.List<IMonitoringEvent> getCurrentStateEvents()
Get the current state as events.
-
-