org.apache.slide.common
Interface Service

All Superinterfaces:
javax.transaction.xa.XAResource
All Known Subinterfaces:
ContentStore, IndexStore, LockStore, NodeStore, RevisionDescriptorsStore, RevisionDescriptorStore, SecurityStore, SequenceStore, Store
All Known Implementing Classes:
AbstractService, AbstractServiceBase, AbstractSimpleService, AbstractStore, AbstractXAService, AbstractXAServiceBase, DefaultIndexer

public interface Service
extends javax.transaction.xa.XAResource

Slide Service interface.

Version:
$Revision: 1.14 $

Field Summary
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Method Summary
 boolean cacheResults()
          Idicates whether or not the objects managed by this service should be cached.
 void connect()
          Connects to the underlying data source (if any is needed).
 void connect(CredentialsToken crdtoken)
          Connects to the underlying data source (if any is needed).
 boolean connectIfNeeded()
          Deprecated.  
 boolean connectIfNeeded(CredentialsToken crdtoken)
          Connects to the service, if we were not previously connected.
 void disconnect()
          Disconnects from the underlying data source.
 Logger getLogger()
          Get logger associated with the service.
 void initialize(NamespaceAccessToken token)
          Initializes service.
 boolean isConnected()
          This function tells whether or not the service is connected.
 void reset()
          Deletes service underlying data source, if possible (and meaningful).
 void setNamespace(Namespace namespace)
          Namespace setter.
 void setParameters(java.util.Hashtable parameters)
          Initializes the service with a set of parameters.
 void setScope(Scope scope)
          Set the scope of the store as specified in domain.xml.
 
Methods inherited from interface javax.transaction.xa.XAResource
commit, end, forget, getTransactionTimeout, isSameRM, prepare, recover, rollback, setTransactionTimeout, start
 

Method Detail

setScope

public void setScope(Scope scope)
Set the scope of the store as specified in domain.xml.


setNamespace

public void setNamespace(Namespace namespace)
Namespace setter.


setParameters

public void setParameters(java.util.Hashtable parameters)
                   throws ServiceParameterErrorException,
                          ServiceParameterMissingException
Initializes the service with a set of parameters. Those could be :
  • User name, login info
  • Host name on which to connect
  • Remote port
  • JDBC driver whoich is to be used :-)
  • Anything else ...

    Parameters:
    parameters - Hashtable containing the parameters' names and associated values
    Throws:
    ServiceParameterErrorException - Incorrect service parameter
    ServiceParameterMissingException - Service parameter missing

  • connect

    public void connect(CredentialsToken crdtoken)
                 throws ServiceConnectionFailedException
    Connects to the underlying data source (if any is needed).

    Parameters:
    crdtoken - the Credentials token containing e.g. the credential
    Throws:
    ServiceConnectionFailedException - Connection failed

    connect

    public void connect()
                 throws ServiceConnectionFailedException
    Connects to the underlying data source (if any is needed).

    Throws:
    ServiceConnectionFailedException - Connection failed

    disconnect

    public void disconnect()
                    throws ServiceDisconnectionFailedException
    Disconnects from the underlying data source.

    Throws:
    ServiceDisconnectionFailedException - Disconnection failed

    initialize

    public void initialize(NamespaceAccessToken token)
                    throws ServiceInitializationFailedException
    Initializes service.

    Parameters:
    token - Namespace access token, needed if the service needs to access objects or data within the namespace during its initialization
    Throws:
    ServiceInitializationFailedException - May throw an exception if the service has already been initialized before

    reset

    public void reset()
               throws ServiceResetFailedException
    Deletes service underlying data source, if possible (and meaningful).

    Throws:
    ServiceResetFailedException - Reset failed

    isConnected

    public boolean isConnected()
                        throws ServiceAccessException
    This function tells whether or not the service is connected.

    Returns:
    boolean true if we are connected
    Throws:
    ServiceAccessException - Service access error

    connectIfNeeded

    public boolean connectIfNeeded(CredentialsToken crdtoken)
                            throws ServiceConnectionFailedException,
                                   ServiceAccessException
    Connects to the service, if we were not previously connected.

    Parameters:
    crdtoken - the Credentials token containing e.g. the credential
    Returns:
    boolean true if we were not already connected
    Throws:
    ServiceAccessException - Unspecified service access error
    ServiceConnectionFailedException - Connection failed

    connectIfNeeded

    public boolean connectIfNeeded()
                            throws ServiceConnectionFailedException,
                                   ServiceAccessException
    Deprecated.  

    Connects to the service, if we were not previously connected.

    Returns:
    boolean true if we were not already connected
    Throws:
    ServiceAccessException - Unspecified service access error
    ServiceConnectionFailedException - Connection failed

    cacheResults

    public boolean cacheResults()
    Idicates whether or not the objects managed by this service should be cached. Useful if the service is fast enough, and / or if it already includes its own custom caching mechanism, which might be more efficient than the default one provided by the helpers.

    Returns:
    boolean True if results should be cached

    getLogger

    public Logger getLogger()
    Get logger associated with the service.

    Returns:
    The logger if one has been set for the associated namespace, or the Domain logger otherwise