public class DoorsBatchServerApplication extends DoorsApplication
It is required to call the dispose()
once no more DOORS data is to be read or updated, at the end of the Java program execution, to
ensure the DOORS client is correctly shutdown and all necessary cleanup are executed.
An instance of this class is usually obtained using the DoorsUtils.createApplication()
method.
This class is not intended to be subclassed by clients but may be instantiated.
DoorsUtils.createApplication(com.sodius.mdw.core.util.PropertySet)
DoorsApplication.Factory
ERROR_DOORS_NOT_RUNNING, OPTION_FETCH_ALL_CHILDREN, PLUGIN_ID
Constructor and Description |
---|
DoorsBatchServerApplication(File doorsExe,
String data,
String user,
String password,
long timeout)
Instantiates a
DoorsBatchServerApplication . |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Shutdowns the DOORS batch client.
|
boolean |
isBatch()
Always returns
true . |
boolean |
isRunning()
Always returns
true , as a DOORS batch client can be launched as necessary to execute DXL scripts. |
int |
runFile(File file)
Executes the specified DXL script.
|
protected Process |
startDoorsClient(File doorsExe,
String data,
String user,
String password,
File dxlFile,
File logFile)
Starts a DOORS client in batch mode to execute the requested DXL file.
|
checkIsRunning, getDatabase, getDatabase
public DoorsBatchServerApplication(File doorsExe, String data, String user, String password, long timeout) throws org.eclipse.core.runtime.CoreException
DoorsBatchServerApplication
.
An instance of this class is usually obtained using the DoorsUtils.createApplication()
method.doorsExe
- The full path of doors.exe
, used to launch a DOORS client in
batch mode.data
- The port and server name of the database to connect to in batch mode
(e.g. 36677@myServer
)user
- The name of the DOORS user to make the connection in batch mode.password
- The password of the DOORS user to make the connection in batch mode.timeout
- Determines the number of milliseconds after which a DOORS client launched
in batch mode is shutdown if it is inactive, i.e. no command is executed
during this period of time. If this timeout is hit and new data is to be
retrieved, a new hidden DOORS client is automatically re-created.org.eclipse.core.runtime.CoreException
- if the DOORS client executable path is not valid.DoorsUtils.createApplication(com.sodius.mdw.core.util.PropertySet)
,
DoorsStatusCode.INVALID_DOORS_PATH
public boolean isRunning()
true
, as a DOORS batch client can be launched as necessary to execute DXL scripts.isRunning
in class DoorsApplication
true
public boolean isBatch()
true
.isBatch
in class DoorsApplication
true
public void dispose()
dispose
in class DoorsApplication
public int runFile(File file) throws org.eclipse.core.runtime.CoreException
runFile
in class DoorsApplication
file
- a file containing a DXL script to execute.0
.org.eclipse.core.runtime.CoreException
- if anything prevents the DXL script to execute properly.
Details on the cause might be found using the DoorsStatusCode
class on the exception status code.DoorsStatusCode
protected Process startDoorsClient(File doorsExe, String data, String user, String password, File dxlFile, File logFile) throws IOException
Subclasses might override this method to change how the DOORS client is executed. For example one might want to use a specific DOORS add-in path as command line argument. Overriding this method shall also be used to start the DOORS client using a batch script file instead of calling the executable directly.
The Process
instance returned by this method is used by the framework to monitor the state of the DOORS client.
The framework will very regularly call Process.exitValue()
to determine whether the DOORS client is still alive, by the time a DXL
code is under execution. This is notably to handle the case the DOORS client has crashed for unexpected reason, to ensure the framework is not
blocked waiting for an execution output that will never come. It is therefore critical this method is very fast to respond, due to the high
number of calls.
The framework will also consume bytes provided by Process.getInputStream()
and Process.getErrorStream()
. Any content
found in those streams will be considered as error outputs of the DOORS client.
This method must start a DOORS client and return immediately. It must not wait for the DXL execution to complete. Not waiting for the
DXL execution to complete is typically done using the DOORS client -W
command line switch.
doorsExe
- the DOORS client executable file.data
- the DOORS port and server information (the DOORS client -data
command line switch).user
- the DOORS user name (the DOORS client -user
command line switch).password
- the DOORS user password (the DOORS client -password
command line switch).dxlFile
- the DXL file to execute (the DOORS client -batch
command line switch).logFile
- the file in which the DXL execution shall report log information (the DOORS client -logfile
command line switch).IOException
- if the DOORS client cannot be started.