cz.vity.freerapid.plugimpl
Class StandardStorageSupportImpl

java.lang.Object
  extended by cz.vity.freerapid.plugimpl.StandardStorageSupportImpl
All Implemented Interfaces:
ConfigurationStorageSupport

public class StandardStorageSupportImpl
extends Object
implements ConfigurationStorageSupport

Standard implementation for

Author:
Ladislav Vitasek

Constructor Summary
StandardStorageSupportImpl(org.jdesktop.application.ApplicationContext context)
          Constructor
 
Method Summary
 boolean configFileExists(String fileName)
          Checks whether configuration file exists (if any configuration was created before)
<E> E
loadConfigFromFile(String fileName, Class<E> type)
          Method loads configuration data from file into Object.
 void storeConfigToFile(Object object, String fileName)
          Method store plugin's configuration data from Object into file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardStorageSupportImpl

public StandardStorageSupportImpl(org.jdesktop.application.ApplicationContext context)
Constructor

Parameters:
context - application context
Method Detail

configFileExists

public boolean configFileExists(String fileName)
Description copied from interface: ConfigurationStorageSupport
Checks whether configuration file exists (if any configuration was created before)

Specified by:
configFileExists in interface ConfigurationStorageSupport
Parameters:
fileName - file name
Returns:
true - if there is such file in configuration directory, false otherwise

loadConfigFromFile

public <E> E loadConfigFromFile(String fileName,
                                Class<E> type)
                     throws Exception
Description copied from interface: ConfigurationStorageSupport
Method loads configuration data from file into Object. Intern implementation uses XMLEncoder.

Specified by:
loadConfigFromFile in interface ConfigurationStorageSupport
Parameters:
fileName - file name for storing data - it's recommended to use 'plugin_id.xml'
type - class of the stored object
Returns:
returns new instance, null if
Throws:
Exception - throwed when reading went wrong
See Also:
load method

storeConfigToFile

public void storeConfigToFile(Object object,
                              String fileName)
                       throws Exception
Description copied from interface: ConfigurationStorageSupport
Method store plugin's configuration data from Object into file. Intern implementation uses XMLEncoder.

Specified by:
storeConfigToFile in interface ConfigurationStorageSupport
fileName - file name for storing data - it's recommended to use 'plugin_id.xml'
Throws:
Exception - throwed when reading went wrong
See Also:
save method