com.phoenix_int.aserver.util.scriptwrapper.api
Class PHXScriptWrapperObject

java.lang.Object
  extended by com.phoenix_int.aserver.util.scriptwrapper.api.PHXScriptWrapperObject

public class PHXScriptWrapperObject
extends java.lang.Object

This object is passed to Script Wrapper scripts and provides the "wrapper" global object which provides runtime services for the wrapper.


Constructor Summary
PHXScriptWrapperObject(com.phoenix_int.aserver.util.scriptwrapper.PHXScriptWrapper wrapper)
          Constructs a wrapper object from a ScriptWrapper instance.
 
Method Summary
 void addAutoClose(java.io.Closeable file)
          Add the opened file to the file Handlers list
 void addConsoleVariables()
           
 void addMethod(java.lang.String methodName)
          Publicizes a method to our clients.
 void addMethod(java.lang.String methodName, boolean downloadInputs)
          Publicizes a method to our clients.
 void addMethod(java.lang.String methodName, java.lang.String fullName)
          Publicizes a method to our clients.
 void addMethod(java.lang.String methodName, java.lang.String fullName, boolean downloadInputs)
          Publicizes a method to our clients.
 IPHXType addVariable(java.lang.String name, java.lang.String type, boolean isInput)
          Adds a variable to this component.
 void backupFile(java.lang.String varName, java.lang.String fileName)
          Backup the file on disk.
 void defaultExecutableMapping(java.lang.String name, java.lang.String location)
           
 void deleteFile(java.lang.String varName, java.lang.String fileName)
          Deletes the given file variable's file
 com.phoenix_int.aserver.ascore.PHXConnection getConnection()
          gets the connection object
 java.util.Hashtable getDictionary()
          gets the dictionary object
 java.lang.String getDirectory()
          Returns the directory where this component was loaded from
 java.lang.String getRunDirectory()
          Returns the current "run" directory, which is the same as getDirectory() unless run sharing is being used.
 PHXRunShareContext getRunShare()
          Returns the PHXRunShareContext object used for process control and monitoring with this component
 IPHXType getVariable(java.lang.String name)
          Returns a reference to the named variable.
 void parseFile(java.lang.String varName, java.lang.String fileName, boolean throwParseError)
          Read the given file variable from the specified file
 void removeAutoClose(java.io.Closeable file)
          Remove the file from the file Handlers list
 void removeVariable(java.lang.String name)
          Dynamically removes a variable from this component
 void requireAnalysisServerVersion(int majorVersion, int minorVersion)
          Verifies we're running a compatible version of Analysis Server
 void setBinary(java.lang.String varName)
          Make a given file variable binary
 void setConnection(com.phoenix_int.aserver.ascore.PHXConnection c)
          sets the connection object
 void sleep(long millisecs)
          sleeps for a period of time
 void trace(java.lang.String msg)
          Prints a string to the trace window
 void updateConsoleVariables()
           
 void writeFile(java.lang.String varName, java.lang.String fileName)
          Write the given file variable out to the specified file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PHXScriptWrapperObject

public PHXScriptWrapperObject(com.phoenix_int.aserver.util.scriptwrapper.PHXScriptWrapper wrapper)
Constructs a wrapper object from a ScriptWrapper instance.

Method Detail

addMethod

public void addMethod(java.lang.String methodName)
               throws PHXNameAlreadyInUseException,
                      PHXInvalidNameException
Publicizes a method to our clients. There must be a method defined in the script by this name. Clients of Analysis Server will be able to call this method

Parameters:
methodName - The name of the method to publicize
Throws:
PHXNameAlreadyInUseException
PHXInvalidNameException

addMethod

public void addMethod(java.lang.String methodName,
                      java.lang.String fullName)
               throws PHXNameAlreadyInUseException,
                      PHXInvalidNameException
Publicizes a method to our clients. There must be a method defined in the script by this name. Clients of Analysis Server will be able to call this method

Parameters:
methodName - The name of the method to publicize.
fullName - A human readable name to show in GUI programs for this method. For example, ModelCenter will show this in the right click menu of a component.
Throws:
PHXNameAlreadyInUseException
PHXInvalidNameException

addMethod

public void addMethod(java.lang.String methodName,
                      boolean downloadInputs)
               throws PHXNameAlreadyInUseException,
                      PHXInvalidNameException
Publicizes a method to our clients. There must be a method defined in the script by this name. Clients of Analysis Server will be able to call this method

Parameters:
methodName - The name of the method to publicize.
downloadInputs - Hint passed to the client on whether the inputs should be downloaded after the method is run.
Throws:
PHXNameAlreadyInUseException
PHXInvalidNameException

addMethod

public void addMethod(java.lang.String methodName,
                      java.lang.String fullName,
                      boolean downloadInputs)
               throws PHXNameAlreadyInUseException,
                      PHXInvalidNameException
Publicizes a method to our clients. There must be a method defined in the script by this name. Clients of Analysis Server will be able to call this method

Parameters:
methodName - The name of the method to publicize.
fullName - A human readable name to show in GUI programs for this method. For example, ModelCenter will show this in the right click menu of a component.
downloadInputs - Hint passed to the client on whether the inputs should be downloaded after the method is run.
Throws:
PHXNameAlreadyInUseException
PHXInvalidNameException

addVariable

public IPHXType addVariable(java.lang.String name,
                            java.lang.String type,
                            boolean isInput)
                     throws PHXNameAlreadyInUseException,
                            PHXInvalidNameException,
                            PHXInvalidTypeException
Adds a variable to this component. Returns a reference to the new variable. Valid types are:
Type Aliases Associated PHXType
doublerealPHXDouble
integerint,longPHXLong
stringstrPHXString
booleanboolPHXBoolean
geometrygeomPHXGeometry
file PHXRawFile
All types except PHXGeometry and PHXRawFile may be made into arrays by adding [] at the end of the type string. In that case, the associated PHX<type>Array class is used to represent a resizable, multi-dimensional array.

Parameters:
name - The full name of the new variable. May include group specification with '.'.
type - The type of variable to create. Use the same type strings as for the variable: statemensts at the top of the ScriptWrapper.
isInput - If true, the variable will be an input, if false, it will be an output.
Throws:
PHXNameAlreadyInUseException - Thrown if there is already a variable by that name.
PHXInvalidNameException - Thrown if the name uses invalid characters like space.
com.phoenix_int.aserver.PHXInvalidTypeException - Thrown if the type string is not understood
PHXInvalidTypeException

getVariable

public IPHXType getVariable(java.lang.String name)
                     throws PHXNoSuchObjectException
Returns a reference to the named variable.

Throws:
PHXNoSuchObjectException

removeVariable

public void removeVariable(java.lang.String name)
                    throws PHXNoSuchObjectException
Dynamically removes a variable from this component

Throws:
PHXNoSuchObjectException

addConsoleVariables

public void addConsoleVariables()
                         throws PHXNameAlreadyInUseException,
                                PHXInvalidNameException,
                                PHXInvalidTypeException
Throws:
PHXNameAlreadyInUseException
PHXInvalidNameException
PHXInvalidTypeException

updateConsoleVariables

public void updateConsoleVariables()
                            throws PHXNoSuchObjectException
Throws:
PHXNoSuchObjectException

getDirectory

public java.lang.String getDirectory()
Returns the directory where this component was loaded from


getRunShare

public PHXRunShareContext getRunShare()
Returns the PHXRunShareContext object used for process control and monitoring with this component


getRunDirectory

public java.lang.String getRunDirectory()
Returns the current "run" directory, which is the same as getDirectory() unless run sharing is being used.


sleep

public void sleep(long millisecs)
sleeps for a period of time

Parameters:
millisecs - the amount of time to sleep

getConnection

public com.phoenix_int.aserver.ascore.PHXConnection getConnection()
gets the connection object


setConnection

public void setConnection(com.phoenix_int.aserver.ascore.PHXConnection c)
sets the connection object


getDictionary

public java.util.Hashtable getDictionary()
gets the dictionary object


setBinary

public void setBinary(java.lang.String varName)
               throws PHXInvalidTypeException,
                      PHXNoSuchObjectException
Make a given file variable binary

Parameters:
varName - the name of the file variable
Throws:
PHXInvalidTypeException
PHXNoSuchObjectException

writeFile

public void writeFile(java.lang.String varName,
                      java.lang.String fileName)
               throws PHXInvalidTypeException,
                      PHXNoSuchObjectException,
                      java.io.IOException
Write the given file variable out to the specified file

Parameters:
varName - the name of the file variable
fileName - the name of the target file
Throws:
PHXInvalidTypeException
PHXNoSuchObjectException
java.io.IOException

parseFile

public void parseFile(java.lang.String varName,
                      java.lang.String fileName,
                      boolean throwParseError)
               throws PHXInvalidTypeException,
                      PHXNoSuchObjectException,
                      java.io.IOException
Read the given file variable from the specified file

Parameters:
varName - the name of the file variable
fileName - the name of the target file
Throws:
PHXInvalidTypeException
PHXNoSuchObjectException
java.io.IOException

deleteFile

public void deleteFile(java.lang.String varName,
                       java.lang.String fileName)
                throws PHXInvalidTypeException,
                       PHXNoSuchObjectException,
                       java.io.IOException
Deletes the given file variable's file

Parameters:
varName - the name of the file variable
fileName - the name of the target file
Throws:
PHXInvalidTypeException
PHXNoSuchObjectException
java.io.IOException

backupFile

public void backupFile(java.lang.String varName,
                       java.lang.String fileName)
                throws PHXInvalidTypeException,
                       PHXNoSuchObjectException,
                       java.io.IOException
Backup the file on disk. File is at the same location with ".bac" appended to the end. If a file by that name already exists, it is deleted prior to moving.

Parameters:
varName - the name of the file variable
fileName - the name of the target file
Throws:
PHXInvalidTypeException
PHXNoSuchObjectException
java.io.IOException

defaultExecutableMapping

public void defaultExecutableMapping(java.lang.String name,
                                     java.lang.String location)

trace

public void trace(java.lang.String msg)
Prints a string to the trace window

Parameters:
msg - the message to print

requireAnalysisServerVersion

public void requireAnalysisServerVersion(int majorVersion,
                                         int minorVersion)
                                  throws PHXVersionException
Verifies we're running a compatible version of Analysis Server

Parameters:
majorVersion - required major version
minorVerions - required minor version
Throws:
PHXVersionException

addAutoClose

public void addAutoClose(java.io.Closeable file)
Add the opened file to the file Handlers list

Parameters:
file - the closeable file

removeAutoClose

public void removeAutoClose(java.io.Closeable file)
Remove the file from the file Handlers list

Parameters:
file - the closeable file