DefaultMuleSession (Mule ESB 2.2.1 API)
Keywords: org.mule.DefaultMuleSession class

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

## org.mule
Class DefaultMuleSession

    java.lang.Object
      org.mule.DefaultMuleSession

All Implemented Interfaces:
  Serializable, MuleSession

    public final class DefaultMuleSession

extends Object
implements MuleSession

`DefaultMuleSession` manages the interaction and distribution of events for Mule Services.

See Also:
  Serialized Form

Constructor Summary
`DefaultMuleSession(MuleMessage message, SessionHandler requestSessionHandler, MuleContext muleContext)`
`DefaultMuleSession(MuleMessage message, SessionHandler requestSessionHandler, Service service, MuleContext muleContext)`
`DefaultMuleSession(Service service, MuleContext muleContext)`

Method Summary
`MuleEvent` | `createOutboundEvent(MuleMessage message, OutboundEndpoint endpoint, MuleEvent previousEvent)` Creates an outbound event for this session
`void` | `dispatchEvent(MuleEvent event)` Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event
`void` | `dispatchEvent(MuleMessage message)` This will dispatch an event asynchronously via the configured outbound endpoint on the service for this session
`void` | `dispatchEvent(MuleMessage message, OutboundEndpoint endpoint)` Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event
`void` | `dispatchEvent(MuleMessage message, String endpointName)` Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event
`String` | `getId()` Returns the unique id for this session
`Object` | `getProperty(Object key)` Will retrieve a session level property.
`Iterator` | `getPropertyNames()` Returns an iterater of property keys for the session properties on this session
`SecurityContext` | `getSecurityContext()` The security context for this session.
`Service` | `getService()` Returns the Service associated with the session in its current execution
`boolean` | `isValid()` Determines if this session is valid.
`protected void` | `processResponse(MuleMessage response)` Once an event has been processed we need to romove certain properties so that they not propagated to the next request
`Object` | `removeProperty(Object key)` Will retrieve a session level property and remove it from the session
`MuleMessage` | `requestEvent(InboundEndpoint endpoint, long timeout)` Requests a synchronous receive of an event on the service
`MuleMessage` | `requestEvent(String endpointName, long timeout)` Requests a synchronous receive of an event on the service
`MuleMessage` | `sendEvent(MuleEvent event)` Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event
`MuleMessage` | `sendEvent(MuleMessage message)` This will send an event via the configured outbound endpoint on the service for this session
`MuleMessage` | `sendEvent(MuleMessage message, OutboundEndpoint endpoint)` Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event
`MuleMessage` | `sendEvent(MuleMessage message, String endpointName)` Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event
`void` | `setProperty(Object key, Object value)` Will set a session level property.
`void` | `setSecurityContext(SecurityContext context)` The security context for this session.
`void` | `setValid(boolean value)` Determines if this session is valid.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultMuleSession

    public DefaultMuleSession(Service service,
                              MuleContext muleContext)

### DefaultMuleSession

    public DefaultMuleSession(MuleMessage message,
                              SessionHandler requestSessionHandler,
                              Service service,
                              MuleContext muleContext)
                       throws MuleException

Throws:
  `MuleException`

### DefaultMuleSession

    public DefaultMuleSession(MuleMessage message,
                              SessionHandler requestSessionHandler,
                              MuleContext muleContext)
                       throws MuleException

Throws:
  `MuleException`

Method Detail

### dispatchEvent

    public void dispatchEvent(MuleMessage message)
                       throws MuleException

  Description copied from interface: `MuleSession`
  This will dispatch an event asynchronously via the configured outbound endpoint on the service for this session

  Specified by:
    `dispatchEvent` in interface `MuleSession`
  Parameters:
    `message` - the message to send
  Throws:
    `MuleException` - if there is no outbound endpoint configured on the service or the events fails during dispatch

### dispatchEvent

    public void dispatchEvent(MuleMessage message,
                              String endpointName)
                       throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `dispatchEvent` in interface `MuleSession`
  Parameters:
    `message` - the event message payload to send
    `endpointName` - The endpoint name to disptch the event through. This will be looked up first on the service configuration and then on the mule manager configuration
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### dispatchEvent

    public void dispatchEvent(MuleMessage message,
                              OutboundEndpoint endpoint)
                       throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `dispatchEvent` in interface `MuleSession`
  Parameters:
    `message` - the event message payload to send
    `endpoint` - The endpoint name to disptch the event through
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### sendEvent

    public MuleMessage sendEvent(MuleMessage message,
                                 String endpointName)
                          throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `sendEvent` in interface `MuleSession`
  Parameters:
    `message` - the event message payload to send
    `endpointName` - The endpoint name to disptch the event through. This will be looked up first on the service configuration and then on the mule manager configuration
  Returns:
    the return Message from the call or null if there was no result
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### sendEvent

    public MuleMessage sendEvent(MuleMessage message)
                          throws MuleException

  Description copied from interface: `MuleSession`
  This will send an event via the configured outbound endpoint on the service for this session

  Specified by:
    `sendEvent` in interface `MuleSession`
  Parameters:
    `message` - the message to send
  Returns:
    the result of the send if any
  Throws:
    `MuleException` - if there is no outbound endpoint configured on the service or the events fails during dispatch

### sendEvent

    public MuleMessage sendEvent(MuleMessage message,
                                 OutboundEndpoint endpoint)
                          throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `sendEvent` in interface `MuleSession`
  Parameters:
    `message` - the event message payload to send
    `endpoint` - The endpoint to disptch the event through
  Returns:
    the return Message from the call or null if there was no result
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### dispatchEvent

    public void dispatchEvent(MuleEvent event)
                       throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event asynchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `dispatchEvent` in interface `MuleSession`
  Parameters:
    `event` - the event message payload to send first on the service configuration and then on the mule manager configuration
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### getId

    public String getId()

  Description copied from interface: `MuleSession`
  Returns the unique id for this session

  Specified by:
    `getId` in interface `MuleSession`
  Returns:
    the unique id for this session

### sendEvent

    public MuleMessage sendEvent(MuleEvent event)
                          throws MuleException

  Description copied from interface: `MuleSession`
  Depending on the session state this methods either Passes an event synchronously to the next available Mule component in the pool or via the endpoint configured for the event

  Specified by:
    `sendEvent` in interface `MuleSession`
  Parameters:
    `event` - the event to process
  Returns:
    the return Message from the call or null if there was no result
  Throws:
    `MuleException` - if the event fails to be processed by the service or the transport for the endpoint

### processResponse

    protected void processResponse(MuleMessage response)

  Once an event has been processed we need to romove certain properties so that they not propagated to the next request

  Parameters:
    `response` - The response from the previous request

### isValid

    public boolean isValid()

  Description copied from interface: `MuleSession`
  Determines if this session is valid. A session becomes invalid if an exception occurs while processing

  Specified by:
    `isValid` in interface `MuleSession`
  Returns:
    true if the service is functioning properly, false otherwise

### setValid

    public void setValid(boolean value)

  Description copied from interface: `MuleSession`
  Determines if this session is valid. A session becomes invalid if an exception occurs while processing

  Specified by:
    `setValid` in interface `MuleSession`
  Parameters:
    `value` - true if the service is functioning properly, false otherwise

### requestEvent

    public MuleMessage requestEvent(String endpointName,
                                    long timeout)
                             throws MuleException

  Description copied from interface: `MuleSession`
  Requests a synchronous receive of an event on the service

  Specified by:
    `requestEvent` in interface `MuleSession`
  Parameters:
    `endpointName` - the endpoint name identifing the endpointUri on ewhich the event will be received
    `timeout` - time in milliseconds before the request timesout
  Returns:
    The requested event or null if the request times out
  Throws:
    `MuleException` - if the request operation fails

### requestEvent

    public MuleMessage requestEvent(InboundEndpoint endpoint,
                                    long timeout)
                             throws MuleException

  Description copied from interface: `MuleSession`
  Requests a synchronous receive of an event on the service

  Specified by:
    `requestEvent` in interface `MuleSession`
  Parameters:
    `endpoint` - the endpoint identifing the endpointUri on ewhich the event will be received
    `timeout` - time in milliseconds before the request timesout
  Returns:
    The requested event or null if the request times out
  Throws:
    `MuleException` - if the request operation fails

### createOutboundEvent

    public MuleEvent createOutboundEvent(MuleMessage message,
                                         OutboundEndpoint endpoint,
                                         MuleEvent previousEvent)
                                  throws MuleException

  Description copied from interface: `MuleSession`
  Creates an outbound event for this session

  Specified by:
    `createOutboundEvent` in interface `MuleSession`
  Parameters:
    `message` - the event messgae payload
    `endpoint` - the endpoint to send/dispatch through
    `previousEvent` - the previous event (if any) on this session
  Returns:
    the event to send/dispatch
  Throws:
    `MuleException` - if the evnet cannot be created

### getService

    public Service getService()

  Description copied from interface: `MuleSession`
  Returns the Service associated with the session in its current execution

  Specified by:
    `getService` in interface `MuleSession`
  Returns:
    Returns the service.
  See Also:
    `Service`

### setSecurityContext

    public void setSecurityContext(SecurityContext context)

  The security context for this session. If not null outbound, inbound and/or method invocations will be authenticated using this context

  Specified by:
    `setSecurityContext` in interface `MuleSession`
  Parameters:
    `context` - the context for this session or null if the request is not secure.

### getSecurityContext

    public SecurityContext getSecurityContext()

  The security context for this session. If not null outbound, inbound and/or method invocations will be authenticated using this context

  Specified by:
    `getSecurityContext` in interface `MuleSession`
  Returns:
    the context for this session or null if the request is not secure.

### setProperty

    public void setProperty(Object key,
                            Object value)

  Will set a session level property. These will either be stored and retrieved using the underlying transport mechanism of stored using a default mechanism

  Specified by:
    `setProperty` in interface `MuleSession`
  Parameters:
    `key` - the key for the object data being stored on the session
    `value` - the value of the session data

### getProperty

    public Object getProperty(Object key)

  Will retrieve a session level property.

  Specified by:
    `getProperty` in interface `MuleSession`
  Parameters:
    `key` - the key for the object data being stored on the session
  Returns:
    the value of the session data or null if the property does not exist

### removeProperty

    public Object removeProperty(Object key)

  Will retrieve a session level property and remove it from the session

  Specified by:
    `removeProperty` in interface `MuleSession`
  Parameters:
    `key` - the key for the object data being stored on the session
  Returns:
    the value of the session data or null if the property does not exist

### getPropertyNames

    public Iterator getPropertyNames()

  Returns an iterater of property keys for the session properties on this session

  Specified by:
    `getPropertyNames` in interface `MuleSession`
  Returns:
    an iterater of property keys for the session properties on this session

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

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.