org.springframework.osgi.web.deployer.support
Class AbstractWarDeployer

java.lang.Object
  extended by org.springframework.osgi.web.deployer.support.AbstractWarDeployer
All Implemented Interfaces:
InitializingBean, BundleContextAware, WarDeployer
Direct Known Subclasses:
JettyWarDeployer, TomcatWarDeployer

public abstract class AbstractWarDeployer
extends Object
implements WarDeployer, InitializingBean, BundleContextAware

Convenient base class offering common functionality for war deployers such as logging.

Author:
Costin Leau

Field Summary
protected  Log log
          logger
 
Constructor Summary
AbstractWarDeployer()
           
 
Method Summary
 void afterPropertiesSet()
           
protected abstract  WarDeployment createDeployment(Bundle bundle, String contextPath)
          Creates and configures (but does not start) the web deployment for the given bundle.
 WarDeployment deploy(Bundle bundle, String contextPath)
          Deploys the given bundle as a WAR using the given context path. Breaks down (and logs appropriately) the deployment process into: creation of the deployment start-up of the deployment Any exception thrown during each step, is wrapped into OsgiWarDeploymentException.
protected  BundleContext getBundleContext()
          Returns the bundle context used by this deployer.
protected abstract  String getServerInfo()
          Returns a nice String representation of the underlying server for logging messages.
 void setBundleContext(BundleContext bundleContext)
          Set the BundleContext that this bean runs in.
protected abstract  void startDeployment(WarDeployment deployment)
          Starts the deployment artifact using the object returned by createDeployment(Bundle, String).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final Log log
logger

Constructor Detail

AbstractWarDeployer

public AbstractWarDeployer()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

setBundleContext

public void setBundleContext(BundleContext bundleContext)
Description copied from interface: BundleContextAware
Set the BundleContext that this bean runs in. Normally this can be used to initialize an object.

Specified by:
setBundleContext in interface BundleContextAware
Parameters:
bundleContext - the BundleContext object to be used by this object

getBundleContext

protected BundleContext getBundleContext()
Returns the bundle context used by this deployer.

Returns:
the OSGi bundle context used by this deployer.

deploy

public WarDeployment deploy(Bundle bundle,
                            String contextPath)
                     throws OsgiWarDeploymentException
Deploys the given bundle as a WAR using the given context path. Traditionally, a WAR means the given bundle contains a WEB-INF/web.xml file in its bundle space. However, implementations can chose to create a synthetic WAR or use other configuration files instead. Breaks down (and logs appropriately) the deployment process into:
  1. creation of the deployment
  2. start-up of the deployment
Any exception thrown during each step, is wrapped into OsgiWarDeploymentException.

Specified by:
deploy in interface WarDeployer
Parameters:
bundle - war bundle
contextPath - the war context path
Returns:
a war deployment for the given bundle
Throws:
OsgiWarDeploymentException - if something went wrong during deployment

createDeployment

protected abstract WarDeployment createDeployment(Bundle bundle,
                                                  String contextPath)
                                           throws Exception
Creates and configures (but does not start) the web deployment for the given bundle. The returned object will be passed to startDeployment(WarDeployment).

Parameters:
bundle - OSGi bundle deployed as war
contextPath - WAR context path
Returns:
web deployment artifact
Throws:
Exception - if something goes wrong.

startDeployment

protected abstract void startDeployment(WarDeployment deployment)
                                 throws Exception
Starts the deployment artifact using the object returned by createDeployment(Bundle, String).

Parameters:
deployment - web deployment artifact
Throws:
Exception - if something goes wrong

getServerInfo

protected abstract String getServerInfo()
Returns a nice String representation of the underlying server for logging messages.

Returns:
toString for the running environment


Copyright © 2006-2009 Spring Framework. All Rights Reserved.