com.ibm.itim.script.wrappers
Class ObjectWrapperManager

java.lang.Object
  extended by com.ibm.itim.script.wrappers.ObjectWrapperManager

public class ObjectWrapperManager
extends java.lang.Object

Main entry point to wrap an Object to place in the scripting environment. This class is a singleton.

Since:
ITIM 5.0

Field Summary
static java.lang.String NO_WRAP
          Factory name to use for classes that should not be wrapped.
 
Method Summary
static ObjectWrapperManager getInstance()
          Get a reference to the only ObjectWrapperManager.
 java.lang.Object lookupItem(java.lang.String name)
          Gets the origional Object with the given name.
 void remove(java.lang.String key)
          Remove the Object associated with key from the lookup map.
 void storeItem(java.lang.Object obj, ObjectWrapper wrapper)
          This method generates a unique key for the wrapper and sets the name via the ObjectWrapper.setKey(String key) method, then inserts obj into the lookup map maintained by ObjectWrapperManager so we can get at the origional object later.
 java.lang.Object wrap(java.lang.String name, java.lang.Object obj, java.lang.String lang, java.lang.Object param)
          Wraps obj with the correct type of Wrapper based on the configuration.
 java.lang.Object wrapInternalObject(java.lang.String name, java.lang.Object obj, java.lang.String lang, java.lang.Object param)
          Wraps obj with the correct type of Wrapper based on the configuration.
Note: This function is intended to be used internally from ScriptEvaluator and the calling function should register the wrapped obj to dispose listener by calling ScriptContextDAO.addDisposeListener(), so that the obj gets cleared from lookup map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_WRAP

public static final java.lang.String NO_WRAP
Factory name to use for classes that should not be wrapped. ObjectWrapperManager will deal with these objects in a consistant manner.

See Also:
Constant Field Values
Method Detail

getInstance

public static ObjectWrapperManager getInstance()
Get a reference to the only ObjectWrapperManager.

Returns:
The one and only ObjectWrapperManager

wrap

public java.lang.Object wrap(java.lang.String name,
                             java.lang.Object obj,
                             java.lang.String lang,
                             java.lang.Object param)
Wraps obj with the correct type of Wrapper based on the configuration. If the wrapper to use for obj is com.ibm.itim.script.wrappers.NO_WRAP then obj will be returned and not wrapped or inserted into the lookup map.

Parameters:
name - Name that can be used to look this bean up using the ScriptEvaluator. This is typically the bean name, and can be null. If name is null, then a unique id will be automatically assigned.
obj - The Object to wrap.
lang - The scripting language we are using.
param - Some wrapper classes need parameters to correctly wrap objects. param is how this information is passed.
Returns:
null - if (obj == null)
null - if param is not sufficient to wrap the object for the given language.
obj - if the wrapper for obj is com.ibm.itim.script.wrappers.NO_WRAP.
obj - if (obj instanceof ObjectWrapper)
obj - if (obj instanceof ExtensionBean)
Wrapped object - else.

remove

public void remove(java.lang.String key)
Remove the Object associated with key from the lookup map. This method should only be called by the dispose() method of ObjectWrapper classes.

Parameters:
key - The key (or name) used to lookup objects in ObjectWrapperManager. Since this method is only supposed to be called by ObjectWrapper classes, key can be gotten from the getKey() method.

lookupItem

public java.lang.Object lookupItem(java.lang.String name)
Gets the origional Object with the given name.

Parameters:
name - The name of the Object used when wrapping the Object.
Returns:
The Object associated with name.

storeItem

public void storeItem(java.lang.Object obj,
                      ObjectWrapper wrapper)
This method generates a unique key for the wrapper and sets the name via the ObjectWrapper.setKey(String key) method, then inserts obj into the lookup map maintained by ObjectWrapperManager so we can get at the origional object later. This method exists so that items constructed from the script environment, in their wrappers, can still be accessed outside of the scripting environment.

Parameters:
obj - The object that is wrapped.
wrapper - The wrapped version of obj.

wrapInternalObject

public java.lang.Object wrapInternalObject(java.lang.String name,
                                           java.lang.Object obj,
                                           java.lang.String lang,
                                           java.lang.Object param)
Wraps obj with the correct type of Wrapper based on the configuration.
Note: This function is intended to be used internally from ScriptEvaluator and the calling function should register the wrapped obj to dispose listener by calling ScriptContextDAO.addDisposeListener(), so that the obj gets cleared from lookup map. If the wrapper to use for obj is com.ibm.itim.script.wrappers.NO_WRAP then obj will be returned and not wrapped or inserted into the lookup map.

Parameters:
name - Name that can be used to look this bean up using the ScriptEvaluator. This is typically the bean name, and can be null. If name is null, then a unique id will be automatically assigned.
obj - The Object to wrap.
lang - The scripting language we are using.
param - Some wrapper classes need parameters to correctly wrap objects. param is how this information is passed.
Returns:
null - if (obj == null)
null - if param is not sufficient to wrap the object for the given language.
obj - if the wrapper for obj is com.ibm.itim.script.wrappers.NO_WRAP.
obj - if (obj instanceof ObjectWrapper)
obj - if (obj instanceof ExtensionBean)
Wrapped object - else.


IBM Security Identity Manager 6.0.0
© Copyright International Business Machines Corporation 2007, 2012. All rights reserved. US Government Users Restricited Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.