Interface ComponentInstancePreDestruction


  • public interface ComponentInstancePreDestruction

    It is a process implied within the deletion of a component instance in Silverpeas. Usually such process is about the deletion of some specific resources related to the component instance that is being deleted. This process is invoked before any cleaning up of the transverses data used by the component instance and before the effective deletion of the component instance. This interface is dedicated to be implemented by the Silverpeas applications.

    When a component instance is being deleted, the resources that are specific to this component instance should be deleted first before going further in the deletion. That's why this interface is for. Once done, the transverses resources that were used by the component instance are then deleted and finally the component instance is unregistered from Silverpeas. As the generic component instance deletion mechanism is unaware of the specific resources that are managed by the component instance, it delegates the task to delete them to the implementation of this interface that should be provided by the Silverpeas application. In order to be found by the deletion mechanism, the implementation has to be qualified by a name satisfying the following convention: [COMPONENT NAME]InstancePreDestruction

    Any application that requires specific actions when a component instance is being deleted has to implement this interface and the implementation has to be qualified with the @Named annotation by a name satisfying the following convention [COMPONENT NAME]InstancePreDestruction. For example, for an application Kmelia, the implementation must be qualified with @Named("kmeliaInstancePreDestruction")
    Author:
    Yohann Chastagnier
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String NAME_SUFFIX
      The predefined suffix that must compound the name of each implementation of this interface.
      static String WORKFLOW_PRE_DESTRUCTION
      Each workflow is an application but all of them uses the same pre destruction process.
      So, when the name of a workflow component is detected, the pre destruction implementation retrieved will be the one named like this constant value.
    • Field Detail

      • NAME_SUFFIX

        static final String NAME_SUFFIX
        The predefined suffix that must compound the name of each implementation of this interface. An implementation of this interface by a Silverpeas application named Kmelia must be named kmelia[NAME_SUFFIX] where NAME_SUFFIX is the predefined suffix as defined below.
        See Also:
        Constant Field Values
      • WORKFLOW_PRE_DESTRUCTION

        static final String WORKFLOW_PRE_DESTRUCTION
        Each workflow is an application but all of them uses the same pre destruction process.
        So, when the name of a workflow component is detected, the pre destruction implementation retrieved will be the one named like this constant value.
        See Also:
        Constant Field Values
    • Method Detail

      • get

        static Optional<ComponentInstancePreDestruction> get​(String destructionName)
        Gets the implementation of this interface with the specified qualified name.
        Parameters:
        destructionName - the qualified name of the implementation as specified by a @Named annotation.
        Returns:
        either an implementation of this interface or nothing.
      • preDestroy

        void preDestroy​(String componentInstanceId)
        Performs pre destruction tasks in the behalf of the specified component instance.
        Parameters:
        componentInstanceId - the unique identifier of the component instance.