org.exist.client
Class InteractiveClient

java.lang.Object
  extended byorg.exist.client.InteractiveClient

public class InteractiveClient
extends java.lang.Object

Command-line client based on the XML:DB API.

Author:
wolf

Nested Class Summary
static class InteractiveClient.ProgressObserver
           
 
Field Summary
protected static int[] colSizes
           
protected  java.util.TreeSet completitions
           
protected static java.lang.String configuration
           
static java.lang.String CONFIGURATION
           
protected  Collection current
           
protected static java.util.Properties defaultProps
           
protected static java.lang.String driver
           
static java.lang.String DRIVER
           
protected static java.lang.String EDIT_CMD
           
protected static java.lang.String ENCODING
           
protected  int filesCount
          number of files of a recursive store
protected  ClientFrame frame
           
protected  java.io.File historyFile
           
protected  int maxResults
           
protected  java.util.HashMap namespaceMappings
           
protected  int nextInSet
           
protected static int PARALLEL_THREADS
           
protected static java.lang.String PASS
           
static java.lang.String PASSWORD
           
protected  java.lang.String path
           
protected  java.util.Properties properties
           
protected  java.util.LinkedList queryHistory
           
protected  java.io.File queryHistoryFile
           
protected  boolean quiet
           
protected  boolean recurseDirs
          default recursive, maybe override by client.properties
protected  java.lang.String[] resources
           
protected  ResourceSet result
           
protected  boolean startGUI
           
protected  long totalLength
          total length of a recursive store
protected  java.io.Writer traceWriter
           
static java.lang.String URI
           
protected static java.lang.String URI_DEFAULT
           
static java.lang.String USER
           
protected static java.lang.String USER_DEFAULT
           
protected  boolean verbose
           
 
Constructor Summary
InteractiveClient()
           
 
Method Summary
protected  void addToHistory(java.lang.String query)
           
protected  void connect()
          Register XML:DB driver and retrieve root collection.
protected  void displayHelp()
          Display help on commands
protected  Collection getCollection()
          Returns the current collection.
protected  Collection getCollection(java.lang.String path)
           
protected  CommandlineOptions getCommandlineOptions(java.lang.String[] args, java.util.Properties props)
          Parse command line options, store into dedicated object
static java.lang.String getExceptionMessage(java.lang.Throwable e)
           
protected  void getResources()
          Get list of resources contained in collection.
static void main(java.lang.String[] args)
          The main program for the InteractiveClient class.
protected  void more(java.lang.String str)
          Display document on screen, by 24 lines.
protected  boolean parse(java.io.File[] files, org.exist.client.UploadDialog upload)
          Method called by the store Dialog
protected  boolean parse(java.lang.String fileName)
          stores given Resource
 void printNotice()
           
protected  boolean process(java.lang.String line)
          In interactive mode, process a line entered by the user.
 void readlineInputLoop(java.lang.String home)
           
protected  void readQueryHistory()
           
protected  void reloadCollection()
           
protected  Resource retrieve(java.lang.String resource)
           
protected  Resource retrieve(java.lang.String resource, java.lang.String indent)
           
 void run(java.lang.String[] args)
          Main processing method for the InteractiveClient object
protected  void setProperties()
           
protected  void shutdown(boolean force)
           
protected  void writeQueryHistory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER

public static final java.lang.String USER
See Also:
Constant Field Values

PASSWORD

public static final java.lang.String PASSWORD
See Also:
Constant Field Values

URI

public static final java.lang.String URI
See Also:
Constant Field Values

CONFIGURATION

public static final java.lang.String CONFIGURATION
See Also:
Constant Field Values

DRIVER

public static final java.lang.String DRIVER
See Also:
Constant Field Values

EDIT_CMD

protected static java.lang.String EDIT_CMD

ENCODING

protected static java.lang.String ENCODING

PASS

protected static java.lang.String PASS

URI_DEFAULT

protected static java.lang.String URI_DEFAULT

USER_DEFAULT

protected static java.lang.String USER_DEFAULT

PARALLEL_THREADS

protected static int PARALLEL_THREADS

defaultProps

protected static java.util.Properties defaultProps

colSizes

protected static final int[] colSizes

driver

protected static java.lang.String driver

configuration

protected static java.lang.String configuration

completitions

protected java.util.TreeSet completitions

queryHistory

protected java.util.LinkedList queryHistory

queryHistoryFile

protected java.io.File queryHistoryFile

historyFile

protected java.io.File historyFile

current

protected Collection current

nextInSet

protected int nextInSet

maxResults

protected int maxResults

path

protected java.lang.String path

properties

protected java.util.Properties properties

resources

protected java.lang.String[] resources

result

protected ResourceSet result

namespaceMappings

protected java.util.HashMap namespaceMappings

filesCount

protected int filesCount
number of files of a recursive store


totalLength

protected long totalLength
total length of a recursive store


quiet

protected boolean quiet

verbose

protected boolean verbose

recurseDirs

protected boolean recurseDirs
default recursive, maybe override by client.properties


startGUI

protected boolean startGUI

traceWriter

protected java.io.Writer traceWriter

frame

protected ClientFrame frame
Constructor Detail

InteractiveClient

public InteractiveClient()
Method Detail

displayHelp

protected void displayHelp()
Display help on commands


main

public static void main(java.lang.String[] args)
The main program for the InteractiveClient class.

Parameters:
args - The command line arguments

connect

protected void connect()
                throws java.lang.Exception
Register XML:DB driver and retrieve root collection.

Throws:
java.lang.Exception - Description of the Exception

getCollection

protected Collection getCollection()
Returns the current collection.

Returns:
the current collection

reloadCollection

protected void reloadCollection()
                         throws XMLDBException
Throws:
XMLDBException

setProperties

protected void setProperties()
                      throws XMLDBException
Throws:
XMLDBException

getResources

protected void getResources()
                     throws XMLDBException
Get list of resources contained in collection.

Throws:
XMLDBException - Description of the Exception

more

protected void more(java.lang.String str)
Display document on screen, by 24 lines.

Parameters:
str - string containing the document.

process

protected boolean process(java.lang.String line)
In interactive mode, process a line entered by the user.

Parameters:
line - the line entered
Returns:
true if command != quit

retrieve

protected final Resource retrieve(java.lang.String resource)
                           throws XMLDBException
Throws:
XMLDBException

retrieve

protected final Resource retrieve(java.lang.String resource,
                                  java.lang.String indent)
                           throws XMLDBException
Throws:
XMLDBException

parse

protected boolean parse(java.lang.String fileName)
                 throws XMLDBException
stores given Resource

Parameters:
fileName - simple file or directory
Returns:
Throws:
XMLDBException

parse

protected boolean parse(java.io.File[] files,
                        org.exist.client.UploadDialog upload)
                 throws XMLDBException
Method called by the store Dialog

Parameters:
files - : selected
upload - : GUI object
Returns:
Throws:
XMLDBException

getCollection

protected Collection getCollection(java.lang.String path)
                            throws XMLDBException
Throws:
XMLDBException

getCommandlineOptions

protected CommandlineOptions getCommandlineOptions(java.lang.String[] args,
                                                   java.util.Properties props)
Parse command line options, store into dedicated object

Parameters:
args - Arguments
props - Client configuration
Returns:
Object representing commandline parametres.

run

public void run(java.lang.String[] args)
         throws java.lang.Exception
Main processing method for the InteractiveClient object

Parameters:
args - arguments from main()
Throws:
java.lang.Exception

getExceptionMessage

public static final java.lang.String getExceptionMessage(java.lang.Throwable e)

readQueryHistory

protected void readQueryHistory()

addToHistory

protected void addToHistory(java.lang.String query)

writeQueryHistory

protected void writeQueryHistory()

readlineInputLoop

public void readlineInputLoop(java.lang.String home)

shutdown

protected final void shutdown(boolean force)

printNotice

public void printNotice()


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.