Class AbstractModelDefinitionPersistenceService
- java.lang.Object
-
- cern.accsoft.steering.jmad.modeldefs.io.impl.AbstractModelDefinitionPersistenceService
-
- All Implemented Interfaces:
ModelDefinitionPersistenceService
,PersistenceService<JMadModelDefinition>
- Direct Known Subclasses:
XmlModelDefinitionPersistenceService
public abstract class AbstractModelDefinitionPersistenceService extends java.lang.Object implements ModelDefinitionPersistenceService
-
-
Constructor Summary
Constructors Constructor Description AbstractModelDefinitionPersistenceService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JMadModelDefinition
clone(JMadModelDefinition object)
Creates a new Instance of the providedObject
by creating a XML-String of the Object Data and instantiating a new Object from that Stringprotected void
configureXStream(com.thoughtworks.xstream.XStream xStream)
java.lang.String
getFileExtension()
protected java.lang.Class<JMadModelDefinitionImpl>
getSaveableClass()
protected abstract GenericXStreamService<JMadModelDefinition>
getXStreamService()
boolean
isCorrectFileName(java.lang.String fileName)
JMadModelDefinition
load(java.io.File file)
Creates an object from the given xmlFileJMadModelDefinition
load(java.io.InputStream inputStream)
loads a new object from an input stream.java.io.File
save(JMadModelDefinitionExportRequest object, java.io.File file)
void
save(JMadModelDefinitionExportRequest object, java.io.OutputStream outStream)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface cern.accsoft.steering.jmad.modeldefs.io.ModelDefinitionPersistenceService
save, save
-
-
-
-
Method Detail
-
clone
public JMadModelDefinition clone(JMadModelDefinition object) throws PersistenceServiceException
Description copied from interface:PersistenceService
Creates a new Instance of the providedObject
by creating a XML-String of the Object Data and instantiating a new Object from that String- Specified by:
clone
in interfacePersistenceService<JMadModelDefinition>
- Parameters:
object
- theObject
you want to get a clone from- Returns:
- the cloned Object
- Throws:
PersistenceServiceException
- if the cloning of the object fails
-
getFileExtension
public java.lang.String getFileExtension()
- Specified by:
getFileExtension
in interfacePersistenceService<JMadModelDefinition>
- Returns:
- the file extension which is used to load/save files
-
isCorrectFileName
public boolean isCorrectFileName(java.lang.String fileName)
- Specified by:
isCorrectFileName
in interfacePersistenceService<JMadModelDefinition>
-
load
public JMadModelDefinition load(java.io.File file) throws PersistenceServiceException
Description copied from interface:PersistenceService
Creates an object from the given xmlFile- Specified by:
load
in interfacePersistenceService<JMadModelDefinition>
- Parameters:
file
- the xmlFile to load the object from- Returns:
- the object created from XML or null in case of failure
- Throws:
PersistenceServiceException
- if the loading of the object fails
-
load
public JMadModelDefinition load(java.io.InputStream inputStream) throws PersistenceServiceException
Description copied from interface:PersistenceService
loads a new object from an input stream.- Specified by:
load
in interfacePersistenceService<JMadModelDefinition>
- Parameters:
inputStream
- the input stream from which to read- Returns:
- the new object
- Throws:
PersistenceServiceException
- if the loading of the object fails
-
save
public java.io.File save(JMadModelDefinitionExportRequest object, java.io.File file) throws PersistenceServiceException
- Specified by:
save
in interfaceModelDefinitionPersistenceService
- Throws:
PersistenceServiceException
-
save
public void save(JMadModelDefinitionExportRequest object, java.io.OutputStream outStream) throws PersistenceServiceException
- Specified by:
save
in interfaceModelDefinitionPersistenceService
- Throws:
PersistenceServiceException
-
getXStreamService
protected abstract GenericXStreamService<JMadModelDefinition> getXStreamService()
- Returns:
- the
GenericXStreamService
to use in thisPersistenceService
for theJMadModelDefinition
s
-
getSaveableClass
protected java.lang.Class<JMadModelDefinitionImpl> getSaveableClass()
-
configureXStream
protected final void configureXStream(com.thoughtworks.xstream.XStream xStream)
-
-