org.apache.slide.common
Class NamespaceAccessTokenImpl

java.lang.Object
  extended byorg.apache.slide.common.NamespaceAccessTokenImpl
All Implemented Interfaces:
NamespaceAccessToken, javax.transaction.UserTransaction

public final class NamespaceAccessTokenImpl
extends java.lang.Object
implements NamespaceAccessToken

Namespace access token implementation.

Version:
$Revision: 1.28 $

Field Summary
(package private)  Namespace namespace
          Default namespace associated with this token.
 
Constructor Summary
(package private) NamespaceAccessTokenImpl(Namespace namespace)
          Constructor.
 
Method Summary
 void begin()
          Create a new transaction and associate it with the current thread.
 void commit()
          Complete the transaction associated with the current thread.
 void disconnect()
          Disconnect.
 void exportData(SlideToken token, java.io.Writer writer)
          Saves Slide Data to XML.
 void exportData(SlideToken token, java.io.Writer writer, java.lang.String startNode)
          Saves Slide Data to XML.
 Content getContentHelper()
          Get the content helper.
 Lock getLockHelper()
          Get the lock helper.
 Logger getLogger()
          Get namespace logger.
 Macro getMacroHelper()
          Get the macro helper.
 java.lang.String getName()
          Get namespace name.
 NamespaceConfig getNamespaceConfig()
          Retrive the namespace configuration.
 Search getSearchHelper()
          Get the search helper.
 Security getSecurityHelper()
          Get the security helper.
 int getStatus()
          Obtain the status of the transaction associated with the current thread.
 Structure getStructureHelper()
          Get the structure helper.
 javax.transaction.TransactionManager getTransactionManager()
           
 Uri getUri(SlideToken token, java.lang.String uri)
          Builds a new uri object to access this namespace.
 void importData(SlideToken token, Configuration dataConfiguration)
          Import data from Avalon configuration object.
 void importData(SlideToken token, java.io.Reader reader)
          Import data from reader.
 void rollback()
          Roll back the transaction associated with the current thread.
 void setRollbackOnly()
          Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
 void setTransactionTimeout(int seconds)
          Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespace

Namespace namespace
Default namespace associated with this token.

Constructor Detail

NamespaceAccessTokenImpl

NamespaceAccessTokenImpl(Namespace namespace)
Constructor.

Parameters:
namespace - Namespace which can be accessed through this token
Method Detail

getStructureHelper

public Structure getStructureHelper()
Get the structure helper.

Specified by:
getStructureHelper in interface NamespaceAccessToken
Returns:
Structure helper

getContentHelper

public Content getContentHelper()
Get the content helper.

Specified by:
getContentHelper in interface NamespaceAccessToken
Returns:
Content helper

getLockHelper

public Lock getLockHelper()
Get the lock helper.

Specified by:
getLockHelper in interface NamespaceAccessToken
Returns:
Lock Lock helper

getSearchHelper

public Search getSearchHelper()
Get the search helper.

Specified by:
getSearchHelper in interface NamespaceAccessToken
Returns:
Search Search helper

getSecurityHelper

public Security getSecurityHelper()
Get the security helper.

Specified by:
getSecurityHelper in interface NamespaceAccessToken
Returns:
Security Security helper

getMacroHelper

public Macro getMacroHelper()
Get the macro helper.

Specified by:
getMacroHelper in interface NamespaceAccessToken
Returns:
Macro Macro helper

getNamespaceConfig

public NamespaceConfig getNamespaceConfig()
Retrive the namespace configuration.

Specified by:
getNamespaceConfig in interface NamespaceAccessToken
Returns:
NamespaceConfig Namespace configuration

getLogger

public Logger getLogger()
Get namespace logger.

Specified by:
getLogger in interface NamespaceAccessToken
Returns:
The logger associated with the namespace.

importData

public void importData(SlideToken token,
                       Configuration dataConfiguration)
                throws ConfigurationException,
                       UnknownObjectClassException,
                       ServiceAccessException
Import data from Avalon configuration object.

Specified by:
importData in interface NamespaceAccessToken
Parameters:
token - SlideToken, used for access to the namespace
dataConfiguration - Configuration object
Throws:
ConfigurationException - Something went wrong during the reading of the XML
UnknownObjectClassException - Object class not found
ServiceAccessException - Error accessing service

importData

public void importData(SlideToken token,
                       java.io.Reader reader)
                throws ConfigurationException,
                       UnknownObjectClassException,
                       ServiceAccessException,
                       org.xml.sax.SAXException,
                       java.io.IOException
Import data from reader.

Specified by:
importData in interface NamespaceAccessToken
Parameters:
token - SlideToken, used for access to the namespace
reader - Reader
Throws:
ConfigurationException - Something went wrong during the reading of the XML
UnknownObjectClassException - Object class not found
ServiceAccessException - Error accessing service
org.xml.sax.SAXException
java.io.IOException

exportData

public void exportData(SlideToken token,
                       java.io.Writer writer)
                throws SlideException
Saves Slide Data to XML.

Specified by:
exportData in interface NamespaceAccessToken
Parameters:
writer - Writer
Throws:
SlideException

exportData

public void exportData(SlideToken token,
                       java.io.Writer writer,
                       java.lang.String startNode)
                throws SlideException
Saves Slide Data to XML.

Specified by:
exportData in interface NamespaceAccessToken
Parameters:
writer - Writer
startNode - Start generating XML from this node of the Slide tree
Throws:
SlideException

disconnect

public void disconnect()
Disconnect.

Specified by:
disconnect in interface NamespaceAccessToken

getName

public java.lang.String getName()
Get namespace name.

Specified by:
getName in interface NamespaceAccessToken
Returns:
String namespace name.

getUri

public Uri getUri(SlideToken token,
                  java.lang.String uri)
Builds a new uri object to access this namespace.

Specified by:
getUri in interface NamespaceAccessToken
Parameters:
token - SlideToken
uri - Requested Uri
Returns:
Uri

begin

public void begin()
           throws javax.transaction.NotSupportedException,
                  javax.transaction.SystemException
Create a new transaction and associate it with the current thread.

Specified by:
begin in interface javax.transaction.UserTransaction
Throws:
javax.transaction.NotSupportedException - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

commit

public void commit()
            throws javax.transaction.RollbackException,
                   javax.transaction.HeuristicMixedException,
                   javax.transaction.HeuristicRollbackException,
                   java.lang.SecurityException,
                   java.lang.IllegalStateException,
                   javax.transaction.SystemException
Complete the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.

Specified by:
commit in interface javax.transaction.UserTransaction
Throws:
javax.transaction.RollbackException - Thrown to indicate that the transaction has been rolled back rather than committed.
javax.transaction.HeuristicMixedException - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back.
javax.transaction.HeuristicRollbackException - Thrown to indicate that a heuristic decision was made and that some relevant updates have been rolled back.
java.lang.SecurityException - Thrown to indicate that the thread is not allowed to commit the transaction.
java.lang.IllegalStateException - Thrown if the current thread is not associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

rollback

public void rollback()
              throws java.lang.SecurityException,
                     java.lang.IllegalStateException,
                     javax.transaction.SystemException
Roll back the transaction associated with the current thread. When this method completes, the thread becomes associated with no transaction.

Specified by:
rollback in interface javax.transaction.UserTransaction
Throws:
java.lang.SecurityException - Thrown to indicate that the thread is not allowed to commit the transaction.
java.lang.IllegalStateException - Thrown if the current thread is not associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

setRollbackOnly

public void setRollbackOnly()
                     throws java.lang.IllegalStateException,
                            javax.transaction.SystemException
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.

Specified by:
setRollbackOnly in interface javax.transaction.UserTransaction
Throws:
java.lang.IllegalStateException - Thrown if the current thread is not associated with a transaction.
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

getStatus

public int getStatus()
              throws javax.transaction.SystemException
Obtain the status of the transaction associated with the current thread.

Specified by:
getStatus in interface javax.transaction.UserTransaction
Returns:
The transaction status. If no transaction is associated with the current thread, this method returns the Status.NoTransaction value.
Throws:
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

setTransactionTimeout

public void setTransactionTimeout(int seconds)
                           throws javax.transaction.SystemException
Modify the value of the timeout value that is associated with the transactions started by the current thread with the begin method.

If an application has not called this method, the transaction service uses some default value for the transaction timeout.

Specified by:
setTransactionTimeout in interface javax.transaction.UserTransaction
Parameters:
seconds - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value.
Throws:
javax.transaction.SystemException - Thrown if the transaction manager encounters an unexpected error condition.

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Specified by:
getTransactionManager in interface NamespaceAccessToken