|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.ucsb.nceas.metacat.DocumentImpl
A class that represents an XML document. It can be created with a simple document identifier from a database connection. It also will write an XML text document to a database connection using SAX.
Constructor Summary | |
DocumentImpl(java.sql.Connection conn,
long rootnodeid,
java.lang.String docname,
java.lang.String doctype,
java.lang.String docid,
java.lang.String action,
java.lang.String user,
java.lang.String pub,
int serverCode)
Construct a new document instance, writing the contents to the database. |
|
DocumentImpl(java.sql.Connection conn,
java.lang.String docid)
Constructor, creates document from database connection, used for reading the document |
Method Summary | |
static void |
delete(java.sql.Connection conn,
java.lang.String docid,
java.lang.String user,
java.lang.String group)
Delete an XML file from the database (actually, just make it a revision in the xml_revisions table) |
java.lang.String |
getCreateDate()
get the creation date |
java.lang.String |
getDocID()
Get the document identifier (docid) |
java.lang.String |
getDocname()
get the document name |
java.lang.String |
getDocTitle()
get the document title |
java.lang.String |
getDoctype()
get the document type (which is the PublicID) |
int |
getPublicaccess()
|
int |
getRev()
|
long |
getRootNodeID()
get the root node identifier |
int |
getServerlocation()
|
java.lang.String |
getSystemID()
get the system identifier |
java.lang.String |
getTitle()
Get the document title |
java.lang.String |
getUpdateDate()
get the update date |
java.lang.String |
getUserowner()
|
java.lang.String |
getUserupdated()
|
static void |
main(java.lang.String[] args)
the main routine used to test the DBWriter utility. |
java.lang.String |
readUsingSlowAlgorithm()
Get a text representation of the XML document as a string This older algorithm uses a recursive tree of Objects to represent the nodes of the tree. |
void |
setTitle(java.lang.String title)
Set the document title |
java.lang.String |
toString()
Print a string representation of the XML document |
void |
toXml(java.io.Writer pw)
Print a text representation of the XML document to a Writer |
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String pub,
java.io.Reader dtd,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group)
|
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String pub,
java.io.Reader dtd,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group,
int serverCode,
boolean override)
Write an XML file to the database, given a Reader |
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group,
int serverCode)
|
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String pub,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group)
|
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String pub,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group,
int serverCode)
|
static java.lang.String |
write(java.sql.Connection conn,
java.io.Reader xml,
java.lang.String pub,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group,
int serverCode,
boolean override)
|
static java.lang.String |
write(java.sql.Connection conn,
java.lang.String filename,
java.lang.String pub,
java.lang.String dtdfilename,
java.lang.String action,
java.lang.String docid,
java.lang.String user,
java.lang.String group)
Write an XML file to the database, given a filename |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DocumentImpl(java.sql.Connection conn, java.lang.String docid) throws McdbException
conn
- the database connection from which to read the documentdocid
- the identifier of the document to be createdpublic DocumentImpl(java.sql.Connection conn, long rootnodeid, java.lang.String docname, java.lang.String doctype, java.lang.String docid, java.lang.String action, java.lang.String user, java.lang.String pub, int serverCode) throws java.sql.SQLException, java.lang.Exception
conn
- the JDBC Connection to which all information is writtenrootnodeid
- - sequence id of the root node in the documentdocname
- - the name of DTD, i.e. the name immediately following
the DOCTYPE keyword ( should be the root element name ) or
the root element name if no DOCTYPE declaration provided
(Oracle's and IBM parsers are not aware if it is not the
root element name)doctype
- - Public ID of the DTD, i.e. the name immediately
following the PUBLIC keyword in DOCTYPE declaration or
the docname if no Public ID provided or
null if no DOCTYPE declaration provideddocid
- the docid to use for the INSERT OR UPDATEaction
- the action to be performed (INSERT OR UPDATE)user
- the user that owns the documentpub
- flag for public "read" access on documentserverCode
- the serverid from xml_replication on which this document
resides.Method Detail |
public java.lang.String getDocname()
public java.lang.String getDoctype()
public java.lang.String getSystemID()
public long getRootNodeID()
public java.lang.String getCreateDate()
public java.lang.String getUpdateDate()
public java.lang.String getDocID()
public java.lang.String getDocTitle()
public java.lang.String getUserowner()
public java.lang.String getUserupdated()
public int getServerlocation()
public int getPublicaccess()
public int getRev()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String readUsingSlowAlgorithm()
public void toXml(java.io.Writer pw)
pw
- the Writer to which we print the documentpublic java.lang.String getTitle()
public void setTitle(java.lang.String title)
title
- the new title for the documentpublic static java.lang.String write(java.sql.Connection conn, java.lang.String filename, java.lang.String pub, java.lang.String dtdfilename, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group) throws java.lang.Exception
conn
- the JDBC connection to the databasefilename
- the filename to be loaded into the databasepub
- flag for public "read" access on documentdtdfilename
- the dtd to be uploaded on server's file systemaction
- the action to be performed (INSERT OR UPDATE)docid
- the docid to use for the INSERT OR UPDATEuser
- the user that owns the documentgroup
- the group to which user belongspublic static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String pub, java.io.Reader dtd, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group) throws java.lang.Exception
public static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String pub, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group) throws java.lang.Exception
public static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group, int serverCode) throws java.lang.Exception
public static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String pub, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group, int serverCode) throws java.lang.Exception
public static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String pub, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group, int serverCode, boolean override) throws java.lang.Exception
public static java.lang.String write(java.sql.Connection conn, java.io.Reader xml, java.lang.String pub, java.io.Reader dtd, java.lang.String action, java.lang.String docid, java.lang.String user, java.lang.String group, int serverCode, boolean override) throws java.lang.Exception
conn
- the JDBC connection to the databasexml
- the xml stream to be loaded into the databasepub
- flag for public "read" access on xml documentdtd
- the dtd to be uploaded on server's file systemaction
- the action to be performed (INSERT OR UPDATE)docid
- the docid to use for the INSERT OR UPDATEuser
- the user that owns the documentgroup
- the group to which user belongsserverCode
- the serverid from xml_replication on which this document
resides.override
- flag to stop insert replication checking.
if override = true then a document not belonging to the local server
will not be checked upon update for a file lock.
if override = false then a document not from this server, upon
update will be locked and version checked.public static void delete(java.sql.Connection conn, java.lang.String docid, java.lang.String user, java.lang.String group) throws java.lang.Exception
docid
- the ID of the document to be deleted from the databasepublic static void main(java.lang.String[] args)
Usage: java DocumentImpl <-f filename -a action -d docid>
filename
- the filename to be loaded into the databaseaction
- the action to perform (READ, INSERT, UPDATE, DELETE)docid
- the id of the document to process
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |