org.apache.muse.core.platform.osgi.axis2
Class Axis2Environment

java.lang.Object
  extended by org.apache.muse.core.AbstractEnvironment
      extended by org.apache.muse.core.platform.axis2.AxisEnvironment
          extended by org.apache.muse.core.platform.osgi.axis2.Axis2Environment
All Implemented Interfaces:
Environment, OSGiEnvironment

public class Axis2Environment
extends AxisEnvironment
implements OSGiEnvironment

Axis2Environment is an OSGi aware extension of the Muse AxisEnvironment. This class implements the OSGiEnvironment interface, which allows the Muse environment to access the Bundle context of an executing thread.

Author:
Joel Hawkins (joelh)
See Also:
OSGiEnvironment

Constructor Summary
Axis2Environment()
           
 
Method Summary
protected  File createRealDirectory()
           
protected  File createRealDirectoryFromContext()
           
 URL getDataResource(String path)
           
 InputStream getDataResourceStream(String path)
          this method returns an InputStream for a resource based on the executing thread's Bundle context.
 String getDefaultURI()
           
 EndpointReference getDeploymentEPR()
           
protected  URI getDeploymentURI(javax.servlet.http.HttpServletRequest request)
           
 File getRealDirectory()
           
 org.osgi.framework.Bundle getThreadLocalBundle()
          getter for the Bundle corresponding to the executing thread
static void setBundleContext(org.osgi.framework.BundleContext context)
          setter for the the bundle context of the hosting bundle.
 void setThreadLocalBundle(org.osgi.framework.Bundle bundle)
          setter for the Bundle corresponding to the executing thread
 
Methods inherited from class org.apache.muse.core.platform.axis2.AxisEnvironment
convertContext, convertEPR, convertToAxiom, convertToDOM
 
Methods inherited from class org.apache.muse.core.AbstractEnvironment
addAddressingContext, createRelativePath, createSoapClient, getAddressingContext, getClassLoader, getDefaultEPR, getDeploymentURI, getDocument, getSoapClient, removeAddressingContext, setDefaultURI, setSoapClient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.muse.core.Environment
addAddressingContext, createRelativePath, getAddressingContext, getClassLoader, getDocument, getSoapClient, removeAddressingContext, setDefaultURI, setSoapClient
 

Constructor Detail

Axis2Environment

public Axis2Environment()
Method Detail

setBundleContext

public static void setBundleContext(org.osgi.framework.BundleContext context)
setter for the the bundle context of the hosting bundle.


getThreadLocalBundle

public org.osgi.framework.Bundle getThreadLocalBundle()
getter for the Bundle corresponding to the executing thread

Specified by:
getThreadLocalBundle in interface OSGiEnvironment
Returns:
the current thread's Bundle

setThreadLocalBundle

public void setThreadLocalBundle(org.osgi.framework.Bundle bundle)
setter for the Bundle corresponding to the executing thread

Specified by:
setThreadLocalBundle in interface OSGiEnvironment
Parameters:
bundle - the current thread's Bundle

getDeploymentEPR

public EndpointReference getDeploymentEPR()
Specified by:
getDeploymentEPR in interface Environment
Overrides:
getDeploymentEPR in class AxisEnvironment
Returns:
The copy of the EPR of the application, as viewed in the context of the current request. When multiple endpoints are mapped to one application/service, this method will return different EPRs from request to request. Muse uses this feature to host different resource types (with different endpoints) in the same application or bundle.

getDefaultURI

public String getDefaultURI()
Specified by:
getDefaultURI in interface Environment
Overrides:
getDefaultURI in class AbstractEnvironment
Returns:
The address of a resource type hosted by this application. This can be used to gather some data about the wsa:Address of a resource, although it is not guaranteed to be an exact match. The purpose of this URI is to provide some address context when none is available from an incoming request.

getDeploymentURI

protected URI getDeploymentURI(javax.servlet.http.HttpServletRequest request)
Parameters:
request -
Returns:
The URI being targeted by the current request. This URI includes an IP address rather than a host name, because we often use it to create EPRs/URIs for remote users based on the results of a local request. Just because the initial request was local doesn't mean we should represent ourselves to remote users with a local name. It also means that remote systems don't have to have a hosts lookup that includes our endpoint's machine.

getRealDirectory

public File getRealDirectory()
Specified by:
getRealDirectory in interface Environment
Overrides:
getRealDirectory in class AxisEnvironment
Returns:
A object corresponding to the executing thread's Bundle's root directory. This method uses the BundleRootHelper class to resolve the root directory.
See Also:
BundleRootHelper

getDataResource

public URL getDataResource(String path)
Specified by:
getDataResource in interface Environment
Overrides:
getDataResource in class AbstractEnvironment
Parameters:
path - A path that is relative to the environment's context root. In J2EE applications this is the WAR root, in OSGi applications this is the bundle's root.
Returns:
The URL of the "data resource" found at the given path. If no such resource is found, the method throws a RuntimeException.

getDataResourceStream

public InputStream getDataResourceStream(String path)
this method returns an InputStream for a resource based on the executing thread's Bundle context.

Specified by:
getDataResourceStream in interface Environment
Overrides:
getDataResourceStream in class AbstractEnvironment
Parameters:
path - the path to the resource
Returns:
an InputStream corresponding to the resource if the resource is found, otherwise null

createRealDirectoryFromContext

protected File createRealDirectoryFromContext()

createRealDirectory

protected File createRealDirectory()
Overrides:
createRealDirectory in class AxisEnvironment


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.