Java Doc for XmlDump.java in  » Database-DBMS » Quadcap-Embeddable-Database » com » quadcap » sql » tools » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » Quadcap Embeddable Database » com.quadcap.sql.tools 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.quadcap.sql.tools.XmlDump

XmlDump
public class XmlDump implements Backup(Code)
Dump an SQL database in an XML representation. The XML document has an outer tag of <database>. Each child element then contains one table row, where the tag name specifies the table name; each child element of this tag contains one column value where the tag name specifies the column name. Most object are represented in their standard Java toString style representation, except binary objects, which are dumped in hexadecimal. (Base-64 would probably be better...)
author:
   Stan Bailes

Inner Class :class DbType

Field Summary
final static  StringcharsAmp
    
final static  StringcharsGt
    
final static  StringcharsLt
    
 Connectionconn
    
final static  char[]hexBytes
    
 intindentLevel
    
 StringlineSep
    
 Hashtabletypes
    
 booleanwasBegin
    
 booleanwasEnd
    

Constructor Summary
public  XmlDump()
     No-argument constructor.
public  XmlDump(Connection conn)
     Construct an XmlDump object bound to the specified connection.
public  XmlDump(Connection conn, int indentLevel)
     Construct an XmlDump object bound to the specified connection, and with a specified initial indent level.

Method Summary
public  voidbackup(java.sql.Connection conn, Writer w)
     A convenience function that sets the current connection and dumps the database in one go.
final  voidbeginTag(Writer w, String tag)
    
 voiddumpIndexDefinitions(Writer w, String tableName)
    
public  voiddumpTable(Writer w, String tableName)
     Dump the rows of the specified table to the output stream in XML format.
public  voiddumpTableDefinition(Writer w, String tableName)
    
public  voiddumpTableForeignKeys(Writer w, String tableName)
    
public  voiddumpTables(Writer w)
     Dump all of the tables in the database which is referenced by the current connection object to the specified output stream.
 voiddumpViewDefinitions(Writer w)
    
final  voidendTag(Writer w, String tag)
    
public  ConnectiongetConnection()
    
 DbTypegetType(int type)
    
 HashtablegetTypes()
    
public static  voidmain(String[] args)
     A main program which allows this function to be run as a command-line application for doing an off-line dump.
public static  ConnectionmakeConnection()
     Establish a database connection based on the settings of system properties.

The following system properties are used to establish the database connection:
jdbc.driver The name of the JDBC driver class (default com.quadcap.jdbc.JdbcDriver)
jdbc.url The JDBC URL used to establish the database connection.
jdbc.props The name of a properties file used to establish the connection. If this property is specified, jdbc.user and jdbc.password aren't used. If this property has the value "system", then the system properties are passed to the DriverManager.getConnection() method.
jdbc.user The user name used to establish the database connection.
final  IteratororderTables()
    
 ListparseViewDef(String s)
    
public  voidsetConnection(Connection conn)
    
final  voidwriteBinary(Writer w, Object obj)
    
final  voidwriteBinaryStream(Writer w, InputStream is)
    
final  voidwriteCharacterStream(Writer w, Reader r)
    
final  voidwriteString(Writer w, String str)
    
final  voidwriteValue(Writer w, Object obj, int jdbcType)
    

Field Detail
charsAmp
final static String charsAmp(Code)



charsGt
final static String charsGt(Code)



charsLt
final static String charsLt(Code)



conn
Connection conn(Code)



hexBytes
final static char[] hexBytes(Code)



indentLevel
int indentLevel(Code)



lineSep
String lineSep(Code)



types
Hashtable types(Code)



wasBegin
boolean wasBegin(Code)



wasEnd
boolean wasEnd(Code)




Constructor Detail
XmlDump
public XmlDump()(Code)
No-argument constructor. The object so constructed needs a Connection in order to do anything useful.



XmlDump
public XmlDump(Connection conn)(Code)
Construct an XmlDump object bound to the specified connection.
Parameters:
  conn - the database connection



XmlDump
public XmlDump(Connection conn, int indentLevel)(Code)
Construct an XmlDump object bound to the specified connection, and with a specified initial indent level.
Parameters:
  conn - the database connection
Parameters:
  indentLevel - the initial indent level (in units -- currentlyindent units are simple spaces




Method Detail
backup
public void backup(java.sql.Connection conn, Writer w) throws IOException, SQLException(Code)
A convenience function that sets the current connection and dumps the database in one go.
Parameters:
  conn - the database connection
Parameters:
  w - the output stream
exception:
  IOException - may be thrown
exception:
  SQLException - may be thrown



beginTag
final void beginTag(Writer w, String tag) throws IOException(Code)



dumpIndexDefinitions
void dumpIndexDefinitions(Writer w, String tableName) throws SQLException, IOException(Code)



dumpTable
public void dumpTable(Writer w, String tableName) throws IOException, SQLException(Code)
Dump the rows of the specified table to the output stream in XML format. Each row is dumped as an XML element with the tag name equal to the table name. Each non-null column is dumped as a sub-element with the tag name equal to the column name.
Parameters:
  w - the output stream
Parameters:
  tableName - the name of the database table to dump.
exception:
  IOException - may be thrown
exception:
  SQLException - may be thrown



dumpTableDefinition
public void dumpTableDefinition(Writer w, String tableName) throws SQLException, IOException(Code)
Dump the SQL table definition for the specified table



dumpTableForeignKeys
public void dumpTableForeignKeys(Writer w, String tableName) throws SQLException, IOException(Code)
Dump the SQL foreign key constraints for the specified table



dumpTables
public void dumpTables(Writer w) throws IOException, SQLException(Code)
Dump all of the tables in the database which is referenced by the current connection object to the specified output stream. This routine writes a well-formed XML document, with a document element named <database>. Sub-elements correspond to indidivual table rows.

This routine first constructs a graph of the foreign table reference constraints, and attempts to output base tables before dependant tables, so that the resulting file can be imported without causing foreign key integrity violations.


Parameters:
  w - the output stream
exception:
  IOException - may be thrown
exception:
  SQLException - may be thrown




dumpViewDefinitions
void dumpViewDefinitions(Writer w) throws SQLException, IOException(Code)



endTag
final void endTag(Writer w, String tag) throws IOException(Code)



getConnection
public Connection getConnection()(Code)
Get the dumper's database connection the current database connection



getType
DbType getType(int type) throws SQLException(Code)



getTypes
Hashtable getTypes() throws SQLException(Code)



main
public static void main(String[] args)(Code)
A main program which allows this function to be run as a command-line application for doing an off-line dump. The name of the output file is specified as the argument. If the name of the output file ends with ".gz", the output is compressed using the gzip compression mechanism.
See Also:   makeConnection
See Also:    for a description of the System properties used
See Also:   to establish the database connection.
Parameters:
  args - com.quadcap.sql.tools.XmlDumpoutput file



makeConnection
public static Connection makeConnection() throws Exception(Code)
Establish a database connection based on the settings of system properties.

The following system properties are used to establish the database connection:
jdbc.driver The name of the JDBC driver class (default com.quadcap.jdbc.JdbcDriver)
jdbc.url The JDBC URL used to establish the database connection.
jdbc.props The name of a properties file used to establish the connection. If this property is specified, jdbc.user and jdbc.password aren't used. If this property has the value "system", then the system properties are passed to the DriverManager.getConnection() method.
jdbc.user The user name used to establish the database connection. If neither jdbc.props nor jdbc.user is specified, the DriverManager.getConnection(String url) method is used to establish the connection.
jdbc.password The password used to establish the database connection.


exception:
  Exception - may be thrown if there's a problem connectingto the database.



orderTables
final Iterator orderTables() throws SQLException(Code)



parseViewDef
List parseViewDef(String s)(Code)



setConnection
public void setConnection(Connection conn)(Code)
Set the dumper's database connection
Parameters:
  conn - the new database connection



writeBinary
final void writeBinary(Writer w, Object obj) throws IOException(Code)



writeBinaryStream
final void writeBinaryStream(Writer w, InputStream is) throws IOException(Code)



writeCharacterStream
final void writeCharacterStream(Writer w, Reader r) throws IOException(Code)



writeString
final void writeString(Writer w, String str) throws IOException(Code)



writeValue
final void writeValue(Writer w, Object obj, int jdbcType) throws SQLException, IOException(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.