net.esper.eql.named
Class NamedWindowServiceImpl

java.lang.Object
  extended by net.esper.eql.named.NamedWindowServiceImpl
All Implemented Interfaces:
NamedWindowService

public class NamedWindowServiceImpl
extends Object
implements NamedWindowService

This service hold for each named window a dedicated processor and a lock to the named window. This lock is shrared between the named window and on-delete statements.


Field Summary
 
Fields inherited from interface net.esper.eql.named.NamedWindowService
ERROR_MSG_DATAWINDOWS, ERROR_MSG_NO_DATAWINDOW_ALLOWED
 
Constructor Summary
NamedWindowServiceImpl(StatementLockFactory statementLockFactory, VariableService variableService)
          Ctor.
 
Method Summary
 void addDispatch(NamedWindowDeltaData delta, Map<EPStatementHandle,List<NamedWindowConsumerView>> consumers)
          For use to add a result of a named window that must be dispatched to consuming views.
 void addNamedWindowLock(String windowName, ManagedLock statementResourceLock)
          Sets the lock to use for a named window.
 NamedWindowProcessor addProcessor(String name, EventType eventType)
          Create a new named window.
 void destroy()
          Clear out the service.
 boolean dispatch()
          Dispatch events of the insert and remove stream of named windows to consumers, as part of the main event processing or dispatch loop.
 ManagedLock getNamedWindowLock(String windowName)
          Returns the statement lock for the named window, to be shared with on-delete statements for the same named window.
 NamedWindowProcessor getProcessor(String name)
          Returns the processing instance for a given named window.
 boolean isNamedWindow(String name)
          Returns true to indicate that the name is a named window.
 void removeProcessor(String name)
          Upon destroy of the named window creation statement, the named window processor must be removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedWindowServiceImpl

public NamedWindowServiceImpl(StatementLockFactory statementLockFactory,
                              VariableService variableService)
Ctor.

Parameters:
statementLockFactory - statement lock factory
variableService - is for variable access
Method Detail

destroy

public void destroy()
Description copied from interface: NamedWindowService
Clear out the service.

Specified by:
destroy in interface NamedWindowService

getNamedWindowLock

public ManagedLock getNamedWindowLock(String windowName)
Description copied from interface: NamedWindowService
Returns the statement lock for the named window, to be shared with on-delete statements for the same named window.

Specified by:
getNamedWindowLock in interface NamedWindowService
Parameters:
windowName - is the window name
Returns:
the lock for the named window, or null if the window dos not yet exists

addNamedWindowLock

public void addNamedWindowLock(String windowName,
                               ManagedLock statementResourceLock)
Description copied from interface: NamedWindowService
Sets the lock to use for a named window.

Specified by:
addNamedWindowLock in interface NamedWindowService
Parameters:
windowName - is the named window name
statementResourceLock - is the statement lock for the create window statement

isNamedWindow

public boolean isNamedWindow(String name)
Description copied from interface: NamedWindowService
Returns true to indicate that the name is a named window.

Specified by:
isNamedWindow in interface NamedWindowService
Parameters:
name - is the window name
Returns:
true if a named window, false if not a named window

getProcessor

public NamedWindowProcessor getProcessor(String name)
Description copied from interface: NamedWindowService
Returns the processing instance for a given named window.

Specified by:
getProcessor in interface NamedWindowService
Parameters:
name - window name
Returns:
processor for the named window

addProcessor

public NamedWindowProcessor addProcessor(String name,
                                         EventType eventType)
                                  throws ViewProcessingException
Description copied from interface: NamedWindowService
Create a new named window.

Specified by:
addProcessor in interface NamedWindowService
Parameters:
name - window name
eventType - the event type of the window
Returns:
processor for the named window
Throws:
ViewProcessingException - if the named window already exists

removeProcessor

public void removeProcessor(String name)
Description copied from interface: NamedWindowService
Upon destroy of the named window creation statement, the named window processor must be removed.

Specified by:
removeProcessor in interface NamedWindowService
Parameters:
name - is the named window name

addDispatch

public void addDispatch(NamedWindowDeltaData delta,
                        Map<EPStatementHandle,List<NamedWindowConsumerView>> consumers)
Description copied from interface: NamedWindowService
For use to add a result of a named window that must be dispatched to consuming views.

Specified by:
addDispatch in interface NamedWindowService
Parameters:
delta - is the result to dispatch
consumers - is the destination of the dispatch, a map of statements to one or more consuming views

dispatch

public boolean dispatch()
Description copied from interface: NamedWindowService
Dispatch events of the insert and remove stream of named windows to consumers, as part of the main event processing or dispatch loop.

Specified by:
dispatch in interface NamedWindowService
Returns:
send events to consuming statements

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com