org.apache.muse.core
Interface Environment

All Known Implementing Classes:
AbstractEnvironment

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.
 java.lang.String createRelativePath(java.lang.String originalPath, java.lang.String relativePath)
          Merges the two paths to create a valid version of the second path.
 MessageHeaders getAddressingContext()
           
 java.lang.ClassLoader getClassLoader()
           
 java.net.URL getDataResource(java.lang.String path)
           
 java.io.InputStream getDataResourceStream(java.lang.String path)
           
 java.lang.String getDefaultURI()
           
 EndpointReference getDeploymentEPR()
           
 org.w3c.dom.Document getDocument(java.lang.String path)
          This is a convenience method that loads an InputStream using getDataResourceStream() and turns it into a DOM Document.
 java.io.File getRealDirectory()
           
 SoapClient getSoapClient()
           
 void removeAddressingContext()
          Removes the context object for the current request.
 void setDefaultURI(java.lang.String defaultURI)
           
 void setSoapClient(SoapClient soapClient)
          Provides a new SOAP client for use by other components in the system.
 

Method Detail

addAddressingContext

public 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

public java.lang.String createRelativePath(java.lang.String originalPath,
                                           java.lang.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

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

getClassLoader

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

getDataResource

public java.net.URL getDataResource(java.lang.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

public java.io.InputStream getDataResourceStream(java.lang.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

public java.lang.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

public 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

public org.w3c.dom.Document getDocument(java.lang.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

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

getSoapClient

public 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

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


setDefaultURI

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

setSoapClient

public 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.