public abstract class Agent
extends com.ibm.ia.common.BaseComponent
implements com.ibm.ia.agent.AgentService
| Modifier and Type | Field and Description |
|---|---|
protected com.ibm.ia.common.impl.DelayValue |
delayValue |
| Modifier and Type | Method and Description |
|---|---|
void |
activated()
An agent has been activated on a partition for event processing.
|
boolean |
agentPerformsSelfMonitoring() |
boolean |
cancelSchedule(java.lang.String key)
Cancel a previously scheduled callback.
|
void |
clearEngineTime(java.lang.String id) |
void |
clearEventTTL(java.lang.String id) |
void |
clearOutboundEvents() |
<T extends com.ibm.ia.model.Entity> |
createRelationship(java.lang.Class<T> entity,
java.lang.String key)
Convenience method to create Relationships
|
<T extends com.ibm.ia.model.Entity> |
createRelationship(T t)
Convenience method to create Relationships
|
void |
deactivated()
Notification when an agent has been deactivated from a partition.
|
void |
emit(com.ibm.ia.model.Event event)
Emit an event.
|
AgentDescriptor |
getAgentDescriptor()
Get the descriptor for the agent.
|
protected java.lang.String |
getAgentProperty(java.lang.String propName,
java.lang.String agentQualifier) |
Version |
getAgentVersion() |
protected com.ibm.ia.time.CalendarDuration |
getCalendarDuration(java.lang.String duration,
com.ibm.ia.time.CalendarDuration defaultDuration) |
EventReference |
getCurrentEventReference(int ttl) |
java.util.List<com.ibm.ia.common.GenericEvent> |
getEmittedEvents() |
java.time.ZonedDateTime |
getEngineTime(java.lang.String id) |
protected EntityFactory |
getEntityFactory()
Deprecated.
|
protected EventFactory |
getEventFactory()
Deprecated.
|
int |
getEventTTL(java.lang.String id) |
protected com.ibm.rules.engine.service.EngineService[] |
getFactoryServices() |
com.ibm.ia.common.GenericEntity |
getGenericEntity(com.ibm.ia.model.Entity entity) |
java.lang.Object |
getGlobalValue(java.lang.String name)
Gets the value of the given global variable name.
|
JobService |
getJobService()
Returns the agent global runtime service for scheduling analytics jobs.
|
protected com.ibm.ia.common.spi.IModelFactory |
getModelFactory()
Deprecated.
prevent use by customer Agents
|
java.lang.String |
getRequiredEngineVersion() |
SolutionDescriptor |
getSolutionDescriptor()
Get solution-specific information.
|
java.util.Map<java.lang.String,java.lang.String> |
getSolutionProperties(java.util.Collection<java.lang.String> propertyNames)
Get multiple solution properties for the solution to which this agent belongs.
|
java.lang.String |
getSolutionProperty(java.lang.String propertyName)
Get a solution property for the solution to which this agent belongs.
|
java.lang.String |
getSolutionProperty(java.lang.String propertyName,
java.lang.String defaultValue)
Get a solution property for the solution to which this agent belongs.
|
SpatialService |
getSpatialService()
Get the Geospatial service library.
|
com.ibm.ia.engine.service.DefaultTimeService |
getTimeService() |
com.ibm.ia.engine.service.DefaultTimeService |
getTimeService(java.lang.String _requiredEngineVersion,
java.time.ZoneId _zoneId) |
boolean |
hasUserDefinedCookie() |
void |
init()
One-time initialization for new agents deployed in the system.
|
com.ibm.ia.engine.runtime.EventEngineDefinition |
initializeEngineDefinition(java.lang.String _requiredEngineVersion,
java.time.ZoneId _zoneId) |
boolean |
isThrowableIgnored() |
java.io.InputStream |
loadRulesetArchive() |
void |
printToLog(java.util.logging.Level level,
java.lang.String message)
Write a message to the log using a specific logging level.
|
void |
printToLog(java.lang.String message)
Write a message to the log.
|
void |
printToLog(java.lang.Throwable throwable)
Log a java.lang.Throwable.
|
abstract void |
process(com.ibm.ia.model.Event event)
Entry point into agent.
|
void |
process(java.lang.String key,
java.lang.String cookie)
Entry point for an agent that is invoked as a result of a previously scheduled callback.
|
com.ibm.ia.model.Event |
resolveEvent(EventReference ref) |
java.lang.String |
schedule(int delay,
java.util.concurrent.TimeUnit unit,
java.lang.String cookie)
Schedule a deferred call to the Agent process(String key, String cookie) method.
|
java.lang.String |
schedule(java.time.ZonedDateTime dateTime,
java.lang.String cookie)
Schedule a deferred call to the Agent process(String key, String cookie) method.
|
void |
setEngineTime(java.time.ZonedDateTime time,
java.lang.String id) |
void |
setEventTTL(int ttl,
java.lang.String id) |
void |
setRequiredEngineVersion(java.lang.String requiredEngineVersion) |
java.lang.String |
toString() |
boolean |
useMonitorWarning() |
emit, getConceptFactory, getEventInstance, getEventResolver, getLocalQueryService, getModelSerializer, getObjectEntityResolver, getObjectEventResolver, getTimeService, processOutboundEvents, resetResolvers, setEntityResolver, setEntityScopedQS, setModelFactory, setObjectEntityResolver, setSolutionDescriptorpublic void init()
public void activated()
public void deactivated()
deactivated in interface com.ibm.ia.common.BaseComponentServicedeactivated in class com.ibm.ia.common.BaseComponentpublic final JobService getJobService()
java.lang.UnsupportedOperationException - if called outside a valid execution contextpublic final java.lang.Object getGlobalValue(java.lang.String name)
name - The name of the variable to get.null.public final SolutionDescriptor getSolutionDescriptor()
getSolutionDescriptor in interface com.ibm.ia.agent.AgentServicegetSolutionDescriptor in interface ExtensiongetSolutionDescriptor in class com.ibm.ia.common.BaseComponentpublic java.lang.String toString()
toString in class java.lang.Objectpublic void process(java.lang.String key,
java.lang.String cookie)
throws AgentException
AgentExceptionkey - The identifier of the schedule to which this invocation applies.cookie - A user-defined string supplied to the schedule method for this scheduled callback.protected EventFactory getEventFactory()
protected EntityFactory getEntityFactory()
protected com.ibm.ia.common.spi.IModelFactory getModelFactory()
getModelFactory in class com.ibm.ia.common.BaseComponentpublic java.lang.String getSolutionProperty(java.lang.String propertyName)
throws java.lang.IllegalArgumentException
getSolutionProperty in interface com.ibm.ia.agent.AgentServicegetSolutionProperty in interface com.ibm.ia.common.BaseComponentServicegetSolutionProperty in interface ExtensiongetSolutionProperty in class com.ibm.ia.common.BaseComponentjava.lang.IllegalArgumentException - if the property name is not recognized.propertyName - The name of the property.public java.lang.String getSolutionProperty(java.lang.String propertyName,
java.lang.String defaultValue)
throws java.lang.IllegalArgumentException
getSolutionProperty in interface com.ibm.ia.agent.AgentServicegetSolutionProperty in interface com.ibm.ia.common.BaseComponentServicegetSolutionProperty in interface ExtensiongetSolutionProperty in class com.ibm.ia.common.BaseComponentjava.lang.IllegalArgumentException - if the property name is not recognized.java.lang.UnsupportedOperationException - if called outside a valid execution contextpropertyName - The name of the property.defaultValue - The value to use if the property is not set.public java.util.Map<java.lang.String,java.lang.String> getSolutionProperties(java.util.Collection<java.lang.String> propertyNames)
getSolutionProperties in interface com.ibm.ia.agent.AgentServicegetSolutionProperties in interface com.ibm.ia.common.BaseComponentServicegetSolutionProperties in interface ExtensiongetSolutionProperties in class com.ibm.ia.common.BaseComponentjava.lang.UnsupportedOperationException - if called outside a valid execution contextpropertyNames - The names of the properties to retrieve.public void emit(com.ibm.ia.model.Event event)
throws AgentException
AgentExceptionevent - The event to emit.public boolean cancelSchedule(java.lang.String key)
throws AgentException
AgentExceptionjava.lang.UnsupportedOperationException - if called outside a valid execution contextkey - The key returned by schedule() to be cancelled.public java.lang.String schedule(int delay,
java.util.concurrent.TimeUnit unit,
java.lang.String cookie)
throws AgentException
java.lang.UnsupportedOperationException - if called outside a valid execution contextAgentExceptiondelay - The number of units (see unit parameter) in the future to delay.
The minimum future time is 1 second. Partial seconds are truncated.
The maximum future time is Integer.MAX_VALUE seconds, larger schedules will be truncated.unit - The java.util.Concurrent.TimeUnit to use. For convenience you can specify
the delay in various units, which will be converted to seconds.cookie - A String which the agent can create which will be passed to the
process(String key, String cookie) method.public java.lang.String schedule(java.time.ZonedDateTime dateTime,
java.lang.String cookie)
throws AgentException
java.lang.UnsupportedOperationException - if called outside a valid execution contextAgentExceptiondateTime - A ZonedDateTime in the future
the minimum future time is 1 second. Partial seconds are truncated.
The maximum future time is Integer.MAX_VALUE seconds, larger schedules will be truncated.cookie - A String which the agent can create which will be passed to the
process(String key, String cookie) method.public SpatialService getSpatialService()
public void printToLog(java.lang.String message)
message - The message to log. The current solution name is automatically included.
You must have the log level set to INFO or greater for these messages to appear in the log.public void printToLog(java.util.logging.Level level,
java.lang.String message)
level - The java.util.logging.Level to use. The message will be logged if the current
logging level is equal to or greater than the specified level.message - The message to log. The current solution name is automatically included.public void printToLog(java.lang.Throwable throwable)
throwable - The java.lang.Throwable to log.public abstract void process(com.ibm.ia.model.Event event)
throws AgentException
AgentExceptionpublic AgentDescriptor getAgentDescriptor()
java.lang.UnsupportedOperationException - if called outside a valid execution contextpublic com.ibm.ia.engine.runtime.EventEngineDefinition initializeEngineDefinition(java.lang.String _requiredEngineVersion,
java.time.ZoneId _zoneId)
public void setEventTTL(int ttl,
java.lang.String id)
public int getEventTTL(java.lang.String id)
public void clearEventTTL(java.lang.String id)
public void setEngineTime(java.time.ZonedDateTime time,
java.lang.String id)
public java.time.ZonedDateTime getEngineTime(java.lang.String id)
public void clearEngineTime(java.lang.String id)
public java.io.InputStream loadRulesetArchive()
public boolean hasUserDefinedCookie()
public boolean isThrowableIgnored()
public boolean agentPerformsSelfMonitoring()
public boolean useMonitorWarning()
public EventReference getCurrentEventReference(int ttl) throws AgentException
AgentExceptionpublic com.ibm.ia.model.Event resolveEvent(EventReference ref)
public Version getAgentVersion()
public com.ibm.ia.engine.service.DefaultTimeService getTimeService()
getTimeService in interface com.ibm.ia.agent.AgentServicegetTimeService in class com.ibm.ia.common.BaseComponentpublic com.ibm.ia.engine.service.DefaultTimeService getTimeService(java.lang.String _requiredEngineVersion,
java.time.ZoneId _zoneId)
public java.lang.String getRequiredEngineVersion()
getRequiredEngineVersion in interface com.ibm.ia.common.BaseComponentServicegetRequiredEngineVersion in class com.ibm.ia.common.BaseComponentpublic void setRequiredEngineVersion(java.lang.String requiredEngineVersion)
setRequiredEngineVersion in interface com.ibm.ia.common.BaseComponentServicesetRequiredEngineVersion in class com.ibm.ia.common.BaseComponentprotected java.lang.String getAgentProperty(java.lang.String propName,
java.lang.String agentQualifier)
protected com.ibm.ia.time.CalendarDuration getCalendarDuration(java.lang.String duration,
com.ibm.ia.time.CalendarDuration defaultDuration)
protected com.ibm.rules.engine.service.EngineService[] getFactoryServices()
public com.ibm.ia.common.GenericEntity getGenericEntity(com.ibm.ia.model.Entity entity)
public java.util.List<com.ibm.ia.common.GenericEvent> getEmittedEvents()
public void clearOutboundEvents()
public <T extends com.ibm.ia.model.Entity> com.ibm.ia.model.Relationship<T> createRelationship(T t)
createRelationship in interface ExtensioncreateRelationship in class com.ibm.ia.common.BaseComponentt - Entity instance for this relationshippublic <T extends com.ibm.ia.model.Entity> com.ibm.ia.model.Relationship<T> createRelationship(java.lang.Class<T> entity,
java.lang.String key)
createRelationship in interface ExtensioncreateRelationship in class com.ibm.ia.common.BaseComponententity - entity class type for this relationshipkey - entity id for this relationship© Copyright IBM 2017