com.espertech.esper.core.service
Class EPServiceProviderImpl

java.lang.Object
  extended by com.espertech.esper.core.service.EPServiceProviderImpl
All Implemented Interfaces:
EPServiceProvider, EPServiceProviderSPI

public class EPServiceProviderImpl
extends java.lang.Object
implements EPServiceProviderSPI

Service provider encapsulates the engine's services for runtime and administration interfaces.


Field Summary
 
Fields inherited from interface com.espertech.esper.core.service.EPServiceProviderSPI
DEFAULT_ENGINE_URI, DEFAULT_ENGINE_URI__QUALIFIER
 
Constructor Summary
EPServiceProviderImpl(Configuration configuration, java.lang.String engineURI, java.util.Map<java.lang.String,EPServiceProviderSPI> runtimes)
          Constructor - initializes services.
 
Method Summary
 void addServiceStateListener(EPServiceStateListener listener)
          Add a listener to service provider state changes that receives a before-destroy event.
 void addStatementStateListener(EPStatementStateListener listener)
          Add a listener to statement state changes that receives statement-level events.
 void destroy()
          Destroys the service.
protected  void doInitialize(java.lang.Long startTime)
          Performs the initialization.
 ConfigurationInformation getConfigurationInformation()
          Returns the current configuration.
 javax.naming.Context getContext()
          Returns the engine environment context for engine-external resources such as adapters.
 ContextManagementService getContextManagementService()
           
 DeploymentStateService getDeploymentStateService()
           
 EngineEnvContext getEngineEnvContext()
          Returns engine environment context such as plugin loader references.
 EngineImportService getEngineImportService()
          Returns engine imports.
 java.util.concurrent.locks.ReadWriteLock getEngineInstanceWideLock()
          Returns the engine-instance global read-write lock.
 EPAdministrator getEPAdministrator()
          Returns a class instance of EPAdministrator.
 EPRuntime getEPRuntime()
          Returns a class instance of EPRuntime.
 EPServiceProviderIsolated getEPServiceIsolated(java.lang.String name)
          Returns the isolated service provider for that name, creating an isolated service if the name is a new name, or returning an existing isolated service for an existing name.
 java.lang.String[] getEPServiceIsolatedNames()
          Returns the names of isolated service providers currently allocated.
 EventAdapterService getEventAdapterService()
          Get the EventAdapterService for this engine.
 ExtensionServicesContext getExtensionServicesContext()
          Returns the extension services context.
 FilterService getFilterService()
          Returns the filter service.
 MetricReportingService getMetricReportingService()
          Returns metrics reporting.
 NamedWindowService getNamedWindowService()
          Returns the named window service.
 SchedulingMgmtService getSchedulingMgmtService()
          Get the SchedulingMgmtService for this engine.
 SchedulingService getSchedulingService()
          Get the SchedulingService for this engine.
 EPServicesContext getServicesContext()
          Returns services.
 StatementContextFactory getStatementContextFactory()
          Returns context factory.
 StatementEventTypeRef getStatementEventTypeRef()
          Returns statement event type reference service.
 StatementIsolationService getStatementIsolationService()
           
 StatementLifecycleSvc getStatementLifecycleSvc()
          Returns statement management service for the engine.
 TableService getTableService()
          Returns the table service.
 ThreadingService getThreadingService()
          Returns threading service for the engine.
 TimeProvider getTimeProvider()
          Returns time provider.
 TimerService getTimerService()
          Returns the timer service.
 java.lang.String getURI()
          Returns the provider URI, or "default" if this is the default provider.
 ValueAddEventService getValueAddEventService()
          Returns value-added type service.
 VariableService getVariableService()
          Returns variable services.
 void initialize()
          Frees any resources associated with this engine instance, and leaves the engine instance ready for further use.
 void initialize(java.lang.Long currentTime)
           
 boolean isDestroyed()
          Returns true if the service is in destroyed state, or false if not.
 void postInitialize()
          Invoked after an initialize operation.
 void removeAllServiceStateListeners()
          Remove all listeners to service provider state changes.
 void removeAllStatementStateListeners()
          Remove all listeners to statement state changes.
 boolean removeServiceStateListener(EPServiceStateListener listener)
          Removate a listener to service provider state changes.
 boolean removeStatementStateListener(EPStatementStateListener listener)
          Removate a listener to statement state changes.
 void setConfiguration(Configuration configuration)
          Sets engine configuration information for use in the next initialize.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPServiceProviderImpl

public EPServiceProviderImpl(Configuration configuration,
                             java.lang.String engineURI,
                             java.util.Map<java.lang.String,EPServiceProviderSPI> runtimes)
                      throws ConfigurationException
Constructor - initializes services.

Parameters:
configuration - is the engine configuration
engineURI - is the engine URI or "default" (or null which it assumes as "default") if this is the default provider
runtimes - map of URI and runtime
Throws:
ConfigurationException - is thrown to indicate a configuraton error
Method Detail

getEPServiceIsolated

public EPServiceProviderIsolated getEPServiceIsolated(java.lang.String name)
Description copied from interface: EPServiceProvider
Returns the isolated service provider for that name, creating an isolated service if the name is a new name, or returning an existing isolated service for an existing name.

Note: Requires configuration setting.

Specified by:
getEPServiceIsolated in interface EPServiceProvider
Parameters:
name - to return isolated service for
Returns:
isolated service

postInitialize

public void postInitialize()
Invoked after an initialize operation.

Specified by:
postInitialize in interface EPServiceProviderSPI

setConfiguration

public void setConfiguration(Configuration configuration)
Sets engine configuration information for use in the next initialize.

Specified by:
setConfiguration in interface EPServiceProviderSPI
Parameters:
configuration - is the engine configs

getURI

public java.lang.String getURI()
Description copied from interface: EPServiceProvider
Returns the provider URI, or "default" if this is the default provider.

Specified by:
getURI in interface EPServiceProvider
Returns:
provider URI

getEPRuntime

public EPRuntime getEPRuntime()
Description copied from interface: EPServiceProvider
Returns a class instance of EPRuntime.

If the engine instance is destroyed, the behavior is undefined and a NullPointerException is possible.

Specified by:
getEPRuntime in interface EPServiceProvider
Returns:
an instance of EPRuntime

getEPAdministrator

public EPAdministrator getEPAdministrator()
Description copied from interface: EPServiceProvider
Returns a class instance of EPAdministrator.

If the engine instance is destroyed, the behavior is undefined and a NullPointerException is possible.

Specified by:
getEPAdministrator in interface EPServiceProvider
Returns:
an instance of EPAdministrator

getServicesContext

public EPServicesContext getServicesContext()
Description copied from interface: EPServiceProviderSPI
Returns services.

Specified by:
getServicesContext in interface EPServiceProviderSPI
Returns:
services

getThreadingService

public ThreadingService getThreadingService()
Description copied from interface: EPServiceProviderSPI
Returns threading service for the engine.

Specified by:
getThreadingService in interface EPServiceProviderSPI
Returns:
the ThreadingService

getEventAdapterService

public EventAdapterService getEventAdapterService()
Description copied from interface: EPServiceProviderSPI
Get the EventAdapterService for this engine.

Specified by:
getEventAdapterService in interface EPServiceProviderSPI
Returns:
the EventAdapterService

getSchedulingService

public SchedulingService getSchedulingService()
Description copied from interface: EPServiceProviderSPI
Get the SchedulingService for this engine.

Specified by:
getSchedulingService in interface EPServiceProviderSPI
Returns:
the SchedulingService

getFilterService

public FilterService getFilterService()
Description copied from interface: EPServiceProviderSPI
Returns the filter service.

Specified by:
getFilterService in interface EPServiceProviderSPI
Returns:
filter service

getTimerService

public TimerService getTimerService()
Description copied from interface: EPServiceProviderSPI
Returns the timer service.

Specified by:
getTimerService in interface EPServiceProviderSPI
Returns:
timer service

getConfigurationInformation

public ConfigurationInformation getConfigurationInformation()
Description copied from interface: EPServiceProviderSPI
Returns the current configuration.

Specified by:
getConfigurationInformation in interface EPServiceProviderSPI
Returns:
configuration information

getNamedWindowService

public NamedWindowService getNamedWindowService()
Description copied from interface: EPServiceProviderSPI
Returns the named window service.

Specified by:
getNamedWindowService in interface EPServiceProviderSPI
Returns:
named window service

getTableService

public TableService getTableService()
Description copied from interface: EPServiceProviderSPI
Returns the table service.

Specified by:
getTableService in interface EPServiceProviderSPI
Returns:
table service

getExtensionServicesContext

public ExtensionServicesContext getExtensionServicesContext()
Description copied from interface: EPServiceProviderSPI
Returns the extension services context.

Specified by:
getExtensionServicesContext in interface EPServiceProviderSPI
Returns:
extension services context

getStatementLifecycleSvc

public StatementLifecycleSvc getStatementLifecycleSvc()
Description copied from interface: EPServiceProviderSPI
Returns statement management service for the engine.

Specified by:
getStatementLifecycleSvc in interface EPServiceProviderSPI
Returns:
the StatementLifecycleSvc

getMetricReportingService

public MetricReportingService getMetricReportingService()
Description copied from interface: EPServiceProviderSPI
Returns metrics reporting.

Specified by:
getMetricReportingService in interface EPServiceProviderSPI
Returns:
metrics reporting

getValueAddEventService

public ValueAddEventService getValueAddEventService()
Description copied from interface: EPServiceProviderSPI
Returns value-added type service.

Specified by:
getValueAddEventService in interface EPServiceProviderSPI
Returns:
value types

getStatementEventTypeRef

public StatementEventTypeRef getStatementEventTypeRef()
Description copied from interface: EPServiceProviderSPI
Returns statement event type reference service.

Specified by:
getStatementEventTypeRef in interface EPServiceProviderSPI
Returns:
statement-type reference service

getEngineEnvContext

public EngineEnvContext getEngineEnvContext()
Description copied from interface: EPServiceProviderSPI
Returns engine environment context such as plugin loader references.

Specified by:
getEngineEnvContext in interface EPServiceProviderSPI
Returns:
environment context

getContext

public javax.naming.Context getContext()
Description copied from interface: EPServiceProviderSPI
Returns the engine environment context for engine-external resources such as adapters.

Specified by:
getContext in interface EPServiceProvider
Specified by:
getContext in interface EPServiceProviderSPI
Returns:
engine environment context

getStatementContextFactory

public StatementContextFactory getStatementContextFactory()
Description copied from interface: EPServiceProviderSPI
Returns context factory.

Specified by:
getStatementContextFactory in interface EPServiceProviderSPI
Returns:
factory

getStatementIsolationService

public StatementIsolationService getStatementIsolationService()
Specified by:
getStatementIsolationService in interface EPServiceProviderSPI

getDeploymentStateService

public DeploymentStateService getDeploymentStateService()
Specified by:
getDeploymentStateService in interface EPServiceProviderSPI

destroy

public void destroy()
Description copied from interface: EPServiceProvider
Destroys the service.

Releases any resources held by the service. The service enteres a state in which operations provided by administrative and runtime interfaces originiated by the service are not guaranteed to operate properly.

Removes the service URI from the known URIs. Allows configuration to change for the instance.

When destroying a service instance your application must make sure that threads that are sending events into the service have completed their work. More generally, the service should not be currently in use during or after the destroy operation.

Specified by:
destroy in interface EPServiceProvider

isDestroyed

public boolean isDestroyed()
Description copied from interface: EPServiceProvider
Returns true if the service is in destroyed state, or false if not.

Specified by:
isDestroyed in interface EPServiceProvider
Returns:
indicator whether the service has been destroyed

initialize

public void initialize()
Description copied from interface: EPServiceProvider
Frees any resources associated with this engine instance, and leaves the engine instance ready for further use.

Do not use the EPAdministrator administrative and EPRuntime runtime instances obtained before the initialize (including related services such as configuration, module management, etc.). Your application must obtain new administrative and runtime instances.

Retains the existing configuration of the engine instance but forgets any runtime configuration changes.

Stops and destroys any existing statement resources such as filters, patterns, expressions, views.

Specified by:
initialize in interface EPServiceProvider

initialize

public void initialize(java.lang.Long currentTime)
Specified by:
initialize in interface EPServiceProviderSPI

doInitialize

protected void doInitialize(java.lang.Long startTime)
Performs the initialization.


addServiceStateListener

public void addServiceStateListener(EPServiceStateListener listener)
Description copied from interface: EPServiceProvider
Add a listener to service provider state changes that receives a before-destroy event. The listener collection applies set-semantics.

Specified by:
addServiceStateListener in interface EPServiceProvider
Parameters:
listener - to add

removeServiceStateListener

public boolean removeServiceStateListener(EPServiceStateListener listener)
Description copied from interface: EPServiceProvider
Removate a listener to service provider state changes.

Specified by:
removeServiceStateListener in interface EPServiceProvider
Parameters:
listener - to remove
Returns:
true to indicate the listener was removed, or fals

removeAllServiceStateListeners

public void removeAllServiceStateListeners()
Description copied from interface: EPServiceProvider
Remove all listeners to service provider state changes.

Specified by:
removeAllServiceStateListeners in interface EPServiceProvider

addStatementStateListener

public void addStatementStateListener(EPStatementStateListener listener)
Description copied from interface: EPServiceProvider
Add a listener to statement state changes that receives statement-level events. The listener collection applies set-semantics.

Specified by:
addStatementStateListener in interface EPServiceProvider
Parameters:
listener - to add

removeStatementStateListener

public boolean removeStatementStateListener(EPStatementStateListener listener)
Description copied from interface: EPServiceProvider
Removate a listener to statement state changes.

Specified by:
removeStatementStateListener in interface EPServiceProvider
Parameters:
listener - to remove
Returns:
true to indicate the listener was removed, or fals

removeAllStatementStateListeners

public void removeAllStatementStateListeners()
Description copied from interface: EPServiceProvider
Remove all listeners to statement state changes.

Specified by:
removeAllStatementStateListeners in interface EPServiceProvider

getEPServiceIsolatedNames

public java.lang.String[] getEPServiceIsolatedNames()
Description copied from interface: EPServiceProvider
Returns the names of isolated service providers currently allocated.

Specified by:
getEPServiceIsolatedNames in interface EPServiceProvider
Returns:
isolated service provider names

getSchedulingMgmtService

public SchedulingMgmtService getSchedulingMgmtService()
Description copied from interface: EPServiceProviderSPI
Get the SchedulingMgmtService for this engine.

Specified by:
getSchedulingMgmtService in interface EPServiceProviderSPI
Returns:
the SchedulingMgmtService

getEngineImportService

public EngineImportService getEngineImportService()
Description copied from interface: EPServiceProviderSPI
Returns engine imports.

Specified by:
getEngineImportService in interface EPServiceProviderSPI
Returns:
engine imports

getTimeProvider

public TimeProvider getTimeProvider()
Description copied from interface: EPServiceProviderSPI
Returns time provider.

Specified by:
getTimeProvider in interface EPServiceProviderSPI
Returns:
time provider

getVariableService

public VariableService getVariableService()
Description copied from interface: EPServiceProviderSPI
Returns variable services.

Specified by:
getVariableService in interface EPServiceProviderSPI
Returns:
services

getContextManagementService

public ContextManagementService getContextManagementService()
Specified by:
getContextManagementService in interface EPServiceProviderSPI

getEngineInstanceWideLock

public java.util.concurrent.locks.ReadWriteLock getEngineInstanceWideLock()
Description copied from interface: EPServiceProvider
Returns the engine-instance global read-write lock. The EPRuntime.sendEvent(java.lang.Object) method takes a read lock. The EPAdministrator.createEPL(java.lang.String) methods take a write lock.

Specified by:
getEngineInstanceWideLock in interface EPServiceProvider
Returns:
engine instance global read-write lock

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