com.bluestream.xdbutil
Class Script

java.lang.Object
  extended bycom.bluestream.xdbutil.Script

public class Script
extends Object

Scripter is a utility to run a set of script commands. The script commands are either XQuery statements or API commands that help in the execution fo XQuery statements. Each script intance is not multi-thread safe, however, to be thread safe just get another script instance.

comments are // for a single line - // must be in first position of line. commands are:

SetResultFile | OR "null" [| PPOff,Append,StripXMLDecl]; // default is PPOn and New

Prepare | ;

SetParam | | ; (not implemented)

FileToParam | | ;

InsertFiles | |

| ,,..... |

ExecutePrepared;

Execute | ;

BeginTran; // begin transaction.

CommitTran; // commit transaction.

SetDescription | ;

SetCategory | | [description]; // for tag output.

AddSchema | ; // AddSchema | v:/example/Schema/W3CSchema/goxmldb/invoice.xsd;

RemoveSchema | ; // RemoveSchema book;

// resource operations

EnableCategories | {DBName}

CreateCategory | {ParentPath} | {CategoryName} // ParentPath must exist - start with /

InsertXMLResource | {FullCategoryPath} | {filename}

InsertBinaryResource | {FullCategoryPath} | {filename}

DeleteResource | {ResourceId} | "DeleteContent" or "KeepContent"

GetResourceToDir | {FullResourcePath} | {RootDirectory}

not implemented ** GetResourceFromServer | ServerName | {FullResourcePath} | {RootDirectory}

// special utility operations

SetServerInfo | {ServerName} | {UserName} | {Password}

ExecuteScript | ; // recursively executes - full path of resource

// specialized output commands.

// specialized output support outputing results to a table and special results files.

BeginOutTableResource | {FullResourcePath} ; // send it to this resource.

SetHtmlResultCategory | {FullCategoryPath} | {filePrefix} | {hrefPrefix} ; //{n}.html will be added

EndOutTableResource ; // finishes off resource

Kludge: ampnbsp will become   in output.


Constructor Summary
Script()
           
 
Method Summary
 void close()
          close any files and any activities the scripter was doing.
 boolean getSwitchQuotes()
           
 String getText()
          get the currently set script.
 void loadFile(File file)
          Load the script from the given file.
 void run(Server srv, AuthenticationInfo authInfo)
          run the loaded script.
 void run(Server srv, AuthenticationInfo authInfo, FlexStringBuffer fsbResult, boolean bAppend)
          run the loaded script.
 void setMessageWriter(Writer writer)
          set the writer for the messages to write to.
 void setOutPrettyPrint(boolean bOutPP)
          set the result file, although a script can do this too.
 void setResultFile(File f)
          set the result file, although a script can do this too.
 void setSwitchQuotes(boolean flag)
           
 void setText(String script)
          Set the script text to the given text.
 void setVerbose(boolean bVerboseOn)
          set the message level to verbose.
static void switchQuotes(FlexStringBuffer fsb)
          Switch from single to double quotes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Script

public Script()
Method Detail

loadFile

public void loadFile(File file)
              throws XDBException
Load the script from the given file.

Throws:
XDBException

close

public void close()
close any files and any activities the scripter was doing.


setText

public void setText(String script)
             throws XDBException
Set the script text to the given text.

Throws:
XDBException

getText

public String getText()
get the currently set script. null is returned for none set.


run

public void run(Server srv,
                AuthenticationInfo authInfo,
                FlexStringBuffer fsbResult,
                boolean bAppend)
         throws XDBException
run the loaded script.

Throws:
XDBException

run

public void run(Server srv,
                AuthenticationInfo authInfo)
         throws XDBException
run the loaded script. In this case results will be either written to the set results file or thrown away. /** run the loaded script.

Throws:
XDBException

setVerbose

public void setVerbose(boolean bVerboseOn)
set the message level to verbose.


setMessageWriter

public void setMessageWriter(Writer writer)
set the writer for the messages to write to.


setResultFile

public void setResultFile(File f)
set the result file, although a script can do this too. null means no result file and is the starting state.


setOutPrettyPrint

public void setOutPrettyPrint(boolean bOutPP)
set the result file, although a script can do this too. null means no result file and is the starting state.


setSwitchQuotes

public void setSwitchQuotes(boolean flag)

getSwitchQuotes

public boolean getSwitchQuotes()

switchQuotes

public static void switchQuotes(FlexStringBuffer fsb)
Switch from single to double quotes. Needed for ExplorerHelp. MC - 2003-Mar-01 Moved from StringUtil.



Copyright 2006 Bluestream Database Software Corp. All Rights Reserved.