Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Event Processing
11g Release 1 (11.1.1.7)

E14303-11
FRAMES    NO FRAMES
DETAIL:  FIELD | CONSTR | METHOD


com.oracle.cep.shell
Interface EpnCommand


public interface EpnCommand

Commands for manipulating EPN components.

A command is a high-level interface that abstracts the Java API. For instance, the channel command creates an EventChannel without the user having to go through an EventChannelFactory. A session must be commenced by invoking beginSession() before any commands can be issued. When done, a session must be ended by invoking endSession(). Ending a session destroys all EPN components that were created during the session. A session is not multithread aware, and must be synchronized by client. The EPN commands are issued through the OCEP shell. See documentation on how to start the shell. The OCEP shell commands are:

The following variables can also be set for an EPN session:

For example, you can turn off including the time-stamp of the output events by using the following shell command: OUT_TIME=OFF Further, you may make use of the EPN commands in a regular OCEP application. This is done by retrieving the EpnCommand OSGi service. This services is registered as an OSGi service factory, thus each OCEP application gets a separate service object. This is ideal for creating Junit-like test-cases for testing EPNs and CQL statements. However, only the commands exposed in this class as methods can be used for this latter purpose.


Field Summary
static OutputTimeFormat DEFAULT_TIME_FORMAT
          Default time format for output events.
static java.lang.String OUTPUT_TIME_FORMAT_VAR_NAME
          Session variable that indicates format of time-stamp to be included in the output events.

 

Method Summary
 void beginSession()
          Begins a new session for invoking commands.
 EventChannel createChannel(boolean relation, java.lang.String applicationTimestampProp, boolean totalOrder, java.lang.String channelName, java.lang.Class clazz)
          Creates a new channel using a Java class event-type.
 EventChannel createChannel(boolean relation, java.lang.String applicationTimestampProp, boolean totalOrder, java.lang.String channelName, java.util.Map metadata)
          Creates a new channel using a metadata-based event-type.
 EventChannel createChannel(boolean relation, java.lang.String channelName, java.lang.Class clazz)
          Creates a new system timestamped channel using a Java class event-type.
 EventChannel createChannel(boolean relation, java.lang.String channelName, java.util.Map metadata)
          Creates a new system timestamped channel using a metadata-based event-type.
 MapEventObject createMapEvent(EventChannel channel, java.util.Map event)
          Creates a map-event to be used for metadata-based channels.
 Processor createProcessor(java.lang.String processorName)
          Creates a CQL processor in the current session.
 Statement createQuery(Processor processor, java.lang.String id, java.lang.String statementValue)
          Creates a CQL query.
 Statement createView(Processor processor, java.lang.String id, java.lang.String statementValue)
          Creates a CQL view.
 void endSession()
          Ends the current session.
 EventChannel[] getChannels()
          Returns all channels that have been created in this current session.
 Processor[] getProcessors()
          Returns all processors that have been created in this session.
 StreamSource link(StreamSource fromStage, StreamSink toStage)
          Connects the fromStage to the toStage.

 

Field Detail

OUTPUT_TIME_FORMAT_VAR_NAME

public static final java.lang.String OUTPUT_TIME_FORMAT_VAR_NAME
Session variable that indicates format of time-stamp to be included in the output events.
See Also:
OutputTimeFormat

DEFAULT_TIME_FORMAT

public static final OutputTimeFormat DEFAULT_TIME_FORMAT
Default time format for output events.

Method Detail

beginSession

public void beginSession()
                  throws java.lang.Exception,
                         java.lang.IllegalStateException
Begins a new session for invoking commands. Only a single session may be active at a time.
Throws:
java.lang.Exception - if session cannot be commenced.
java.lang.IllegalStateException - if a session already exists.

endSession

public void endSession()
                throws java.lang.IllegalStateException
Ends the current session. Only a single session may be active at a time.
Throws:
java.lang.IllegalStateException - if no session has been commenced.

getChannels

public EventChannel[] getChannels()
                           throws java.lang.IllegalStateException
Returns all channels that have been created in this current session.
Returns:
EventChannel [] list of channels in current session
Throws:
java.lang.IllegalStateException - if no session has been commenced.

createChannel

public EventChannel createChannel(boolean relation,
                                  java.lang.String channelName,
                                  java.lang.Class clazz)
                           throws java.lang.Exception,
                                  java.lang.IllegalStateException
Creates a new system timestamped channel using a Java class event-type.
Parameters:
relation - true if channel is a relation, false if it is a stream
channelName - name of the channel
clazz - event-type of the channel
Returns:
EventChannel
Throws:
java.lang.Exception - if channel cannot be created.
java.lang.IllegalStateException - if no session has been commenced.

createChannel

public EventChannel createChannel(boolean relation,
                                  java.lang.String applicationTimestampProp,
                                  boolean totalOrder,
                                  java.lang.String channelName,
                                  java.lang.Class clazz)
                           throws java.lang.Exception,
                                  java.lang.IllegalStateException
Creates a new channel using a Java class event-type. If channel is application timestamped, then event must include a timestamp.
Parameters:
relation - true if channel is a relation, false if it is a stream
applicationTimestampProp - name of the event property that should be used as the application timestamp, or null if channel is system timestamped.
totalOrder - true if application time is always strictly greater than the last value used.
channelName - name of the channel
clazz - event-type of the channel
Returns:
EventChannel
Throws:
java.lang.Exception - if channel cannot be created.
java.lang.IllegalStateException - if no session has been commenced.

createChannel

public EventChannel createChannel(boolean relation,
                                  java.lang.String channelName,
                                  java.util.Map metadata)
                           throws java.lang.Exception,
                                  java.lang.IllegalStateException
Creates a new system timestamped channel using a metadata-based event-type.
Parameters:
relation - true if channel is a relation, false if it is a stream
channelName - name of the channel
metadata - metadata describing the channel's event-type.
Returns:
EventChannel
Throws:
java.lang.Exception - if channel cannot be created.
java.lang.IllegalStateException - if no session has been commenced.

createChannel

public EventChannel createChannel(boolean relation,
                                  java.lang.String applicationTimestampProp,
                                  boolean totalOrder,
                                  java.lang.String channelName,
                                  java.util.Map metadata)
                           throws java.lang.Exception,
                                  java.lang.IllegalStateException
Creates a new channel using a metadata-based event-type. If channel is application time-stamped, then event must include a timestamp.
Parameters:
relation - true if channel is a relation, false if it is a stream
applicationTimestampProp - name of the event property that should be used as the application timestamp, or null if channel is system time-stamped.
totalOrder - true if application time is always strictly greater than the last value used.
channelName - name of the channel
metadata - metadata describing the channel's event-type.
Returns:
EventChannel
Throws:
java.lang.Exception - if channel cannot be created.
java.lang.IllegalStateException - if no session has been commenced.

getProcessors

public Processor[] getProcessors()
                          throws java.lang.IllegalStateException
Returns all processors that have been created in this session.
Returns:
Processor [] processors created in current session.
Throws:
java.lang.IllegalStateException - if no session has been commenced.

createProcessor

public Processor createProcessor(java.lang.String processorName)
                          throws java.lang.Exception,
                                 java.lang.IllegalStateException
Creates a CQL processor in the current session.
Parameters:
processorName - name of the processor
Returns:
Processor
Throws:
java.lang.Exception - if processor cannot be created
java.lang.IllegalStateException - if no session has been commenced.

link

public StreamSource link(StreamSource fromStage,
                         StreamSink toStage)
                  throws java.util.TooManyListenersException,
                         java.lang.IllegalStateException,
                         java.lang.Exception
Connects the fromStage to the toStage.
Parameters:
fromStage - the event source
toStage - the event sink
Returns:
the event source
Throws:
java.util.TooManyListenersException - if fromStage cannot be added another event sink
java.lang.Exception - if link cannot be created
java.lang.IllegalStateException - if no session has been commenced.

createView

public Statement createView(Processor processor,
                            java.lang.String id,
                            java.lang.String statementValue)
                     throws java.lang.IllegalStateException,
                            java.lang.IllegalArgumentException
Creates a CQL view.
Parameters:
processor - the source processor
id - the ID of the view
statementValue - the value of the view
Returns:
Statement CQL view
Throws:
java.lang.IllegalStateException - if no session has been commenced.
java.lang.IllegalArgumentException - if processor was not created in the current session.

createQuery

public Statement createQuery(Processor processor,
                             java.lang.String id,
                             java.lang.String statementValue)
                      throws java.lang.IllegalStateException,
                             java.lang.IllegalArgumentException
Creates a CQL query.
Parameters:
processor - the source processor
id - the ID of the view
statementValue - the value of the view
Returns:
Statement CQL view
Throws:
java.lang.IllegalStateException - if no session has been commenced.
java.lang.IllegalArgumentException - if processor was not created in the current session.

createMapEvent

public MapEventObject createMapEvent(EventChannel channel,
                                     java.util.Map event)
Creates a map-event to be used for metadata-based channels.
Parameters:
channel - targeted channel
event - map-based event
Returns:
event Map-based event

Overview  Package   Class   Use  Tree  Deprecated  Index  Help 
Copyright © 2007, 2013 Oracle and/or its affiliates. All rights reserved.
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD