Standalone jBPM application with SWT

According to the white paper on the jBPM [1] page, jBMP can be easily used in a standalone application. However, I could not find any information on how to actually do this. I want to create a simple java application (possibly with SWT) that displays a process with jBPM. Then the user should be able to change the behavior of applications by modifying the jBPM diagram. For this, I also need to integrate some components of the eclipse, which I think .. any ideas how this works?

[1] http://www.jboss.com/pdf/jbpm_whitepaper.pdf

+3
source share
2 answers

, , Roamflow , jBPM Eclipse/RCP-/.

, eclipse, , eclipse plugin/SWT, " Eclipse Building Commercial-Quality", eclipse Addison-Wesley. , , .

  • JVM . J2EE, ..

  • jBPM eclipse, , ? SWT/eclipse, , jBPM. , jBPM, eclipse. : jBPM, . , .

  • SWT/, jBPM SWT "g = SWTGraphics (gc);". , jBPM.

    protected void writeImage() {           
    SWTGraphics g = null;
    GC gc = null;
    Image image = null;
    LayerManager lm = (LayerManager)getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
    IFigure figure = lm.getLayer(LayerConstants.PRINTABLE_LAYERS);
    
    try {
        Rectangle r = figure.getBounds();
        image = new Image(Display.getDefault(), r.width, r.height);
        gc = new GC(image);
        g = new SWTGraphics(gc);
        g.translate(r.x * -1, r.y * -1);
        figure.paint(g);
        ImageLoader imageLoader = new ImageLoader();
        imageLoader.data = new ImageData[] {image.getImageData()};
        imageLoader.save(getImageSavePath(), SWT.IMAGE_JPEG);
        refreshProcessFolder();
    
    } finally {
        //SNIP
    }
    }
    
  • plugin.xml, src, . , jBPM :

    point="org.eclipse.ui.views" ... view class="org.jboss.tools.flow.jpdl4.view.DetailsView"...
    

    , , "". , eclipse. , JBPM.

  • , , GMF (Graphical Modeling Framework), , / /. , . , GMF , , jBPM- , .

  • , (/) jBPM. , eclipse RCP Rich Client... ( jBPM RCP, post), eclipse , eclipse.

, .

+2

, , jbpm- , java-. J2EE . , jbpm 4.4

,

  • jbpm
  • jars jbpm : ANTLR-runtime.jar antlr.jar dom4j.jar -core.jar javassist.jar jbpm.jar SLF4J-api.jar SLF4J-jdk14.jar SLF4J-log4j12.jar -collections.jar jta.jar Juel-api.jar Juel-engine.jar Juel-impl.jar mail.jar JDBC .
  • :

    package test.ayusman;

    import java.util.HashMap;
    import java.util.Map;

    import org.jbpm.api.Configuration;
    import org.jbpm.api.ExecutionService;
    import org.jbpm.api.ProcessEngine;
    import org.jbpm.api.ProcessInstance;
    import org.jbpm.api.RepositoryService;

    public class ProcessDeployer {

        // Create a process engine that can be used for all other work...
        // ProcessEngine is starting point for all other application.
        private static ProcessEngine jbpmProcessEngine = new Configuration()
                .setResource("jbpm.cfg.xml").buildProcessEngine();
        // private static Logger logger = Logger.getLogger(JBPMDao.class);

        private static RepositoryService repositoryService = null;
        private static ExecutionService executionService = null;
        private static ProcessInstance pi = null;
        private static String processInstanceState;
        private static String processInstanceId;


        public static void main(String[] args) {
            try {

                ProcessDeployer ejm = new ProcessDeployer();

                //Start the process...
                ejm.startProcess();

                //Analyze process... just a small fancy method
                ejm.analyzeProcess();


            } catch (Exception e) {
                e.printStackTrace();
            }

        }// End of main()


        void startProcess() throws Exception
        {

            repositoryService = jbpmProcessEngine.getRepositoryService();
            executionService =  jbpmProcessEngine.getExecutionService();

            //NOTE: The example assumes that the process definition file name is: your_process.jpdl.xml
            processInstanceId = repositoryService.createDeployment().addResourceFromClasspath("your_process.jpdl.xml").deploy();             

            //NOTE: The jpdl file has key name as "Java"
            pi = executionService.startProcessInstanceByKey("Java");  

            System.out.println("Obtained processInstanceId is: "+processInstanceId);             
        }

        void analyzeProcess() throws Exception
        {
            processInstanceState = pi.getState();
            System.out.println("processInstanceState is: "+processInstanceState);
            System.out.println("processInstanceId is: "+processInstanceId);
        }


    }// End of class ProcessDeployer
  • , SWT, JVM, SWT, , .

, : -)

+2

Source: https://habr.com/ru/post/1709835/


All Articles