com.sapportals.wcm.repository.service

Class AbstractRepositoryService

java.lang.Object
  extended by com.sapportals.wcm.repository.service.AbstractRepositoryService
All Implemented Interfaces:
com.sap.netweaver.km.monitor.IMonitorInfoProvider, IAutoStartable, IComponent, IComponentInfo, IComponentListener, IConfigurable, ILifecycleInfo, IStartable, IThreadSafe, IRepositoryService
Direct Known Subclasses:
WastebasketService

public abstract class AbstractRepositoryService
extends Object
implements IRepositoryService, IThreadSafe, IComponent, IConfigurable, IAutoStartable, IComponentInfo, ILifecycleInfo, IComponentListener, com.sap.netweaver.km.monitor.IMonitorInfoProvider

This is the abstract base class for all repository service implementations.

Copyright (c) SAP AG 2002


Nested Class Summary
static interface AbstractRepositoryService.CONFIG_ATTRIBUTE_NAME
          TBD: Description of the class.
 
Field Summary
protected  IConfiguration config
           
protected  String description
           
protected  String id
           
static String PARAMETER_ACTION
           
static String PARAMETER_FALSE
           
static String PARAMETER_IS_GLOBAL
           
static String PARAMETER_LOCATION
           
static String PARAMETER_POPUP
           
static String PARAMETER_PREFIX
           
static String PARAMETER_REPOSITORY
           
static String PARAMETER_RESOURCE
           
static String PARAMETER_SERVICE
           
static String PARAMETER_TRUE
           
protected  Properties properties
           
protected  ComponentStateHandler stateHandler
           
 
Constructor Summary
AbstractRepositoryService()
          The default constructor.
AbstractRepositoryService(Properties properties)
          Deprecated. As of EP 5.0 SP5, replaced by the default (public, no arguments) constructor.
 
Method Summary
 String acceptServletCall(Properties properties, IResourceContext context)
          This method is called by the eServiceServlet to perform some action.
protected  void addRepositoryAssignment(IRepositoryManager mgr)
          Called by the framework if a new repository with services is added or the service was added to the list of an existing repository.
 void configure(IConfiguration config)
          Passes the configuration data to the configurable.
static com.sap.netweaver.km.monitor.data.ConfigData convertConfigData(IConfiguration cfg)
          Convert a CRT configuration data object to the monitor format.
static Properties convertConfigToProperties(IConfiguration config)
          Helper method for conversion of configuration data into properties.
protected static Properties convertConfigToProperties(IConfiguration config, String prefix)
          Helper method for conversion of configuration data into properties.
static com.sap.netweaver.km.monitor.data.StatusInfo convertStatus(ComponentStateHandler sh)
          Convert the CRT status information to the generic monitor status.
static com.sap.netweaver.km.monitor.data.StructuredData createPropertyList(ComponentStateHandler sh)
          Create a list of properties for CRT lifecycle information.
 Date getCreationDate()
          Returns the date and time of the creation of the component instance.
 String getDescription()
          Returns a description for this service.
 String getDescription(Locale locale)
          Returns a description for this service.
 String getID()
          Returns a service identifier, unique for this instance.
static int getInstanceType()
          A service implementation must overwrite this method to specify it's instance type
 ConfigurationException getLastConfigurationException()
          Returns the exception thrown in the last call to IConfigurable.configure(IConfiguration), or IReconfigurable.reconfigure(IConfiguration).
 Date getLastReconfigurationDate()
          Returns the date and time of the last reconfiguration of this component.
 String getName()
          Returns the component's human-readable name or null .
 Date getNextAutoRestartDate()
          Returns the date and time of the next automatic restart of the component.
 Properties getProperties()
          Returns some arbitrary properties with information about the component or null .
 StartupException getStartupException()
          Returns the exception thrown in the last call to IStartable.start(), Can be null .
 ComponentState getState()
          Returns the current life-cycle state of the component.
 void notify(ComponentEvent event)
          A component was added, reconfigured or will be removed.
protected  void removeRepositoryAssignment(IRepositoryManager mgr)
          Called by the framework if a repository is removed from the configuration or the service is removed from the list.
 com.sap.netweaver.km.monitor.data.MonitorData retrieveMonitorData()
          Default implementation - should be overwritten by a service to manage the status during runtime.
protected  void shutDown()
          Deprecated. As of EP 5.0 SP5, replaced by startUpImpl(Collection).
protected  void shutDownImpl()
          The implementation must overwrite this method if it has to release resources acquired during startup.
 void start()
          A component must implement this method if it has initial startup handling to do before being accessible (acquire resources, open connections to remote systems, etc).
protected  void startUp(Collection repositoryManagers)
          Deprecated. As of EP 5.0 SP5, replaced by shutDownImpl().
protected  void startUpImpl(Collection repositoryManagers)
          The implementation must overwrite this method if it has initial startup handling to do (acquire resources, open connections to remote systems, etc).
 void stop()
          This method is only called once during the life-time of a component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sapportals.wcm.repository.service.IRepositoryService
getServiceType
 

Field Detail

PARAMETER_SERVICE

public static final String PARAMETER_SERVICE
See Also:
Constant Field Values

PARAMETER_ACTION

public static final String PARAMETER_ACTION
See Also:
Constant Field Values

PARAMETER_RESOURCE

public static final String PARAMETER_RESOURCE
See Also:
Constant Field Values

PARAMETER_REPOSITORY

public static final String PARAMETER_REPOSITORY
See Also:
Constant Field Values

PARAMETER_IS_GLOBAL

public static final String PARAMETER_IS_GLOBAL
See Also:
Constant Field Values

PARAMETER_LOCATION

public static final String PARAMETER_LOCATION
See Also:
Constant Field Values

PARAMETER_POPUP

public static final String PARAMETER_POPUP
See Also:
Constant Field Values

PARAMETER_PREFIX

public static final String PARAMETER_PREFIX
See Also:
Constant Field Values

PARAMETER_TRUE

public static final String PARAMETER_TRUE
See Also:
Constant Field Values

PARAMETER_FALSE

public static final String PARAMETER_FALSE
See Also:
Constant Field Values

id

protected String id

description

protected String description

properties

protected Properties properties

config

protected IConfiguration config

stateHandler

protected final ComponentStateHandler stateHandler
Constructor Detail

AbstractRepositoryService

public AbstractRepositoryService()
The default constructor.


AbstractRepositoryService

public AbstractRepositoryService(Properties properties)
                          throws ResourceException
Deprecated. As of EP 5.0 SP5, replaced by the default (public, no arguments) constructor.

Throws:
ResourceException
Method Detail

getInstanceType

public static int getInstanceType()
A service implementation must overwrite this method to specify it's instance type

Returns:
The service's instance type
See Also:
IWcmConst

getID

public final String getID()
Description copied from interface: IRepositoryService
Returns a service identifier, unique for this instance.

Specified by:
getID in interface IRepositoryService
Returns:
a service identifier, unique for this instance.

getDescription

public String getDescription()
Description copied from interface: IRepositoryService
Returns a description for this service.

Specified by:
getDescription in interface IRepositoryService
Returns:
a description for this service.

acceptServletCall

public String acceptServletCall(Properties properties,
                                IResourceContext context)
                         throws ResourceException
Description copied from interface: IRepositoryService
This method is called by the eServiceServlet to perform some action.

Specified by:
acceptServletCall in interface IRepositoryService
Parameters:
properties - TBD: Description of the incoming method parameter
context - TBD: Description of the incoming method parameter
Returns:
The message to show on the servlet
Throws:
ServiceCallException - Exception raised in failure situation
ResourceException - Exception raised in failure situation

configure

public final void configure(IConfiguration config)
                     throws ConfigurationException
Description copied from interface: IConfigurable
Passes the configuration data to the configurable. This method will by called by the CRT only once. It is called after construction and contextualization and before startup (if implemented).

Specified by:
configure in interface IConfigurable
Parameters:
config - the component's configuration data.
Throws:
ConfigurationException - Exception raised in failure situation

start

public final void start()
                 throws StartupException
Description copied from interface: IStartable
A component must implement this method if it has initial startup handling to do before being accessible (acquire resources, open connections to remote systems, etc). This method is only called once during the life-time of a component except an AutoRestartException was thrown.

Specified by:
start in interface IStartable
Throws:
StartupException - If the initialization failed because neccessary resources could not be allocated.

stop

public final void stop()
Description copied from interface: IStartable
This method is only called once during the life-time of a component. It is called by the CRT when the component was removed from the configuration or the system shuts down. A stopped component can not be (re)started. After a shutdown the component instance will be finalized by the Java VM as soon as no other components in the system holds a reference to it.

Specified by:
stop in interface IStartable

getName

public String getName()
Description copied from interface: IComponentInfo
Returns the component's human-readable name or null .

Specified by:
getName in interface IComponentInfo
Returns:
the component's human-readable name or null .

getDescription

public String getDescription(Locale locale)
Description copied from interface: IRepositoryService
Returns a description for this service.

Specified by:
getDescription in interface IComponentInfo
Specified by:
getDescription in interface IRepositoryService
Parameters:
locale - TBD: Description of the incoming method parameter
Returns:
a description for this service.

getProperties

public Properties getProperties()
Description copied from interface: IComponentInfo
Returns some arbitrary properties with information about the component or null .

Specified by:
getProperties in interface IComponentInfo
Returns:
some arbitrary properties with information about the component or null .

getState

public final ComponentState getState()
Description copied from interface: ILifecycleInfo
Returns the current life-cycle state of the component. Can be null .

Specified by:
getState in interface ILifecycleInfo
Returns:
the current life-cycle state of the component. Can be null .

getLastConfigurationException

public ConfigurationException getLastConfigurationException()
Description copied from interface: ILifecycleInfo
Returns the exception thrown in the last call to IConfigurable.configure(IConfiguration), or IReconfigurable.reconfigure(IConfiguration). Can be null .

Specified by:
getLastConfigurationException in interface ILifecycleInfo
Returns:
lastConfigurationException

getStartupException

public StartupException getStartupException()
Description copied from interface: ILifecycleInfo
Returns the exception thrown in the last call to IStartable.start(), Can be null .

Specified by:
getStartupException in interface ILifecycleInfo
Returns:
startupException

getCreationDate

public final Date getCreationDate()
Description copied from interface: ILifecycleInfo
Returns the date and time of the creation of the component instance. Can be null . This property usually makes sense only for components that implement the IThreadSafe interface.

Specified by:
getCreationDate in interface ILifecycleInfo
Returns:
the date and time of the creation of the component instance. Can be null .

getLastReconfigurationDate

public Date getLastReconfigurationDate()
Description copied from interface: ILifecycleInfo
Returns the date and time of the last reconfiguration of this component. Can be null .

Specified by:
getLastReconfigurationDate in interface ILifecycleInfo
Returns:
the date and time of the last reconfiguration of this component. Can be null .

getNextAutoRestartDate

public Date getNextAutoRestartDate()
Description copied from interface: ILifecycleInfo
Returns the date and time of the next automatic restart of the component. Can be null .

Specified by:
getNextAutoRestartDate in interface ILifecycleInfo
Returns:
the date and time of the next automatic restart of the component. Can be null .
See Also:
AutoRestartException

notify

public final void notify(ComponentEvent event)
Description copied from interface: IComponentListener
A component was added, reconfigured or will be removed.

Specified by:
notify in interface IComponentListener
Parameters:
event - the component event
See Also:
ComponentEvent.Type

startUpImpl

protected void startUpImpl(Collection repositoryManagers)
                    throws ConfigurationException,
                           StartupException,
                           ServiceNotAvailableException
The implementation must overwrite this method if it has initial startup handling to do (acquire resources, open connections to remote systems, etc). Accoring to the contract of the IStartable interface of the CRT this method will be called only once. It will be called on systen start up or when a new instance of this component is added to the configuration.

Parameters:
repositoryManagers - A collection of repository manager instances that this services is attached to via configuration. Usually a service implementation will register for certain resource events at the repository's event broker.
Throws:
ConfigurationException - Exception raised in failure situation
StartupException - Exception raised in failure situation
ServiceNotAvailableException - Exception raised in failure situation

startUp

protected void startUp(Collection repositoryManagers)
                throws com.sapportals.wcm.WcmException
Deprecated. As of EP 5.0 SP5, replaced by shutDownImpl().

The implementation must overwrite this method if it has initial startup handling to do (acquire resources, open connections to remote systems, etc).

Parameters:
repositoryManagers - TBD: Description of the incoming method parameter
Throws:
com.sapportals.wcm.WcmException - Exception raised in failure situation

shutDownImpl

protected void shutDownImpl()
The implementation must overwrite this method if it has to release resources acquired during startup. Accoring to the contract of the IStartable interface of the CRT this method will be called only once. It will be called when the component is removed from the persistent configuration or when the system shuts down.


shutDown

protected void shutDown()
                 throws com.sapportals.wcm.WcmException
Deprecated. As of EP 5.0 SP5, replaced by startUpImpl(Collection).

The implementation must overwrite this method if it has to release resources acquired during shutdown.

Throws:
com.sapportals.wcm.WcmException - Exception raised in failure situation

addRepositoryAssignment

protected void addRepositoryAssignment(IRepositoryManager mgr)
                                throws ServiceNotAvailableException
Called by the framework if a new repository with services is added or the service was added to the list of an existing repository.

Parameters:
mgr - The repository manager instance that this service was assigned to in configuration.
Throws:
ServiceNotAvailableException - If the service cannot be assigned to the repository.

removeRepositoryAssignment

protected void removeRepositoryAssignment(IRepositoryManager mgr)
                                   throws com.sapportals.wcm.WcmException
Called by the framework if a repository is removed from the configuration or the service is removed from the list.

Parameters:
mgr - TBD: Description of the incoming method parameter
Throws:
com.sapportals.wcm.WcmException - Exception raised in failure situation

convertConfigToProperties

public static final Properties convertConfigToProperties(IConfiguration config)
Helper method for conversion of configuration data into properties.

Parameters:
config - to be converted to properties
Returns:
attributes of config as properties

convertConfigToProperties

protected static final Properties convertConfigToProperties(IConfiguration config,
                                                            String prefix)
Helper method for conversion of configuration data into properties.

Parameters:
config - to be converted to properties
Returns:
attributes of config as properties

retrieveMonitorData

public com.sap.netweaver.km.monitor.data.MonitorData retrieveMonitorData()
Default implementation - should be overwritten by a service to manage the status during runtime.

Specified by:
retrieveMonitorData in interface com.sap.netweaver.km.monitor.IMonitorInfoProvider

convertConfigData

public static com.sap.netweaver.km.monitor.data.ConfigData convertConfigData(IConfiguration cfg)
Convert a CRT configuration data object to the monitor format.

Parameters:
cfg -
Returns:

convertStatus

public static com.sap.netweaver.km.monitor.data.StatusInfo convertStatus(ComponentStateHandler sh)
Convert the CRT status information to the generic monitor status.

Parameters:
sh -
Returns:

createPropertyList

public static com.sap.netweaver.km.monitor.data.StructuredData createPropertyList(ComponentStateHandler sh)
Create a list of properties for CRT lifecycle information.

Parameters:
sh -
startupTime - value in ms or null.
Returns:
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM


Copyright 2011 SAP AG Complete Copyright Notice