Package lumis.portal.service
Class GenericService
- java.lang.Object
-
- lumis.portal.service.GenericService
-
- All Implemented Interfaces:
IService
- Direct Known Subclasses:
DouiService
,LikeItService
,PortletService
@StableMinor(version="16.0", sinceVersion="4.0") public class GenericService extends java.lang.Object implements IService
A generic service implementation. May be used as a base class for custom service implementations.- Since:
- 4.0.0
- Version:
- $Revision: 25808 $ $Date: 2023-07-04 15:20:55 -0300 (Tue, 04 Jul 2023) $
-
-
Field Summary
Fields Modifier and Type Field Description protected ServiceConfig
serviceConfig
-
Constructor Summary
Constructors Constructor Description GenericService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
autoAddDependencies(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Adds service specific dependencies.void
deserializeContent(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext)
Deserializes service instance Content.org.w3c.dom.Element
getDefaultServiceInstanceMenu(ServiceInstanceConfig serviceInstance)
Returns the default service instance menu definition to use for a service instance.protected java.lang.String
getResourceClassName()
void
instanceAdded(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Called by the service container to indicate that a service instance has been added.void
instanceDeleted(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction)
Called by the service container to indicate that a service instance is about to be deleted.void
instanceDeserialized(SessionConfig sessionConfig, java.lang.String serviceInstanceId, DeserializationConfig deserializationConfig, org.w3c.dom.Node accessControlListNode, ITransaction transaction)
Called after an service instance is deserialized.void
instanceDeserialized(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext)
Called after an service instance is deserialized.void
instanceLoaded(ServiceInstanceConfig config)
Deprecated.void
instanceMoved(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstance, IPortalBaseFolder oldWebRootFolder, IPortalBaseFolder newWebRootFolder, ITransaction transaction)
Called to indicate the given service instance has been moved from aweb root base folder
to another one.void
instanceMoved(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstance, IWebsite oldWebsite, IWebsite newWebsite, ITransaction transaction)
Called to indicate the given service instance has been moved from awebsite
to another one.void
instanceSerialized(SessionConfig sessionConfig, java.lang.String serviceInstanceId, java.io.OutputStream outputStream, ITransaction transaction)
Called after the serialization of a service instance.void
instanceSerialized(ServiceInstanceSerializationContext serviceInstanceSerializationContext)
Called after the serialization of a service instance.void
instanceUnloaded(ServiceInstanceConfig config)
Deprecated.void
load(ServiceConfig config)
Called by the service container to indicate to a service that the service is being activated.void
postRegister(SessionConfig sessionConfig, ServiceConfig serviceConfig, ITransaction transaction)
Called by the service manager after a service definition is registered.void
postUnregister(SessionConfig sessionConfig, ITransaction transaction)
Called by the service manager after a service has been unregistered.void
preRegister(SessionConfig sessionConfig, org.w3c.dom.Node serviceXmlNode, ITransaction transaction)
Called by the service manager when a service definition is about to be registered.void
preUnregister(SessionConfig sessionConfig, ITransaction transaction)
Called by the service manager when a service is about to be unregistered.void
unload(ServiceConfig config)
Called by the service container to indicate to a service that the it is being de-activated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.portal.service.IService
checkFileAccess, instanceMoved
-
-
-
-
Field Detail
-
serviceConfig
protected ServiceConfig serviceConfig
-
-
Method Detail
-
preUnregister
public void preUnregister(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager when a service is about to be unregistered.- Specified by:
preUnregister
in interfaceIService
- Parameters:
sessionConfig
- the user session information.transaction
- transaction for persistence access.- Throws:
PortalException
-
postUnregister
public void postUnregister(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager after a service has been unregistered.- Specified by:
postUnregister
in interfaceIService
- Parameters:
sessionConfig
- the user session information.transaction
- transaction for persistence access.- Throws:
PortalException
-
preRegister
public void preRegister(SessionConfig sessionConfig, org.w3c.dom.Node serviceXmlNode, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager when a service definition is about to be registered. This method allows the Service implementation to set its default values into the service definition xml.- Specified by:
preRegister
in interfaceIService
- Parameters:
sessionConfig
- TODOtransaction
- TODO- Throws:
PortalException
-
postRegister
public void postRegister(SessionConfig sessionConfig, ServiceConfig serviceConfig, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called by the service manager after a service definition is registered. This method allows the Service implementation to perform any custom registration that the service may require.- Specified by:
postRegister
in interfaceIService
- Throws:
PortalException
-
getResourceClassName
protected java.lang.String getResourceClassName()
-
load
public void load(ServiceConfig config) throws ServiceException, PortalException
Description copied from interface:IService
Called by the service container to indicate to a service that the service is being activated.The service container calls the
init
method exactly once after instantiating the service. Theinit
method must complete successfully before any interfaces are created.The service container cannot place the service into service if the
init
method- Throws a
ServiceException
- Does not return within a time period defined by the service container.
- Specified by:
load
in interfaceIService
- Parameters:
config
- aServiceConfig
object containing the service's configuration and initialization parameters- Throws:
ServiceException
- if an exception has occurred that interferes with the service interface's normal operation.PortalException
- Throws a
-
unload
public void unload(ServiceConfig config) throws ServiceException, PortalException
Description copied from interface:IService
Called by the service container to indicate to a service that the it is being de-activated.Before the service container calls the destroy method, it should allow any threads that are currently processing requests within the service object to complete execution. To avoid waiting forever, the service container can optionally wait for a predefined time before destroying the service object.
This method enables the service to do the following:
- clean up any resources that it holds (for example, memory, file handles, threads)
- make sure that any persistent state is synchronized with the service current state in memory.
- Specified by:
unload
in interfaceIService
- Parameters:
config
- aServiceConfig
object containing the service's configuration- Throws:
ServiceException
PortalException
-
instanceLoaded
@Deprecated public void instanceLoaded(ServiceInstanceConfig config) throws ServiceException
Deprecated.Description copied from interface:IService
Called by the service container to indicate that a service instance has been loaded- Specified by:
instanceLoaded
in interfaceIService
- Parameters:
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
-
instanceUnloaded
@Deprecated public void instanceUnloaded(ServiceInstanceConfig config) throws ServiceException
Deprecated.Description copied from interface:IService
Called by the service container to indicate that a service instance is about to be unloaded- Specified by:
instanceUnloaded
in interfaceIService
- Parameters:
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
-
instanceDeleted
public void instanceDeleted(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Called by the service container to indicate that a service instance is about to be deleted.- Specified by:
instanceDeleted
in interfaceIService
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
PortalException
-
instanceMoved
public void instanceMoved(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstance, IWebsite oldWebsite, IWebsite newWebsite, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Called to indicate the given service instance has been moved from awebsite
to another one. The websites are, necessarily, different and they may benull
, but not both.- Specified by:
instanceMoved
in interfaceIService
- Parameters:
sessionConfig
- the user's session.serviceInstance
- the service instance.oldWebsite
- the old website.newWebsite
- the new website.transaction
- the transaction.- Throws:
ServiceException
PortalException
-
instanceMoved
public void instanceMoved(SessionConfig sessionConfig, ServiceInstanceConfig serviceInstance, IPortalBaseFolder oldWebRootFolder, IPortalBaseFolder newWebRootFolder, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Called to indicate the given service instance has been moved from aweb root base folder
to another one. Both folders are necessarily notnull
.- Specified by:
instanceMoved
in interfaceIService
- Parameters:
sessionConfig
- the user's session.serviceInstance
- the service instance.oldWebRootFolder
- the old web root folder.newWebRootFolder
- the new web root folder.transaction
- the transaction.- Throws:
ServiceException
PortalException
-
autoAddDependencies
public void autoAddDependencies(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Adds service specific dependencies. This is usually called when an instance of the service is created.- Specified by:
autoAddDependencies
in interfaceIService
- Throws:
ServiceException
PortalException
-
instanceDeserialized
public void instanceDeserialized(SessionConfig sessionConfig, java.lang.String serviceInstanceId, DeserializationConfig deserializationConfig, org.w3c.dom.Node accessControlListNode, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called after an service instance is deserialized.- Specified by:
instanceDeserialized
in interfaceIService
- Parameters:
sessionConfig
- user session information.serviceInstanceId
- the service instance id.deserializationConfig
- the deserialization configuration.accessControlListNode
- the deserialized acl node.transaction
- the transaction for persistence access.- Throws:
PortalException
- See Also:
IService.instanceSerialized(SessionConfig, String, OutputStream, ITransaction)
-
instanceSerialized
public void instanceSerialized(SessionConfig sessionConfig, java.lang.String serviceInstanceId, java.io.OutputStream outputStream, ITransaction transaction) throws PortalException
Description copied from interface:IService
Called after the serialization of a service instance. The service may add custom information on the output stream, and they will be available during#aclDeserialized
.- Specified by:
instanceSerialized
in interfaceIService
- Parameters:
sessionConfig
- user session information.serviceInstanceId
- the service instance id.outputStream
- the serialization outputStream.transaction
- the transaction for persistence access.- Throws:
PortalException
- See Also:
IService.instanceDeserialized(SessionConfig, String, DeserializationConfig, Node, ITransaction)
-
instanceAdded
public void instanceAdded(SessionConfig sessionConfig, ServiceInstanceConfig config, ITransaction transaction) throws ServiceException, PortalException
Description copied from interface:IService
Called by the service container to indicate that a service instance has been added. Dependencies between services must never be created inside this method. Dependencies must be created in theIService.autoAddDependencies(lumis.portal.authentication.SessionConfig, lumis.portal.serviceinstance.ServiceInstanceConfig, lumis.util.ITransaction)
method.- Specified by:
instanceAdded
in interfaceIService
config
- aServiceInstanceConfig
object containing the service's configuration- Throws:
ServiceException
PortalException
-
instanceDeserialized
public void instanceDeserialized(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext) throws PortalException
Description copied from interface:IService
Called after an service instance is deserialized.- Specified by:
instanceDeserialized
in interfaceIService
- Throws:
PortalException
-
instanceSerialized
public void instanceSerialized(ServiceInstanceSerializationContext serviceInstanceSerializationContext) throws PortalException
Description copied from interface:IService
Called after the serialization of a service instance. The service may serialize additional structure or data- Specified by:
instanceSerialized
in interfaceIService
- Throws:
PortalException
-
deserializeContent
public void deserializeContent(ServiceInstanceDeserializationContext serviceInstanceDeserializationContext) throws PortalException
Description copied from interface:IService
Deserializes service instance Content.- Specified by:
deserializeContent
in interfaceIService
- Throws:
PortalException
-
getDefaultServiceInstanceMenu
public org.w3c.dom.Element getDefaultServiceInstanceMenu(ServiceInstanceConfig serviceInstance) throws PortalException
Description copied from interface:IService
Returns the default service instance menu definition to use for a service instance.This default is used if this service does not have a explicit menu definition in its
servicedefinition.xml
.- Specified by:
getDefaultServiceInstanceMenu
in interfaceIService
- Parameters:
serviceInstance
- the service instance.- Returns:
- the menu definition.
- Throws:
PortalException
- if the menu could not be generated.
-
-