org.springframework.osgi.web.extender.deployer.support
Class DefaultContextPathStrategy

java.lang.Object
  extended by org.springframework.osgi.web.extender.deployer.support.DefaultContextPathStrategy
All Implemented Interfaces:
ContextPathStrategy

public class DefaultContextPathStrategy
extends Object
implements ContextPathStrategy

ContextPathStrategy default implementation that takes into account the OSGi bundle properties for determining the war context path.

This implementation iterates through following properties, considering the first one that is available in the following order:

  1. bundle location - if present, the location filename is returned as the context path.
  2. bundle name - if present, it is used as a fall back to the bundle location.
  3. bundle symbolic name - if present, it used as a fallback to the bundle name.
  4. bundle identity - if neither of the properties above is present, the bundle object identity will be used as context path.

Author:
Costin Leau
See Also:
Bundle.getLocation(), Constants.BUNDLE_NAME, Bundle.getSymbolicName(), System.identityHashCode(Object)

Constructor Summary
DefaultContextPathStrategy()
           
 
Method Summary
 String getContextPath(Bundle bundle)
          Obtains the context path for the given OSGi bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultContextPathStrategy

public DefaultContextPathStrategy()
Method Detail

getContextPath

public String getContextPath(Bundle bundle)
Description copied from interface: ContextPathStrategy
Obtains the context path for the given OSGi bundle. The returned String should be not null and should not contain any spaces.

Specified by:
getContextPath in interface ContextPathStrategy
Parameters:
bundle - OSGi bundle deployed as war
Returns:
the not-null context path (without any spaces) associated with the given bundle


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