(9) The implementation of Shark workflow and the contrast of WMFC & OMG specification

zhaozj2021-02-17  53

SHARK workflow implementation and comparison of WMFC & OMG specifications

----- Ninth section: Analyze the implementation process of OBE self-belt example

Keywords: Shark workflow WMFC OMG specification

The execution of the OBE workflow, below, the execution process of the example in Test:

An instance of a repositoryManager is required when initializing the workflow engine

RepositoryManager represents repositories needed in the workflow, such as: External tool information that needs to be called in the event, and so on. Then perform the initialization of the workflow engine:

WorkflowEngine Engine = New WorkflowEngine (RepositoryManager);

After the engine is initialized, use OBE's XPDL parsing class to instantiate Package from the user-defined XPDL process.

XPDLPARSER PARSER = New Dom4jxpdlparser ();

FileInputStream in = New fileinputstream (file);

Package PKG = NULL;

Try {

PKG = PARSER.PARSE (IN);

} catch (exception e) {

Log.FATAL ("Error Parsing Configuration: E.getMessage ());

E.PrintStackTrace ();

Return;

}

Then add the initialized package to the engine instance:

Engine.AddPackage (PKG);

Then it will be implemented:

Try {

Log.info ("Executing Workflow Process" packageID ":" Processid);

IF (ExecutionMode.equalsignoreCase ("asynch")) {

Log.info ("Executing asynchronously";

Engine.executeasynch (packageId, processid, getparameters ());

} else {

Log.info ("Executing Synchronously";

Engine.executeSynch (packageID, processid, getparameters ());

}

} catch (exception e) {

Log.Error ("Error Executing Workflow Process" Processid "In Package" PackageID);

E.PrintStackTrace ();

}

.

It seems that the entire implementation process is simple.

How is the repositoryManager mentioned above?

The repository in the example has the following types:

1, BasicApplicationRepository

2, BasicProcedureRepository

3, BasicParticipantRepository

Among them, BasicParticipantRepository includes: 1) RoundrobingRoup

2) Workflowsystem

For example: add management and editing information:

Roundrobingroup editors = new roundrobingroup ();

Editors.Add (New Human);

Editors.Add (New Human ("Joe User"); RoundrobingRoup Administrators = New RoundrobingRoup ();

Administrators.Add (New Human));

Workflowsystem system = new workflowsystem ();

ParticipantRepository.put ("P1", Editors);

ParticipantRepository.put ("P2", Administrators;

ParticipantRepository.put ("p3", system);

ParticipantRepository.SetDefaultConnector;

getParticipantRepositories (). Add (participantrepository);

BasicApplicationRepository apprepository = new basICApplicationRepository ();

AppRepository.put ("A1", New DebugApplicationConnector ("App 1"));

AppRepository.Put ("a2", New DebugApplicationConnector ("APP 2"));

AppRepository.Put ("a3", New RuntimeApplicationConnector (Test_exe,

ExecutionType.synchronous)));

AppRepository.put ("A4", New DebugApplicationConnector ("APP 4", 1000));

AppRepository.put ("A5", New DebugApplicationConnector ("APP 5"));

GetApplicationRepositories (). Add (apprepository);

Below we analyze the execution process of the OBE engine based on the example binding engine provided by OBE.

to be continued

Tian Chunfeng

Accesine@163.com

转载请注明原文地址:https://www.9cbs.com/read-30270.html

New Post(0)