|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.event.EventAdapterServiceImpl
public class EventAdapterServiceImpl
Implementation for resolving event name to event type.
The implementation assigned a unique identifier to each event type. For Class-based event types, only one EventType instance and one event type id exists for the same class.
Event type names must be unique, that is an name must resolve to a single event type.
Each event type can have multiple names defined for it. For example, expressions such as "select * from A" and "select * from B" in which A and B are names for the same class X the select clauses each fireStatementStopped for events of type X. In summary, names A and B point to the same underlying event type and therefore event type id.
Field Summary |
---|
Fields inherited from interface com.espertech.esper.event.EventAdapterService |
---|
ANONYMOUS_TYPE_NAME_PREFIX |
Constructor Summary | |
---|---|
EventAdapterServiceImpl(EventTypeIdGenerator eventTypeIdGenerator,
int anonymousTypeCacheSize)
Ctor. |
Method Summary | |
---|---|
EventBean |
adapterForBean(java.lang.Object theEvent)
Create an event bean given an event of object id. |
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[] properties,
EventType eventType)
|
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 for the given Java 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 optionalConfig,
boolean isPreconfiguredStatic,
boolean isPreconfigured,
boolean isConfigured,
boolean namedWindow,
boolean insertInto,
boolean table,
java.lang.String tableName)
|
EventType |
addPlugInEventType(java.lang.String eventTypeName,
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)
Add a configured XML DOM event type. |
EventType |
createAnonymousBeanType(java.lang.String eventTypeName,
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 epRuntime,
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. |
static java.lang.String |
isCompatibleWrapper(EventType existingType,
EventType underlyingType,
java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
Returns true if the wrapper type is compatible with an existing wrapper type, for the reason that the underlying event is a subtype of the existing underlying wrapper's type. |
boolean |
removeType(java.lang.String name)
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> classToLegacyConfigs)
Set the legacy Java class type information. |
void |
setDefaultAccessorStyle(ConfigurationEventTypeLegacy.AccessorStyle defaultAccessorStyle)
|
void |
setDefaultPropertyResolutionStyle(Configuration.PropertyResolutionStyle defaultPropertyResolutionStyle)
Sets the default property resolution style. |
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventAdapterServiceImpl(EventTypeIdGenerator eventTypeIdGenerator, int anonymousTypeCacheSize)
Method Detail |
---|
public java.util.Map<java.lang.String,EventType> getDeclaredEventTypes()
getDeclaredEventTypes
in interface EventAdapterService
public void setClassLegacyConfigs(java.util.Map<java.lang.String,ConfigurationEventTypeLegacy> classToLegacyConfigs)
setClassLegacyConfigs
in interface EventAdapterService
classToLegacyConfigs
- is the legacy class configspublic ConfigurationEventTypeLegacy getClassLegacyConfigs(java.lang.String className)
EventAdapterService
getClassLegacyConfigs
in interface EventAdapterService
className
- is the fully-qualified class namepublic java.util.Set<WriteablePropertyDescriptor> getWriteableProperties(EventType eventType, boolean allowAnyType)
EventAdapterService
getWriteableProperties
in interface EventAdapterService
eventType
- to reflect on
public EventBeanManufacturer getManufacturer(EventType eventType, WriteablePropertyDescriptor[] properties, EngineImportService engineImportService, boolean allowAnyType) throws EventBeanManufactureException
EventAdapterService
getManufacturer
in interface EventAdapterService
eventType
- to create underlying objects forproperties
- to write
EventBeanManufactureException
- if a factory cannot be created for the typepublic EventType[] getAllTypes()
EventAdapterService
getAllTypes
in interface EventAdapterService
public void addTypeByName(java.lang.String name, EventType eventType) throws EventAdapterException
EventAdapterService
addTypeByName
in interface EventAdapterService
name
- to add an event type undereventType
- the type to add
EventAdapterException
- if the name is already in used by another typepublic void addEventRepresentation(java.net.URI eventRepURI, PlugInEventRepresentation pluginEventRep) throws EventAdapterException
EventAdapterService
addEventRepresentation
in interface EventAdapterService
eventRepURI
- URI is the unique identifier for the event representationpluginEventRep
- is the instance
EventAdapterException
public EventType addPlugInEventType(java.lang.String eventTypeName, java.net.URI[] resolutionURIs, java.io.Serializable initializer) throws EventAdapterException
EventAdapterService
addPlugInEventType
in interface EventAdapterService
eventTypeName
- is the name of the event typeresolutionURIs
- is the URIs of plug-in event representations, or child URIs of suchinitializer
- is configs for the type
EventAdapterException
public EventSender getStaticTypeEventSender(EPRuntimeEventSender runtimeEventSender, java.lang.String eventTypeName, ThreadingService threadingService) throws EventTypeException
EventAdapterService
getStaticTypeEventSender
in interface EventAdapterService
runtimeEventSender
- the runtime handle for sending the wrapped typeeventTypeName
- is the name of the event type to return the sender forthreadingService
- threading service
EventTypeException
public void updateMapEventType(java.lang.String mapeventTypeName, java.util.Map<java.lang.String,java.lang.Object> typeMap) throws EventAdapterException
EventAdapterService
updateMapEventType
in interface EventAdapterService
mapeventTypeName
- name to updatetypeMap
- additional properties to add, nesting allowed
EventAdapterException
- when the type is not found or is not a Mappublic void updateObjectArrayEventType(java.lang.String objectArrayEventTypeName, java.util.Map<java.lang.String,java.lang.Object> typeMap) throws EventAdapterException
updateObjectArrayEventType
in interface EventAdapterService
EventAdapterException
public EventSender getDynamicTypeEventSender(EPRuntimeEventSender epRuntime, java.net.URI[] uri, ThreadingService threadingService) throws EventTypeException
EventAdapterService
getDynamicTypeEventSender
in interface EventAdapterService
epRuntime
- the runtime handle for sending the wrapped typeuri
- is for plug-in event representations to provide implementations, if accepted, to make a wrapped eventthreadingService
- threading service
EventTypeException
public BeanEventTypeFactory getBeanEventTypeFactory()
EventAdapterService
getBeanEventTypeFactory
in interface EventAdapterService
public void setDefaultPropertyResolutionStyle(Configuration.PropertyResolutionStyle defaultPropertyResolutionStyle)
setDefaultPropertyResolutionStyle
in interface EventAdapterService
defaultPropertyResolutionStyle
- is the default stylepublic void setDefaultAccessorStyle(ConfigurationEventTypeLegacy.AccessorStyle defaultAccessorStyle)
setDefaultAccessorStyle
in interface EventAdapterService
public EventType getExistsTypeByName(java.lang.String eventTypeName)
EventAdapterService
getExistsTypeByName
in interface EventAdapterService
eventTypeName
- is the event type name to return type for
public EventType addBeanType(java.lang.String eventTypeName, java.lang.Class clazz, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured) throws EventAdapterException
EventAdapterService
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
.
addBeanType
in interface EventAdapterService
eventTypeName
- is the name for the event typeclazz
- is the fully Java classisConfigured
- if the class is application-configured
EventAdapterException
- if name already exists and doesn't match class namespublic EventType addBeanTypeByName(java.lang.String eventTypeName, java.lang.Class clazz, boolean isNamedWindow) throws EventAdapterException
addBeanTypeByName
in interface EventAdapterService
EventAdapterException
public EventBean adapterForBean(java.lang.Object theEvent)
adapterForBean
in interface EventAdapterService
theEvent
- is the event class
public EventType addBeanType(java.lang.String eventTypeName, java.lang.String fullyQualClassName, boolean considerAutoName, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured) throws EventAdapterException
addBeanType
in interface EventAdapterService
eventTypeName
- is the namefullyQualClassName
- is the Java class nameconsiderAutoName
- whether auto-name by Java packages should be considered
EventAdapterException
- if the Class name cannot resolve or other error occuredpublic 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
EventAdapterService
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
.
addNestableMapType
in interface EventAdapterService
eventTypeName
- is the name for the event typepropertyTypes
- is the names and types of event propertiesoptionalConfig
- an optional set of Map event type names that are supertypes to the typeisConfigured
- if the type is application-configurednamedWindow
- if the type is from a named windowinsertInto
- if inserting into a stream
EventAdapterException
- if name already exists and doesn't match property type infopublic EventType addNestableObjectArrayType(java.lang.String eventTypeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes, ConfigurationEventTypeObjectArray optionalConfig, boolean isPreconfiguredStatic, boolean isPreconfigured, boolean isConfigured, boolean namedWindow, boolean insertInto, boolean table, java.lang.String tableName) throws EventAdapterException
addNestableObjectArrayType
in interface EventAdapterService
EventAdapterException
public EventBean adapterForMap(java.util.Map<java.lang.String,java.lang.Object> theEvent, java.lang.String eventTypeName) throws EPException
EventAdapterService
EventBean
using the event type name
to identify the EventType that the event should carry.
adapterForMap
in interface EventAdapterService
theEvent
- to be wrappedeventTypeName
- name for the event type of the event
EventAdapterException
- if the name has not been declared, or the event cannot be wrapped using that
name's event type
EPException
public EventBean adapterForObjectArray(java.lang.Object[] theEvent, java.lang.String eventTypeName) throws EPException
adapterForObjectArray
in interface EventAdapterService
EPException
public EventBean adapterForDOM(org.w3c.dom.Node node)
EventAdapterService
adapterForDOM
in interface EventAdapterService
node
- is the node to wrap
public EventBean adapterForTypedDOM(org.w3c.dom.Node node, EventType eventType)
EventAdapterService
adapterForTypedDOM
in interface EventAdapterService
node
- is the node to wrapeventType
- the event type associated with the node
public EventType addXMLDOMType(java.lang.String eventTypeName, ConfigurationEventTypeXMLDOM configurationEventTypeXMLDOM, SchemaModel optionalSchemaModel, boolean isPreconfiguredStatic)
addXMLDOMType
in interface EventAdapterService
eventTypeName
- is the name name of the event typeconfigurationEventTypeXMLDOM
- configures the event type schema and namespace and XPath
property information.optionalSchemaModel
- is the object model of the schema, or null in none provided
public EventType replaceXMLEventType(java.lang.String xmlEventTypeName, ConfigurationEventTypeXMLDOM config, SchemaModel schemaModel)
replaceXMLEventType
in interface EventAdapterService
public final EventBean adapterForType(java.lang.Object theEvent, EventType eventType)
EventAdapterService
adapterForType
in interface EventAdapterService
theEvent
- underlyingeventType
- type
public final EventBean adapterForTypedMap(java.util.Map<java.lang.String,java.lang.Object> properties, EventType eventType)
EventAdapterService
adapterForTypedMap
in interface EventAdapterService
properties
- is key-value pairs for the event propertieseventType
- is the type metadata for any maps of that type
public final EventBean adapterForTypedObjectArray(java.lang.Object[] properties, EventType eventType)
adapterForTypedObjectArray
in interface EventAdapterService
public EventType addWrapperType(java.lang.String eventTypeName, EventType underlyingEventType, java.util.Map<java.lang.String,java.lang.Object> propertyTypes, boolean isNamedWindow, boolean isInsertInto) throws EventAdapterException
EventAdapterService
addWrapperType
in interface EventAdapterService
eventTypeName
- is the name for the event typeunderlyingEventType
- is the event type for the event type that this wrapper wrapspropertyTypes
- is the names and types of any additional propertiesisNamedWindow
- if the type is from a named windowisInsertInto
- if inserting into a stream
EventAdapterException
- if name already exists and doesn't match this type's infopublic static java.lang.String isCompatibleWrapper(EventType existingType, EventType underlyingType, java.util.Map<java.lang.String,java.lang.Object> propertyTypes)
existingType
- is the existing wrapper typeunderlyingType
- is the proposed new wrapper type's underlying typepropertyTypes
- is the additional properties
public final EventType createAnonymousMapType(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes) throws EventAdapterException
EventAdapterService
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.
createAnonymousMapType
in interface EventAdapterService
propertyTypes
- is a map of String to Class objects
EventAdapterException
public final EventType createAnonymousObjectArrayType(java.lang.String typeName, java.util.Map<java.lang.String,java.lang.Object> propertyTypes) throws EventAdapterException
createAnonymousObjectArrayType
in interface EventAdapterService
EventAdapterException
public 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)
EventAdapterService
createSemiAnonymousMapType
in interface EventAdapterService
taggedEventTypes
- simple type per property namearrayEventTypes
- array type per property nameisUsedByChildViews
- if the type is going to be in used by child views
public final EventType createAnonymousWrapperType(java.lang.String typeName, EventType underlyingEventType, java.util.Map<java.lang.String,java.lang.Object> propertyTypes) throws EventAdapterException
EventAdapterService
createAnonymousWrapperType
in interface EventAdapterService
underlyingEventType
- is the event type for the event type that this wrapper wrapspropertyTypes
- is the names and types of any additional properties
EventAdapterException
- if name already exists and doesn't match this type's infopublic final EventBean adapterForTypedWrapper(EventBean theEvent, java.util.Map<java.lang.String,java.lang.Object> properties, EventType eventType)
EventAdapterService
adapterForTypedWrapper
in interface EventAdapterService
theEvent
- is the wrapped eventproperties
- are the additional propertieseventType
- os the type metadata for any wrappers of this type
public final EventBean adapterForTypedBean(java.lang.Object bean, EventType eventType)
EventAdapterService
adapterForTypedBean
in interface EventAdapterService
bean
- event objecteventType
- event type
public void addAutoNamePackage(java.lang.String javaPackageName)
EventAdapterService
addAutoNamePackage
in interface EventAdapterService
javaPackageName
- is the fully-qualified Java package name of the Java package that event classes reside inpublic EventType createAnonymousBeanType(java.lang.String eventTypeName, java.lang.Class clazz)
createAnonymousBeanType
in interface EventAdapterService
public EventBean[] typeCast(java.util.List<EventBean> events, EventType targetType)
EventAdapterService
typeCast
in interface EventAdapterService
events
- to casttargetType
- target type
public boolean removeType(java.lang.String name)
EventAdapterService
Does not uncache an existing class loaded by a JVM. Does remove XML root element names. Does not handle value-add event types.
removeType
in interface EventAdapterService
name
- to remove
public EventBeanSPI getShellForType(EventType eventType)
getShellForType
in interface EventAdapterService
public EventBeanAdapterFactory getAdapterFactoryForType(EventType eventType)
getAdapterFactoryForType
in interface EventAdapterService
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |