de.ispsoft.jaxme
Class JMFileManager

java.lang.Object
  extended byde.ispsoft.jaxme.JMManagerImpl
      extended byde.ispsoft.jaxme.JMFileManager
All Implemented Interfaces:
JMManager

public class JMFileManager
extends JMManagerImpl

Although the name suggests different, this is not a true JMManager, but just a set of shortcuts that simplify reading from and writing to files.

Author:
Jochen Wiedmann

Nested Class Summary
 
Nested classes inherited from class de.ispsoft.jaxme.JMManagerImpl
JMManagerImpl.MyObserver
 
Field Summary
protected  java.lang.String fileName
           
 
Fields inherited from class de.ispsoft.jaxme.JMManagerImpl
ELEMENT_CLASS_NAME, HANDLER_CLASS_NAME, jmAnyElementClass, jmContentHandlerClass
 
Fields inherited from interface de.ispsoft.jaxme.JMManager
BIGINT, BIT, BLOB, BOOLEAN, CLOB, DECIMAL, DOUBLE, FLOAT, INTEGER, SMALLINT, TIMESTAMP, TINYINT, VARBINARY, VARCHAR
 
Constructor Summary
JMFileManager()
          Creates a new instance of JMFileManager
 
Method Summary
 void delete(JMAnyElement pElement)
          Not implemented, throws a SAXException.
 java.lang.String getFileName()
          Returns the filename to use for the insert() and update() methods.
 void insert(JMAnyElement pElement)
          Inserts the given element into the file.
 void insert(java.lang.String pFileName, JMAnyElement pElement)
          Inserts the given element into the given file.
 void select(Observer pObserver, java.lang.String pFileName, java.lang.Object[] pPlaceHolderArgs, int pStart, int pMax)
          Reads documents from the given file.
 void setFileName(java.lang.String pFileName)
          Sets the filename to use for the insert() and update() methods.
 void setJMAnyElementClass(java.lang.Class pElementClass)
          Sets the JMAnyElement class for reading elements.
 void setJMContentHandlerClass(java.lang.Class pHandlerClass)
          Sets the JMContentHandler class for reading elements.
 void update(JMAnyElement pElement)
          Updates the file with the contents of the given element.
 void update(java.lang.String pFileName, JMAnyElement pElement)
          Updates the given file with the contents of the given element.
 
Methods inherited from class de.ispsoft.jaxme.JMManagerImpl
create, getJMAnyElementClass, getJMContentHandler, getLocalName, getNamespaceSupport, getNamespaceURI, init, parseConfiguration, select, select, select, select, select, select, select, toSAX, toWriter, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

protected java.lang.String fileName
Constructor Detail

JMFileManager

public JMFileManager()
Creates a new instance of JMFileManager

Method Detail

setJMContentHandlerClass

public void setJMContentHandlerClass(java.lang.Class pHandlerClass)

Sets the JMContentHandler class for reading elements.


setJMAnyElementClass

public void setJMAnyElementClass(java.lang.Class pElementClass)

Sets the JMAnyElement class for reading elements.


select

public void select(Observer pObserver,
                   java.lang.String pFileName,
                   java.lang.Object[] pPlaceHolderArgs,
                   int pStart,
                   int pMax)
            throws org.xml.sax.SAXException

Reads documents from the given file.

Specified by:
select in interface JMManager
Overrides:
select in class JMManagerImpl
Parameters:
pObserver - The observer to notify about documents that have been read
pFileName - The file name to read from
pPlaceHolderArgs - Must be null, as this manager doesn't support placeholders
pStart - Number of documents to skip at the beginning; 0 for all documents
pMax - Maximum number of documents to read, excluding skipped documents, 0 for all documents
Throws:
org.xml.sax.SAXException

setFileName

public void setFileName(java.lang.String pFileName)

Sets the filename to use for the insert() and update() methods.


getFileName

public java.lang.String getFileName()

Returns the filename to use for the insert() and update() methods.


insert

public void insert(JMAnyElement pElement)
            throws org.xml.sax.SAXException

Inserts the given element into the file. If the file does not yet exist, it is created. Otherwise, it will be overwritten.

Specified by:
insert in interface JMManager
Overrides:
insert in class JMManagerImpl
Throws:
org.xml.sax.SAXException

insert

public void insert(java.lang.String pFileName,
                   JMAnyElement pElement)
            throws org.xml.sax.SAXException

Inserts the given element into the given file. If the file does not yet exist, it is created. Otherwise, it will be overwritten.

Throws:
org.xml.sax.SAXException

update

public void update(JMAnyElement pElement)
            throws org.xml.sax.SAXException

Updates the file with the contents of the given element. If the file does not yet exist, a SAXException is thrown.

Specified by:
update in interface JMManager
Overrides:
update in class JMManagerImpl
Throws:
org.xml.sax.SAXException

update

public void update(java.lang.String pFileName,
                   JMAnyElement pElement)
            throws org.xml.sax.SAXException

Updates the given file with the contents of the given element. If the file does not yet exist, a SAXException is thrown.

Throws:
org.xml.sax.SAXException

delete

public void delete(JMAnyElement pElement)
            throws org.xml.sax.SAXException

Not implemented, throws a SAXException.

Specified by:
delete in interface JMManager
Overrides:
delete in class JMManagerImpl
Throws:
org.xml.sax.SAXException