com.altair.hwm.toolkit.binding
Class HWMAdapterMgr

java.lang.Object
  extended by com.altair.hwm.toolkit.binding.HWMAdapterMgr

public class HWMAdapterMgr
extends java.lang.Object

Title: HWMAdapterMgr

Description: This class manages all operatios pertaining to the adapter class, which include writing the adapter class, any queries to the adapter class, etc.

Company: Altair Engineering, Inc.


Constructor Summary
HWMAdapterMgr()
          Constructor.
 
Method Summary
 void AddListener(HWMBindingInfo hwmBindingInfo)
          Gets the adaptor class from binding info and calls AddListener method on it.
 void ClearAll()
          When a new template/project is loaded, or the existing project/template closed, the adapter manager needs to reinitialize itself
 int GetLastUsedAdapterClassID()
          Get the last used adapter ID class.
 void InitEventAdapter(HWMBindingInfo hwmBindingInfo, java.lang.Object objBeanSource, java.lang.Object objBeanTarget, java.lang.String strTemplateDir, HWMClassLoader hwmClassLoader)
          Create an instance of the adapter class, and Initialize it.
 void InitPropertyAdapter(HWMBindingInfo hwmBindingInfo, java.lang.Object objBeanSource, java.lang.Object objBeanTarget)
          Instantiates the property adapter class for the binding and stores it in the binding info
 void RemoveListener(HWMBindingInfo hwmBindingInfo)
          Gets the adaptor class from binding info and calls RemoveListener method on it.
 void SetLastUsedAdapterClassID(int nID)
          Set the last used adapter ID class.
 void WriteAdapterClass(HWMBindingInfo hwmBindingInfo, java.lang.Object objBeanSource, java.lang.Object objBeanTarget, java.lang.String strTemplateDir, java.lang.String strTemplateName, HWMClassLoader hwmClassLoader)
          Write the adapter class for the information provided by the BindingInfo, and compile it to a class file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HWMAdapterMgr

public HWMAdapterMgr()
Constructor.

Method Detail

WriteAdapterClass

public void WriteAdapterClass(HWMBindingInfo hwmBindingInfo,
                              java.lang.Object objBeanSource,
                              java.lang.Object objBeanTarget,
                              java.lang.String strTemplateDir,
                              java.lang.String strTemplateName,
                              HWMClassLoader hwmClassLoader)
                       throws java.io.IOException,
                              java.lang.NoSuchMethodException,
                              java.lang.InterruptedException,
                              java.lang.Exception
Write the adapter class for the information provided by the BindingInfo, and compile it to a class file

Parameters:
hwmBindingInfo - -- The binding info for the adapter class to be written
strTemplateDir - -- The template directory
Throws:
java.io.IOException
java.lang.NoSuchMethodException
java.lang.InterruptedException
java.lang.Exception

InitEventAdapter

public void InitEventAdapter(HWMBindingInfo hwmBindingInfo,
                             java.lang.Object objBeanSource,
                             java.lang.Object objBeanTarget,
                             java.lang.String strTemplateDir,
                             HWMClassLoader hwmClassLoader)
                      throws java.lang.IllegalAccessException,
                             java.lang.reflect.InvocationTargetException,
                             java.lang.NoSuchMethodException,
                             java.lang.Exception
Create an instance of the adapter class, and Initialize it. The adapter class adds itself as a listener to the approppriate event of the source bean.

Parameters:
hwmBindingInfo - -- The Binding Info structure that holds the information about the adapter class and the source.target beans
strTemplateDir - -- The template directory
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.Exception

InitPropertyAdapter

public void InitPropertyAdapter(HWMBindingInfo hwmBindingInfo,
                                java.lang.Object objBeanSource,
                                java.lang.Object objBeanTarget)
                         throws java.lang.IllegalAccessException,
                                java.lang.reflect.InvocationTargetException,
                                java.lang.NoSuchMethodException,
                                java.lang.Exception
Instantiates the property adapter class for the binding and stores it in the binding info

Parameters:
hwmBindingInfo - -- The Binding Info structure that holds the information about the adapter class and the source.target beans
Throws:
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.Exception

ClearAll

public void ClearAll()
When a new template/project is loaded, or the existing project/template closed, the adapter manager needs to reinitialize itself


GetLastUsedAdapterClassID

public int GetLastUsedAdapterClassID()
Get the last used adapter ID class. This info should be persisted

Returns:
int The last ID used for generating the adapter class

SetLastUsedAdapterClassID

public void SetLastUsedAdapterClassID(int nID)
Set the last used adapter ID class. Between sessions, this info was persisted, and now it is being set again (after being read from file)

Parameters:
nID - The ID to use for generating the adapetr class

AddListener

public void AddListener(HWMBindingInfo hwmBindingInfo)
Gets the adaptor class from binding info and calls AddListener method on it.

Parameters:
hwmBindingInfo - The binding info object

RemoveListener

public void RemoveListener(HWMBindingInfo hwmBindingInfo)
Gets the adaptor class from binding info and calls RemoveListener method on it.

Parameters:
hwmBindingInfo - The binding info object