net.esper.eql.core
Class StreamTypeServiceImpl

java.lang.Object
  extended by net.esper.eql.core.StreamTypeServiceImpl
All Implemented Interfaces:
StreamTypeService

public class StreamTypeServiceImpl
extends Object
implements StreamTypeService

Implementation that provides stream number and property type information.


Constructor Summary
StreamTypeServiceImpl(EventType[] eventTypes, String[] streamNames)
          Ctor.
StreamTypeServiceImpl(LinkedHashMap<String,EventType> namesAndTypes, boolean isStreamZeroUnambigous, boolean requireStreamNames)
          Ctor.
 
Method Summary
 EventType[] getEventTypes()
          Returns an array of event types for each event stream in the order declared.
 String[] getStreamNames()
          Returns an array of event stream names in the order declared.
 PropertyResolutionDescriptor resolveByPropertyName(String propertyName)
          Returns the offset of the stream and the type of the property for the given property name, by looking through the types offered and matching up.
 PropertyResolutionDescriptor resolveByStreamAndPropName(String streamAndPropertyName)
          Returns the offset of the stream and the type of the property for the given property name, by looking through the types offered and matching up.
 PropertyResolutionDescriptor resolveByStreamAndPropName(String streamName, String propertyName)
          Returns the offset of the stream and the type of the property for the given property name, by using the specified stream name to resolve the property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamTypeServiceImpl

public StreamTypeServiceImpl(EventType[] eventTypes,
                             String[] streamNames)
Ctor.

Parameters:
eventTypes - - array of event types, one for each stream
streamNames - - array of stream names, one for each stream

StreamTypeServiceImpl

public StreamTypeServiceImpl(LinkedHashMap<String,EventType> namesAndTypes,
                             boolean isStreamZeroUnambigous,
                             boolean requireStreamNames)
Ctor.

Parameters:
namesAndTypes - is the ordered list of stream names and event types available (stream zero to N)
isStreamZeroUnambigous - indicates whether when a property is found in stream zero and another stream an exception should be thrown or the stream zero should be assumed
requireStreamNames - is true to indicate that stream names are required for any non-zero streams (for subqueries)
Method Detail

getEventTypes

public EventType[] getEventTypes()
Description copied from interface: StreamTypeService
Returns an array of event types for each event stream in the order declared.

Specified by:
getEventTypes in interface StreamTypeService
Returns:
event types

getStreamNames

public String[] getStreamNames()
Description copied from interface: StreamTypeService
Returns an array of event stream names in the order declared.

Specified by:
getStreamNames in interface StreamTypeService
Returns:
stream names

resolveByPropertyName

public PropertyResolutionDescriptor resolveByPropertyName(String propertyName)
                                                   throws DuplicatePropertyException,
                                                          PropertyNotFoundException
Description copied from interface: StreamTypeService
Returns the offset of the stream and the type of the property for the given property name, by looking through the types offered and matching up.

This method considers only a property name and looks at all streams to resolve the property name.

Specified by:
resolveByPropertyName in interface StreamTypeService
Parameters:
propertyName - - property name in event
Returns:
descriptor with stream number, property type and property name
Throws:
DuplicatePropertyException - to indicate property was found twice
PropertyNotFoundException - to indicate property could not be resolved

resolveByStreamAndPropName

public PropertyResolutionDescriptor resolveByStreamAndPropName(String streamName,
                                                               String propertyName)
                                                        throws PropertyNotFoundException,
                                                               StreamNotFoundException
Description copied from interface: StreamTypeService
Returns the offset of the stream and the type of the property for the given property name, by using the specified stream name to resolve the property.

This method considers and explicit stream name and property name, both parameters are required.

Specified by:
resolveByStreamAndPropName in interface StreamTypeService
Parameters:
streamName - - name of stream, required
propertyName - - property name in event, , required
Returns:
descriptor with stream number, property type and property name
Throws:
PropertyNotFoundException - to indicate property could not be resolved
StreamNotFoundException - to indicate stream name could not be resolved

resolveByStreamAndPropName

public PropertyResolutionDescriptor resolveByStreamAndPropName(String streamAndPropertyName)
                                                        throws DuplicatePropertyException,
                                                               PropertyNotFoundException
Description copied from interface: StreamTypeService
Returns the offset of the stream and the type of the property for the given property name, by looking through the types offered and matching up.

This method considers a single property name that may or may not be prefixed by a stream name. The resolution first attempts to find the property name itself, then attempts to consider a stream name that may be part of the property name.

Specified by:
resolveByStreamAndPropName in interface StreamTypeService
Parameters:
streamAndPropertyName - - stream name and property name (e.g. s0.p0) or just a property name (p0)
Returns:
descriptor with stream number, property type and property name
Throws:
DuplicatePropertyException - to indicate property was found twice
PropertyNotFoundException - to indicate property could not be resolved