org.ow2.clif.scenario.isac.egui.wizards.plugin
Class ManipulatorManager

java.lang.Object
  extended by org.ow2.clif.scenario.isac.egui.wizards.plugin.ManipulatorManager

public class ManipulatorManager
extends java.lang.Object

Singleton class which manages model in memory (Java code + XML). This class loads ISAC plugin files in memory, manages manipulation and saves them if user asked.

Author:
Fabrice Rivart, Bruno Dillenseger

Method Summary
 void addAction(java.lang.String action, java.lang.String name)
          This method adds an action into model.
 void addGroup(java.lang.String action, java.lang.String actionName, java.lang.String parentPath, java.lang.String groupName)
          This method adds group element into model.
 void addParameter(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String pluginPath, java.lang.String paramName)
          This method adds parameter element into model.
 void addParameterElement(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName)
          This method adds parameter element into model.
 java.lang.Object clone()
           
 void deleteAction(java.lang.String action, java.lang.String name)
          This method delete an action into model.
 void deleteElement(java.lang.String action, java.lang.String actionName, java.lang.String guiParentPath, java.lang.String pluginParentPath, java.lang.String guiElementPath, java.lang.String pluginElementPath, java.lang.String parameterName, java.lang.String type)
          This method delete group or parameter element into model.
 void deleteParameterElement(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName)
          This method deletes parameter element into model.
 void destroy()
          This method resets all references.
 java.util.ArrayList<java.lang.String> getActions(java.lang.String action)
          Returns a ArrayList representing string actions.
 java.lang.String getClassName()
          Returns class name.
 java.lang.String getDataProvider()
          Returns data provider state ("yes" or "no").
 java.lang.String getGuiFileName()
          Returns gui file name.
 java.lang.String getHelp(java.lang.String action, java.lang.String name)
          Returns a String representing action help.
static ManipulatorManager getInstance()
          Returns a ManipulatorManager singleton instance.
 java.lang.String getPackageName()
          Returns package name.
 java.lang.String getParameterElementDefault(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName)
          Returns default parameter element value from model.
 java.util.ArrayList<java.lang.String> getParameterElements(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type)
          Returns parameter element list in gui XML file.
 java.lang.String getParameterFieldSize(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath)
          This method returns parameter field size from model.
 java.lang.String getParameterFieldText(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath)
          This method returns parameter field text from model.
 java.lang.String getParameterLabel(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath)
          This method returns parameter label from model.
 java.lang.String getParameterType(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath)
          This method returns parameter represention from gui file.
 org.jdom.Element getParams(java.lang.String action, java.lang.String name)
          Returns a Element representing action params element.
 java.lang.String getPluginFileName()
          Returns plugin file name.
 java.lang.String getPluginName()
          Returns plugin name.
 java.lang.String getSource()
          Returns source path.
 void init(org.eclipse.core.resources.IProject arg0, org.eclipse.swt.widgets.Shell s)
          This method loads ISAC plugin files in memory.
 boolean isParameterExist(java.lang.String action, java.lang.String name, java.lang.String elementPath)
          Returns true if element exists
 void moveDownAction(java.lang.String action, java.lang.String name)
          This method move down action element into model.
 void moveDownParameter(java.lang.String action, java.lang.String actionName, java.lang.String guiParentPath, java.lang.String guiElementPath)
          This method moves down parameter in XML file.
 void moveDownParameterElement(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName)
          This method moves down parameter element in gui XML file.
 void moveUpAction(java.lang.String action, java.lang.String name)
          This method move up action into model.
 void moveUpParameter(java.lang.String action, java.lang.String actionName, java.lang.String guiParentPath, java.lang.String guiElementPath)
          This method moves up parameter in XML file.
 void moveUpParameterElement(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName)
          This method moves up parameter element into model.
 void save()
          this method saves all modifications on model into xml and Java files.
 void setClassName(java.lang.String name)
          Sets new class name.
 void setDataProvider(java.lang.String provider)
          Sets new data provider state ("yes" or "no").
 void setGuiFileName(java.lang.String name)
          Sets new gui file name.
 void setHelp(java.lang.String action, java.lang.String name, java.lang.String help)
          Set action help into model
 void setPackageName(java.lang.String name)
          Sets new package name.
 void setParameterElementDefault(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String elementName, java.lang.String value)
          This method sets default parameter element value to true or false into model.
 void setParameterFieldSize(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath, java.lang.String size)
          This method updates parameter field size into model.
 void setParameterFieldText(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath, java.lang.String text)
          This method updates parameter field text into model.
 void setParameterLabel(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath, java.lang.String label)
          This method updates parameter label into model.
 void setParameterType(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath, java.lang.String type)
          This method updates parameter represention in gui file.
 void setPluginFileName(java.lang.String name)
          Sets new plugin file name.
 void setPluginName(java.lang.String name)
          Sets new plugin name.
 void setSource(java.lang.String path)
          Sets new source path.
 void updateAction(java.lang.String action, java.lang.String oldName, java.lang.String newName)
          This method updates an action into model.
 void updateElementName(java.lang.String action, java.lang.String actionName, java.lang.String guiElementPath, java.lang.String pluginElementPath, java.lang.String oldName, java.lang.String newName, java.lang.String type)
          This method updates group or parameter element name into model.
 void updateParameterElement(java.lang.String action, java.lang.String actionName, java.lang.String guiPath, java.lang.String type, java.lang.String oldElementName, java.lang.String newElementName)
          This method updates parameter element into model.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ManipulatorManager getInstance()
Returns a ManipulatorManager singleton instance.

Returns:
ManipulatorManager singleton instance.

init

public void init(org.eclipse.core.resources.IProject arg0,
                 org.eclipse.swt.widgets.Shell s)
          throws java.lang.Exception
This method loads ISAC plugin files in memory.

Parameters:
arg0 - IProject representing the ISAC plugin project.
s - Shell representing the current shell
Throws:
java.lang.Exception

addAction

public void addAction(java.lang.String action,
                      java.lang.String name)
               throws java.lang.Exception
This method adds an action into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Throws:
java.lang.Exception - if there is an error

deleteAction

public void deleteAction(java.lang.String action,
                         java.lang.String name)
                  throws java.lang.Exception
This method delete an action into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Throws:
java.lang.Exception - if there is an error

updateAction

public void updateAction(java.lang.String action,
                         java.lang.String oldName,
                         java.lang.String newName)
                  throws java.lang.Exception
This method updates an action into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
oldName - String representing old action name
newName - String representing new action name
Throws:
java.lang.Exception - if there is an error

moveUpAction

public void moveUpAction(java.lang.String action,
                         java.lang.String name)
                  throws java.lang.Exception
This method move up action into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Throws:
java.lang.Exception - if there is an error

moveDownAction

public void moveDownAction(java.lang.String action,
                           java.lang.String name)
                    throws java.lang.Exception
This method move down action element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Throws:
java.lang.Exception - if there is an error

getActions

public java.util.ArrayList<java.lang.String> getActions(java.lang.String action)
                                                 throws java.lang.Exception
Returns a ArrayList representing string actions.

Parameters:
action - String representing the action to add (sample, timer, test, control)
Returns:
ArrayList representing string actions
Throws:
java.lang.Exception - if there is an error

addGroup

public void addGroup(java.lang.String action,
                     java.lang.String actionName,
                     java.lang.String parentPath,
                     java.lang.String groupName)
              throws java.lang.Exception
This method adds group element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
parentPath - String representing XPath parent expression
groupName - String representing group name
Throws:
java.lang.Exception - if there is an error

addParameter

public void addParameter(java.lang.String action,
                         java.lang.String actionName,
                         java.lang.String guiPath,
                         java.lang.String pluginPath,
                         java.lang.String paramName)
                  throws java.lang.Exception
This method adds parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
pluginPath - String representing XPath parent expression in plugin file
paramName - String representing parameter name
Throws:
java.lang.Exception - if there is an error

deleteElement

public void deleteElement(java.lang.String action,
                          java.lang.String actionName,
                          java.lang.String guiParentPath,
                          java.lang.String pluginParentPath,
                          java.lang.String guiElementPath,
                          java.lang.String pluginElementPath,
                          java.lang.String parameterName,
                          java.lang.String type)
                   throws java.lang.Exception
This method delete group or parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiParentPath - String representing XPath parent expression in gui file
pluginParentPath - String representing XPath parent expression in plugin file
guiElementPath - String representing XPath element expression in gui file
pluginElementPath - String representing XPath element expression in plugin file
parameterName - String representing parameter name
type - String representing element type (group or param)
Throws:
java.lang.Exception - if there is an error

updateElementName

public void updateElementName(java.lang.String action,
                              java.lang.String actionName,
                              java.lang.String guiElementPath,
                              java.lang.String pluginElementPath,
                              java.lang.String oldName,
                              java.lang.String newName,
                              java.lang.String type)
                       throws java.lang.Exception
This method updates group or parameter element name into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
pluginElementPath - String representing XPath element expression in plugin file
oldName - String representing the old element name
newName - String representing the new element name
type - String representing element type (group or param)
Throws:
java.lang.Exception - if there is an error

moveUpParameter

public void moveUpParameter(java.lang.String action,
                            java.lang.String actionName,
                            java.lang.String guiParentPath,
                            java.lang.String guiElementPath)
                     throws java.lang.Exception
This method moves up parameter in XML file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiParentPath - String representing XPath parent element expression in gui file
guiElementPath - String representing XPath element expression in gui file
Throws:
java.lang.Exception - if there is an error

moveDownParameter

public void moveDownParameter(java.lang.String action,
                              java.lang.String actionName,
                              java.lang.String guiParentPath,
                              java.lang.String guiElementPath)
                       throws java.lang.Exception
This method moves down parameter in XML file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiParentPath - String representing XPath parent element expression in gui file
guiElementPath - String representing XPath element expression in gui file
Throws:
java.lang.Exception - if there is an error

setParameterLabel

public void setParameterLabel(java.lang.String action,
                              java.lang.String actionName,
                              java.lang.String guiElementPath,
                              java.lang.String label)
                       throws java.lang.Exception
This method updates parameter label into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
label - String representing the new parameter label
Throws:
java.lang.Exception - if there is an error

getParameterLabel

public java.lang.String getParameterLabel(java.lang.String action,
                                          java.lang.String actionName,
                                          java.lang.String guiElementPath)
                                   throws java.lang.Exception
This method returns parameter label from model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
Throws:
java.lang.Exception - if there is an error

setParameterType

public void setParameterType(java.lang.String action,
                             java.lang.String actionName,
                             java.lang.String guiElementPath,
                             java.lang.String type)
                      throws java.lang.Exception
This method updates parameter represention in gui file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
type - String representing the new parameter representation
Throws:
java.lang.Exception - if there is an error

getParameterType

public java.lang.String getParameterType(java.lang.String action,
                                         java.lang.String actionName,
                                         java.lang.String guiElementPath)
                                  throws java.lang.Exception
This method returns parameter represention from gui file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
Returns:
parameter represention from gui file
Throws:
java.lang.Exception - if there is an error

setParameterFieldText

public void setParameterFieldText(java.lang.String action,
                                  java.lang.String actionName,
                                  java.lang.String guiElementPath,
                                  java.lang.String text)
                           throws java.lang.Exception
This method updates parameter field text into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
text - String representing the new parameter field text
Throws:
java.lang.Exception - if there is an error

getParameterFieldText

public java.lang.String getParameterFieldText(java.lang.String action,
                                              java.lang.String actionName,
                                              java.lang.String guiElementPath)
                                       throws java.lang.Exception
This method returns parameter field text from model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
Returns:
parameter represention from gui file
Throws:
java.lang.Exception - if there is an error

setParameterFieldSize

public void setParameterFieldSize(java.lang.String action,
                                  java.lang.String actionName,
                                  java.lang.String guiElementPath,
                                  java.lang.String size)
                           throws java.lang.Exception
This method updates parameter field size into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
Throws:
java.lang.Exception - if there is an error

getParameterFieldSize

public java.lang.String getParameterFieldSize(java.lang.String action,
                                              java.lang.String actionName,
                                              java.lang.String guiElementPath)
                                       throws java.lang.Exception
This method returns parameter field size from model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiElementPath - String representing XPath element expression in gui file
Returns:
parameter represention from gui file
Throws:
java.lang.Exception - if there is an error

addParameterElement

public void addParameterElement(java.lang.String action,
                                java.lang.String actionName,
                                java.lang.String guiPath,
                                java.lang.String type,
                                java.lang.String elementName)
                         throws java.lang.Exception
This method adds parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
Throws:
java.lang.Exception - if there is an error

deleteParameterElement

public void deleteParameterElement(java.lang.String action,
                                   java.lang.String actionName,
                                   java.lang.String guiPath,
                                   java.lang.String type,
                                   java.lang.String elementName)
                            throws java.lang.Exception
This method deletes parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
Throws:
java.lang.Exception - if there is an error

updateParameterElement

public void updateParameterElement(java.lang.String action,
                                   java.lang.String actionName,
                                   java.lang.String guiPath,
                                   java.lang.String type,
                                   java.lang.String oldElementName,
                                   java.lang.String newElementName)
                            throws java.lang.Exception
This method updates parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
oldElementName - String representing old parameter element name
newElementName - String representing new parameter element name
Throws:
java.lang.Exception - if there is an error

moveUpParameterElement

public void moveUpParameterElement(java.lang.String action,
                                   java.lang.String actionName,
                                   java.lang.String guiPath,
                                   java.lang.String type,
                                   java.lang.String elementName)
                            throws java.lang.Exception
This method moves up parameter element into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
Throws:
java.lang.Exception - if there is an error

moveDownParameterElement

public void moveDownParameterElement(java.lang.String action,
                                     java.lang.String actionName,
                                     java.lang.String guiPath,
                                     java.lang.String type,
                                     java.lang.String elementName)
                              throws java.lang.Exception
This method moves down parameter element in gui XML file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
Throws:
java.lang.Exception - if there is an error

getParameterElements

public java.util.ArrayList<java.lang.String> getParameterElements(java.lang.String action,
                                                                  java.lang.String actionName,
                                                                  java.lang.String guiPath,
                                                                  java.lang.String type)
                                                           throws java.lang.Exception
Returns parameter element list in gui XML file.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
Returns:
ArrayList of all elements
Throws:
java.lang.Exception - if there is an error

setParameterElementDefault

public void setParameterElementDefault(java.lang.String action,
                                       java.lang.String actionName,
                                       java.lang.String guiPath,
                                       java.lang.String type,
                                       java.lang.String elementName,
                                       java.lang.String value)
                                throws java.lang.Exception
This method sets default parameter element value to true or false into model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
value - String representing the value to set
Throws:
java.lang.Exception - if there is an error

getParameterElementDefault

public java.lang.String getParameterElementDefault(java.lang.String action,
                                                   java.lang.String actionName,
                                                   java.lang.String guiPath,
                                                   java.lang.String type,
                                                   java.lang.String elementName)
                                            throws java.lang.Exception
Returns default parameter element value from model.

Parameters:
action - String representing the action to add (sample, timer, test, control)
actionName - String representing action name
guiPath - String representing XPath parent expression in gui file
type - String representing representation of element
elementName - String representing parameter element name
Returns:
String representing default parameter element value
Throws:
java.lang.Exception - if there is an error

getParams

public org.jdom.Element getParams(java.lang.String action,
                                  java.lang.String name)
                           throws java.lang.Exception
Returns a Element representing action params element.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Returns:
Element representing action params element
Throws:
java.lang.Exception - if there is an error

getHelp

public java.lang.String getHelp(java.lang.String action,
                                java.lang.String name)
                         throws java.lang.Exception
Returns a String representing action help.

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
Returns:
String representing action help
Throws:
java.lang.Exception - if there is an error

setHelp

public void setHelp(java.lang.String action,
                    java.lang.String name,
                    java.lang.String help)
             throws java.lang.Exception
Set action help into model

Parameters:
action - String representing the action to add (sample, timer, test, control)
name - String representing action name
help - String representing action help
Throws:
java.lang.Exception - if there is an error

isParameterExist

public boolean isParameterExist(java.lang.String action,
                                java.lang.String name,
                                java.lang.String elementPath)
                         throws java.lang.Exception
Returns true if element exists

Parameters:
action - String representing the action (sample, timer, test, control)
name - String representing action name
elementPath - String representing XPath expression of element
Returns:
true if element exists
Throws:
java.lang.Exception - if there is an error.

setPluginName

public void setPluginName(java.lang.String name)
Sets new plugin name.

Parameters:
name - String representing plugin name.

getPluginName

public java.lang.String getPluginName()
Returns plugin name.

Returns:
String representing plugin name.

setSource

public void setSource(java.lang.String path)
Sets new source path.

Parameters:
path - String representing source path.

getSource

public java.lang.String getSource()
Returns source path.

Returns:
String representing source path.

setPackageName

public void setPackageName(java.lang.String name)
Sets new package name.

Parameters:
name - String representing package name.

getPackageName

public java.lang.String getPackageName()
Returns package name.

Returns:
String representing package name.

setClassName

public void setClassName(java.lang.String name)
Sets new class name.

Parameters:
name - String representing class name.

getClassName

public java.lang.String getClassName()
Returns class name.

Returns:
String representing class name.

setGuiFileName

public void setGuiFileName(java.lang.String name)
Sets new gui file name.

Parameters:
name - String representing gui file name.

getGuiFileName

public java.lang.String getGuiFileName()
Returns gui file name.

Returns:
String representing gui file name.

setPluginFileName

public void setPluginFileName(java.lang.String name)
Sets new plugin file name.

Parameters:
name - String representing plugin file name.

getPluginFileName

public java.lang.String getPluginFileName()
Returns plugin file name.

Returns:
String representing plugin file name.

setDataProvider

public void setDataProvider(java.lang.String provider)
Sets new data provider state ("yes" or "no").

Parameters:
provider - String representing data provider state.

getDataProvider

public java.lang.String getDataProvider()
Returns data provider state ("yes" or "no").

Returns:
String representing data provider state ("yes" or "no").

save

public void save()
          throws java.lang.Exception
this method saves all modifications on model into xml and Java files.

Throws:
java.lang.Exception - if there is an error.

destroy

public void destroy()
This method resets all references.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException