com.metamatrix.server.query.service
Class QueryService

java.lang.Object
  extended by com.metamatrix.platform.service.controller.AbstractService
      extended by com.metamatrix.server.query.service.QueryService
All Implemented Interfaces:
EventObjectListener, CacheAdmin, ServiceInterface, QueryServiceInterface, java.util.EventListener

public class QueryService
extends AbstractService
implements QueryServiceInterface

Wraps up a QueryServiceEngine to tie it into the platform concept of services. Is a remote object. Provides the QueryServiceEngine with a session service object. Configures the QueryServiceEngine from the configuration source. Buffers the QueryServiceEngine from dependencies on CurrentConfiguration.getInstance(). These measures allow the QueryServiceEngine to be instantiated in a light-weight fashion without a full, running "server".


Field Summary
 
Fields inherited from interface com.metamatrix.server.query.service.QueryServiceInterface
SERVICE_NAME
 
Fields inherited from interface com.metamatrix.platform.service.api.ServiceInterface
WAIT_TO_DIE_TIME
 
Fields inherited from interface com.metamatrix.platform.service.api.CacheAdmin
CODE_TABLE_CACHE, CONNECTOR_RESULT_SET_CACHE, PREPARED_PLAN_CACHE, QUERY_SERVICE_RESULT_SET_CACHE
 
Constructor Summary
QueryService()
           
 
Method Summary
 void cancelQueries(SessionToken sessionToken, boolean shouldRollback)
           
 void cancelQuery(AtomicRequestID ari)
           
 void cancelQuery(RequestID requestID, boolean shouldRollback)
           
 void clearCache(SessionToken sessionToken)
           
 void clearCache(java.lang.String name, java.util.Properties props)
          Clear the named cached using properties to set options if necessary
protected  void closeService()
          Close the service to new work if applicable.
 java.util.Collection getAllQueries()
           
 java.util.Map getCaches()
          Get names of all caches in this object
 java.util.Collection getQueriesForSession(SessionToken userToken)
           
 java.util.Collection getQueueStatistics()
          Returns a list of QueueStats objects that represent the queues in this service.
 WorkerPoolStats getQueueStatistics(java.lang.String name)
          Returns a QueueStats object that represent the queue in this service.
 java.util.Collection<Transaction> getTransactions()
           
protected  TransactionService getTransactionService()
           
 void init(ServiceID id, DeployedComponentID deployedComponentID, java.util.Properties props, ClientServiceRegistry listenerRegistry, ClassLoaderManager clManager)
          Initialize a service using the properties specified.
protected  void initService(java.util.Properties props)
          Perform initialization and commence processing.
protected  void killService()
          Terminate all processing and reclaim resources.
 void terminateTransaction(java.lang.String transactionId, java.lang.String sessionId)
           
 void terminateTransaction(javax.transaction.xa.Xid transactionId)
           
protected  void waitForServiceToClear()
          Wait until the service has completed all outstanding work.
 
Methods inherited from class com.metamatrix.platform.service.controller.AbstractService
checkState, die, dieNow, getCurrentState, getHostname, getID, getInitException, getInstanceName, getProcessName, getProperties, getResourceName, getServiceData, getServiceName, getServiceType, getStartTime, getStateChangeTime, isAlive, isClosed, isInitialized, isOpen, processEvent, registerForEvents, setInitException, unregisterForEvents, updateState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.metamatrix.platform.service.api.ServiceInterface
checkState, die, dieNow, getCurrentState, getHostname, getID, getInitException, getProcessName, getProperties, getServiceData, getServiceType, getStartTime, getStateChangeTime, isAlive, setInitException, updateState
 

Constructor Detail

QueryService

public QueryService()
Method Detail

initService

protected void initService(java.util.Properties props)
                    throws java.lang.Exception
Description copied from class: AbstractService
Perform initialization and commence processing. This method is called only once.

Specified by:
initService in class AbstractService
Throws:
java.lang.Exception

closeService

protected void closeService()
                     throws java.lang.Exception
Description copied from class: AbstractService
Close the service to new work if applicable. After this method is called the service should no longer accept new work to perform but should continue to process any outstanding work. This method is called by die().

Specified by:
closeService in class AbstractService
Throws:
java.lang.Exception

waitForServiceToClear

protected void waitForServiceToClear()
                              throws java.lang.Exception
Description copied from class: AbstractService
Wait until the service has completed all outstanding work. This method is called by die() just before calling dieNow().

Specified by:
waitForServiceToClear in class AbstractService
Throws:
java.lang.Exception

killService

protected void killService()
Description copied from class: AbstractService
Terminate all processing and reclaim resources. This method is called by dieNow() and is only called once.

Specified by:
killService in class AbstractService

clearCache

public void clearCache(SessionToken sessionToken)
                throws ComponentNotFoundException
Specified by:
clearCache in interface QueryServiceInterface
Throws:
ComponentNotFoundException

getAllQueries

public java.util.Collection getAllQueries()
Specified by:
getAllQueries in interface QueryServiceInterface

cancelQueries

public void cancelQueries(SessionToken sessionToken,
                          boolean shouldRollback)
                   throws MetaMatrixComponentException
Specified by:
cancelQueries in interface QueryServiceInterface
Throws:
MetaMatrixComponentException

getQueriesForSession

public java.util.Collection getQueriesForSession(SessionToken userToken)

cancelQuery

public void cancelQuery(RequestID requestID,
                        boolean shouldRollback)
                 throws InvalidRequestIDException,
                        MetaMatrixComponentException
Specified by:
cancelQuery in interface QueryServiceInterface
Throws:
InvalidRequestIDException
MetaMatrixComponentException

cancelQuery

public void cancelQuery(AtomicRequestID ari)
                 throws InvalidRequestIDException,
                        MetaMatrixComponentException
Specified by:
cancelQuery in interface QueryServiceInterface
Throws:
InvalidRequestIDException
MetaMatrixComponentException

getQueueStatistics

public java.util.Collection getQueueStatistics()
Returns a list of QueueStats objects that represent the queues in this service. If there are no queues, null is returned.

Specified by:
getQueueStatistics in interface ServiceInterface
Overrides:
getQueueStatistics in class AbstractService

getQueueStatistics

public WorkerPoolStats getQueueStatistics(java.lang.String name)
Returns a QueueStats object that represent the queue in this service. If there is no queue with the given name, null is returned.

Specified by:
getQueueStatistics in interface ServiceInterface
Overrides:
getQueueStatistics in class AbstractService

getCaches

public java.util.Map getCaches()
                        throws MetaMatrixComponentException
Description copied from interface: CacheAdmin
Get names of all caches in this object

Specified by:
getCaches in interface CacheAdmin
Returns:
Map where each key is the name of a cache and each value is the type, as defined by constants in this interface.
Throws:
MetaMatrixComponentException - If an error occurs

clearCache

public void clearCache(java.lang.String name,
                       java.util.Properties props)
                throws MetaMatrixComponentException
Description copied from interface: CacheAdmin
Clear the named cached using properties to set options if necessary

Specified by:
clearCache in interface CacheAdmin
Parameters:
name - Name of the cache to clear
props - Optional additional properties which may vary by cache type
Throws:
MetaMatrixComponentException - If an error occurs

init

public void init(ServiceID id,
                 DeployedComponentID deployedComponentID,
                 java.util.Properties props,
                 ClientServiceRegistry listenerRegistry,
                 ClassLoaderManager clManager)
Description copied from class: AbstractService
Initialize a service using the properties specified. The properties MUST contain a property SERVICE_TYPE and SERVICE_SUB_TYPE which identifies the type of service. All other properties are service specific. The properties object supplied MUST NOT CONTAIN DEFAULTS as the default properties DO NOT serialize. If a properties object which uses defaults is supplied, a call to getProperties() will return an incomplete set of properties since the method is typically invoked remotely.

Specified by:
init in interface ServiceInterface
Overrides:
init in class AbstractService
Parameters:
id - The ServiceID this service was registered with
deployedComponentID - Unique identifier of this deployed component.
props - the properties which define the service configuration

getTransactions

public java.util.Collection<Transaction> getTransactions()
Specified by:
getTransactions in interface QueryServiceInterface

terminateTransaction

public void terminateTransaction(java.lang.String transactionId,
                                 java.lang.String sessionId)
                          throws AdminException
Specified by:
terminateTransaction in interface QueryServiceInterface
Throws:
AdminException

terminateTransaction

public void terminateTransaction(javax.transaction.xa.Xid transactionId)
                          throws AdminException
Specified by:
terminateTransaction in interface QueryServiceInterface
Throws:
AdminException

getTransactionService

protected TransactionService getTransactionService()


Copyright © 2009. All Rights Reserved.