org.apache.muse.core
Interface Environment

All Known Subinterfaces:
OSGiEnvironment
All Known Implementing Classes:
AbstractEnvironment, Axis2Environment, AxisEnvironment, LocalEnvironment, MiniEnvironment, OSGiEnvironmentImpl, OSGiMiniEnvironment, WsdlEnvironment

public interface Environment

Environment defines features related to the underlying platform and the endpoint's configuration in a generic way. It allows resources to ask for data or task completion that depends on a platform-specific API without introducing platform-specific API usage into implementation code.

Author:
Dan Jemiolo (danj)

Method Summary
 void addAddressingContext(MessageHeaders context)
          Records the WS-Addressing data for the current request.
 String createRelativePath(String originalPath, String relativePath)
          Merges the two paths to create a valid version of the second path.
 MessageHeaders getAddressingContext()
           
 ClassLoader getClassLoader()
           
 URL getDataResource(String path)
           
 InputStream getDataResourceStream(String path)
           
 String getDefaultURI()
           
 EndpointReference getDeploymentEPR()
           
 Document getDocument(String path)
          This is a convenience method that loads an InputStream using getDataResourceStream() and turns it into a DOM Document.
 File getRealDirectory()
           
 SoapClient getSoapClient()
           
 void removeAddressingContext()
          Removes the context object for the current request.
 void setDefaultURI(String defaultURI)
           
 void setSoapClient(SoapClient soapClient)
          Provides a new SOAP client for use by other components in the system.
 

Method Detail

addAddressingContext

void addAddressingContext(MessageHeaders context)
Records the WS-Addressing data for the current request.

Parameters:
context - An object that can provide platform-specific information and which is thread-unique or thread-safe.

createRelativePath

String createRelativePath(String originalPath,
                          String relativePath)
Merges the two paths to create a valid version of the second path. This method should be used when you encounter a relative path in a document and must resolve it based on the path of the current file.


getAddressingContext

MessageHeaders getAddressingContext()
Returns:
The WS-Addressing context for the current request.

getClassLoader

ClassLoader getClassLoader()
Returns:
The ClassLoader used to load all classes and file system resources.

getDataResource

URL getDataResource(String path)
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

InputStream getDataResourceStream(String path)
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:
An open InputStream that can read the "data resource" found at the given path. If no such resource is found, the method throws a RuntimeException.

getDefaultURI

String getDefaultURI()
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.

getDeploymentEPR

EndpointReference getDeploymentEPR()
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.

getDocument

Document getDocument(String path)
This is a convenience method that loads an InputStream using getDataResourceStream() and turns it into a DOM Document.

See Also:
getDataResourceStream(String)

getRealDirectory

File getRealDirectory()
Returns:
The actual directory on the file system where the application is deployed.

getSoapClient

SoapClient getSoapClient()
Returns:
The SOAP client that should be used by components wishing to make web service calls. The default client provided by this class is an instance of SimpleSoapClient.

removeAddressingContext

void removeAddressingContext()
Removes the context object for the current request.


setDefaultURI

void setDefaultURI(String defaultURI)
Parameters:
defaultURI - The URI to use when some address context is needed, but there is no request data to provide it.

setSoapClient

void setSoapClient(SoapClient soapClient)
Provides a new SOAP client for use by other components in the system.

Parameters:
soapClient - The SOAP client that should be used by components needing to invoke other web services.


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