All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.beans.tools.dip.MorphController
java.lang.Object
|
+----com.ibm.beans.tools.dip.MorphController
- public class MorphController
- extends Object
- implements MorphViewListener
The MorphController class displays the Morphing UI and manages the
Models of the classes to be morphed and the dips to be applied.
A MorphController instance is invoked by the morph class.
A MorphController instance can be invoked
directly from a Frame such as the bean box.
- See Also:
- morph
-
fAdditionalClasses
- The array of additional API class names.
-
fAdditionalInterfaces
- The array of additional API interface names.
-
fBeanInfoRootFileName
- The root part of the BeanInfo classes file name.
-
fClassesModel
- Model containing the classes.
-
fClassesModelListener
- Listener to tell this MorphController when
more classes are added to the model
-
fClassesModelManipulator
- MorphModelManipulator instance linked to
fClassesModel.
-
fClassesModelSelectable
- Flag indicating if the fClassesModel
implements the ModelSelectable interface.
-
fCleanUpJavaFiles
- Flag indicating if the .java source code of the
morphed class should be deleted after a
successful compilation.
-
fCompileFiles
- Flag indicating if the .java source code of the
morphed class should be compiled.
-
fCompileOK
- Local flag indicating if the generated .java
source code compiled cleanly.
-
fCreateDipSer
- Flag indicating if .ser files for the dips applied
to the dippable bean should be created.
-
fCustomizedDips
- The hashtable used to hold the initial property
settings for the pre-dips.
-
fDebugLog
- The debug log messages are written to.
-
fDippableRootFileName
- The root part of the dippable classes file name.
-
fDipsModel
- Model containing the dips.
-
fDipsModelListener
- Listener to tell this MorphController when
more dips are added to the model
-
fDipsModelManipulator
- MorphModelManipulator instance linked to
fDipsModel.
-
fDipsModelSelectable
- Flag indicating if the fDipsModel
implements the ModelSelectable interface.
-
fDipsModelUpdateListener
- Listener to the classes model, so that when
classes are added, all dips are added to the dips
model too.
-
fErrorLog
- The status log messages are written to.
-
fExit
- Flag indicating a System.exit() method call needs
to be run when the MorphController exits.
-
fLocalSaveToJar
- Local flag indicating whether processing problems
will prevent this MorphController from saving the
morphed class to a jar.
-
fMF
- The MessageFormatter for a MorphDialog.
-
fOriginalRepositoryName
- The name of the original repository which held the
original class.
-
fOriginalRepositoryURL
- The URL of the original repository which held the
original class.
-
fSaveToJar
- Flag indicating if the morphed class should be
saved to a jar or repository.
-
fView
- MorphView instantiation.
-
MorphController(MorphView, MorphModelManipulator)
- Constructs a MorphController instance.
-
MorphController(MorphView, MorphModelManipulator, MorphModelManipulator)
- Constructs a MorphController instance.
-
compile(String, String)
- Compiles the file.
-
createDipSerFiles()
- Creates .ser files for every pre-Dip added to the dippable bean.
-
doMorphing(String, String, boolean, String, boolean)
- Morphs the class.
-
finalize()
- Disposes of system resources and performs other cleanup before
garbage collection.
-
getAdditionalAPIs()
- Gets the list of additional APIs to be added to the dippable class.
-
getClassName()
- Gets package qualified class name of the class to use while morphing.
-
getDips()
- Gets the list of dips to be applied to the dippable class.
-
getDoCleanUpJavaFiles()
- Gets the flag that indicates if the .java source code of the
morphed class should be deleted after a successful compilation.
-
getDoCompileFiles()
- Gets the flag that indicates if the .java source code of the
morphed class should be compiled.
-
getDoCreateDipSer()
- Gets the flag that indicates if .ser files for the dips applied to
to the dippable bean should be created.
-
getDoRunExit()
- Gets the flag that indicates a System.exit() method call needs to be
run when the MorphController exits.
-
getDoSaveToJar()
- Gets the flag that indicates if the morphed class should be saved
to a jar or repository.
-
getFinalMethodNames()
- Gets the list of final method names in the new dippable class that
should be final methods.
-
getInterfaces(Class, Vector)
- Gets the names of all the interfaces implemented by a class
and puts them in a vector.
-
handleAdditionalClassSelected(MorphViewEvent)
- Manages a ADDITIONAL_CLASS_SELECTED MorphViewEvent.
-
handleCancel(MorphViewEvent)
- Manages a CANCEL MorphViewEvent.
-
handleClassSelected(MorphViewEvent)
- Manages a CLASS_SELECTED MorphViewEvent.
-
handleDipDeselected(MorphViewEvent)
- Manages a DIP_DESELECTED MorphViewEvent.
-
handleDipSelected(MorphViewEvent)
- Manages a DIP_SELECTED MorphViewEvent.
-
handleFinalMethods(MorphViewEvent)
- Manages a FINAL_METHODS MorphViewEvent.
-
handleLoadClassesModel(MorphViewEvent)
- Manages a LOAD_CLASSES_MODEL MorphViewEvent.
-
handleLoadDipsModel(MorphViewEvent)
- Manages a LOAD_DIPS_MODEL MorphViewEvent.
-
handleMorph(MorphViewEvent)
- Manages a MORPH MorphViewEvent.
-
handleViewAction(MorphViewEvent)
- Manages an action from the MorphView.
-
morph(String, String, boolean, String, boolean, String)
- Morph the class.
-
outputErrorMessage(String)
- Output the error message using a MessageFormatter object.
-
outputErrorMessage(String, String)
- Output the error message using a MessageFormatter object.
-
outputErrorMessage(String, String, String)
- Output the error message using a MessageFormatter object.
-
outputErrorMessageWithoutFormatter(String)
- Output the error message without using a MessageFormatter object.
-
outputStatusMessage(String, String)
- Output the status message using a MessageFormatter object.
-
outputStatusMessage(String, String, String)
- Output the status message using a MessageFormatter object.
-
saveToJar(String, String, boolean)
- Saves the morphed class to either the original or a new Jar file.
-
setDoCleanUpJavaFiles(boolean)
- Sets the flag that indicates if the .java source code of the
morphed class should be deleted after a successful compilation.
-
setDoCompileFiles(boolean)
- Sets the flag that indicates if the .java source code of the
morphed class should be compiled.
-
setDoCreateDipSer(boolean)
- Sets the flag that indicates if .ser files for the dips applied to
to the dippable bean should be created.
-
setDoRunExit(boolean)
- Sets the flag that indicates a System.exit() method call needs to be
run when the MorphController exits.
-
setDoSaveToJar(boolean)
- Sets the flag that indicates if the morphed class should be saved
to a jar or repository.
fAdditionalClasses
protected String fAdditionalClasses[]
- The array of additional API class names.
fAdditionalInterfaces
protected String fAdditionalInterfaces[]
- The array of additional API interface names.
fDipsModelListener
protected ModelChangeListener fDipsModelListener
- Listener to tell this MorphController when
more dips are added to the model
fClassesModelListener
protected ModelChangeListener fClassesModelListener
- Listener to tell this MorphController when
more classes are added to the model
fDipsModelUpdateListener
protected ModelChangeListener fDipsModelUpdateListener
- Listener to the classes model, so that when
classes are added, all dips are added to the dips
model too.
fView
protected MorphView fView
- MorphView instantiation. This is the GUI
presented to the user.
fClassesModel
protected Model fClassesModel
- Model containing the classes.
fClassesModelManipulator
protected MorphModelManipulator fClassesModelManipulator
- MorphModelManipulator instance linked to
fClassesModel.
fDipsModel
protected Model fDipsModel
- Model containing the dips.
fDipsModelManipulator
protected MorphModelManipulator fDipsModelManipulator
- MorphModelManipulator instance linked to
fDipsModel.
fClassesModelSelectable
protected boolean fClassesModelSelectable
- Flag indicating if the fClassesModel
implements the ModelSelectable interface.
fDipsModelSelectable
protected boolean fDipsModelSelectable
- Flag indicating if the fDipsModel
implements the ModelSelectable interface.
fCustomizedDips
protected Hashtable fCustomizedDips
- The hashtable used to hold the initial property
settings for the pre-dips.
fMF
protected MessageFormatter fMF
- The MessageFormatter for a MorphDialog.
fExit
protected boolean fExit
- Flag indicating a System.exit() method call needs
to be run when the MorphController exits.
- See Also:
- setDoRunExit, getDoRunExit
fLocalSaveToJar
protected boolean fLocalSaveToJar
- Local flag indicating whether processing problems
will prevent this MorphController from saving the
morphed class to a jar.
fSaveToJar
protected boolean fSaveToJar
- Flag indicating if the morphed class should be
saved to a jar or repository.
- See Also:
- setDoSaveToJar, getDoSaveToJar
fCreateDipSer
protected boolean fCreateDipSer
- Flag indicating if .ser files for the dips applied
to the dippable bean should be created.
- See Also:
- setDoCreateDipSer, getDoCreateDipSer
fCompileFiles
protected boolean fCompileFiles
- Flag indicating if the .java source code of the
morphed class should be compiled.
- See Also:
- setDoCompileFiles, getDoCompileFiles
fCompileOK
protected boolean fCompileOK
- Local flag indicating if the generated .java
source code compiled cleanly.
fCleanUpJavaFiles
protected boolean fCleanUpJavaFiles
- Flag indicating if the .java source code of the
morphed class should be deleted after a
successful compilation.
- See Also:
- setDoCleanUpJavaFiles, getDoCleanUpJavaFiles
fErrorLog
protected LogStream fErrorLog
- The status log messages are written to.
fDebugLog
protected LogStream fDebugLog
- The debug log messages are written to.
fDippableRootFileName
protected String fDippableRootFileName
- The root part of the dippable classes file name.
For example
D:\src\main is the root part of D:\src\main.java.
fBeanInfoRootFileName
protected String fBeanInfoRootFileName
- The root part of the BeanInfo classes file name.
For example
D:\src\mainBeanInfo is the root part of
D:\src\mainBeanInfo.java.
fOriginalRepositoryURL
protected String fOriginalRepositoryURL
- The URL of the original repository which held the
original class.
fOriginalRepositoryName
protected String fOriginalRepositoryName
- The name of the original repository which held the
original class.
MorphController
public MorphController(MorphView modelView,
MorphModelManipulator classesManipulator)
- Constructs a MorphController instance. The MorphController manages
all the logic between the ModelView implementation and the Models in the
MorphModelManipulator instances.
Because there is no seperate dipsManipulator, the copy constructor
for the classesManipulator will be used to create a seperate model
for the dips.
- Parameters:
- modelView
-
-
The view to be presented to the user.
- classesManipulator
-
-
The MorphModelManipulator containing the
model of the classes to be selected for morphing.
This parameter can be null
if
the user wishes to use an empty BeanBagModel instance
as the Model implementation.
MorphController
public MorphController(MorphView modelView,
MorphModelManipulator classesManipulator,
MorphModelManipulator dipsManipulator)
- Constructs a MorphController instance. The MorphController manages
all the logic between the ModelView and the Models in the
MorphModelManipulators.
- Parameters:
- modelView
-
-
The view to be presented to the user.
- classesManipulator
-
-
The MorphModelManipulator containing the
model of the classes to be selected for morphing.
This parameter can be null
if
the user wishes to use an empty BeanBagModel instance
as the Model implementation.
- dipsManipulator
-
-
The MorphModelManipulator containing the
model of the dips to be applied for pre-dipping.
This parameter can be null
if
the user wishes to use an empty BeanBagModel instance
as the Model implementation.
handleViewAction
public void handleViewAction(MorphViewEvent evt)
- Manages an action from the MorphView. This method is invoked when
a change from the MorphView means action needs to be taken.
- Parameters:
- evt - A MorphViewEvent object describing what action is requested
and providing all data necessary to handle the event.
handleLoadClassesModel
protected void handleLoadClassesModel(MorphViewEvent evt)
- Manages a LOAD_CLASSES_MODEL MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the LOAD_CLASSES_MODEL Action ID.
handleLoadDipsModel
protected void handleLoadDipsModel(MorphViewEvent evt)
- Manages a LOAD_DIPS_MODEL MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the LOAD_DIPS_MODEL Action ID.
handleClassSelected
protected void handleClassSelected(MorphViewEvent evt)
- Manages a CLASS_SELECTED MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the CLASS_SELECTED Action ID.
handleFinalMethods
protected void handleFinalMethods(MorphViewEvent evt)
- Manages a FINAL_METHODS MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the FINAL_METHODS Action ID.
handleDipSelected
protected void handleDipSelected(MorphViewEvent evt)
- Manages a DIP_SELECTED MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the DIP_SELECTED Action ID.
handleDipDeselected
protected void handleDipDeselected(MorphViewEvent evt)
- Manages a DIP_DESELECTED MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the DIP_DESELECTED Action ID.
handleCancel
protected void handleCancel(MorphViewEvent evt)
- Manages a CANCEL MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the CANCEL Action ID.
handleMorph
protected void handleMorph(MorphViewEvent evt)
- Manages a MORPH MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the MORPH Action ID.
handleAdditionalClassSelected
protected void handleAdditionalClassSelected(MorphViewEvent evt)
- Manages a ADDITIONAL_CLASS_SELECTED MorphViewEvent.
- Parameters:
- evt - The MorphViewEvent with the ADDITIONAL_CLASS_SELECTED Action ID.
setDoRunExit
public void setDoRunExit(boolean state)
- Sets the flag that indicates a System.exit() method call needs to be
run when the MorphController exits.
- Parameters:
- state -
true
indicates the System.exit() method should
be called; false
otherwise.
getDoRunExit
public boolean getDoRunExit()
- Gets the flag that indicates a System.exit() method call needs to be
run when the MorphController exits.
- Returns:
-
true
indicates the System.exit() method should
be called; false
otherwise.
setDoSaveToJar
public void setDoSaveToJar(boolean state)
- Sets the flag that indicates if the morphed class should be saved
to a jar or repository.
- Parameters:
- state -
true
indicates the morphed class should be
saved; false
otherwise.
getDoSaveToJar
public boolean getDoSaveToJar()
- Gets the flag that indicates if the morphed class should be saved
to a jar or repository.
- Returns:
-
true
indicates the morphed class should be saved;
false
otherwise.
setDoCreateDipSer
public void setDoCreateDipSer(boolean state)
- Sets the flag that indicates if .ser files for the dips applied to
to the dippable bean should be created. This flag is only checked
if the dippable bean is not saved to a jar. If the dippable bean
is saved to a jar, the .ser file must be created.
- Parameters:
- state -
true
indicates the dip .ser file should be
created; false
otherwise.
getDoCreateDipSer
public boolean getDoCreateDipSer()
- Gets the flag that indicates if .ser files for the dips applied to
to the dippable bean should be created. This flag is only checked
if the dippable bean is not saved to a jar. If the dippable bean
is saved to a jar, the .ser file must be created.
- Returns:
-
true
indicates the dip .ser file should be
created; false
otherwise.
setDoCleanUpJavaFiles
public void setDoCleanUpJavaFiles(boolean state)
- Sets the flag that indicates if the .java source code of the
morphed class should be deleted after a successful compilation.
If compilation is not attemped, then the .java source is not
deleted, no matter what the setting of this property.
- Parameters:
- state -
true
indicates the generated .java source
code should be deleted after a successful compile;
false
otherwise.
getDoCleanUpJavaFiles
public boolean getDoCleanUpJavaFiles()
- Gets the flag that indicates if the .java source code of the
morphed class should be deleted after a successful compilation.
If compilation is not attemped, then the .java source is not
deleted, no matter what the setting of this property.
- Returns:
-
true
indicates the generated .java source
code will be deleted after a successful compile;
false
otherwise.
setDoCompileFiles
public void setDoCompileFiles(boolean state)
- Sets the flag that indicates if the .java source code of the
morphed class should be compiled.
- Parameters:
- state -
true
indicates the generated .java source
code should be compiled;
false
otherwise.
getDoCompileFiles
public boolean getDoCompileFiles()
- Gets the flag that indicates if the .java source code of the
morphed class should be compiled.
- Returns:
-
true
indicates the generated .java source
code will be compiled;
false
otherwise.
getAdditionalAPIs
protected String getAdditionalAPIs()
- Gets the list of additional APIs to be added to the dippable class.
For more information, see
additionalAPIs parameter in DippableGenerator
- Returns:
-
null
if no additional APIs are to be added to the
new dippable class; otherwise a string with the list of
additional APIs.
getDips
protected String getDips()
- Gets the list of dips to be applied to the dippable class.
For more information, see
dips parameter in DippableGenerator
- Returns:
-
null
if no dips are to be applied to the
new dippable class; otherwise a string with the list of
dips.
getFinalMethodNames
protected String getFinalMethodNames()
- Gets the list of final method names in the new dippable class that
should be final methods.
- Returns:
-
null
if no methods are to be final methods;
otherwise a string with the list of method names.
Method names are separated in the string by a semicolon (;).
getClassName
protected String getClassName()
- Gets package qualified class name of the class to use while morphing.
- Returns:
-
null
if no class is selected;
otherwise return the name of the class.
doMorphing
protected void doMorphing(String className,
String interfaceName,
boolean useInherit,
String newName,
boolean beanInfo)
- Morphs the class.
- Parameters:
- className - The package qualified name of the class to morph.
- interfaceName - The interface the new dippable bean should implement.
- useInherit
-
-
true
means create the new dippable bean
through inheritance; false
means create the new
dippable bean through aggregation.
- newName
-
-
A String containing a name for the new dippable bean.
If
null
, the name of the dippable bean is
be based on the className argument.
This parameter can be null
.
- beanInfo
-
-
true
means create a BeanInfo for the
new dippable class; false
means
do not create a BeanInfo.
- Returns:
-
true
if morphing is successful
outputErrorMessageWithoutFormatter
protected void outputErrorMessageWithoutFormatter(String msg)
- Output the error message without using a MessageFormatter object.
- Parameters:
- msg - The error message.
outputErrorMessage
protected void outputErrorMessage(String msgKey)
- Output the error message using a MessageFormatter object.
- Parameters:
- msgKey - The string that is the key for retrieving
a message from the MessageFormatter instance.
outputErrorMessage
protected void outputErrorMessage(String msgKey,
String msgParm)
- Output the error message using a MessageFormatter object.
- Parameters:
- msgKey - The string that is the key for retrieving
a message from the MessageFormatter instance.
- msgParm - An object reference to the variable argument.
outputErrorMessage
protected void outputErrorMessage(String msgKey,
String msgParm1,
String msgParm2)
- Output the error message using a MessageFormatter object.
- Parameters:
- msgKey - The string that is the key for retrieving
a message from the MessageFormatter instance.
- msgParm1 - An object reference to the first variable argument.
- msgParm2 - An object reference to the second variable argument.
outputStatusMessage
protected void outputStatusMessage(String msgKey,
String msgParm)
- Output the status message using a MessageFormatter object.
- Parameters:
- msgKey - The string that is the key for retrieving
a message from the MessageFormatter instance.
- msgParm - An object reference to the variable argument.
outputStatusMessage
protected void outputStatusMessage(String msgKey,
String msgParm1,
String msgParm2)
- Output the status message using a MessageFormatter object.
- Parameters:
- msgKey - The string that is the key for retrieving
a message from the MessageFormatter instance.
- msgParm1 - An object reference to the first variable argument.
- msgParm2 - An object reference to the second variable argument.
saveToJar
protected void saveToJar(String originalClassName,
String newClassName,
boolean beanInfo)
- Saves the morphed class to either the original or a new Jar file.
- Parameters:
- originalClassName - The name of the original, un-morphed class.
- newClassName - The name of the new dippable class.
- beanInfo
-
-
true
means a BeanInfo was created for the
new dippable class; false
otherwise.
createDipSerFiles
protected void createDipSerFiles()
- Creates .ser files for every pre-Dip added to the dippable bean.
morph
protected void morph(String beanToMorph,
String interfaceName,
boolean useInherit,
String newName,
boolean beanInfo,
String relativeNewClassName) throws NullPointerException
- Morph the class.
- Create temporary directory
- Generate morphed source code
- Compile
- Parameters:
- beanToMorph - The package qualified name of the class to morph.
- interfaceName - The interface the new dippable bean should
implement.
- useInherit
-
-
true
means create the new dippable bean
through inheritance; false
means create the new
dippable bean through aggregation.
- newName
-
-
A String containing a name for the new dippable bean.
If
null
, the name of the dippable bean is
based on the className argument.
This parameter can be null
.
- beanInfo
-
-
true
means create a BeanInfo for the
new dippable class; false
means
do not create a BeanInfo.
- relativeNewClassName - The package-qualified class name of the
new morphed class.
- Throws: NullPointerException
- Thrown if using aggregation but the
interfacename is blank.
compile
protected boolean compile(String fileName,
String tmpDir)
- Compiles the file.
- Parameters:
- fileName - The name of the file to compile.
- tmpDir - The directory where the file resides.
finalize
protected void finalize() throws Throwable
- Disposes of system resources and performs other cleanup before
garbage collection.
- Throws: Throwable
- Not thrown directly by this logic.
- Overrides:
- finalize in class Object
getInterfaces
protected void getInterfaces(Class c,
Vector nameVector)
- Gets the names of all the interfaces implemented by a class
and puts them in a vector.
- Parameters:
- c - The class to check.
- nameVector - The vector to contain the interface names.
All Packages Class Hierarchy This Package Previous Next Index