jrun.deployment
Class DeployerService

jrunx.kernel.ServiceAdapter
  |
  +--jrunx.kernel.ServicePartition
        |
        +--jrunx.kernel.ConfigurableServicePartition
              |
              +--jrunx.cluster.ClusterableServiceAdapter
                    |
                    +--jrun.deployment.DeployerService
All Implemented Interfaces:
ClusterableService, ClusterableServiceAdapterMBean, ClusterConstants, ConfigurableServicePartitionMBean, DeployerServiceMBean, DeployerServiceRemote, java.util.EventListener, javax.naming.Referenceable, java.rmi.Remote, java.lang.Runnable, java.io.Serializable, ServerEventListener, Service, ServiceMBean, ServicePartitionMBean

public class DeployerService
extends ClusterableServiceAdapter
implements DeployerServiceMBean, DeployerServiceRemote, java.lang.Runnable, ServerEventListener

The externally-visible object that kicks off the deployment process at run time. This Class needs to be configured in the server's jrun.xml file, as it is a publicly-manageable service.
Note that deployment is NOT a separate step in JRun, it occurs every time the server is started. Deployment and runtime are intermingled; in traditional terms, there is no deployment because no container artifacts are generated.

Author:
Nick Tsivranidis, Paul Reilly, Brian Deitte, Cathy Murphy, Tom Reilly
See Also:
Serialized Form

Fields inherited from class jrunx.cluster.ClusterableServiceAdapter
clientSocketFactoryName, defaultAlgorithm, myHost, myIP, myPeers, myStub, port, serverSocketFactoryName
 
Fields inherited from class jrunx.kernel.ServicePartition
sortedServices
 
Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrun.deployment.DeployerServiceMBean
OBJECT_NAME
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Fields inherited from interface jrunx.cluster.ClusterConstants
AVAILABLE_SERVICES, CLUSTER_MANAGER_JNDI, DEFAULT_CLUSTER_DOMAIN, DEFAULT_ENABLED, JINI_CODE_BASE_JAR, PRIMARY_SERVICE, SECONDARY_SERVICE
 
Constructor Summary
DeployerService()
           
 
Method Summary
 void addDeployDirectory(java.lang.String path)
          Adds this directory to the list of watched directories.
 void checkWatchedDirectories()
          Check watched directories for new urls.
 void deploy(java.net.URL url)
          Deploy this url immediately.
 void deployPersistentURL(java.net.URL url)
          Deploy and add the URL, url, to jrun.xml.
 void destroy()
          Destroy all deployed containers.
 java.lang.String[] getDeployDirectoryList()
          Get the list of watched Directories
 java.util.ArrayList getDeployedComponentObjectNames(java.net.URL url)
          Get deployed Component JMX object name
 java.lang.String[] getDeployedURLs()
          Get the list of deployed URLs
 java.lang.String[] getEARs()
          Get deployed EAR JMX object names
 java.lang.String[] getEJBs()
          Get deployed EJB jars object names (not including ones inside deployed ears)
 boolean getHotDeploy()
           
 long getPollFrequency()
           
 java.lang.String[] getRARs()
          Get deployed EJB jars object names (not including ones inside deployed ears)
 java.lang.String getTemporaryDirectory()
          Accessors for the temporary directory.
 java.lang.String[] getWARs()
          Get deployed EJB jars object names (not including ones inside deployed ears)
 void handleEvent(ServerEvent event, java.lang.Object handback)
          Handle a server event
 void init()
          Not every service needs to init, implement it out of convenience.
 boolean inWatchedDirectory(java.net.URL url)
          Check watched directories for new urls.
 boolean isDeployed(java.net.URL url)
          Determine whether a specific application is deployed
 boolean isPersistXML()
           
 boolean isStartupDeployComplete()
          During server startup, client tools need to know when all deployments are completed.
 boolean isValidateXML()
           
 J2EEModuleFactory lookupJ2EEModuleFactory(java.net.URL url, java.net.URL originURL)
           
 J2EEModuleFactory lookupJ2EEModuleFactory(java.net.URL url, java.net.URL originURL, java.util.Iterator factoryIterator)
           
 void redeploy(java.net.URL url)
          Redeploy this url and all of it's dependents immediately.
 void removeDeployDirectory(java.lang.String path)
          Remove this directory from the watched directory list
 void run()
          The auto-deployer acts through this runnable method.
 void setDeployDirectory(java.lang.String path)
          Add this directory to the watched directory list.
 void setFile(java.lang.String fileString)
          This method conforms to the MBean standard in order to make use of attributes set in jrun.xml.
 void setHotDeploy(boolean newValue)
          Turn hotDeploy on or off.
 void setPersistXML(boolean persistXML)
           
 void setPollFrequency(long seconds)
          Set the polling frequency of the DeployerService
 void setTemporaryDirectory(java.lang.String temporaryDirectory)
           
 void setUrl(java.lang.String urlString)
          This method conforms to the MBean standard in order to make use of attributes set in jrun.xml.
 void setValidateXML(boolean validateXML)
           
 void start()
          Register to receive server started event.
 void stop()
          Stop all deployed containers.
 void undeploy(java.net.URL url)
          Undeploy the application at the specific url
 void undeployPersistentURL(java.net.URL url)
          Undeploy and remove the URL, url, from jrun.xml.
 
Methods inherited from class jrunx.cluster.ClusterableServiceAdapter
addPeerListener, addServersToClients, getClientSocketFactory, getClusterAlgorithm, getPeers, getPort, getRemoteHostIP, getRemoteHostName, getRemoteServerName, getServerInfo, getServerSocketFactoryClass, invoke, isValidPeer, killRemoteServer, numPeers, setClientSocketFactoryClass, setClusterAlgorithm, setPort, setServerSocketFactoryClass, toStub
 
Methods inherited from class jrunx.kernel.ConfigurableServicePartition
destroyServices, initServices, loadAndInit, loadChildren, setChildElements, startServices, stopServices
 
Methods inherited from class jrunx.kernel.ServicePartition
addService, addService, getServices, invokeChain, iterator, removeService, removeService
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.cluster.ClusterableServiceAdapterMBean
addPeerListener, getClientSocketFactory, getClusterAlgorithm, getPort, getServerSocketFactoryClass, setClientSocketFactoryClass, setClusterAlgorithm, setPort, setServerSocketFactoryClass
 
Methods inherited from interface jrunx.kernel.ConfigurableServicePartitionMBean
setChildElements
 
Methods inherited from interface jrunx.kernel.ServicePartitionMBean
addService, addService, iterator, removeService, removeService
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
getStatus, updateStatus
 
Methods inherited from interface jrunx.cluster.ClusterableService
getPeers, getRemoteHostIP, getRemoteHostName, getRemoteServerName, getServerInfo, invoke, killRemoteServer, numPeers, toStub
 

Constructor Detail

DeployerService

public DeployerService()
Method Detail

checkWatchedDirectories

public void checkWatchedDirectories()
                             throws DeploymentException
Check watched directories for new urls.

destroy

public void destroy()
             throws java.lang.Exception
Destroy all deployed containers.
Specified by:
destroy in interface Service
Overrides:
destroy in class ClusterableServiceAdapter

handleEvent

public void handleEvent(ServerEvent event,
                        java.lang.Object handback)
Description copied from interface: ServerEventListener
Handle a server event
Specified by:
handleEvent in interface ServerEventListener
Following copied from interface: jrunx.kernel.ServerEventListener
Parameters:
event - The server event
handback - The object handback supplied when the listener was registered

deploy

public void deploy(java.net.URL url)
            throws DeploymentException,
                   java.rmi.RemoteException
Deploy this url immediately. The url will be added to the watched url list.
Specified by:
deploy in interface DeployerServiceMBean

getDeployDirectoryList

public java.lang.String[] getDeployDirectoryList()
Get the list of watched Directories
Specified by:
getDeployDirectoryList in interface DeployerServiceMBean

getDeployedURLs

public java.lang.String[] getDeployedURLs()
Get the list of deployed URLs
Specified by:
getDeployedURLs in interface DeployerServiceMBean

getEARs

public java.lang.String[] getEARs()
Description copied from interface: DeployerServiceMBean
Get deployed EAR JMX object names
Specified by:
getEARs in interface DeployerServiceMBean

getEJBs

public java.lang.String[] getEJBs()
Description copied from interface: DeployerServiceMBean
Get deployed EJB jars object names (not including ones inside deployed ears)
Specified by:
getEJBs in interface DeployerServiceMBean

getRARs

public java.lang.String[] getRARs()
Description copied from interface: DeployerServiceMBean
Get deployed EJB jars object names (not including ones inside deployed ears)
Specified by:
getRARs in interface DeployerServiceMBean

getWARs

public java.lang.String[] getWARs()
Description copied from interface: DeployerServiceMBean
Get deployed EJB jars object names (not including ones inside deployed ears)
Specified by:
getWARs in interface DeployerServiceMBean

getDeployedComponentObjectNames

public java.util.ArrayList getDeployedComponentObjectNames(java.net.URL url)
                                                    throws DeploymentException
Get deployed Component JMX object name
Specified by:
getDeployedComponentObjectNames in interface DeployerServiceMBean

getHotDeploy

public boolean getHotDeploy()
Specified by:
getHotDeploy in interface DeployerServiceMBean

getPollFrequency

public long getPollFrequency()
Specified by:
getPollFrequency in interface DeployerServiceMBean

getTemporaryDirectory

public java.lang.String getTemporaryDirectory()
Description copied from interface: DeployerServiceMBean
Accessors for the temporary directory.
Specified by:
getTemporaryDirectory in interface DeployerServiceMBean

init

public void init()
          throws java.lang.Exception
Description copied from class: ServiceAdapter
Not every service needs to init, implement it out of convenience.
Specified by:
init in interface Service
Overrides:
init in class ClusterableServiceAdapter

isDeployed

public boolean isDeployed(java.net.URL url)
                   throws DeploymentException,
                          java.rmi.RemoteException
Determine whether a specific application is deployed
Specified by:
isDeployed in interface DeployerServiceMBean

isPersistXML

public boolean isPersistXML()
Specified by:
isPersistXML in interface DeployerServiceMBean

isValidateXML

public boolean isValidateXML()
Specified by:
isValidateXML in interface DeployerServiceMBean

isStartupDeployComplete

public boolean isStartupDeployComplete()
                                throws java.rmi.RemoteException
Description copied from interface: DeployerServiceMBean
During server startup, client tools need to know when all deployments are completed.
Specified by:
isStartupDeployComplete in interface DeployerServiceMBean

lookupJ2EEModuleFactory

public J2EEModuleFactory lookupJ2EEModuleFactory(java.net.URL url,
                                                 java.net.URL originURL)
                                          throws DeploymentException

lookupJ2EEModuleFactory

public J2EEModuleFactory lookupJ2EEModuleFactory(java.net.URL url,
                                                 java.net.URL originURL,
                                                 java.util.Iterator factoryIterator)
                                          throws DeploymentException

run

public void run()
The auto-deployer acts through this runnable method.
Specified by:
run in interface java.lang.Runnable

setDeployDirectory

public void setDeployDirectory(java.lang.String path)
                        throws DeploymentException
Add this directory to the watched directory list. This is used by JMX.
Specified by:
setDeployDirectory in interface DeployerServiceMBean

addDeployDirectory

public void addDeployDirectory(java.lang.String path)
                        throws DeploymentException
Adds this directory to the list of watched directories. This is used by the JMC.
Specified by:
addDeployDirectory in interface DeployerServiceMBean

removeDeployDirectory

public void removeDeployDirectory(java.lang.String path)
                           throws DeploymentException
Remove this directory from the watched directory list
Specified by:
removeDeployDirectory in interface DeployerServiceMBean

setHotDeploy

public void setHotDeploy(boolean newValue)
Description copied from interface: DeployerServiceMBean
Turn hotDeploy on or off. HotDeploy watches for changes in J2EE apps in the deploy directory. Turning it off means that you will have to restart the server after you make any changes to deployed apps. Defaults to true.
Specified by:
setHotDeploy in interface DeployerServiceMBean

setPollFrequency

public void setPollFrequency(long seconds)
Description copied from interface: DeployerServiceMBean
Set the polling frequency of the DeployerService
Specified by:
setPollFrequency in interface DeployerServiceMBean

setTemporaryDirectory

public void setTemporaryDirectory(java.lang.String temporaryDirectory)
                           throws java.io.IOException
Specified by:
setTemporaryDirectory in interface DeployerServiceMBean

setUrl

public void setUrl(java.lang.String urlString)
            throws DeploymentException
Description copied from interface: DeployerServiceMBean
This method conforms to the MBean standard in order to make use of attributes set in jrun.xml. It invokes deploy(url).
Specified by:
setUrl in interface DeployerServiceMBean

setFile

public void setFile(java.lang.String fileString)
             throws DeploymentException
Description copied from interface: DeployerServiceMBean
This method conforms to the MBean standard in order to make use of attributes set in jrun.xml. It invokes deploy(url).
Specified by:
setFile in interface DeployerServiceMBean

setPersistXML

public void setPersistXML(boolean persistXML)
Specified by:
setPersistXML in interface DeployerServiceMBean

setValidateXML

public void setValidateXML(boolean validateXML)
Specified by:
setValidateXML in interface DeployerServiceMBean

start

public void start()
           throws java.lang.Exception
Register to receive server started event.
Specified by:
start in interface Service
Overrides:
start in class ClusterableServiceAdapter

stop

public void stop()
          throws java.lang.Exception
Stop all deployed containers.
Specified by:
stop in interface Service
Overrides:
stop in class ClusterableServiceAdapter

redeploy

public void redeploy(java.net.URL url)
              throws DeploymentException,
                     java.rmi.RemoteException
Redeploy this url and all of it's dependents immediately. The url will be added to the watched url list if it is not already there.
Specified by:
redeploy in interface DeployerServiceMBean

undeploy

public void undeploy(java.net.URL url)
              throws DeploymentException,
                     java.rmi.RemoteException
Undeploy the application at the specific url
Specified by:
undeploy in interface DeployerServiceMBean

deployPersistentURL

public void deployPersistentURL(java.net.URL url)
                         throws DeploymentException
Description copied from interface: DeployerServiceMBean
Deploy and add the URL, url, to jrun.xml.
Specified by:
deployPersistentURL in interface DeployerServiceMBean

undeployPersistentURL

public void undeployPersistentURL(java.net.URL url)
                           throws DeploymentException
Description copied from interface: DeployerServiceMBean
Undeploy and remove the URL, url, from jrun.xml.
Specified by:
undeployPersistentURL in interface DeployerServiceMBean

inWatchedDirectory

public boolean inWatchedDirectory(java.net.URL url)
Check watched directories for new urls.
Specified by:
inWatchedDirectory in interface DeployerServiceMBean


Copyright � 2002 Macromedia Corporation. All Rights Reserved.