com.apama.event.parser
Class EventParser

java.lang.Object
  extended by com.apama.event.parser.EventParser

public class EventParser
extends java.lang.Object

Provides the functionality to parse String objects into Apama Event objects, for any EventType registered with the parser.

Threading: The EventParser is thread-safe.

See the EventType documentation for an example of how event strings may be parsed using this class.


Constructor Summary
EventParser(EventType... types)
          Constructor to create an EventParser.
 
Method Summary
 void deregisterEventType(EventType type)
          Deregister the given event type from being a valid type this parser.
static EventParser getDefaultParser()
          Singleton method for retrieving the default (singleton) EventParser.
 EventType getEventType(java.lang.String name)
          Retrieve an Event Type by name.
static java.lang.String getTypeName(java.lang.String eventString)
          Method to extract and return the event type name from an event string.
 Event parse(java.lang.String eventString)
          Parse an event string.
 void registerEventType(EventType type)
          Register the given event type as being a valid type this parser recognizes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventParser

public EventParser(EventType... types)
Constructor to create an EventParser.

Parameters:
types - Optional parameter for automatically registering a set of initial event types with the parser.
Method Detail

getDefaultParser

public static EventParser getDefaultParser()
Singleton method for retrieving the default (singleton) EventParser.

Returns:
the singleton EventParser instance.

registerEventType

public void registerEventType(EventType type)
Register the given event type as being a valid type this parser recognizes.

Parameters:
type - the event type to parse

deregisterEventType

public void deregisterEventType(EventType type)
Deregister the given event type from being a valid type this parser. recognizes.

Parameters:
type - the event type to parse

getEventType

public EventType getEventType(java.lang.String name)
Retrieve an Event Type by name.

Parameters:
name - the name of the EventType
Returns:
the EventType or null if unknown

parse

public Event parse(java.lang.String eventString)
            throws ParserRuntimeException
Parse an event string.

Parameters:
eventString - the string representation of the event
Returns:
The resulting Event object
Throws:
ParserRuntimeException - if the event string is invalid, or if the EventType of the specified event has not been registered with this EventParser.

getTypeName

public static java.lang.String getTypeName(java.lang.String eventString)
Method to extract and return the event type name from an event string. Note that this method will NOT parse the entire event, only the name will be extracted from the eventString.

Parameters:
eventString - the event string to process
Returns:
the type name or null if the name cannot be extracted


Submit a bug or feature
Copyright (c) 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG