com.espertech.esper.client.context
Interface EPContextPartitionAdmin

All Known Subinterfaces:
EPContextPartitionAdminSPI
All Known Implementing Classes:
EPContextPartitionAdminImpl

public interface EPContextPartitionAdmin

Service interface for administration of contexts and context partitions.


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.
 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.
 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.
 

Method Detail

getContextStatementNames

java.lang.String[] getContextStatementNames(java.lang.String contextName)
Returns the statement names associated to the context of the given name.

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

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

int getContextNestingLevel(java.lang.String contextName)
Returns the nesting level for the context declaration, i.e. 1 for unnested and >1 for nested contexts.

Parameters:
contextName - context name
Returns:
nesting level
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared

destroyContextPartitions

ContextPartitionCollection destroyContextPartitions(java.lang.String contextName,
                                                    ContextPartitionSelector selector)
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.

Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the destroyed context partition ids and descriptors
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared
InvalidContextPartitionSelector - if the selector type and context declaration mismatch

stopContextPartitions

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.

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.

Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the stopped context partition ids and descriptors
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared
InvalidContextPartitionSelector - if the selector type and context declaration mismatch

startContextPartitions

ContextPartitionCollection startContextPartitions(java.lang.String contextName,
                                                  ContextPartitionSelector selector)
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.

Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the started context partition ids and descriptors
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared
InvalidContextPartitionSelector - if the selector type and context declaration mismatch

getContextPartitions

ContextPartitionCollection getContextPartitions(java.lang.String contextName,
                                                ContextPartitionSelector selector)
Returns information about selected context partitions including state.

Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
collection of the context partition ids and descriptors
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared
InvalidContextPartitionSelector - if the selector type and context declaration mismatch

getContextPartitionIds

java.util.Set<java.lang.Integer> getContextPartitionIds(java.lang.String contextName,
                                                        ContextPartitionSelector selector)
Returns the context partition ids.

Parameters:
contextName - context name
selector - a selector that identifies the context partitions
Returns:
set of the context partition ids
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared
InvalidContextPartitionSelector - if the selector type and context declaration mismatch

destroyContextPartition

ContextPartitionDescriptor destroyContextPartition(java.lang.String contextName,
                                                   int agentInstanceId)
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.

Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared

stopContextPartition

ContextPartitionDescriptor stopContextPartition(java.lang.String contextName,
                                                int agentInstanceId)
Stop the context partition if it is currently started and returning its descriptor.

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
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared

startContextPartition

ContextPartitionDescriptor startContextPartition(java.lang.String contextName,
                                                 int agentInstanceId)
Start the context partition if it is currently stopped and returning its descriptor.

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
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared

getDescriptor

ContextPartitionDescriptor getDescriptor(java.lang.String contextName,
                                         int agentInstanceId)
Returning the descriptor of a given context partition.

Parameters:
contextName - context name
agentInstanceId - the context partition id number
Returns:
descriptor or null if the context partition is not found
Throws:
java.lang.IllegalArgumentException - if a context by that name was not declared

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