org.mule
Class MessagePropertiesContext

java.lang.Object
  extended by org.mule.MessagePropertiesContext
All Implemented Interfaces:
Serializable

public class MessagePropertiesContext
extends Object
implements Serializable

This object maintains a scoped map of properties. This means that certain properties will only be visible under some scopes. The scopes supported by Mule are:

  1. PropertyScope.INBOUND Contains properties that were on the message when it was received by Mule. This scope is read-only.
  2. PropertyScope.INVOCATION Any properties set on the invocation scope will be available to the current service but will not be attached to any outbound messages.
  3. PropertyScope.OUTBOUND Any properties set in this scope will be attached to any outbound messages resulting from this message. This is the default scope.
  4. PropertyScope.SESSION Any properties set on this scope will be added to the session. Note Session properties are not stored on the MuleMessage. This scope should only be used once a MuleEvent has been created as there is no MuleSession and therefore Session scope properties before this time

See Also:
Serialized Form

Field Summary
protected  Map<String,Object> invocationMap
           
protected  Set<String> keySet
          The union of all property names from all scopes.
protected  Map<PropertyScope,Map<String,Object>> scopedMap
          Map of maps containing the scoped properties, each scope has its own Map.
protected  Map<String,Object> sessionMap
           
 
Constructor Summary
MessagePropertiesContext()
           
 
Method Summary
protected  void addInboundProperties(Map<String,Object> properties)
           
protected  void checkScopeForWriteAccess(PropertyScope scope)
           
 void clearProperties()
          Removes all properties from all scopes except for SESSION and INBOUND (which is read-only).
 void clearProperties(PropertyScope scope)
           
 boolean getBooleanProperty(String name, boolean defaultValue)
           
 byte getByteProperty(String name, byte defaultValue)
           
 PropertyScope getDefaultScope()
           
 double getDoubleProperty(String name, double defaultValue)
           
 float getFloatProperty(String name, float defaultValue)
           
 int getIntProperty(String name, int defaultValue)
           
 long getLongProperty(String name, long defaultValue)
           
 Object getProperty(String key)
          Deprecated. use the overloaded version with an explicit lookup scope. This method will now use only the outbound scope.
 Object getProperty(String key, Object defaultValue)
           
<T> T
getProperty(String key, PropertyScope scope)
           
 Set<String> getPropertyNames()
          Deprecated. use getPropertyNames(org.mule.api.transport.PropertyScope)
 Set<String> getPropertyNames(PropertyScope scope)
           
protected  Map<String,Object> getScopedProperties(PropertyScope scope)
           
 short getShortProperty(String name, short defaultValue)
           
 String getStringProperty(String name, PropertyScope scope, String defaultValue)
           
 String getStringProperty(String name, String defaultValue)
          Deprecated. 
 Object removeProperty(String key)
          Removes a property from all scopes except for SESSION and INBOUND (which is read-only).
 Object removeProperty(String key, PropertyScope scope)
          Removes a property from the specified property scope.
 void setProperty(String key, Object value)
          Deprecated. use setProperty(String, Object, org.mule.api.transport.PropertyScope)
 void setProperty(String key, Object value, PropertyScope scope)
          Set a property on the message
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scopedMap

protected Map<PropertyScope,Map<String,Object>> scopedMap
Map of maps containing the scoped properties, each scope has its own Map.


invocationMap

protected Map<String,Object> invocationMap

sessionMap

protected transient Map<String,Object> sessionMap

keySet

protected Set<String> keySet
The union of all property names from all scopes.

Constructor Detail

MessagePropertiesContext

public MessagePropertiesContext()
Method Detail

getScopedProperties

protected Map<String,Object> getScopedProperties(PropertyScope scope)

getDefaultScope

public PropertyScope getDefaultScope()

addInboundProperties

protected void addInboundProperties(Map<String,Object> properties)

getProperty

@Deprecated
public Object getProperty(String key)
Deprecated. use the overloaded version with an explicit lookup scope. This method will now use only the outbound scope.


getProperty

public <T> T getProperty(String key,
                         PropertyScope scope)

clearProperties

public void clearProperties()
Removes all properties from all scopes except for SESSION and INBOUND (which is read-only). You may explicitly clear the session properties by calling clearProperties(PropertyScope.SESSION)


clearProperties

public void clearProperties(PropertyScope scope)

removeProperty

public Object removeProperty(String key)
Removes a property from all scopes except for SESSION and INBOUND (which is read-only). You may explicitly remove a session property by calling removeProperty(key, PropertyScope.SESSION)

Parameters:
key - the property key to remove
Returns:
the removed property value or null if the property did not exist

removeProperty

public Object removeProperty(String key,
                             PropertyScope scope)
Removes a property from the specified property scope.

Parameters:
key - the property key to remove
Returns:
the removed property value or null if the property did not exist

setProperty

@Deprecated
public void setProperty(String key,
                                   Object value)
Deprecated. use setProperty(String, Object, org.mule.api.transport.PropertyScope)

Set a property on the message

Parameters:
key - the key on which to associate the value
value - the property value

setProperty

public void setProperty(String key,
                        Object value,
                        PropertyScope scope)
Set a property on the message

Parameters:
key - the key on which to associate the value
value - the property value
scope - the scope to se the property on
See Also:
PropertyScope

getPropertyNames

@Deprecated
public Set<String> getPropertyNames()
Deprecated. use getPropertyNames(org.mule.api.transport.PropertyScope)


getPropertyNames

public Set<String> getPropertyNames(PropertyScope scope)
Returns:
all property keys on this message for the given scope

checkScopeForWriteAccess

protected void checkScopeForWriteAccess(PropertyScope scope)

getProperty

public Object getProperty(String key,
                          Object defaultValue)

getByteProperty

public byte getByteProperty(String name,
                            byte defaultValue)

getShortProperty

public short getShortProperty(String name,
                              short defaultValue)

getIntProperty

public int getIntProperty(String name,
                          int defaultValue)

getLongProperty

public long getLongProperty(String name,
                            long defaultValue)

getFloatProperty

public float getFloatProperty(String name,
                              float defaultValue)

getDoubleProperty

public double getDoubleProperty(String name,
                                double defaultValue)

getBooleanProperty

public boolean getBooleanProperty(String name,
                                  boolean defaultValue)

getStringProperty

@Deprecated
public String getStringProperty(String name,
                                           String defaultValue)
Deprecated. 


getStringProperty

public String getStringProperty(String name,
                                PropertyScope scope,
                                String defaultValue)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.