dke.smwp.serialize
Class PageSer

java.lang.Object
  |
  +--dke.smwp.serialize.PageSer

public class PageSer
extends java.lang.Object

serializes single pages

Version:
1.0
Author:
Martin Bernauer, Werner Enser

Field Summary
private static org.xml.sax.XMLReader _parser
          xml parser
private  PageClassSer _pc
          page class the page is mapped to
private  java.util.Hashtable _pParams
          parameters used by fragment class; using parameter name as key and parameter value as value
private  java.lang.String _systemId
          filename of serialized page (xml document)
private static boolean DEBUG
           
 
Constructor Summary
PageSer(PageClassSer pc, java.util.Hashtable pParams)
          constructor
 
Method Summary
private static void createXMLReader()
          creates and initializes an xml reader for serialization
 boolean equals(PageSer b)
          comparison operator; compared current object with b
private  org.xml.sax.InputSource getDocument(java.sql.Connection con, java.lang.String storageMedia, java.lang.String systemId, boolean readFileIntoMemory)
          gets xml document from spezified source (designated by storageMedia
 java.lang.String getSystemId()
          gets page (xml document) systemid which is folderpath and filename prefix for page
 void modifyIncrementally(java.sql.Connection con, TupleModificationDescr mod)
          incrementally modifies one page (xml document)
 void removeFromDatabase(java.sql.Connection con)
          removes page (xml document) from database
 void removeFromDisk()
          Deprecated.  
 void serialize(java.sql.Connection con, org.xml.sax.ContentHandler hdl)
          Serializes a certain page of the Page Class.
 void serializeToDatabase(java.sql.Connection con)
          serializes Page Class/page as xml document to database
 void serializeToDisk(java.sql.Connection con)
          Deprecated.  
 java.lang.String toString()
          Generates String-representation of page class name in following syntax: pc_name "(" [ pc_param_name { "," pc_param_name } ] ")"
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

_pc

private PageClassSer _pc
page class the page is mapped to

_pParams

private java.util.Hashtable _pParams
parameters used by fragment class; using parameter name as key and parameter value as value

_systemId

private java.lang.String _systemId
filename of serialized page (xml document)

_parser

private static org.xml.sax.XMLReader _parser
xml parser
Constructor Detail

PageSer

public PageSer(PageClassSer pc,
               java.util.Hashtable pParams)
constructor
Parameters:
pc - page class
pParams - page class parameters
Method Detail

createXMLReader

private static void createXMLReader()
                             throws org.xml.sax.SAXException
creates and initializes an xml reader for serialization
Throws:
org.xml.sax.SAXException - initializing SAXParser failed

removeFromDatabase

public void removeFromDatabase(java.sql.Connection con)
                        throws java.sql.SQLException
removes page (xml document) from database
Parameters:
con - Connection handle
Throws:
java.sql.SQLException - document deletion failed

removeFromDisk

public void removeFromDisk()
Deprecated.  

removes page (xml document) from disk

getSystemId

public java.lang.String getSystemId()
gets page (xml document) systemid which is folderpath and filename prefix for page
Returns:
systemId

serialize

public void serialize(java.sql.Connection con,
                      org.xml.sax.ContentHandler hdl)
               throws org.xml.sax.SAXException,
                      java.sql.SQLException
Serializes a certain page of the Page Class.
Parameters:
con - Connection handle
hdl - document content handle
Throws:
org.xml.sax.SAXException - generating/parsing xml document failed
java.sql.SQLException - reading / writing data failed

modifyIncrementally

public void modifyIncrementally(java.sql.Connection con,
                                TupleModificationDescr mod)
                         throws java.io.IOException,
                                org.xml.sax.SAXException,
                                java.sql.SQLException
incrementally modifies one page (xml document)
Parameters:
con - Connection handle
mod - tuple modification description
Throws:
java.io.IOException - reading/writing xml document failed
org.xml.sax.SAXException - generating/parsing xml document failed
java.sql.SQLException - fetching data failed

getDocument

private org.xml.sax.InputSource getDocument(java.sql.Connection con,
                                            java.lang.String storageMedia,
                                            java.lang.String systemId,
                                            boolean readFileIntoMemory)
                                     throws java.sql.SQLException,
                                            java.io.FileNotFoundException,
                                            java.io.IOException
gets xml document from spezified source (designated by storageMedia
Parameters:
con - Connection handle
storageMedia - type of media where the xml documents are fetched from, which are "DATABASE", "FILE" and "IFS" (IFS no longer supported. Saving files into IFS not possible, when IFS methods are invoced within a java stored procedure)
systemId - complete document identifier; providing folderpath and filename
readFileIntoMemory - true if file is to be read into InputSource, false setting InputSource with handle to file
Returns:
InputSource of xml document
Throws:
java.sql.SQLException - fetching data failed
java.io.FileNotFoundException - document not found in file system
java.io.IOException - reading / getting reader for document failed

serializeToDisk

public void serializeToDisk(java.sql.Connection con)
                     throws java.io.IOException,
                            org.xml.sax.SAXException,
                            java.sql.SQLException
Deprecated.  

serializes page as xml document into file system
Parameters:
con - Connection handle
Throws:
java.io.IOException - writing document failed
org.xml.sax.SAXException - generating / parsing xml document failed
java.sql.SQLException - fetching data failed

serializeToDatabase

public void serializeToDatabase(java.sql.Connection con)
                         throws org.xml.sax.SAXException,
                                java.sql.SQLException,
                                java.io.IOException
serializes Page Class/page as xml document to database
Parameters:
con - Connection handle
Throws:
org.xml.sax.SAXException - generating / parsing xml document failed
java.sql.SQLException - fetching data failed
java.io.IOException - writing document failed

equals

public boolean equals(PageSer b)
comparison operator; compared current object with b
Parameters:
b - object which is compared to this object
Returns:
true if b equals this, false otherwise

toString

public java.lang.String toString()
Generates String-representation of page class name in following syntax: pc_name "(" [ pc_param_name { "," pc_param_name } ] ")"
Overrides:
toString in class java.lang.Object