gov.nasa.arc.brahms.vm.api.convert
Class InstanceMappingSingleton

java.lang.Object
  extended by gov.nasa.arc.brahms.vm.api.convert.InstanceMappingSingleton
All Implemented Interfaces:
IInstanceMapping

public class InstanceMappingSingleton
extends java.lang.Object
implements IInstanceMapping

InstanceMappingSingleton is a singleton IInstanceMapping used to maintain a mapping between existing Brahms and Java objects used to ensure that during the conversion between Brahms and Java objects no new objects are created when a mapping already exists, in that case state information is updated in the mapped object. This singleton maintains the mapping for a single Brahms virtual machine while that virtual machine is running.

Version:
$Revision: 1.1 $ $Date: 2008/06/23 18:45:01 $ $Author: rvhoof $
Author:
Ron van Hoof

Method Summary
 void addMapping(java.lang.Object jobj, IObject bobj)
          Adds the specified mapping between the specified Java object and Brahms object.
 IObject getBrahmsMapping(java.lang.Object obj)
          Returns the Brahms object mapped to the specified Java object.
static InstanceMappingSingleton getInstance()
          Returns the singleton InstanceMappingSingleton.
 java.lang.Object getJavaMapping(IObject obj)
          Returns the Java object mapped to the specified Brahms object.
 void removeMapping(java.lang.Object jobj, IObject bobj)
          Removes the specified mapping between the specified Java object and Brahms object.
 void reset()
          Resets the mapping, clearing out any mappings that were maintained by this instance mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static final InstanceMappingSingleton getInstance()
Returns the singleton InstanceMappingSingleton.

Returns:
InstanceMappingSingleton the singleton

addMapping

public void addMapping(java.lang.Object jobj,
                       IObject bobj)
Adds the specified mapping between the specified Java object and Brahms object. The mapping is maintained in a hashtable so the hashkey of each is used to maintain the mapping.

Specified by:
addMapping in interface IInstanceMapping
Parameters:
jobj - the Java Object being mapped
bobj - the Brahms IObject being mapped

removeMapping

public void removeMapping(java.lang.Object jobj,
                          IObject bobj)
Removes the specified mapping between the specified Java object and Brahms object. The mapping is maintained in a hashtable so the hashkey of each is used to maintain the mapping.

Specified by:
removeMapping in interface IInstanceMapping
Parameters:
jobj - the mapped Java Object
bobj - the mapped Brahms IObject

getJavaMapping

public java.lang.Object getJavaMapping(IObject obj)
Returns the Java object mapped to the specified Brahms object.

Specified by:
getJavaMapping in interface IInstanceMapping
Parameters:
obj - the Brahms IObject for which to return its Java counterpart
Returns:
Object the Java object mapped to the specified Brahms object, null if no mapping exists

getBrahmsMapping

public IObject getBrahmsMapping(java.lang.Object obj)
Returns the Brahms object mapped to the specified Java object.

Specified by:
getBrahmsMapping in interface IInstanceMapping
Parameters:
obj - the Java Object for which to return its Brahms counterpart
Returns:
IObject the Brahms object mapped to the specified Java object, null if no mapping exists

reset

public void reset()
Resets the mapping, clearing out any mappings that were maintained by this instance mapping.



Copyright © 1997-2012 All Rights Reserved.