IJob
Description:
IJob encapsulates access to the parameters and execution of a Job.
import "OxSvrSpt.idl"
Public Methods:
HRESULT Execute ()
Properties:
IOutputParameters OutputParameters [get]
BSTR Name [get]
IInputParameters InputParameters [get]
IErrors Erros [get]
IInputFileParameters InputFileParameters [get]
IOutputFileParameters OutputFileParameters [get]
Documentation of Element Functions:
-
HRESULT Execute ()
After calling this method, the output parameters are available in the collections OutputParameters and OutputFileParameters. If an error occurs during execution of the Job, a COM error is thrown. This happens for both logical and system errors. The COM error contains the topmost message from the Error collection. The additional messages can be retrieved from the Error collection via the Errors property of this object.
Examples:
VB
' login
Dim oServer As New OxSvrSpt.Server
Dim oSession As OxSvrSpt.Session
Set oSession = oServer.Login("root", "optimal", "localhost", "4000", pwNotEncrypted)
' create job
Dim oJob As OxSvrSpt.Job
Set oJob = oSession.NewJob("dms.GetResultList")
' add parameters
Dim oParameter As OxSvrSpt.Parameter
oJob.InputParameters.AddNewIntegerParameter "Flags", 16
Set oParameter = oJob.InputParameters.AddNewXMLParameter("XML")
Dim oDomDocument As New MSXML2.DOMDocument40
Dim bSuccess As Boolean
bSuccess = oDomDocument.Load("c:\dmstest.xml")
oDomDocument.save oParameter.Stream
' execute job
oJob.Execute
' read XML from XML file parameter
Dim strXML As String
strXML = oJob.OutputFileParameters(1).XML
C++ via import mechanism
#import "../Debug/OxSvrSpt.dll" raw_method_prefix("raw_")
using namespace OxSvrSpt;
// ...
try
{
_bstr_t bstrUser = L"root";
_bstr_t bstrPassword = L"optimal";
_bstr_t bstrServer = L"adunkel";
_bstr_t bstrPort = L"4000";
_bstr_t bstrJobName = L"krn.GetServerInfo";
OxSvrSpt::IServerPtr spServer( __uuidof( OxSvrSpt::Server ));
OxSvrSpt::ISessionPtr spSession = spServer->Login( bstrUser, bstrPassword,
bstrServer, bstrPort, pwNotEncrypted );
OxSvrSpt::IJobPtr spJob = spSession->NewJob( bstrJobName );
spJob->InputParameters->AddNewIntegerParameter( L"Flags", 0 );
spJob->InputParameters->AddNewIntegerParameter( L"Info", 1 );
spJob->Execute();
_variant_t varName = spJob->OutputParameters->GetItem( L"Name" )->Value;
}
catch( _com_error& e )
{
_bstr_t bstrError = e.Description( );
if( bstrError.length() == 0 )
{
bstrError = e.ErrorMessage();
}
AfxMessageBox( bstrError );
}
Documentation of Properties:
-
IErrors Erros [get]
Errors returns the collection with the errors that occurred on the server
This contains objects of type IError.
Parameters:
[out]: pVal (VB return value) collection with the occurring errors
-
IInputFileParameters InputFileParameters [get]
InputFileParameters returns the collection with the FileParameters for passing to the server
This contains objects of type IFileParameters
Parameters:
[out]: pVal (VB return value) collection with the files for the server call
-
IInputParameters InputParameters [get]
InputFileParameters returns the collection of InputParameters.
Parameters:
[out]: pVal (VB return value) collection of input parameters
-
BSTR Name [get]
Name returns the name of the Job.
The name of the Job is specified when creating the Job object and cannot be changed afterwards.
Parameters:
[out]: pVal (VB return value) name of the Job
-
IOutputFileParameters OutputFileParameters [get]
OutputFileParameters returns the collection with the FileParameters provided by the server after calling a Job
This contains objects of type IFileParameters
Parameters:
[out]: pVal (VB return value) collection with the result files after a server call.
-
IOutputParameters OutputParameters [get]
OutputParameters returns the collection of OutputParameters
This property is the default property of the IJob interface.
Parameters:
[out]: pVal (VB return value) collection of output parameters of the Job