Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.core
Class AbstractEnvironment

    java.lang.Object
      org.apache.muse.core.AbstractEnvironment

All Implemented Interfaces:
  Environment

public abstract class AbstractEnvironment
extends java.lang.Object
implements Environment

AbstractEnvironment is an abstract class that defines features related to the underlying platform as well as the endpoint's configuration. Its major responsibilities include storing request context on a per-thread basis and providing generic deployment information. Concrete isolation layers should provide concrete Environments that implement the abstract methods using the APIs of the underlying web services platform.

Author:
  Dan Jemiolo (danj)
See Also:
  `org.apache.muse.core.platform.AbstractIsolationLayer`

Constructor Summary
`AbstractEnvironment()` The default constructor calls this('true').
`AbstractEnvironment(boolean createSoapClient)` Initializes the AbstractEnvironment with its own ClassLoader.
`AbstractEnvironment(java.lang.ClassLoader classLoader)` This constructor calls this(classLoader, 'true').
`AbstractEnvironment(java.lang.ClassLoader classLoader, boolean createSoapClient)`

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.
`protected SoapClient` | `createSoapClient()` This method can be overridden by concrete Environments to provide a different implementation of SoapClient for use by the application.
`MessageHeaders` | `getAddressingContext()`
`java.lang.ClassLoader` | `getClassLoader()`
`java.net.URL` | `getDataResource(java.lang.String path)`
`java.io.InputStream` | `getDataResourceStream(java.lang.String path)`
`protected EndpointReference` | `getDefaultEPR()`
`java.lang.String` | `getDefaultURI()`
`protected java.lang.String` | `getDeploymentURI(java.lang.String uriString)`
`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.
`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. The default SOAP client is an instance of SimpleSoapClient.

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
`getDeploymentEPR, getRealDirectory`

Constructor Detail

### AbstractEnvironment

    public AbstractEnvironment()

  The default constructor calls this('true').

### AbstractEnvironment

    public AbstractEnvironment(boolean createSoapClient)

  Initializes the AbstractEnvironment with its own ClassLoader.

Parameters:
  `createSoapClient` - True if you want the SOAP client to be initialized. This requires that you have a valid JAX-RPC SOAP implementation (not just the interfaces) on the classpath.

### AbstractEnvironment

    public AbstractEnvironment(java.lang.ClassLoader classLoader)

  This constructor calls this(classLoader, 'true').

### AbstractEnvironment

    public AbstractEnvironment(java.lang.ClassLoader classLoader,
                               boolean createSoapClient)

Parameters:
  `classLoader` - The ClassLoader that will be used to load all Java classes as well as all file system resources.
  `createSoapClient` - True if you want the SOAP client to be initialized. This requires that you have a valid JAX-RPC SOAP implementation (not just the interfaces) on the classpath.

Method Detail

### addAddressingContext

    public void addAddressingContext(MessageHeaders context)

  Description copied from interface: `Environment`
  Records the WS-Addressing data for the current request.

  Specified by:
    `addAddressingContext` in interface `Environment`
  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)

  Description copied from interface: `Environment`
  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.

  Specified by:
    `createRelativePath` in interface `Environment`

### createSoapClient

    protected SoapClient createSoapClient()

  This method can be overridden by concrete Environments to provide a different implementation of SoapClient for use by the application.

  Returns:
    A concrete SoapClient. This implementation of Environment returns a SimpleSoapClient object.

### getAddressingContext

    public MessageHeaders getAddressingContext()

  Specified by:
    `getAddressingContext` in interface `Environment`
  Returns:
    The WS-Addressing context for the current request.

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Specified by:
    `getClassLoader` in interface `Environment`
  Returns:
    The ClassLoader used to load all classes and file system resources.

### getDataResource

    public java.net.URL getDataResource(java.lang.String path)

  Specified by:
    `getDataResource` in interface `Environment`
  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)

  Specified by:
    `getDataResourceStream` in interface `Environment`
  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.

### getDefaultEPR

    protected EndpointReference getDefaultEPR()

  Returns:
    An EPR whose URI is the value returned by getDefaultURI().

### getDefaultURI

    public java.lang.String getDefaultURI()

  Specified by:
    `getDefaultURI` in interface `Environment`
  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 java.lang.String getDeploymentURI(java.lang.String uriString)

  Parameters:
    `uriString` -
  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. Returning an IP means that remote systems don't have to have a hosts lookup that includes our endpoint's machine.

### getDocument

    public org.w3c.dom.Document getDocument(java.lang.String path)

  Description copied from interface: `Environment`
  This is a convenience method that loads an InputStream using getDataResourceStream() and turns it into a DOM Document.

  Specified by:
    `getDocument` in interface `Environment`
  See Also:
    `Environment.getDataResourceStream(String)`

### getSoapClient

    public SoapClient getSoapClient()

  Specified by:
    `getSoapClient` in interface `Environment`
  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.
  See Also:
    `SimpleSoapClient`

### removeAddressingContext

    public void removeAddressingContext()

  Description copied from interface: `Environment`
  Removes the context object for the current request.

  Specified by:
    `removeAddressingContext` in interface `Environment`

### setDefaultURI

    public void setDefaultURI(java.lang.String defaultURI)

  Specified by:
    `setDefaultURI` in interface `Environment`
  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. The default SOAP client is an instance of SimpleSoapClient.

  Specified by:
    `setSoapClient` in interface `Environment`
  Parameters:
    `soapClient` - The SOAP client that should be used by components needing to invoke other web services.
  See Also:
    `SimpleSoapClient`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD