net.smartlab.web
Class Domain

java.lang.Object
  extended by net.smartlab.web.Domain
All Implemented Interfaces:
ManageableDomain
Direct Known Subclasses:
EnterpriseDomainBuilder

public abstract class Domain
extends java.lang.Object
implements ManageableDomain

Author:
rlogiacco

Field Summary
protected  org.apache.commons.logging.Log logger
          Provides logging capabilities to the domain.
 
Constructor Summary
protected Domain()
          Subclasses should make their own constructors private and behave like singletons.
 
Method Summary
protected  org.hibernate.Transaction begin(BusinessObjectFactory factory)
          Starts a new transaction, allowing all the operations performed in the same context to be atomically applied (commit) or reverted (rollback).
protected  void commit(org.hibernate.Transaction transaction)
          Commits the specified transaction applying all the changes happened since its beginning.
 net.smartlab.config.Configuration getConfiguration()
          Returns the Configuration instance used by this instance.
 net.smartlab.config.Configuration getConfiguration(java.lang.String filename)
          Returns the Configuration instance used by this instance.
static java.lang.String getLastArchiveName(java.lang.Class type)
          Returns the name of the last archive containing the class or an empty string if the class is in no archive.
static java.net.URL getResource(java.lang.Class context, java.lang.String[] names)
          Returns the first resource in the list available in the specified context.
protected  void rollback(org.hibernate.Transaction transaction)
          Rollbacks the specified transaction reverting all the changes happened since its beginning.
static void setConfigurationStrategy(DomainConfigurationStrategy strategy)
          Changes the strategy used to configure the domain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Provides logging capabilities to the domain.

Constructor Detail

Domain

protected Domain()
Subclasses should make their own constructors private and behave like singletons.

Method Detail

begin

protected org.hibernate.Transaction begin(BusinessObjectFactory factory)
                                   throws BusinessException
Starts a new transaction, allowing all the operations performed in the same context to be atomically applied (commit) or reverted (rollback). The context is identifyied by a BusinessObjectFactory instance but the context spans over all the instances sharing the same configuration.

Parameters:
factory - the identifier for the context
Returns:
an object representation of the transaction.
Throws:
BusinessException - if something wrong occurs during the operation.

commit

protected void commit(org.hibernate.Transaction transaction)
               throws BusinessException
Commits the specified transaction applying all the changes happened since its beginning.

Parameters:
transaction - the transaction to commit.
Throws:
BusinessException - if something wrong occurs during the operation.

rollback

protected void rollback(org.hibernate.Transaction transaction)
                 throws BusinessException
Rollbacks the specified transaction reverting all the changes happened since its beginning.

Parameters:
transaction - the transaction to rollback.
Throws:
BusinessException - if something wrong occurs during the operation.

setConfigurationStrategy

public static void setConfigurationStrategy(DomainConfigurationStrategy strategy)
Changes the strategy used to configure the domain.

Parameters:
strategy - an implementation of the DomainConfigurationStrategy interface.

getConfiguration

public net.smartlab.config.Configuration getConfiguration()
                                                   throws net.smartlab.config.ConfigurationException
Returns the Configuration instance used by this instance.

Returns:
the Configuration instance used by this instance.
Throws:
net.smartlab.config.ConfigurationException - if something wrong occurs while reading the configuration file, usually meaning the configuration file is missing.

getConfiguration

public net.smartlab.config.Configuration getConfiguration(java.lang.String filename)
                                                   throws net.smartlab.config.ConfigurationException
Returns the Configuration instance used by this instance.

Parameters:
filename - the configuration file name.
Returns:
the Configuration instance used by this instance.
Throws:
net.smartlab.config.ConfigurationException - if something wrong occurs while reading the configuration file, usually meaning the configuration file is missing.

getResource

public static java.net.URL getResource(java.lang.Class context,
                                       java.lang.String[] names)
Returns the first resource in the list available in the specified context.

Parameters:
context - the class identifying the search context.
names - the list, ordered from first to last, of resources to search for.
Returns:
the first resource in the list available in the context.

getLastArchiveName

public static java.lang.String getLastArchiveName(java.lang.Class type)
Returns the name of the last archive containing the class or an empty string if the class is in no archive.

Parameters:
type - the class to search for.
Returns:
the name of the last archive containing the class or an empty string if the class is in no archive.


Copyright © 2004-2009 The SmartWeb Team. All Rights Reserved.