java.lang.Object
omix.util.io.AbstractModelIOHandler
omix.util.io.AbstractModelIODomHandler
- All Implemented Interfaces:
ModelIOHandlerInterface
,EntityResolver
,ErrorHandler
- Direct Known Subclasses:
StandardModelIODomHandler
public abstract class AbstractModelIODomHandler extends AbstractModelIOHandler implements EntityResolver, ErrorHandler
This class can be used to realize a
ModelIOHandlerInterface
for Omix with DOM
(Package org.w3c.dom).
The write(String, URLConnection, Model, OutputUtilities)
and read(String, URLConnection, omix.plugin.model.writable.Model, InputUtilities)
methods catch various types of exceptions and generate adequate error messages.- Since:
- Omix 1.3
- Author:
- Dr. Peter Droste, Omix Visualization
-
Constructor Summary
Constructors Constructor Description AbstractModelIODomHandler()
Empty constructor -
Method Summary
Modifier and Type Method Description void
error(SAXParseException exception)
Called by the XML parser when errors occur.void
fatalError(SAXParseException exception)
Called by the XML parser when errors occur.void
read(String suffix, URLConnection connection, Model model, InputUtilities utilities)
This method catch various types of exceptions and generate adequate error messages.protected abstract void
readFromDom(String suffix, URLConnection connection, Model model, InputUtilities utilities)
Reads an XML file by using DOM.abstract InputSource
resolveEntity(String publicId, String systemId)
Gives access to a document type definition or an XML schema filevoid
warning(SAXParseException exception)
Called by the XML parser when problems occur.void
write(String suffix, URLConnection connection, Model model, OutputUtilities utilities)
This method catch various types of exceptions and generate adequate error messages.
The real write proces happens inwriteToDom(String, URLConnection, Model, OutputUtilities)
.protected abstract void
writeToDom(String suffix, URLConnection connection, Model model, OutputUtilities utilities)
Writes the model into an XML file by using DOM.Methods inherited from class omix.util.io.AbstractModelIOHandler
canRead, canWrite, getDescription, getSuffixes, readThumbnail, supports
-
Constructor Details
-
AbstractModelIODomHandler
public AbstractModelIODomHandler()Empty constructor
-
-
Method Details
-
write
public final void write(String suffix, URLConnection connection, Model model, OutputUtilities utilities) throws IOExceptionThis method catch various types of exceptions and generate adequate error messages.
The real write proces happens inwriteToDom(String, URLConnection, Model, OutputUtilities)
.- Specified by:
write
in interfaceModelIOHandlerInterface
- Specified by:
write
in classAbstractModelIOHandler
- Parameters:
suffix
- the file suffix (identifier of the valid file filter).connection
- helps to write the file (URLConnection.getOutputStream()
).model
- the network modelutilities
- utilities for file writing and reading network contents- Throws:
IOException
- See Also:
AbstractModelIOHandler.write(java.lang.String, java.net.URLConnection, omix.plugin.model.Model, omix.plugin.io.util.OutputUtilities)
-
read
public final void read(String suffix, URLConnection connection, Model model, InputUtilities utilities) throws IOExceptionThis method catch various types of exceptions and generate adequate error messages. The real read process happens inreadFromDom(String, URLConnection, omix.plugin.model.writable.Model, InputUtilities)
.- Specified by:
read
in interfaceModelIOHandlerInterface
- Specified by:
read
in classAbstractModelIOHandler
- Parameters:
suffix
- the file suffix (identifier of the valid file filter).connection
- helps to open the file (URLConnection.getInputStream()
).model
- a writable model to create and interconnect network components.utilities
- utilities for file reading and creating a network- Throws:
IOException
- See Also:
AbstractModelIOHandler.read(java.lang.String, java.net.URLConnection, omix.plugin.model.writable.Model, omix.plugin.io.util.InputUtilities)
-
writeToDom
protected abstract void writeToDom(String suffix, URLConnection connection, Model model, OutputUtilities utilities) throws ParserConfigurationException, IllegalArgumentException, SAXException, IOException, IllegalAccessException, NoSuchFieldException, TransformerFactoryConfigurationError, TransformerException, ThrowableWrites the model into an XML file by using DOM.- Parameters:
suffix
-connection
-model
-utilities
-- Throws:
ParserConfigurationException
IllegalArgumentException
SAXException
IOException
IllegalAccessException
NoSuchFieldException
TransformerFactoryConfigurationError
TransformerException
Throwable
-
readFromDom
protected abstract void readFromDom(String suffix, URLConnection connection, Model model, InputUtilities utilities) throws ParserConfigurationException, SAXException, IOException, TransformerConfigurationException, IllegalArgumentException, TransformerException, IllegalAccessException, NoSuchFieldException, ComponentExistsException, IllegalComponentException, ThrowableReads an XML file by using DOM.- Parameters:
suffix
-connection
-model
-utilities
-- Throws:
ParserConfigurationException
SAXException
IOException
TransformerConfigurationException
IllegalArgumentException
TransformerException
IllegalAccessException
NoSuchFieldException
ComponentExistsException
IllegalComponentException
Throwable
-
error
Called by the XML parser when errors occur.- Specified by:
error
in interfaceErrorHandler
- Parameters:
exception
-- Throws:
SAXException
- See Also:
DocumentBuilder.setErrorHandler(ErrorHandler)
-
fatalError
Called by the XML parser when errors occur.- Specified by:
fatalError
in interfaceErrorHandler
- Parameters:
exception
-- Throws:
SAXException
- See Also:
DocumentBuilder.setErrorHandler(ErrorHandler)
-
warning
Called by the XML parser when problems occur.- Specified by:
warning
in interfaceErrorHandler
- Parameters:
exception
-- Throws:
SAXException
- See Also:
DocumentBuilder.setErrorHandler(ErrorHandler)
-
resolveEntity
public abstract InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOExceptionGives access to a document type definition or an XML schema file- Specified by:
resolveEntity
in interfaceEntityResolver
- Parameters:
publicId
-systemId
-- Returns:
- an input source containing the DTD or XSD file.
- Throws:
SAXException
IOException
- See Also:
DocumentBuilder.setEntityResolver(EntityResolver)
-