4.1

Table Of Contents
7 Implement the BaseAction.prepare() method to instantiate the configuration adapter and load the
configuration information.
The SolarSystemConfigureAction class creates an instance of the SolarSystemConfigurationAdaptor class
and calls the SolarSystemConfigurationAdaptor.loadConfiguration() method.
public void prepare() throws Exception {
solarSystemConfigurationAdaptor = new SolarSystemConfigurationAdaptor();
solarSystemConfigurationAdaptor.loadConfiguration(null);
}
8 Implement the BaseAction.execute() method to log and validate the configuration information.
The SolarSystemConfigureAction class implements the BaseAction.execute() method to record in the
logs the result of calling the SolarSystemConfigurationAdaptor.validateConfiguration() method.
public String execute() throws Exception {
log.debug("SolarSystemConfigureAction execute method");
configErrors = solarSystemConfigurationAdaptor.validateConfiguration();
return SUCCESS;
}
9 Implement a save() method to save the configuration information.
The SolarSystemConfigureAction class implements the save() method to record in the logs the result of
calling the SolarSystemConfigurationAdaptor.saveConfiguration() method.
public String save() throws Exception {
log.debug("SolarSystemConfigureAction save method");
solarSystemConfigurationAdaptor.saveConfiguration(null);
configErrors = solarSystemConfigurationAdaptor.validateConfiguration();
return SUCCESS;
}
10 Add error handling to the implementation of the configuration action.
The SolarSystemConfigureAction class returns an array of errors if the configuration is invalid.
public ConfigurationError[] getConfigErrors() {
return configErrors;
}
public void setConfigErrors(ConfigurationError[] configErrors) {
this.configErrors = configErrors;
}
public int getConfigErrorsSize() {
return configErrors.length;
}
11 Add the configuration adapter to the Struts Web application in the configuration interface by
implementing the ModelDriven.getModel() class from the OpenSymphony XWork2 framework.
The SolarSystemConfigureAction class passes an instance of the SolarSystemConfigurationAdaptor to the
Struts framework.
public SolarSystemConfigurationAdaptor getModel() {
return solarSystemConfigurationAdaptor;
}
You created the configuration action that instantiates the configuration adapter and implements the
Orchestrator BaseAction and OpenSymphony ModelDriven classes. The BaseAction and ModelDriven classes
pass configuration information from the Orchestrator configuration interface to the Orchestrator server
through the Struts framework.
Chapter 7 Developing Plug-Ins
VMware, Inc. 191