com.espertech.esper.core.service
Class EPContextPartitionAdminImpl

java.lang.Object
  extended by com.espertech.esper.core.service.EPContextPartitionAdminImpl
All Implemented Interfaces:
EPContextPartitionAdmin, EPContextPartitionAdminSPI

public class EPContextPartitionAdminImpl
extends java.lang.Object
implements EPContextPartitionAdminSPI


Nested Class Summary
static class EPContextPartitionAdminImpl.CPImportCallback
           
static class EPContextPartitionAdminImpl.CPSelectorById
           
 
Constructor Summary
EPContextPartitionAdminImpl(EPServicesContext services)
           
 
Method Summary
 ContextPartitionDescriptor destroyContextPartition(java.lang.String contextName, int agentInstanceId)
          Destroy the context partition returning its descriptor.
 ContextPartitionCollection destroyContextPartitions(java.lang.String contextName, ContextPartitionSelector selector)
          Destroy one or more context partitions dropping the associated state and removing associated context partition metadata.
 EPContextPartitionExtract extractDestroyPaths(java.lang.String contextName, ContextPartitionSelector selector)
           
 EPContextPartitionExtract extractPaths(java.lang.String contextName, ContextPartitionSelector selector)
           
 EPContextPartitionExtract extractStopPaths(java.lang.String contextName, ContextPartitionSelector selector)
           
 int getContextNestingLevel(java.lang.String contextName)
          Returns the nesting level for the context declaration, i.e.
 java.util.Set<java.lang.Integer> getContextPartitionIds(java.lang.String contextName, ContextPartitionSelector selector)
          Returns the context partition ids.
 ContextPartitionCollection getContextPartitions(java.lang.String contextName, ContextPartitionSelector selector)
          Returns information about selected context partitions including state.
 java.lang.String[] getContextStatementNames(java.lang.String contextName)
          Returns the statement names associated to the context of the given name.
 ContextPartitionDescriptor getDescriptor(java.lang.String contextName, int agentInstanceId)
          Returning the descriptor of a given context partition.
 EPContextPartitionImportResult importStartPaths(java.lang.String contextName, EPContextPartitionImportable importable, AgentInstanceSelector agentInstanceSelector)
           
 ContextPartitionDescriptor startContextPartition(java.lang.String contextName, int agentInstanceId)
          Start the context partition if it is currently stopped and returning its descriptor.
 ContextPartitionCollection startContextPartitions(java.lang.String contextName, ContextPartitionSelector selector)
          Start one or more context partitions that were previously stopped.
 ContextPartitionDescriptor stopContextPartition(java.lang.String contextName, int agentInstanceId)
          Stop the context partition if it is currently started and returning its descriptor.
 ContextPartitionCollection stopContextPartitions(java.lang.String contextName, ContextPartitionSelector selector)
          Stop one or more context partitions that are currently started, dropping the associated state and but keeping associated context partition metadata for the purpose of starting it again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPContextPartitionAdminImpl

public EPContextPartitionAdminImpl(EPServicesContext services)
Method Detail

getContextStatementNames

public java.lang.String[] getContextStatementNames(java.lang.String contextName)
Description copied from interface: EPContextPartitionAdmin
Returns the statement names associated to the context of the given name.

Returns null if a context declaration for the name does not exist.

Specified by:
getContextStatementNames in interface EPContextPartitionAdmin
Parameters:
contextName - context name to return statements for
Returns:
statement names, or null if the context does not exist, or empty list if no statements are associated to the context (counting started and stopped statements, not destroyed ones).

getContextNestingLevel

public int getContextNestingLevel(java.lang.String contextName)
Description copied from interface: EPContextPartitionAdmin
Returns the nesting level for the context declaration, i.e. 1 for unnested and >1 for nested contexts.

Specified by:
getContextNestingLevel in interface EPContextPartitionAdmin
Parameters:
contextName - context name
Returns:
nesting level

destroyContextPartitions

public ContextPartitionCollection destroyContextPartitions(java.lang.String contextName,
                                                           ContextPartitionSelector selector)
Description copied from interface: EPContextPartitionAdmin
Destroy one or more context partitions dropping the associated state and removing associated context partition metadata.

For key-partitioned contexts and hash-segmented contexts the next event for such context partition allocates a new context partition for that key or hash.

If context partitions cannot be found they are not part of the collection returned. Only context partitions in stopped or started state can be destroyed.

Specified by:
destroyContextPartitions in interface EPContextPartitionAdmin
Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the destroyed context partition ids and descriptors

destroyContextPartition

public ContextPartitionDescriptor destroyContextPartition(java.lang.String contextName,
                                                          int agentInstanceId)
Description copied from interface: EPContextPartitionAdmin
Destroy the context partition returning its descriptor.

For key-partitioned contexts and hash-segmented contexts the next event for such context partition allocates a new context partition for that key or hash.

Only context partitions in stopped or started state can be destroyed.

Specified by:
destroyContextPartition in interface EPContextPartitionAdmin
Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found

extractDestroyPaths

public EPContextPartitionExtract extractDestroyPaths(java.lang.String contextName,
                                                     ContextPartitionSelector selector)
Specified by:
extractDestroyPaths in interface EPContextPartitionAdminSPI

stopContextPartitions

public ContextPartitionCollection stopContextPartitions(java.lang.String contextName,
                                                        ContextPartitionSelector selector)
Description copied from interface: EPContextPartitionAdmin
Stop one or more context partitions that are currently started, dropping the associated state and but keeping associated context partition metadata for the purpose of starting it again.

Stopping a context partition means any associated statements no longer process events or time for that context partition only, and dropping all such associated state.

If context partitions cannot be found they are not part of the collection returned. Stopped context partitions remain stopped and are not returned.

Specified by:
stopContextPartitions in interface EPContextPartitionAdmin
Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the stopped context partition ids and descriptors

startContextPartitions

public ContextPartitionCollection startContextPartitions(java.lang.String contextName,
                                                         ContextPartitionSelector selector)
Description copied from interface: EPContextPartitionAdmin
Start one or more context partitions that were previously stopped.

Starting a context partition means any associated statements beging to process events or time for that context partition, starting fresh with newly allocated state.

If context partitions cannot be found they are not part of the collection returned. Started context partitions remain started and are not returned.

Specified by:
startContextPartitions in interface EPContextPartitionAdmin
Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the started context partition ids and descriptors

getContextPartitions

public ContextPartitionCollection getContextPartitions(java.lang.String contextName,
                                                       ContextPartitionSelector selector)
Description copied from interface: EPContextPartitionAdmin
Returns information about selected context partitions including state.

Specified by:
getContextPartitions in interface EPContextPartitionAdmin
Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the context partition ids and descriptors

stopContextPartition

public ContextPartitionDescriptor stopContextPartition(java.lang.String contextName,
                                                       int agentInstanceId)
Description copied from interface: EPContextPartitionAdmin
Stop the context partition if it is currently started and returning its descriptor.

Specified by:
stopContextPartition in interface EPContextPartitionAdmin
Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found or is already stopped

startContextPartition

public ContextPartitionDescriptor startContextPartition(java.lang.String contextName,
                                                        int agentInstanceId)
Description copied from interface: EPContextPartitionAdmin
Start the context partition if it is currently stopped and returning its descriptor.

Specified by:
startContextPartition in interface EPContextPartitionAdmin
Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found or is already started

getDescriptor

public ContextPartitionDescriptor getDescriptor(java.lang.String contextName,
                                                int agentInstanceId)
Description copied from interface: EPContextPartitionAdmin
Returning the descriptor of a given context partition.

Specified by:
getDescriptor in interface EPContextPartitionAdmin
Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found

extractStopPaths

public EPContextPartitionExtract extractStopPaths(java.lang.String contextName,
                                                  ContextPartitionSelector selector)
Specified by:
extractStopPaths in interface EPContextPartitionAdminSPI

extractPaths

public EPContextPartitionExtract extractPaths(java.lang.String contextName,
                                              ContextPartitionSelector selector)
Specified by:
extractPaths in interface EPContextPartitionAdminSPI

getContextPartitionIds

public java.util.Set<java.lang.Integer> getContextPartitionIds(java.lang.String contextName,
                                                               ContextPartitionSelector selector)
Description copied from interface: EPContextPartitionAdmin
Returns the context partition ids.

Specified by:
getContextPartitionIds in interface EPContextPartitionAdmin
Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
set of the context partition ids

importStartPaths

public EPContextPartitionImportResult importStartPaths(java.lang.String contextName,
                                                       EPContextPartitionImportable importable,
                                                       AgentInstanceSelector agentInstanceSelector)
Specified by:
importStartPaths in interface EPContextPartitionAdminSPI

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com