com.sapportals.wcm.service.wastebasket

Class WastebasketService

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

public class WastebasketService
extends AbstractRepositoryService
implements IReconfigurable, IWastebasketService

Wastebasket Service.

Copyright (c) SAP AG 2002-2004


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sapportals.wcm.repository.service.AbstractRepositoryService
AbstractRepositoryService.CONFIG_ATTRIBUTE_NAME
 
Field Summary
 
Fields inherited from class com.sapportals.wcm.repository.service.AbstractRepositoryService
config, description, id, PARAMETER_ACTION, PARAMETER_FALSE, PARAMETER_IS_GLOBAL, PARAMETER_LOCATION, PARAMETER_POPUP, PARAMETER_PREFIX, PARAMETER_REPOSITORY, PARAMETER_RESOURCE, PARAMETER_SERVICE, PARAMETER_TRUE, properties, stateHandler
 
Constructor Summary
WastebasketService()
          This constructor is only to be called by the J2EE environment at startup.
 
Method Summary
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.
 boolean canRestore(IResource resource)
          Indicates if the service is able to restore the given resource, i.e. if the resource is a link located in a user's global wastebasket pointing to a resource in that user's local wastebasket.
 com.sapportals.wcm.util.uri.RID delete(IResource resource)
          Deletes the given resource by storing it in the user's local wastebasket.
 String getDescription()
          Returns a description for this service.
 com.sapportals.wcm.util.uri.RID getGlobalWastebasketRID(IResource resource)
          Returns the RID to a user's global wastebasket.
 com.sapportals.wcm.util.uri.RID getGlobalWastebasketRID(IResourceContext context)
          Returns the RID to a user's global wastebasket.
static IWastebasketService getInstance()
          Returns the instance of this class that was last created.
 com.sapportals.wcm.util.uri.RID getLocalWastebasketRID(IResource resource)
          Returns the RID to a user's local wastebasket.
 String getServiceType()
          Get the service's service type, as defined in IWcmConfig.
 boolean hasWastebasket(IResource resource)
          This method decides if the resource should be moved into the wastebasket or not
 void reconfigure(IConfiguration configuration)
          Passes the new configuration data to the component.
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.sapportals.wcm.util.uri.RID restore(IResource resource, boolean overwrite)
          Restores the given resource to it's original location and returns the RID of the restored resource.
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).
 
Methods inherited from class com.sapportals.wcm.repository.service.AbstractRepositoryService
acceptServletCall, configure, convertConfigData, convertConfigToProperties, convertConfigToProperties, convertStatus, createPropertyList, getCreationDate, getDescription, getID, getInstanceType, getLastConfigurationException, getLastReconfigurationDate, getName, getNextAutoRestartDate, getProperties, getStartupException, getState, notify, retrieveMonitorData, shutDown, shutDownImpl, start, startUp, stop
 
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
acceptServletCall, getDescription, getID
 

Constructor Detail

WastebasketService

public WastebasketService()
This constructor is only to be called by the J2EE environment at startup.

Method Detail

getInstance

public static IWastebasketService getInstance()
Returns the instance of this class that was last created.
This method does not create any new instances of the service. This is done at startup by the J2EE environment based on the configuration for this repository service.


getDescription

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

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

getGlobalWastebasketRID

public com.sapportals.wcm.util.uri.RID getGlobalWastebasketRID(IResource resource)
                                                        throws com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Returns the RID to a user's global wastebasket.
If the given resource is a user specific local wastebasket collection then this user's global wastebasket is returned.
If the given resource is some user's valid home collection then this user's global wastebasket is returned.
In any other case the user is resolved from the ResourceContext of the given resource.

Specified by:
getGlobalWastebasketRID in interface IWastebasketService
Returns:
The RID to the global wastebasket
Throws:
com.sapportals.wcm.WcmException

getGlobalWastebasketRID

public com.sapportals.wcm.util.uri.RID getGlobalWastebasketRID(IResourceContext context)
                                                        throws com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Returns the RID to a user's global wastebasket. The user is resolved from the given ResourceContext

Specified by:
getGlobalWastebasketRID in interface IWastebasketService
Returns:
The RID to the global wastebasket
Throws:
com.sapportals.wcm.WcmException

getLocalWastebasketRID

public com.sapportals.wcm.util.uri.RID getLocalWastebasketRID(IResource resource)
                                                       throws com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Returns the RID to a user's local wastebasket. The user is resolved from the ResourceContext of the given Resource.
Note: This method does not tell if the service is in fact able to delete the resource recoverably. If it is, it will use the returned RID as local wastebasket.

Specified by:
getLocalWastebasketRID in interface IWastebasketService
Returns:
the RID of the user's local wastebasket collection.
Throws:
com.sapportals.wcm.WcmException
See Also:
IWastebasketService.hasWastebasket(IResource)

canRestore

public boolean canRestore(IResource resource)
                   throws com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Indicates if the service is able to restore the given resource, i.e. if the resource is a link located in a user's global wastebasket pointing to a resource in that user's local wastebasket. Note: A positive return value does not guarantee a following call to IWastebasketService.restore(IResource, boolean) to succeed. But it might be used to decide if a UI command should be rendered or not.

Specified by:
canRestore in interface IWastebasketService
Throws:
com.sapportals.wcm.WcmException

delete

public com.sapportals.wcm.util.uri.RID delete(IResource resource)
                                       throws com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Deletes the given resource by storing it in the user's local wastebasket. A RID is returned that identifies a link in the user's global wastebasket. You may hand this link to the IWastebasketService.restore(IResource, boolean) method to have the original resource restored.

Specified by:
delete in interface IWastebasketService
Parameters:
resource - The resource to be deleted
Returns:
The RID of the deleted resource that is now kept in the wastebasket. null, if the resource was deleted permanently.
Throws:
com.sapportals.wcm.WcmException

restore

public com.sapportals.wcm.util.uri.RID restore(IResource resource,
                                               boolean overwrite)
                                        throws NameAlreadyExistsException,
                                               com.sapportals.wcm.WcmException
Description copied from interface: IWastebasketService
Restores the given resource to it's original location and returns the RID of the restored resource.

Specified by:
restore in interface IWastebasketService
Returns:
the original RID to were the resource was restored
Throws:
NameAlreadyExistsException - It there exists a resource with the original RID and parameter overwrite is false.
com.sapportals.wcm.WcmException

hasWastebasket

public boolean hasWastebasket(IResource resource)
                       throws com.sapportals.wcm.WcmException
This method decides if the resource should be moved into the wastebasket or not

Specified by:
hasWastebasket in interface IWastebasketService
Throws:
com.sapportals.wcm.WcmException

getServiceType

public String getServiceType()
Description copied from interface: IRepositoryService
Get the service's service type, as defined in IWcmConfig.

Specified by:
getServiceType in interface IRepositoryService
Returns:
The service type constant for this service.

addRepositoryAssignment

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

Overrides:
addRepositoryAssignment in class AbstractRepositoryService
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
Description copied from class: AbstractRepositoryService
Called by the framework if a repository is removed from the configuration or the service is removed from the list.

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

reconfigure

public void reconfigure(IConfiguration configuration)
                 throws ConfigurationException
Description copied from interface: IReconfigurable
Passes the new configuration data to the component. This method is called by the CRT whenever the configuration was changed.

Specified by:
reconfigure in interface IReconfigurable
Parameters:
configuration - The new configuration data.
Throws:
ConfigurationException - Exception raised in failure situation

startUpImpl

protected void startUpImpl(Collection repositoryManagers)
                    throws ConfigurationException,
                           StartupException,
                           ServiceNotAvailableException
Description copied from class: AbstractRepositoryService
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.

Overrides:
startUpImpl in class AbstractRepositoryService
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
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