com.espertech.esper.event
Interface EventAdapterService

All Known Implementing Classes:
EventAdapterServiceImpl

public interface EventAdapterService

Interface for a service to resolve event names to event type.


Field Summary
static java.lang.String ANONYMOUS_TYPE_NAME_PREFIX
           
 
Method Summary
 EventBean adapterForBean(java.lang.Object theEvent)
          Wrap the native event returning an EventBean.
 EventBean adapterForDOM(org.w3c.dom.Node node)
          Returns an adapter for the XML DOM document that exposes it's data as event properties for use in statements.
 EventBean adapterForMap(java.util.Map<java.lang.String,java.lang.Object> theEvent, java.lang.String eventTypeName)
          Wrap the Map-type event returning an EventBean using the event type name to identify the EventType that the event should carry.
 EventBean adapterForObjectArray(java.lang.Object[] theEvent, java.lang.String eventTypeName)
           
 EventBean adapterForType(java.lang.Object theEvent, EventType eventType)
          Returns an adapter for an event underlying object when the event type is known.
 EventBean adapterForTypedBean(java.lang.Object bean, EventType eventType)
          Creates a thin adaper for an event object given an event type.
 EventBean adapterForTypedDOM(org.w3c.dom.Node node, EventType eventType)
          Returns an adapter for the XML DOM document that exposes it's data as event properties for use in statements.
 EventBean adapterForTypedMap(java.util.Map<java.lang.String,java.lang.Object> properties, EventType eventType)
          Create an event map bean from a set of event properties (name and value objectes) stored in a Map.
 EventBean adapterForTypedObjectArray(java.lang.Object[] props, EventType resultEventType)
           
 EventBean adapterForTypedWrapper(EventBean theEvent, java.util.Map<java.lang.String,java.lang.Object> properties, EventType eventType)
          Creata a wrapper around an event and some additional properties
 void addAutoNamePackage(java.lang.String javaPackageName)
          Adds a Java package name of a package that Java event classes reside in.
 EventType addBeanType(java.lang.String eventTypeName, java.lang.Class clazz, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured)
          Add an event type with the given name and Java class.
 EventType addBeanType(java.lang.String eventTypeName, java.lang.String fullyQualClassName, boolean considerAutoName, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured)
          Add an event type with the given name and Java fully-qualified class name.
 EventType addBeanTypeByName(java.lang.String eventTypeName, java.lang.Class clazz, boolean isNamedWindow)
           
 void addEventRepresentation(java.net.URI eventRepURI, PlugInEventRepresentation pluginEventRep)
          Add a plug-in event representation.
 EventType addNestableMapType(java.lang.String eventTypeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes, ConfigurationEventTypeMap optionalConfig, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured, boolean namedWindow, boolean insertInto)
          Add an event type with the given name and a given set of properties, wherein properties may itself be Maps, nested and strongly-typed.
 EventType addNestableObjectArrayType(java.lang.String eventTypeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes, ConfigurationEventTypeObjectArray typeConfig, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured, boolean namedWindow, boolean insertInto, boolean table, java.lang.String tableName)
           
 EventType addPlugInEventType(java.lang.String name, java.net.URI[] resolutionURIs, java.io.Serializable initializer)
          Adds a plug-in event type.
 void addTypeByName(java.lang.String name, EventType eventType)
          Adds an event type to the registery available for use, and originating outside as a non-adapter.
 EventType addWrapperType(java.lang.String eventTypeName, EventType underlyingEventType, java.util.Map<java.lang.String,java.lang.Object> propertyTypes, boolean isNamedWindow, boolean isInsertInto)
          Add an event type with the given name and the given underlying event type, as well as the additional given properties.
 EventType addXMLDOMType(java.lang.String eventTypeName, ConfigurationEventTypeXMLDOM configurationEventTypeXMLDOM, SchemaModel optionalSchemaModel, boolean isPreconfiguredStatic)
          Adds an XML DOM event type.
 EventType createAnonymousBeanType(java.lang.String schemaName, java.lang.Class clazz)
           
 EventType createAnonymousMapType(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
          Creates a new anonymous EventType instance for an event type that contains a map of name value pairs.
 EventType createAnonymousObjectArrayType(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
           
 EventType createAnonymousWrapperType(java.lang.String typeName, EventType underlyingEventType, java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
          Create a new anonymous event type with the given underlying event type, as well as the additional given properties.
 EventType createSemiAnonymousMapType(java.lang.String typeName, java.util.Map<java.lang.String,Pair<EventType,java.lang.String>> taggedEventTypes, java.util.Map<java.lang.String,Pair<EventType,java.lang.String>> arrayEventTypes, boolean isUsedByChildViews)
          Creates an anonymous map that has no name, however in a fail-over scenario events of this type may be recoverable and therefore the type is only semi-anonymous, identified by the tags and event type names used.
 EventBeanAdapterFactory getAdapterFactoryForType(EventType eventType)
           
 EventType[] getAllTypes()
          Return all known event types.
 BeanEventTypeFactory getBeanEventTypeFactory()
          Returns a subset of the functionality of the service specific to creating POJO bean event types.
 ConfigurationEventTypeLegacy getClassLegacyConfigs(java.lang.String className)
          Returns the configured legacy Java class information or null if none defined.
 java.util.Map<java.lang.String,EventType> getDeclaredEventTypes()
           
 EventSender getDynamicTypeEventSender(EPRuntimeEventSender runtimeEventSender, java.net.URI[] uri, ThreadingService threadingService)
          Returns an event sender that dynamically decides what the event type for a given object is.
 EventType getExistsTypeByName(java.lang.String eventTypeName)
          Return the event type for a given event name, or null if none is registered for that name.
 EventBeanManufacturer getManufacturer(EventType eventType, WriteablePropertyDescriptor[] properties, EngineImportService engineImportService, boolean allowAnyType)
          Returns a factory for creating and populating event object instances for the given type.
 EventBeanSPI getShellForType(EventType eventType)
           
 EventSender getStaticTypeEventSender(EPRuntimeEventSender runtimeEventSender, java.lang.String eventTypeName, ThreadingService threadingService)
          Returns an event sender for a specific type, only generating events of that type.
 java.util.Set<WriteablePropertyDescriptor> getWriteableProperties(EventType eventType, boolean allowAnyType)
          Returns descriptors for all writable properties.
 boolean removeType(java.lang.String eventTypeName)
          Removes an event type by a given name indicating by the return value whether the type was found or not.
 EventType replaceXMLEventType(java.lang.String xmlEventTypeName, ConfigurationEventTypeXMLDOM config, SchemaModel schemaModel)
           
 void setClassLegacyConfigs(java.util.Map<java.lang.String,ConfigurationEventTypeLegacy> classLegacyInfo)
          Sets the configured legacy Java class information.
 void setDefaultAccessorStyle(ConfigurationEventTypeLegacy.AccessorStyle defaultAccessorStyle)
           
 void setDefaultPropertyResolutionStyle(Configuration.PropertyResolutionStyle classPropertyResolutionStyle)
          Sets the resolution style for case-sentitivity.
 EventBean[] typeCast(java.util.List<EventBean> events, EventType targetType)
          Casts event type of a list of events to either Wrapper or Map type.
 void updateMapEventType(java.lang.String mapEventTypeName, java.util.Map<java.lang.String,java.lang.Object> typeMap)
          Update a given Map event type.
 void updateObjectArrayEventType(java.lang.String objectArrayEventTypeName, java.util.Map<java.lang.String,java.lang.Object> typeMap)
           
 

Field Detail

ANONYMOUS_TYPE_NAME_PREFIX

static final java.lang.String ANONYMOUS_TYPE_NAME_PREFIX
See Also:
Constant Field Values
Method Detail

getWriteableProperties

java.util.Set<WriteablePropertyDescriptor> getWriteableProperties(EventType eventType,
                                                                  boolean allowAnyType)
Returns descriptors for all writable properties.

Parameters:
eventType - to reflect on
Returns:
list of writable properties

getManufacturer

EventBeanManufacturer getManufacturer(EventType eventType,
                                      WriteablePropertyDescriptor[] properties,
                                      EngineImportService engineImportService,
                                      boolean allowAnyType)
                                      throws EventBeanManufactureException
Returns a factory for creating and populating event object instances for the given type.

Parameters:
eventType - to create underlying objects for
properties - to write
engineImportService -
Returns:
factory
Throws:
EventBeanManufactureException - if a factory cannot be created for the type

adapterForTypedBean

EventBean adapterForTypedBean(java.lang.Object bean,
                              EventType eventType)
Creates a thin adaper for an event object given an event type.

Parameters:
bean - event object
eventType - event type
Returns:
event

addTypeByName

void addTypeByName(java.lang.String name,
                   EventType eventType)
                   throws EventAdapterException
Adds an event type to the registery available for use, and originating outside as a non-adapter.

Parameters:
name - to add an event type under
eventType - the type to add
Throws:
EventAdapterException - if the name is already in used by another type

getExistsTypeByName

EventType getExistsTypeByName(java.lang.String eventTypeName)
Return the event type for a given event name, or null if none is registered for that name.

Parameters:
eventTypeName - is the event type name to return type for
Returns:
event type for named event, or null if unknown/unnamed type

getAllTypes

EventType[] getAllTypes()
Return all known event types.

Returns:
event types

addNestableMapType

EventType addNestableMapType(java.lang.String eventTypeName,
                             java.util.Map<java.lang.String,java.lang.Object> propertyTypes,
                             ConfigurationEventTypeMap optionalConfig,
                             boolean isPreconfiguredStatic,
                             boolean isPreconfigured,
                             boolean isConfigured,
                             boolean namedWindow,
                             boolean insertInto)
                             throws EventAdapterException
Add an event type with the given name and a given set of properties, wherein properties may itself be Maps, nested and strongly-typed.

If the name already exists with the same event property information, returns the existing EventType instance.

If the name already exists with different event property information, throws an exception.

If the name does not already exists, adds the name and constructs a new MapEventType.

Parameters:
eventTypeName - is the name for the event type
propertyTypes - is the names and types of event properties
optionalConfig - an optional set of Map event type names that are supertypes to the type
isConfigured - if the type is application-configured
namedWindow - if the type is from a named window
insertInto - if inserting into a stream
Returns:
event type is the type added
Throws:
EventAdapterException - if name already exists and doesn't match property type info

addWrapperType

EventType addWrapperType(java.lang.String eventTypeName,
                         EventType underlyingEventType,
                         java.util.Map<java.lang.String,java.lang.Object> propertyTypes,
                         boolean isNamedWindow,
                         boolean isInsertInto)
                         throws EventAdapterException
Add an event type with the given name and the given underlying event type, as well as the additional given properties.

Parameters:
eventTypeName - is the name for the event type
underlyingEventType - is the event type for the event type that this wrapper wraps
propertyTypes - is the names and types of any additional properties
isNamedWindow - if the type is from a named window
isInsertInto - if inserting into a stream
Returns:
eventType is the type added
Throws:
EventAdapterException - if name already exists and doesn't match this type's info

createAnonymousMapType

EventType createAnonymousMapType(java.lang.String typeName,
                                 java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
Creates a new anonymous EventType instance for an event type that contains a map of name value pairs. The method accepts a Map that contains the property names as keys and Class objects as the values. The Class instances represent the property types.

New instances are createdStatement by this method on every invocation. Clients to this method need to cache the returned EventType instance to reuse EventType's for same-typed events.

Parameters:
propertyTypes - is a map of String to Class objects
Returns:
EventType implementation for map field names and value types

adapterForTypedWrapper

EventBean adapterForTypedWrapper(EventBean theEvent,
                                 java.util.Map<java.lang.String,java.lang.Object> properties,
                                 EventType eventType)
Creata a wrapper around an event and some additional properties

Parameters:
theEvent - is the wrapped event
properties - are the additional properties
eventType - os the type metadata for any wrappers of this type
Returns:
wrapper event bean

addBeanType

EventType addBeanType(java.lang.String eventTypeName,
                      java.lang.String fullyQualClassName,
                      boolean considerAutoName,
                      boolean isPreconfiguredStatic,
                      boolean isPreconfigured,
                      boolean isConfigured)
                      throws EventAdapterException
Add an event type with the given name and Java fully-qualified class name.

If the name already exists with the same class name, returns the existing EventType instance.

If the name already exists with different class name, throws an exception.

If the name does not already exists, adds the name and constructs a new BeanEventType.

Takes into account all event-type-auto-package names supplied and attempts to resolve the class name via the packages if the direct resolution failed.

Parameters:
eventTypeName - is the name for the event type
fullyQualClassName - is the fully qualified class name
considerAutoName - whether auto-name by Java packages should be considered
Returns:
event type is the type added
Throws:
EventAdapterException - if name already exists and doesn't match class names

addBeanType

EventType addBeanType(java.lang.String eventTypeName,
                      java.lang.Class clazz,
                      boolean isPreconfiguredStatic,
                      boolean isPreconfigured,
                      boolean isConfigured)
                      throws EventAdapterException
Add an event type with the given name and Java class.

If the name already exists with the same Class, returns the existing EventType instance.

If the name already exists with different Class name, throws an exception.

If the name does not already exists, adds the name and constructs a new BeanEventType.

Parameters:
eventTypeName - is the name for the event type
clazz - is the fully Java class
isConfigured - if the class is application-configured
Returns:
event type is the type added
Throws:
EventAdapterException - if name already exists and doesn't match class names

addBeanTypeByName

EventType addBeanTypeByName(java.lang.String eventTypeName,
                            java.lang.Class clazz,
                            boolean isNamedWindow)
                            throws EventAdapterException
Throws:
EventAdapterException

adapterForBean

EventBean adapterForBean(java.lang.Object theEvent)
Wrap the native event returning an EventBean.

Parameters:
theEvent - to be wrapped
Returns:
event bean wrapping native underlying event

adapterForMap

EventBean adapterForMap(java.util.Map<java.lang.String,java.lang.Object> theEvent,
                        java.lang.String eventTypeName)
                        throws EventAdapterException
Wrap the Map-type event returning an EventBean using the event type name to identify the EventType that the event should carry.

Parameters:
theEvent - to be wrapped
eventTypeName - name for the event type of the event
Returns:
event bean wrapping native underlying event
Throws:
EventAdapterException - if the name has not been declared, or the event cannot be wrapped using that name's event type

adapterForObjectArray

EventBean adapterForObjectArray(java.lang.Object[] theEvent,
                                java.lang.String eventTypeName)
                                throws EventAdapterException
Throws:
EventAdapterException

adapterForTypedMap

EventBean adapterForTypedMap(java.util.Map<java.lang.String,java.lang.Object> properties,
                             EventType eventType)
Create an event map bean from a set of event properties (name and value objectes) stored in a Map.

Parameters:
properties - is key-value pairs for the event properties
eventType - is the type metadata for any maps of that type
Returns:
EventBean instance

adapterForDOM

EventBean adapterForDOM(org.w3c.dom.Node node)
Returns an adapter for the XML DOM document that exposes it's data as event properties for use in statements.

Parameters:
node - is the node to wrap
Returns:
event wrapper for document

adapterForTypedDOM

EventBean adapterForTypedDOM(org.w3c.dom.Node node,
                             EventType eventType)
Returns an adapter for the XML DOM document that exposes it's data as event properties for use in statements.

Parameters:
node - is the node to wrap
eventType - the event type associated with the node
Returns:
event wrapper for document

adapterForType

EventBean adapterForType(java.lang.Object theEvent,
                         EventType eventType)
Returns an adapter for an event underlying object when the event type is known.

Parameters:
theEvent - underlying
eventType - type
Returns:
event wrapper for object

createAnonymousWrapperType

EventType createAnonymousWrapperType(java.lang.String typeName,
                                     EventType underlyingEventType,
                                     java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
                                     throws EventAdapterException
Create a new anonymous event type with the given underlying event type, as well as the additional given properties.

Parameters:
underlyingEventType - is the event type for the event type that this wrapper wraps
propertyTypes - is the names and types of any additional properties
Returns:
eventType is the type createdStatement
Throws:
EventAdapterException - if name already exists and doesn't match this type's info

addXMLDOMType

EventType addXMLDOMType(java.lang.String eventTypeName,
                        ConfigurationEventTypeXMLDOM configurationEventTypeXMLDOM,
                        SchemaModel optionalSchemaModel,
                        boolean isPreconfiguredStatic)
Adds an XML DOM event type.

Parameters:
eventTypeName - is the name to add the type for
configurationEventTypeXMLDOM - is the XML DOM config info
optionalSchemaModel - is the object model of the schema, or null in none provided
Returns:
event type

setClassLegacyConfigs

void setClassLegacyConfigs(java.util.Map<java.lang.String,ConfigurationEventTypeLegacy> classLegacyInfo)
Sets the configured legacy Java class information.

Parameters:
classLegacyInfo - is configured legacy

getClassLegacyConfigs

ConfigurationEventTypeLegacy getClassLegacyConfigs(java.lang.String className)
Returns the configured legacy Java class information or null if none defined.

Parameters:
className - is the fully-qualified class name

setDefaultPropertyResolutionStyle

void setDefaultPropertyResolutionStyle(Configuration.PropertyResolutionStyle classPropertyResolutionStyle)
Sets the resolution style for case-sentitivity.

Parameters:
classPropertyResolutionStyle - for resolving properties.

addAutoNamePackage

void addAutoNamePackage(java.lang.String javaPackageName)
Adds a Java package name of a package that Java event classes reside in.

Parameters:
javaPackageName - is the fully-qualified Java package name of the Java package that event classes reside in

getBeanEventTypeFactory

BeanEventTypeFactory getBeanEventTypeFactory()
Returns a subset of the functionality of the service specific to creating POJO bean event types.

Returns:
bean event type factory

addEventRepresentation

void addEventRepresentation(java.net.URI eventRepURI,
                            PlugInEventRepresentation pluginEventRep)
Add a plug-in event representation.

Parameters:
eventRepURI - URI is the unique identifier for the event representation
pluginEventRep - is the instance

addPlugInEventType

EventType addPlugInEventType(java.lang.String name,
                             java.net.URI[] resolutionURIs,
                             java.io.Serializable initializer)
Adds a plug-in event type.

Parameters:
name - is the name of the event type
resolutionURIs - is the URIs of plug-in event representations, or child URIs of such
initializer - is configs for the type
Returns:
type

getStaticTypeEventSender

EventSender getStaticTypeEventSender(EPRuntimeEventSender runtimeEventSender,
                                     java.lang.String eventTypeName,
                                     ThreadingService threadingService)
Returns an event sender for a specific type, only generating events of that type.

Parameters:
runtimeEventSender - the runtime handle for sending the wrapped type
eventTypeName - is the name of the event type to return the sender for
threadingService - threading service
Returns:
event sender that is static, single-type

getDynamicTypeEventSender

EventSender getDynamicTypeEventSender(EPRuntimeEventSender runtimeEventSender,
                                      java.net.URI[] uri,
                                      ThreadingService threadingService)
Returns an event sender that dynamically decides what the event type for a given object is.

Parameters:
runtimeEventSender - the runtime handle for sending the wrapped type
uri - is for plug-in event representations to provide implementations, if accepted, to make a wrapped event
threadingService - threading service
Returns:
event sender that is dynamic, multi-type based on multiple event bean factories provided by plug-in event representations

updateMapEventType

void updateMapEventType(java.lang.String mapEventTypeName,
                        java.util.Map<java.lang.String,java.lang.Object> typeMap)
                        throws EventAdapterException
Update a given Map event type.

Parameters:
mapEventTypeName - name to update
typeMap - additional properties to add, nesting allowed
Throws:
EventAdapterException - when the type is not found or is not a Map

typeCast

EventBean[] typeCast(java.util.List<EventBean> events,
                     EventType targetType)
Casts event type of a list of events to either Wrapper or Map type.

Parameters:
events - to cast
targetType - target type
Returns:
type casted event array

removeType

boolean removeType(java.lang.String eventTypeName)
Removes an event type by a given name indicating by the return value whether the type was found or not.

Does not uncache an existing class loaded by a JVM. Does remove XML root element names. Does not handle value-add event types.

Parameters:
eventTypeName - to remove
Returns:
true if found and removed, false if not found

createSemiAnonymousMapType

EventType createSemiAnonymousMapType(java.lang.String typeName,
                                     java.util.Map<java.lang.String,Pair<EventType,java.lang.String>> taggedEventTypes,
                                     java.util.Map<java.lang.String,Pair<EventType,java.lang.String>> arrayEventTypes,
                                     boolean isUsedByChildViews)
Creates an anonymous map that has no name, however in a fail-over scenario events of this type may be recoverable and therefore the type is only semi-anonymous, identified by the tags and event type names used.

Parameters:
taggedEventTypes - simple type per property name
arrayEventTypes - array type per property name
isUsedByChildViews - if the type is going to be in used by child views
Returns:
event type

setDefaultAccessorStyle

void setDefaultAccessorStyle(ConfigurationEventTypeLegacy.AccessorStyle defaultAccessorStyle)

replaceXMLEventType

EventType replaceXMLEventType(java.lang.String xmlEventTypeName,
                              ConfigurationEventTypeXMLDOM config,
                              SchemaModel schemaModel)

getDeclaredEventTypes

java.util.Map<java.lang.String,EventType> getDeclaredEventTypes()

adapterForTypedObjectArray

EventBean adapterForTypedObjectArray(java.lang.Object[] props,
                                     EventType resultEventType)

createAnonymousObjectArrayType

EventType createAnonymousObjectArrayType(java.lang.String typeName,
                                         java.util.Map<java.lang.String,java.lang.Object> propertyTypes)

addNestableObjectArrayType

EventType addNestableObjectArrayType(java.lang.String eventTypeName,
                                     java.util.Map<java.lang.String,java.lang.Object> propertyTypes,
                                     ConfigurationEventTypeObjectArray typeConfig,
                                     boolean isPreconfiguredStatic,
                                     boolean isPreconfigured,
                                     boolean isConfigured,
                                     boolean namedWindow,
                                     boolean insertInto,
                                     boolean table,
                                     java.lang.String tableName)
                                     throws EventAdapterException
Throws:
EventAdapterException

updateObjectArrayEventType

void updateObjectArrayEventType(java.lang.String objectArrayEventTypeName,
                                java.util.Map<java.lang.String,java.lang.Object> typeMap)

getShellForType

EventBeanSPI getShellForType(EventType eventType)

getAdapterFactoryForType

EventBeanAdapterFactory getAdapterFactoryForType(EventType eventType)

createAnonymousBeanType

EventType createAnonymousBeanType(java.lang.String schemaName,
                                  java.lang.Class clazz)

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com