com.phenix.pct
Class PCTRun

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.phenix.pct.PCT
              extended by com.phenix.pct.PCTRun
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
PCTCompile, PCTCRC, PCTDumpData, PCTDumpIncremental, PCTDumpSchema, PCTLoadData, PCTLoadSchema, PCTSchemaDoc, PCTWSComp, ProUnit, ServerProcess, WSServerProcess

public class PCTRun
extends PCT

Run a Progress procedure.

Version:
$Revision$
Author:
Gilles QUERRET

Field Summary
protected  Collection dbConnList
           
protected  org.apache.tools.ant.taskdefs.ExecTask exec
           
protected  int initID
           
protected  File initProc
           
protected  org.apache.tools.ant.types.Path internalPropath
           
protected  List outputParameters
           
protected  File outputStream
           
protected  int outputStreamID
           
protected  File pctLib
           
protected  int plID
           
protected  String procedure
           
protected  org.apache.tools.ant.types.Path propath
           
protected  Collection runParameters
           
protected  File status
           
protected  int statusID
           
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
PCTRun()
          Default constructor
PCTRun(boolean tmp)
          Default constructor
PCTRun(boolean tmp, boolean batchMode)
           
 
Method Summary
 void addOption(PCTRunOption option)
          Adds a new command line option
 void addOutputParameter(OutputParameter param)
          Add a new output param which will be passed to progress procedure
 void addParameter(RunParameter param)
          Add a new parameter which will be passed to the progress procedure in a temp-table
 void addPCTConnection(PCTConnection dbConn)
          Adds a database connection
 void addPCTRunOption(PCTRunOption option)
           
 void addPropath(org.apache.tools.ant.types.Path propath)
          Set the propath to be used when running the procedure
protected  void cleanup()
          Delete temporary files if debug not activated
 org.apache.tools.ant.types.Path createPropath()
          Creates a new Path instance
protected static String escapeString(String str)
          Escapes a string so it does not accidentally contain Progress escape characters
 void execute()
          Do the work
protected  List getCmdLineParameters()
           
protected  boolean getDebugPCT()
          Return PCT Debug status
protected  String getStatusFileName()
          Returns status file name (where to write progress procedure result)
 boolean isPrepared()
          Exec task is prepared ?
protected  void maybeSetResultPropertyValue(int result)
          Helper method to set result property to the passed in value if appropriate.
protected  void prepareExecTask()
          Creates and initialize
protected  void preparePropath()
           
 void setBaseDir(File baseDir)
          The directory in which the Progress runtime should be executed.
 void setCenturyYearOffset(int centuryYearOffset)
          Century year offset (-yy attribute)
 void setCompileUnderscore(boolean compUnderscore)
          If files beginning with an underscore should be compiled (-zn option) See POSSE documentation for more details
 void setCpInternal(String cpInternal)
          Internal code page (-cpinternal attribute)
 void setCpStream(String cpStream)
          Stream code page (-cpstream attribute)
 void setDebugPCT(boolean debugPCT)
          Turns on/off debugging mode (keeps Progress temp files on disk)
 void setDebugReady(int debugReady)
          Port number on which debugger should connect (-debugReady parameter)
 void setDirSize(int dirSize)
          The number of compiled procedure directory entries (-D attribute)
protected  void setExecTaskParams()
           
 void setFailOnError(boolean failOnError)
          Sets the failOnError parameter.
 void setGraphicalMode(boolean graphMode)
          Graphical mode on/off (call to _progres or prowin32)
 void setIniFile(File iniFile)
          Sets .ini file to use (-basekey INI -ininame xxx)
 void setInputChars(int inputChars)
          The number of characters allowed in a single statement (-inp attribute)
 void setMaximumMemory(int maximumMemory)
          The amount of memory allocated for r-code segments
 void setMsgBufferSize(int msgBufSize)
          Message buffer size (-Mm attribute)
 void setNumDec(String numdec)
          Decimal separator (-numdec attribute)
 void setNumSep(String numsep)
          Thousands separator (-numsep attribute)
 void setParameter(String param)
          Parameter (-param attribute)
 void setParameters(Collection params)
          Defines a new collection of parameters
 void setParamFile(File pf)
          Parameter file (-pf attribute)
 void setProcedure(String procedure)
          Procedure to be run (not -p param, this parameter is always pct_initXXX.p)
 void setResultProperty(String resultProperty)
          Sets the name of a property in which the return valeur of the Progress procedure should be stored.
 void setStackSize(int stackSize)
          The size of the stack in 1KB units.
 void setTempDir(File tempDir)
          Temporary directory for Progress runtime (-T parameter)
 void setToken(int token)
          The number of tokens allowed in a 4GL statement (-tok attribute)
 void setTTBufferSize(int ttBufferSize)
          Buffer Size for Temporary Tables (-Bt attribute)
 
Methods inherited from class com.phenix.pct.PCT
addEnv, checkDlcHome, deleteDirectory, extractPL, extractPL, getDlcBin, getDlcHome, getDLCMaintenanceVersion, getDLCMajorVersion, getDLCMinorVersion, getDLCPatchLevel, getDLCRevision, getEnvironment, getExecPath, getFullVersion, getIncludedPL, getJavaFileset, getJavaFileset, getProgressProcedures, getRCodeVersion, getReducedVersion, isSourceCodeUsed, nextRandomInt, setDlcBin, setDlcHome, setDlcJava, setIncludedPL
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

procedure

protected String procedure

dbConnList

protected Collection dbConnList

propath

protected org.apache.tools.ant.types.Path propath

internalPropath

protected org.apache.tools.ant.types.Path internalPropath

runParameters

protected Collection runParameters

outputParameters

protected List outputParameters

exec

protected org.apache.tools.ant.taskdefs.ExecTask exec

statusID

protected int statusID

initID

protected int initID

plID

protected int plID

outputStreamID

protected int outputStreamID

initProc

protected File initProc

status

protected File status

pctLib

protected File pctLib

outputStream

protected File outputStream
Constructor Detail

PCTRun

public PCTRun()
Default constructor


PCTRun

public PCTRun(boolean tmp)
Default constructor

Parameters:
tmp - True if temporary files need to be created

PCTRun

public PCTRun(boolean tmp,
              boolean batchMode)
Method Detail

addPCTConnection

public void addPCTConnection(PCTConnection dbConn)
Adds a database connection

Parameters:
dbConn - Instance of PCTConnection class

addOption

public void addOption(PCTRunOption option)
Adds a new command line option

Parameters:
option - Instance of PCTRunOption class

addPCTRunOption

public void addPCTRunOption(PCTRunOption option)

addParameter

public void addParameter(RunParameter param)
Add a new parameter which will be passed to the progress procedure in a temp-table

Parameters:
param - Instance of RunParameter class

addOutputParameter

public void addOutputParameter(OutputParameter param)
Add a new output param which will be passed to progress procedure

Parameters:
param - Instance of OutputParameter
Since:
PCT 0.14

setParameters

public void setParameters(Collection params)
Defines a new collection of parameters

Parameters:
params - Collection

setParamFile

public void setParamFile(File pf)
Parameter file (-pf attribute)

Parameters:
pf - File

setNumSep

public void setNumSep(String numsep)
Thousands separator (-numsep attribute)

Parameters:
numsep - String

setNumDec

public void setNumDec(String numdec)
Decimal separator (-numdec attribute)

Parameters:
numdec - String

setParameter

public void setParameter(String param)
Parameter (-param attribute)

Parameters:
param - String

setDebugPCT

public void setDebugPCT(boolean debugPCT)
Turns on/off debugging mode (keeps Progress temp files on disk)

Parameters:
debugPCT - boolean

setCompileUnderscore

public void setCompileUnderscore(boolean compUnderscore)
If files beginning with an underscore should be compiled (-zn option) See POSSE documentation for more details

Parameters:
compUnderscore - boolean

setDirSize

public void setDirSize(int dirSize)
The number of compiled procedure directory entries (-D attribute)

Parameters:
dirSize - int

setGraphicalMode

public void setGraphicalMode(boolean graphMode)
Graphical mode on/off (call to _progres or prowin32)

Parameters:
graphMode - boolean

setIniFile

public void setIniFile(File iniFile)
Sets .ini file to use (-basekey INI -ininame xxx)

Parameters:
iniFile - File

setFailOnError

public void setFailOnError(boolean failOnError)
Sets the failOnError parameter. Defaults to true.

Parameters:
failOnError -

setProcedure

public void setProcedure(String procedure)
Procedure to be run (not -p param, this parameter is always pct_initXXX.p)

Parameters:
procedure - String

addPropath

public void addPropath(org.apache.tools.ant.types.Path propath)
Set the propath to be used when running the procedure

Parameters:
propath - an Ant Path object containing the propath

createPropath

public org.apache.tools.ant.types.Path createPropath()
Creates a new Path instance

Returns:
Path

setCpStream

public void setCpStream(String cpStream)
Stream code page (-cpstream attribute)

Parameters:
cpStream - String

setCpInternal

public void setCpInternal(String cpInternal)
Internal code page (-cpinternal attribute)

Parameters:
cpInternal - String

setInputChars

public void setInputChars(int inputChars)
The number of characters allowed in a single statement (-inp attribute)

Parameters:
inputChars - Integer

setCenturyYearOffset

public void setCenturyYearOffset(int centuryYearOffset)
Century year offset (-yy attribute)

Parameters:
centuryYearOffset - Integer

setToken

public void setToken(int token)
The number of tokens allowed in a 4GL statement (-tok attribute)

Parameters:
token - int

setMaximumMemory

public void setMaximumMemory(int maximumMemory)
The amount of memory allocated for r-code segments

Parameters:
maximumMemory - int

setStackSize

public void setStackSize(int stackSize)
The size of the stack in 1KB units.

Parameters:
stackSize - int

setTTBufferSize

public void setTTBufferSize(int ttBufferSize)
Buffer Size for Temporary Tables (-Bt attribute)

Parameters:
ttBufferSize - int

setMsgBufferSize

public void setMsgBufferSize(int msgBufSize)
Message buffer size (-Mm attribute)

Parameters:
msgBufSize - int

setDebugReady

public void setDebugReady(int debugReady)
Port number on which debugger should connect (-debugReady parameter)

Parameters:
debugReady - int

setTempDir

public void setTempDir(File tempDir)
Temporary directory for Progress runtime (-T parameter)

Parameters:
tempDir - File

setBaseDir

public void setBaseDir(File baseDir)
The directory in which the Progress runtime should be executed.

Parameters:
baseDir - File

setResultProperty

public void setResultProperty(String resultProperty)
Sets the name of a property in which the return valeur of the Progress procedure should be stored. Only of interest if failonerror=false.

Parameters:
resultProperty - name of property.
Since:
PCT 0.14

maybeSetResultPropertyValue

protected void maybeSetResultPropertyValue(int result)
Helper method to set result property to the passed in value if appropriate.

Parameters:
result - value desired for the result property value.

isPrepared

public boolean isPrepared()
Exec task is prepared ?

Returns:
boolean

getStatusFileName

protected String getStatusFileName()
Returns status file name (where to write progress procedure result)

Returns:
String

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Do the work

Specified by:
execute in class PCT
Throws:
org.apache.tools.ant.BuildException - Something went wrong

prepareExecTask

protected void prepareExecTask()
Creates and initialize


getCmdLineParameters

protected List getCmdLineParameters()

setExecTaskParams

protected void setExecTaskParams()

preparePropath

protected void preparePropath()

escapeString

protected static String escapeString(String str)
Escapes a string so it does not accidentally contain Progress escape characters

Parameters:
str - the input string
Returns:
the escaped string

getDebugPCT

protected boolean getDebugPCT()
Return PCT Debug status

Returns:
boolean

cleanup

protected void cleanup()
Delete temporary files if debug not activated



Copyright © 2003-2011 Gilles QUERRET. All Rights Reserved.