g-Eclipse
Release 1.0.0

eu.geclipse.jsdl.ui.preference
Class ApplicationParametersRegistry

java.lang.Object
  extended by eu.geclipse.jsdl.ui.preference.ApplicationParametersRegistry

public class ApplicationParametersRegistry
extends java.lang.Object

Register that manages GridApplicationParameters, which are created, removed and edited while gEclipse is run. Those objects are serialized, so there are accessible after Eclipse is restarted. This class is singleton.


Method Summary
 void addApplicationSpecificData(java.lang.String appName, java.lang.String appPath, Path xmlPath, Path jsdlPath, IVirtualOrganization vo)
          Method for adding user-defined parameters to this registry.
 void addContentChangeListener(IContentChangeListener listener)
           
 void editApplicationSpecificData(GridApplicationParameters oldASO, java.lang.String newAppName, java.lang.String newAppPath, java.lang.String newXMLPath, java.lang.String newJSDLPath)
          Changes given GridApplicationParameters.
 IGridApplicationParameters getApplicationData(int paramId)
          Returns application parameter object with given id.
 java.util.Map<java.lang.String,java.lang.Integer> getApplicationDataMapping(IVirtualOrganization vo)
          Returns map of applications names as a keys and corresponding application's parameters object's id as a value.
 java.util.List<IGridApplicationParameters> getApplicationParameters(IVirtualOrganization vo)
          Returns stored values of applications' parameters for given virtual organization.
static ApplicationParametersRegistry getInstance()
          Returns the only instance (singleton) of this registry.
 void removeApplicationParameters(GridApplicationParameters param)
          Method for removing application's parameters from registry.
 void removeContentChangeListener(IContentChangeListener listener)
           
 void updateApplicationsParameters(IVirtualOrganization vo, IProgressMonitor monitor)
          Updates registry with most up-to-date values of applications' parameters of a given virtual organization.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ApplicationParametersRegistry getInstance()
Returns the only instance (singleton) of this registry. If this instance was not created yet - this method will trigger a constructor.

Returns:
singleton instance of registry

getApplicationParameters

public java.util.List<IGridApplicationParameters> getApplicationParameters(IVirtualOrganization vo)
Returns stored values of applications' parameters for given virtual organization.

Parameters:
vo - virtual organization for which applications' parameters will be returned. This value can be null - indicating that parameters for all available virtual organizations should be returned.
Returns:
list of applications' parameters stored by this registry. To make sure you will get the most up-to-date values call updateApplicationsParameters(IVirtualOrganization, IProgressMonitor) before calling this method.

updateApplicationsParameters

public void updateApplicationsParameters(IVirtualOrganization vo,
                                         IProgressMonitor monitor)
                                  throws ProblemException
Updates registry with most up-to-date values of applications' parameters of a given virtual organization. Calling this method results in contacting info service and replacing data held by this data with new values obtained from this service.
This method do not affects applications parameters defined by user through user interface .

Parameters:
vo - virtual organization for which applications' parameters will be updated. This value can be null - indicating that parameters for all available virtual organizations should be updated.
monitor - this may be a long-running operation. Parent method calling this operation should provide a progress monitor for it.
Throws:
ProblemException - it is thrown in case registry was not able to access resources

addContentChangeListener

public void addContentChangeListener(IContentChangeListener listener)

removeContentChangeListener

public void removeContentChangeListener(IContentChangeListener listener)

removeApplicationParameters

public void removeApplicationParameters(GridApplicationParameters param)
                                 throws ApplicationParametersException
Method for removing application's parameters from registry. All listeners are informed that parameter was removed.
Note that this can be done only for user-defined parameters - not for those fetched from info system, as they are defined on "server side" and removing them from registy might result in confusion if they are deleted also on "the server side" or not.

Parameters:
param - parameter to be removed
Throws:
ApplicationParametersException - is thrown when registry doesn't contain user-defined parameter equal to one passed to this method

addApplicationSpecificData

public void addApplicationSpecificData(java.lang.String appName,
                                       java.lang.String appPath,
                                       Path xmlPath,
                                       Path jsdlPath,
                                       IVirtualOrganization vo)
Method for adding user-defined parameters to this registry. All listeners are informed that new parameter was added.

Parameters:
appName - application name
appPath - application executable path, this is optional and may be null
xmlPath - path to file containing XML definition of JSDL wizard additional pages.
jsdlPath - path to file containing base JSDL file which will be used as a "parent" for JSDL files created for this application.
vo - virtual application for which this application is defined, null indicates that it is defined for all virtual organization available

editApplicationSpecificData

public void editApplicationSpecificData(GridApplicationParameters oldASO,
                                        java.lang.String newAppName,
                                        java.lang.String newAppPath,
                                        java.lang.String newXMLPath,
                                        java.lang.String newJSDLPath)
                                 throws ApplicationParametersException
Changes given GridApplicationParameters. In this object given values will be set. All listeners are notified of this change.
Note that this can be done only for user-defined parameters - not for those fetched from info system, as they are defined on "server side" and modifying them from registy might result in confusion if they are changed also on "the server side" or not.

Parameters:
oldASO - object to change
newAppName - application name to change in given ApplicationSpecificObject
newAppPath - path to executable file to change in given ApplicationSpecificObject
newXMLPath - path to XML file to change in given ApplicationSpecificObject
newJSDLPath - path to JSDL file to change in given ApplicationSpecificObject
Throws:
ApplicationParametersException - is thrown when registry doesn't contain user-defined parameter equal to one passed to this method

getApplicationDataMapping

public java.util.Map<java.lang.String,java.lang.Integer> getApplicationDataMapping(IVirtualOrganization vo)
Returns map of applications names as a keys and corresponding application's parameters object's id as a value. The key - application name - is modified this way that if there are more then one applications with the same name an ordinal numeral is added to name. This change affects only list returned by this method - not applications' parameters contained by this registry.

Parameters:
vo - virtual organization for which list of application's parameters should be created. null value indicates all virtual organizations available.
Returns:
map of applications names (modified with an ordinal number when needed) as a keys and corresponding application's parameters object's id as a value

getApplicationData

public IGridApplicationParameters getApplicationData(int paramId)
Returns application parameter object with given id.

Parameters:
paramId - id of application parameter object
Returns:
application parameter object with given id or null if registry does not hold object with such id

g-Eclipse
Release 1.0.0