de.fzj.unicore.wsrflite.utils.deployment
Class DeploymentManager

java.lang.Object
  extended by de.fzj.unicore.wsrflite.utils.deployment.DeploymentManager

public class DeploymentManager
extends Object

Manages (un-)deployment of Web Services.

Author:
j.daivandy@fz-juelich.de

Method Summary
 org.codehaus.xfire.service.Service deployService(DeploymentPackage depPack)
           
static DeploymentManager getInstance()
           
 ClassLoader getServiceClassLoader(String serviceName)
           
 Home getServiceHome(String serviceName)
           
 Collection<Home> getServiceHomes()
           
 void loadClasses(File serviceJar, String serviceName, String iFace, String impl)
          Web Services need to be undeployable at runtime and thus their classes must be removable at runtime.
 void registerWSRFService(String serviceName, Class<?> spec, Class<? extends Home> impl)
           
 void releaseAndDeleteJar(String serviceName)
           
 boolean serviceExists(String serviceName)
          Returns true if a service jar exists for the specified name, but hasn't necessarily been deployed (could be, though; call serviceDeployed() to be sure).
 boolean serviceIsDeployed(String serviceName)
          Returns true if a service with the specified name is already deployed and running.
 void setAutomaticDeployment(boolean activate)
           
 void setServiceClassLoader(String serviceName, ClassLoader cl)
           
 void undeployService(String serviceName, int mode)
           
 void unregisterService(String serviceName)
          To unregister and totally undeploy a Web Service the following prerequisites have to be met:

release all references to all its instances release all references to its class objects release all references to its class loader remove the Service object from the XFire Service Registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DeploymentManager getInstance()

setAutomaticDeployment

public void setAutomaticDeployment(boolean activate)
                            throws Exception
Throws:
Exception

undeployService

public void undeployService(String serviceName,
                            int mode)
                     throws Exception
Throws:
Exception

deployService

public org.codehaus.xfire.service.Service deployService(DeploymentPackage depPack)
                                                 throws Exception
Throws:
Exception

getServiceHome

public Home getServiceHome(String serviceName)

getServiceClassLoader

public ClassLoader getServiceClassLoader(String serviceName)

setServiceClassLoader

public void setServiceClassLoader(String serviceName,
                                  ClassLoader cl)

loadClasses

public void loadClasses(File serviceJar,
                        String serviceName,
                        String iFace,
                        String impl)
                 throws IOException,
                        ClassNotFoundException
Web Services need to be undeployable at runtime and thus their classes must be removable at runtime. Since a URLClassLoader instance locks all loaded class files beyond its own lifetime for the duration of the JVM up-time, all service JARs are copied into a temporary folder that'll be sweeped at the next WSRFLite start-up.
The service class loaders use said jar file copies, so that the original service jars can be deleted at runtime and thus the service can be undeployed.

The original service JARs get the corresponding service name each, e.g.: Service 'Cart' => Cart.jar.
Existing service JARs indicate an existing service and thus can't be overwritten by a new service with the same name (in that case service deployment aborts).

Parameters:
serviceJar - The jar file containing the service classes
serviceName - - if null will be determined automatically from serviceJar
iFace - The fully qualified name of the service interface class
impl - The fully qualified name of the service home/implementation class
Throws:
IOException
ClassNotFoundException

registerWSRFService

public void registerWSRFService(String serviceName,
                                Class<?> spec,
                                Class<? extends Home> impl)
                         throws Exception
Throws:
Exception

unregisterService

public void unregisterService(String serviceName)
To unregister and totally undeploy a Web Service the following prerequisites have to be met:

  • release all references to all its instances
  • release all references to its class objects
  • release all references to its class loader
  • remove the Service object from the XFire Service Registry


  • serviceExists

    public boolean serviceExists(String serviceName)
    Returns true if a service jar exists for the specified name, but hasn't necessarily been deployed (could be, though; call serviceDeployed() to be sure).


    serviceIsDeployed

    public boolean serviceIsDeployed(String serviceName)
    Returns true if a service with the specified name is already deployed and running.


    getServiceHomes

    public Collection<Home> getServiceHomes()

    releaseAndDeleteJar

    public void releaseAndDeleteJar(String serviceName)
                             throws IOException
    Throws:
    IOException


    Copyright © 2010. All Rights Reserved.