arlut.csd.ganymede.client
Class xmlclient

java.lang.Object
  |
  +--arlut.csd.ganymede.client.xmlclient
All Implemented Interfaces:
ClientListener

public final class xmlclient
extends java.lang.Object
implements ClientListener

This is a text client for the Ganymede server. This client is designed to take the filename for an XML file on the command line, load the file, parse it, then connect to the server and transfer the file to the server for server-side integration into the Ganymede database.


Field Summary
 int bufferSize
          The default buffer size in the XMLReader.
static boolean debug
           
private  boolean doTest
           
private  boolean dumpData
           
private  boolean dumpSchema
           
static int majorVersion
          This major version number is compared with the "major" attribute in the Ganymede XML document element.
static int minorVersion
          This minor version number is provided to the server when handling raw schema files (files whose document element is <ganyschema>.
 java.lang.String password
           
 java.lang.String propFilename
           
 arlut.csd.Util.XMLReader reader
          Streaming XML reader.
 int registryPortProperty
           
private  boolean schemaOnly
           
private  arlut.csd.ganymede.Server server
          RMI reference to a Ganymede server
 java.lang.String server_url
           
 java.lang.String serverHostProperty
           
 arlut.csd.ganymede.XMLSession session
          Remote session interface to the Ganymede server, used while loading data objects into the server.
 java.lang.String username
           
 java.lang.String xmlFilename
           
 
Constructor Summary
xmlclient(java.lang.String[] argv)
          This constructor takes care of parsing the command line arguments for xmlclient when run from the command line.
 
Method Summary
 void disconnected(arlut.csd.ganymede.client.ClientEvent e)
          Handle a forced disconnect message from the ClientBase RMI object.
 boolean doEverything(boolean commandLine)
          Actually do the thing.
 boolean doXMLDump(boolean commandLine, boolean sendData, boolean sendSchema)
           
 arlut.csd.Util.XMLItem getNextItem()
          Private helper method to process events from the XMLReader.
 boolean loadProperties(java.lang.String filename)
          This method loads properties from the ganymede.properties file.
static void main(java.lang.String[] argv)
          main
 void messageReceived(arlut.csd.ganymede.client.ClientEvent e)
          Handle a message from the ClientBase RMI object.
 void printUsage()
           
 void runTest()
          Simple test rig for XMLReader.getNextTree().
 boolean scanXML()
          This method handles the actual XML processing, once the command line arguments have been parsed and handled by the xmlclient constructor.
 void skipToClose(java.lang.String name)
          This method is called to consume XML elements until we find the matching close.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

majorVersion

public static final int majorVersion

This major version number is compared with the "major" attribute in the Ganymede XML document element. xmlclient won't try to read Ganymede XML files whose major number is too high

See Also:
Constant Field Values

minorVersion

public static final int minorVersion

This minor version number is provided to the server when handling raw schema files (files whose document element is <ganyschema>.

See Also:
Constant Field Values

serverHostProperty

public java.lang.String serverHostProperty

registryPortProperty

public int registryPortProperty

server_url

public java.lang.String server_url

propFilename

public java.lang.String propFilename

xmlFilename

public java.lang.String xmlFilename

username

public java.lang.String username

password

public java.lang.String password

dumpSchema

private boolean dumpSchema

dumpData

private boolean dumpData

doTest

private boolean doTest

schemaOnly

private boolean schemaOnly

server

private arlut.csd.ganymede.Server server
RMI reference to a Ganymede server


session

public arlut.csd.ganymede.XMLSession session

Remote session interface to the Ganymede server, used while loading data objects into the server.


bufferSize

public int bufferSize

The default buffer size in the XMLReader. This value determines how far ahead the XMLReader's i/o thread can get in reading from the XML file. Higher or lower values of this variable may give better performance, depending on the characteristics of the JVM with regards threading, etc.


reader

public arlut.csd.Util.XMLReader reader

Streaming XML reader. xmlclient creates one of these on startup, and from that point on, all XML reading is done through this object.

Constructor Detail

xmlclient

public xmlclient(java.lang.String[] argv)

This constructor takes care of parsing the command line arguments for xmlclient when run from the command line.

Method Detail

main

public static void main(java.lang.String[] argv)
main


printUsage

public void printUsage()

doXMLDump

public boolean doXMLDump(boolean commandLine,
                         boolean sendData,
                         boolean sendSchema)
                  throws java.rmi.RemoteException
java.rmi.RemoteException

runTest

public void runTest()
Simple test rig for XMLReader.getNextTree().


doEverything

public boolean doEverything(boolean commandLine)
                     throws java.rmi.RemoteException,
                            java.io.IOException

Actually do the thing.

java.rmi.RemoteException
java.io.IOException

scanXML

public boolean scanXML()

This method handles the actual XML processing, once the command line arguments have been parsed and handled by the xmlclient constructor.


loadProperties

public boolean loadProperties(java.lang.String filename)

This method loads properties from the ganymede.properties file.

This method is public so that loader code linked with the Ganymede server code can initialize the properties without going through Ganymede.main().


getNextItem

public arlut.csd.Util.XMLItem getNextItem()
                                   throws org.xml.sax.SAXException

Private helper method to process events from the XMLReader. By using this method, the rest of the code in the xmlclient doesn't have to check for error and warning conditions.

org.xml.sax.SAXException

skipToClose

public void skipToClose(java.lang.String name)
                 throws org.xml.sax.SAXException

This method is called to consume XML elements until we find the matching close.

org.xml.sax.SAXException

messageReceived

public void messageReceived(arlut.csd.ganymede.client.ClientEvent e)
Handle a message from the ClientBase RMI object.

Specified by:
messageReceived in interface ClientListener

disconnected

public void disconnected(arlut.csd.ganymede.client.ClientEvent e)
Handle a forced disconnect message from the ClientBase RMI object.

Specified by:
disconnected in interface ClientListener