com.espertech.esper.core.deploy
Class EPDeploymentAdminImpl

java.lang.Object
  extended by com.espertech.esper.core.deploy.EPDeploymentAdminImpl
All Implemented Interfaces:
EPDeploymentAdmin, EPDeploymentAdminSPI

public class EPDeploymentAdminImpl
extends java.lang.Object
implements EPDeploymentAdminSPI

Deployment administrative implementation.


Constructor Summary
EPDeploymentAdminImpl(EPAdministratorSPI epService, DeploymentStateService deploymentStateService, StatementEventTypeRef statementEventTypeRef, EventAdapterService eventAdapterService, StatementIsolationService statementIsolationService, StatementIdGenerator optionalStatementIdGenerator, FilterService filterService)
          Ctor.
 
Method Summary
 java.lang.String add(Module module)
          Adds a module in undeployed state, generating a deployment id and returning the generated deployment id of the module.
 void add(Module module, java.lang.String assignedDeploymentId)
          Adds a module in undeployed state, using the provided deployment id as a unique identifier for the module.
 DeploymentResult deploy(Module module, DeploymentOptions options)
          Deploy a single module returning a generated deployment id to use when undeploying statements as well as additional statement-level information.
 DeploymentResult deploy(Module module, DeploymentOptions options, java.lang.String assignedDeploymentId)
          Deploy a single module using the deployment id provided as a parameter.
 DeploymentResult deploy(java.lang.String deploymentId, DeploymentOptions options)
          Deploy a previously undeployed module.
 DeploymentInformation getDeployment(java.lang.String deploymentId)
          Returns the deployment information for a given deployment.
 DeploymentInformation[] getDeploymentInformation()
          Returns deployment information for all known modules.
 DeploymentOrder getDeploymentOrder(java.util.Collection<Module> modules, DeploymentOrderOptions options)
          Compute a deployment order among the modules passed in considering their uses-dependency declarations and considering the already-deployed modules.
 java.lang.String[] getDeployments()
          Return deployment ids of all currently known modules.
 boolean isDeployed(java.lang.String moduleName)
          Determine if a named module is already deployed (in deployed state), returns true if one or more modules of the same name are deployed or false when no module of that name is deployed.
 Module parse(java.lang.String eplModuleText)
          Parse the module text passed in, returning the module.
 DeploymentResult parseDeploy(java.lang.String eplModuleText)
          Shortcut method to parse and deploy a single module from a string text buffer, without providing a module URI name or archive name or user object.
 DeploymentResult parseDeploy(java.lang.String buffer, java.lang.String moduleURI, java.lang.String moduleArchive, java.lang.Object userObject)
          Shortcut method to parse and deploy a single module from a string text buffer.
 Module read(java.io.File file)
          Read the module by reading the text file and return the module.
 Module read(java.io.InputStream stream, java.lang.String uri)
          Read the input stream and return the module.
 Module read(java.lang.String resource)
          Read the resource by opening from classpath and return the module.
 Module read(java.net.URL url)
          Read the module by reading from the URL provided and return the module.
 DeploymentResult readDeploy(java.io.InputStream stream, java.lang.String moduleURI, java.lang.String moduleArchive, java.lang.Object userObject)
          Shortcut method to read and deploy a single module from an input stream.
 DeploymentResult readDeploy(java.lang.String resource, java.lang.String moduleURI, java.lang.String moduleArchive, java.lang.Object userObject)
          Shortcut method to read and deploy a single module from a classpath resource.
 void remove(java.lang.String deploymentId)
          Remove a module that is currently in undeployed state.
 UndeploymentResult undeploy(java.lang.String deploymentId)
          Undeploy a previously deployed module.
 UndeploymentResult undeploy(java.lang.String deploymentId, UndeploymentOptions undeploymentOptions)
          Undeploy a previously deployed module.
 UndeploymentResult undeployRemove(java.lang.String deploymentId)
          Undeploy a single module, if its in deployed state, and removes it from the known modules.
 UndeploymentResult undeployRemove(java.lang.String deploymentId, UndeploymentOptions undeploymentOptions)
          Undeploy a single module, if its in deployed state, and removes it from the known modules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPDeploymentAdminImpl

public EPDeploymentAdminImpl(EPAdministratorSPI epService,
                             DeploymentStateService deploymentStateService,
                             StatementEventTypeRef statementEventTypeRef,
                             EventAdapterService eventAdapterService,
                             StatementIsolationService statementIsolationService,
                             StatementIdGenerator optionalStatementIdGenerator,
                             FilterService filterService)
Ctor.

Parameters:
epService - administrative SPI
deploymentStateService - deployment state maintenance service
statementEventTypeRef - maintains statement-eventtype relationship
eventAdapterService - event wrap service
statementIsolationService - for isolated statement execution
Method Detail

read

public Module read(java.io.InputStream stream,
                   java.lang.String uri)
            throws java.io.IOException,
                   ParseException
Description copied from interface: EPDeploymentAdmin
Read the input stream and return the module. It is up to the calling method to close the stream when done.

Specified by:
read in interface EPDeploymentAdmin
Parameters:
stream - to read
uri - uri of the module
Returns:
module
Throws:
java.io.IOException - when the io operation failed
ParseException - when parsing of the module failed

read

public Module read(java.io.File file)
            throws java.io.IOException,
                   ParseException
Description copied from interface: EPDeploymentAdmin
Read the module by reading the text file and return the module.

Specified by:
read in interface EPDeploymentAdmin
Parameters:
file - the file to read
Returns:
module
Throws:
java.io.IOException - when the file could not be read
ParseException - when parsing of the module failed

read

public Module read(java.net.URL url)
            throws java.io.IOException,
                   ParseException
Description copied from interface: EPDeploymentAdmin
Read the module by reading from the URL provided and return the module.

Specified by:
read in interface EPDeploymentAdmin
Parameters:
url - the URL to read
Returns:
module
Throws:
java.io.IOException - when the url input stream could not be read
ParseException - when parsing of the module failed

read

public Module read(java.lang.String resource)
            throws java.io.IOException,
                   ParseException
Description copied from interface: EPDeploymentAdmin
Read the resource by opening from classpath and return the module.

Specified by:
read in interface EPDeploymentAdmin
Parameters:
resource - name of the classpath resource
Returns:
module
Throws:
java.io.IOException - when the resource could not be read
ParseException - when parsing of the module failed

deploy

public DeploymentResult deploy(Module module,
                               DeploymentOptions options,
                               java.lang.String assignedDeploymentId)
                        throws DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Deploy a single module using the deployment id provided as a parameter.

Pass in @{link DeploymentOptions} to customize the behavior. When passing no options or passing default options, the operation first compiles all EPL statements before starting each statement, fails-fast on the first statement that fails to start and rolls back (destroys) any started statement on a failure.

When setting validate-only in the deployment options, the method returns a null-value on success.

Specified by:
deploy in interface EPDeploymentAdmin
Parameters:
module - to deploy
options - operation options or null for default options
assignedDeploymentId - the deployment id to assign
Returns:
result object with statement detail, or null for pass on validate-only
Throws:
DeploymentActionException - when the deployment fails, contains a list of deployment failures

deploy

public DeploymentResult deploy(Module module,
                               DeploymentOptions options)
                        throws DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Deploy a single module returning a generated deployment id to use when undeploying statements as well as additional statement-level information.

Pass in @{link DeploymentOptions} to customize the behavior. When passing no options or passing default options, the operation first compiles all EPL statements before starting each statement, fails-fast on the first statement that fails to start and rolls back (destroys) any started statement on a failure.

When setting validate-only in the deployment options, the method returns a null-value on success.

Specified by:
deploy in interface EPDeploymentAdmin
Parameters:
module - to deploy
options - operation options or null for default options
Returns:
result object with statement detail, or null for pass on validate-only
Throws:
DeploymentActionException - when the deployment fails, contains a list of deployment failures

parse

public Module parse(java.lang.String eplModuleText)
             throws java.io.IOException,
                    ParseException
Description copied from interface: EPDeploymentAdmin
Parse the module text passed in, returning the module.

Specified by:
parse in interface EPDeploymentAdmin
Parameters:
eplModuleText - to parse
Returns:
module
Throws:
java.io.IOException - when the parser failed to read the string buffer
ParseException - when parsing of the module failed

undeployRemove

public UndeploymentResult undeployRemove(java.lang.String deploymentId)
                                  throws DeploymentNotFoundException
Description copied from interface: EPDeploymentAdmin
Undeploy a single module, if its in deployed state, and removes it from the known modules.

This operation destroys all statements previously associated to the deployed module and also removes this module from the list deployments list.

Specified by:
undeployRemove in interface EPDeploymentAdmin
Parameters:
deploymentId - of the deployment to undeploy.
Returns:
result object with statement-level detail
Throws:
DeploymentNotFoundException - when the deployment id could not be resolved to a deployment

undeployRemove

public UndeploymentResult undeployRemove(java.lang.String deploymentId,
                                         UndeploymentOptions undeploymentOptions)
                                  throws DeploymentNotFoundException
Description copied from interface: EPDeploymentAdmin
Undeploy a single module, if its in deployed state, and removes it from the known modules.

This operation, by default, destroys all statements previously associated to the deployed module and also removes this module from the list deployments list. Use the options object to control whether statements get destroyed.

Specified by:
undeployRemove in interface EPDeploymentAdmin
Parameters:
deploymentId - of the deployment to undeploy.
undeploymentOptions - for controlling undeployment, can be a null value
Returns:
result object with statement-level detail
Throws:
DeploymentNotFoundException - when the deployment id could not be resolved to a deployment

undeploy

public UndeploymentResult undeploy(java.lang.String deploymentId)
                            throws DeploymentStateException,
                                   DeploymentNotFoundException
Description copied from interface: EPDeploymentAdmin
Undeploy a previously deployed module.

Specified by:
undeploy in interface EPDeploymentAdmin
Parameters:
deploymentId - of the module to undeploy
Returns:
undeployment result
Throws:
DeploymentStateException - when attempting to undeploy a module that does not exist is already undeployed
DeploymentNotFoundException - when the deployment id could not be resolved

undeploy

public UndeploymentResult undeploy(java.lang.String deploymentId,
                                   UndeploymentOptions undeploymentOptions)
                            throws DeploymentException
Description copied from interface: EPDeploymentAdmin
Undeploy a previously deployed module.

Specified by:
undeploy in interface EPDeploymentAdmin
Parameters:
deploymentId - of the module to undeploy
undeploymentOptions - undeployment options, or null for default behavior
Returns:
undeployment result
Throws:
DeploymentStateException - when attempting to undeploy a module that does not exist is already undeployed
DeploymentNotFoundException - when the deployment id could not be resolved
DeploymentException

getDeployments

public java.lang.String[] getDeployments()
Description copied from interface: EPDeploymentAdmin
Return deployment ids of all currently known modules.

Specified by:
getDeployments in interface EPDeploymentAdmin
Returns:
array of deployment ids

getDeployment

public DeploymentInformation getDeployment(java.lang.String deploymentId)
Description copied from interface: EPDeploymentAdmin
Returns the deployment information for a given deployment.

Specified by:
getDeployment in interface EPDeploymentAdmin
Parameters:
deploymentId - to return the deployment information for.
Returns:
deployment info

getDeploymentInformation

public DeploymentInformation[] getDeploymentInformation()
Description copied from interface: EPDeploymentAdmin
Returns deployment information for all known modules.

Specified by:
getDeploymentInformation in interface EPDeploymentAdmin
Returns:
deployment information.

getDeploymentOrder

public DeploymentOrder getDeploymentOrder(java.util.Collection<Module> modules,
                                          DeploymentOrderOptions options)
                                   throws DeploymentOrderException
Description copied from interface: EPDeploymentAdmin
Compute a deployment order among the modules passed in considering their uses-dependency declarations and considering the already-deployed modules.

The operation also checks and reports circular dependencies.

Pass in @{link DeploymentOrderOptions} to customize the behavior if this method. When passing no options or passing default options, the default behavior checks uses-dependencies and circular dependencies.

Specified by:
getDeploymentOrder in interface EPDeploymentAdmin
Parameters:
modules - to determine ordering for
options - operation options or null for default options
Returns:
ordered modules
Throws:
DeploymentOrderException - when any module dependencies are not satisfied

isDeployed

public boolean isDeployed(java.lang.String moduleName)
Description copied from interface: EPDeploymentAdmin
Determine if a named module is already deployed (in deployed state), returns true if one or more modules of the same name are deployed or false when no module of that name is deployed.

Specified by:
isDeployed in interface EPDeploymentAdmin
Parameters:
moduleName - to look up
Returns:
indicator

readDeploy

public DeploymentResult readDeploy(java.io.InputStream stream,
                                   java.lang.String moduleURI,
                                   java.lang.String moduleArchive,
                                   java.lang.Object userObject)
                            throws java.io.IOException,
                                   ParseException,
                                   DeploymentOrderException,
                                   DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Shortcut method to read and deploy a single module from an input stream.

Uses default options for performing deployment dependency checking and deployment.

Leaves the stream unclosed.

Specified by:
readDeploy in interface EPDeploymentAdmin
Parameters:
stream - to read
moduleURI - uri of module to assign or null if not applicable
moduleArchive - archive name of module to assign or null if not applicable
userObject - user object to assign to module, passed along unused as part of deployment information, or null if not applicable
Returns:
deployment result object
Throws:
java.io.IOException - when the file could not be read
ParseException - when parsing of the module failed
DeploymentOrderException - when any module dependencies are not satisfied
DeploymentActionException - when the deployment fails, contains a list of deployment failures

readDeploy

public DeploymentResult readDeploy(java.lang.String resource,
                                   java.lang.String moduleURI,
                                   java.lang.String moduleArchive,
                                   java.lang.Object userObject)
                            throws java.io.IOException,
                                   ParseException,
                                   DeploymentOrderException,
                                   DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Shortcut method to read and deploy a single module from a classpath resource.

Uses default options for performing deployment dependency checking and deployment.

Specified by:
readDeploy in interface EPDeploymentAdmin
Parameters:
resource - to read
moduleURI - uri of module to assign or null if not applicable
moduleArchive - archive name of module to assign or null if not applicable
userObject - user object to assign to module, passed along unused as part of deployment information, or null if not applicable
Returns:
deployment result object
Throws:
java.io.IOException - when the file could not be read
ParseException - when parsing of the module failed
DeploymentOrderException - when any module dependencies are not satisfied
DeploymentActionException - when the deployment fails, contains a list of deployment failures

parseDeploy

public DeploymentResult parseDeploy(java.lang.String eplModuleText)
                             throws java.io.IOException,
                                    ParseException,
                                    DeploymentException
Description copied from interface: EPDeploymentAdmin
Shortcut method to parse and deploy a single module from a string text buffer, without providing a module URI name or archive name or user object. The module URI, archive name and user object are defaulted to null.

Uses default options for performing deployment dependency checking and deployment.

Specified by:
parseDeploy in interface EPDeploymentAdmin
Parameters:
eplModuleText - to parse
Returns:
deployment result object
Throws:
java.io.IOException - when the file could not be read
ParseException - when parsing of the module failed
DeploymentOrderException - when any module dependencies are not satisfied
DeploymentActionException - when the deployment fails, contains a list of deployment failures
DeploymentException

parseDeploy

public DeploymentResult parseDeploy(java.lang.String buffer,
                                    java.lang.String moduleURI,
                                    java.lang.String moduleArchive,
                                    java.lang.Object userObject)
                             throws java.io.IOException,
                                    ParseException,
                                    DeploymentOrderException,
                                    DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Shortcut method to parse and deploy a single module from a string text buffer.

Uses default options for performing deployment dependency checking and deployment.

Specified by:
parseDeploy in interface EPDeploymentAdmin
Parameters:
buffer - to parse
moduleURI - uri of module to assign or null if not applicable
moduleArchive - archive name of module to assign or null if not applicable
userObject - user object to assign to module, passed along unused as part of deployment information, or null if not applicable
Returns:
deployment result object
Throws:
java.io.IOException - when the file could not be read
ParseException - when parsing of the module failed
DeploymentOrderException - when any module dependencies are not satisfied
DeploymentActionException - when the deployment fails, contains a list of deployment failures

add

public void add(Module module,
                java.lang.String assignedDeploymentId)
Description copied from interface: EPDeploymentAdmin
Adds a module in undeployed state, using the provided deployment id as a unique identifier for the module.

Specified by:
add in interface EPDeploymentAdmin
Parameters:
module - to add
assignedDeploymentId - deployment id to assign

add

public java.lang.String add(Module module)
Description copied from interface: EPDeploymentAdmin
Adds a module in undeployed state, generating a deployment id and returning the generated deployment id of the module.

Specified by:
add in interface EPDeploymentAdmin
Parameters:
module - to add
Returns:
The deployment id assigned to the module

deploy

public DeploymentResult deploy(java.lang.String deploymentId,
                               DeploymentOptions options)
                        throws DeploymentNotFoundException,
                               DeploymentStateException,
                               DeploymentOrderException,
                               DeploymentActionException
Description copied from interface: EPDeploymentAdmin
Deploy a previously undeployed module.

Specified by:
deploy in interface EPDeploymentAdmin
Parameters:
deploymentId - of the module to deploy
options - deployment options
Returns:
deployment result
Throws:
DeploymentNotFoundException - if no such deployment id is known
DeploymentStateException - when attempting to deploy a module that does not exist is already deployed
DeploymentOrderException - when deployment dependencies are not satisfied
DeploymentActionException - when the deployment (or validation when setting validate-only) failed

remove

public void remove(java.lang.String deploymentId)
            throws DeploymentStateException,
                   DeploymentNotFoundException
Description copied from interface: EPDeploymentAdmin
Remove a module that is currently in undeployed state.

This call may only be used on undeployed modules.

Specified by:
remove in interface EPDeploymentAdmin
Parameters:
deploymentId - of the module to remove
Throws:
DeploymentStateException - when attempting to remove a module that does not exist or a module that is not in undeployed state
DeploymentNotFoundException - if no such deployment id is known

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