4.0

Table Of Contents
6 Define the variables that the BaseAction implementation requires.
The SolarSystemConfigureAction class declares variables for the unique identifier of each instance of the
serializable BaseAction class, a logger, an array of ConfigurationError instances, and the configuration
adapter instance.
private static final long serialVersionUID = 1L;
private static Logger log = Logger.getLogger(SolarSystemConfigureAction.class);
private ConfigurationError[] configErrors;
private SolarSystemConfigurationAdaptor solarSystemConfigurationAdaptor;
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;
}
Chapter 7 Developing Plug-Ins
VMware, Inc. 197