com.ail.core
Class Service

java.lang.Object
  extended by com.ail.core.Type
      extended by com.ail.core.Service
All Implemented Interfaces:
ConfigurationOwner, CoreUser, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AcceptQuotationService, AddPolicyNumberService, AddQuoteNumberService, AssessPaymentOptionsService, AssessRiskService, CalculateBrokerageService, CalculateCommissionService, CalculateManagementChargeService, CalculatePremiumService, CalculateTaxService, CancelEntryService, CastorFromXMLService, CastorToXMLService, CatalogCarService, CollectPremiumService, CommonsValidatorService, DeployCarService, EnforceComplianceService, GenerateDocumentService, GenerateDocumentService, GenerateDocumentService, GetClassListService, GetCommandScriptService, GetConfigurationService, GetNamespacesHistoryService, GetNamespacesService, HibernateCloseSessionService, HibernateCreateService, HibernateDeleteService, HibernateLoadService, HibernateOpenSessionService, HibernateQueryService, HibernateUpdateService, JavaMergeDataService, ListProductsService, MakeARecoveryService, MakeEntryService, NewProductTypeService, NullService, PackageCarService, ProduceDocumentationService, PutOnRiskService, RefreshAssessmentSheetsService, RegisterProductService, RemoveProductService, RenderPdfDocumentService, ResetAllProductsService, ResetProductService, SetCommandScriptService, SetConfigurationService, SystemOutLoggerService, TestService, UpdateProductService

public abstract class Service
extends Type
implements CoreUser, ConfigurationOwner

The Service abstract class is implemented by all classes that may be exposed as component entry points.

In addition to the methods described here, an entry point implementation is also expected to offer getter and setter methods which are used to pass arguments to the entry point (setters called before invoke), and fetch the entry point's results (getters, called after invoke).

Each entry point has associated version and configuration information. The version details are burned into the entry point's source code at build time. The entry point's configuration can be modified at run-time using the setter provided.

Version:
$Revision: 1.9 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ail.core.Type
jXPathContext, NOT_PERSISTED
 
Constructor Summary
Service()
           
 
Method Summary
abstract  CommandArg getArgs()
          Get the arguments used by this entry point.
 Configuration getConfiguration()
          Default entry point implementation of the getConfiguration method.
 java.lang.String getConfigurationNamespace()
          Default entry point implementation of the getConfigurationNamespace method.
abstract  Core getCore()
          Fetch the entry point's instance of the core.
 java.security.Principal getSecurityPrincipal()
          Get the security principal associated with this instance.
abstract  Version getVersion()
          Return the version details of this entry point.
 VersionEffectiveDate getVersionEffectiveDate()
          A default entry point implemention returning the version effective date.
abstract  void invoke()
          Invoke the entry point's business logic.
 void resetConfiguration()
          Default entry point implementation of the resetConfiguration method.
abstract  void setArgs(CommandArg args)
          Set the arguments to be used by this entry point's business logic.
 void setConfiguration(Configuration configuration)
          Default entry point implementation of the setConfiguration method.
 
Methods inherited from class com.ail.core.Type
addAttribute, clone, deleteLock, deleteSerialVersion, fetchJXPathContext, getAttribute, getAttribute, getAttributeCount, getForeignSystemId, getLock, getSerialVersion, getSystemId, hasLock, hasSerialVersion, hasSystemId, isPersisted, markAsNotPersisted, mergeWithDataFrom, removeAttribute, removeAttribute, setAttribute, setForeignSystemId, setLock, setSerialVersion, setSystemId, xpathGet, xpathGet, xpathIterate, xpathSet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Service

public Service()
Method Detail

getVersion

public abstract Version getVersion()
Return the version details of this entry point.

Returns:
version details

setArgs

public abstract void setArgs(CommandArg args)
Set the arguments to be used by this entry point's business logic.

Parameters:
args - Arguments for the entry point to process.

invoke

public abstract void invoke()
                     throws BaseException
Invoke the entry point's business logic. This is the core of the entry point. Before this method is called, setArgs() will have been called to supply the entry point with the arguments it will process. After invoke() has been called, getArgs() will be called to retrieve the results.

Throws:
BaseException

getVersionEffectiveDate

public VersionEffectiveDate getVersionEffectiveDate()
A default entry point implemention returning the version effective date. Entry points with a critical dependency on selecting the version effective date should override this method. The default behaviour is to use the version effective date from the CallersCore supplied in the Args passed to the service. If that is null, then the date now is used.

Specified by:
getVersionEffectiveDate in interface CoreUser
Returns:
Date date to use.

getArgs

public abstract CommandArg getArgs()
Get the arguments used by this entry point. "Arguments" in this context are both the objects passed into the entry point, and the objects returned by it. The entry point user will call getArgs() to retrieve the entry points results.

Returns:
The results of executing the entry point.

getCore

public abstract Core getCore()
Fetch the entry point's instance of the core.

Returns:
The core being used by the entry points.

setConfiguration

public void setConfiguration(Configuration configuration)
Default entry point implementation of the setConfiguration method. This method takes care of saving configrations on the behalf of the entry point.

Specified by:
setConfiguration in interface ConfigurationOwner
Parameters:
configuration - The configuration to save.

getConfiguration

public Configuration getConfiguration()
Default entry point implementation of the getConfiguration method. This method takes care of loading configurations on the behalf of the entry point.

Specified by:
getConfiguration in interface ConfigurationOwner
Returns:
The loaded configuration.

getConfigurationNamespace

public java.lang.String getConfigurationNamespace()
Default entry point implementation of the getConfigurationNamespace method. The name of the entry point class is returned.

Specified by:
getConfigurationNamespace in interface CoreUser
Returns:
The classes namespace

resetConfiguration

public void resetConfiguration()
Default entry point implementation of the resetConfiguration method. This implementation loads the default config from the class resource file named "DefaultConfig.xml". For an entry point named 'RedService', the resource 'RedDefaultConfig.xml' is loaded.

Specified by:
resetConfiguration in interface ConfigurationOwner

getSecurityPrincipal

public java.security.Principal getSecurityPrincipal()
Get the security principal associated with this instance.

Specified by:
getSecurityPrincipal in interface CoreUser
Returns:
The associated security principal - if defined, null otherwise.