Class MailResourceDeployer

  • All Implemented Interfaces:
    ResourceDeployer

    @Service
    @Singleton
    public class MailResourceDeployer
    extends GlobalResourceDeployer
    implements ResourceDeployer
    Handles mail resource events in the server instance.

    The mail resource events from the admin instance are propagated to this object.

    The methods can potentially be called concurrently, therefore implementation need to be synchronized.

    Since:
    JDK1.4
    Author:
    James Kong
    • Constructor Detail

      • MailResourceDeployer

        public MailResourceDeployer()
    • Method Detail

      • deployResource

        public void deployResource​(Object resource,
                                   String applicationName,
                                   String moduleName)
                            throws Exception
        Deploy the resource into the server's runtime naming context This API is used in cases where the "config" bean is not yet persisted in domain.xml and is part of the "config" transaction.
        Specified by:
        deployResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        applicationName - application-name
        moduleName - module-name
        Throws:
        Exception - thrown if fail
      • deployResource

        public void deployResource​(Object resource)
                            throws Exception
        Deploy the resource into the server's runtime naming context
        Specified by:
        deployResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        Throws:
        Exception - thrown if fail
      • undeployResource

        public void undeployResource​(Object resource,
                                     String applicationName,
                                     String moduleName)
                              throws Exception
        Undeploy the resource from the server's runtime naming context
        Specified by:
        undeployResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        applicationName - application-name
        moduleName - module-name
        Throws:
        Exception - thrown if fail
      • undeployResource

        public void undeployResource​(Object resource)
                              throws Exception
        Undeploy the resource from the server's runtime naming context
        Specified by:
        undeployResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        Throws:
        Exception - thrown if fail
      • redeployResource

        public void redeployResource​(Object resource)
                              throws Exception
        Redeploy the resource into the server's runtime naming context
        Specified by:
        redeployResource in interface ResourceDeployer
        Parameters:
        resource - a resource object
        Throws:
        Exception - thrown if fail
      • handles

        public boolean handles​(Object resource)
        Indicates whether a particular resource deployer can handle the resource in question
        Specified by:
        handles in interface ResourceDeployer
        Parameters:
        resource - resource that need to be handled
        Returns:
        boolean
      • supportsDynamicReconfiguration

        public boolean supportsDynamicReconfiguration()
        Description copied from interface: ResourceDeployer
        Indicates whether the resource deployer can handle transparent-dynamic-reconfiguration of resource
        Specified by:
        supportsDynamicReconfiguration in interface ResourceDeployer
        Returns:
        boolean indicating whether transparent-dynamic-reconfiguration is supported.
      • enableResource

        public void enableResource​(Object resource)
                            throws Exception
        Enable the resource in the server's runtime naming context
        Specified by:
        enableResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        Throws:
        Exception - thrown if fail
      • disableResource

        public void disableResource​(Object resource)
                             throws Exception
        Disable the resource in the server's runtime naming context
        Specified by:
        disableResource in interface ResourceDeployer
        Parameters:
        resource - a resource object (eg. JmsResource)
        Throws:
        Exception - thrown if fail
      • installMailResource

        public void installMailResource​(MailBean mailResource,
                                        ResourceInfo resourceInfo)
        Installs the given mail resource. This method gets called during server initialization and from mail resource deployer to handle resource events.
        Parameters:
        mailResource - mail resource
        resourceInfo -
      • toMailBean

        public static MailBean toMailBean​(MailResource mailResourceConfig,
                                          ResourceInfo resourceInfo)
        Returns a new instance of j2ee mail resource from the given config bean.

        This method gets called from the mail resource deployer to convert mail config bean into mail j2ee resource.

        Parameters:
        mailResourceConfig - mail-resource config bean
        resourceInfo -
        Returns:
        a new instance of j2ee mail resource
      • canDeploy

        public boolean canDeploy​(boolean postApplicationDeployment,
                                 Collection<Resource> allResources,
                                 Resource resource)
        A deployer can indicate whether a particular resource can be deployed before application deployment
        Used in case of application-scoped-resources
        eg: Embedded RAR resources are created after application (that has embedded .rar) deployment.
        Specified by:
        canDeploy in interface ResourceDeployer
        Parameters:
        postApplicationDeployment - post-application-deployment
        allResources - resources collection in which the resource being validated is present.
        resource - resource to be validated
        Returns:
        boolean