tags:

views:

929

answers:

1

According to the whitepaper on the jBPM page [1], jBMP can be easily used in a standalone app. However I could not find any information about how to actually do this. I want to create a simple java app (maybe with SWT), which displays a process with jBPM. The user should then be able to modify the applications behavior, by modifying the jBPM diagram. For this purpose I also have to integrate some eclipse components I think.. any ideas how this works?

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

+1  A: 

Before you start, you may want also to see if Roamflow meets your needs as it seems to be a standalone jBPM Eclipse/RCP based viewer/editor.

Otherwise you should know how to build eclipse plug-ins, or get the book I found useful for most eclipse plugin/SWT development needs, "Eclipse Building Commercial-Quality Plug-ins", published by eclipse and Addison-Wesley. Also, I am not going to sit down and write you a test app, you need to understand the fundamentals anyhow.

  1. By stand alone they mean run in any old JVM with the right libraries. It does need to be deployed in a J2EE container, viewed through the web, etc.

  2. Look at the source code for the jBPM eclipse plug-in as it has the features you are looking for right? An SWT/eclipse based to that displays jBPM. This includes checking for extension points that jBPM may install which you can use to build your eclipse plug-in with quickly. For example: The jBPM editor code, here. Or how to serialize, here, re-use.

  3. Here is the critical SWT/drawing, a critical line is converting the jBPM into and SWT thing "g = new SWTGraphics(gc);". This seems to generate an image from a jBPM model.

    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
    }
    }
    
  4. Learn from the plug-in's plugin.xml, src located here in this case. For example, here is the jBPM adding it's view to eclipse:

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

    This may be one extension you want to copy as it seems to stand up the "view". This will help you understand how they construct the pieces of their eclipse based app. You can search for these classes in your work space and view the source code if you installed the developer versions on the JBPM plug-ins.

  5. Decide if you need to hack apart the app parts built as GMF (Graphical Modeling Framework) stuff, like the model, behavior of the view/diagram and the different edit/drawing parts. Don't mess with this unless you have too. However, understanding GMF plug-ins or looking that the examples will help you understand what jBPM plug-in pieces you might need to use, especially if editing is needed.

  6. Roll the pieces into a plug-in, remembering to reuse what pieces (plugins/pluglets) you can from the jBPM project. May sure to build your eclipse plugin as an RCP or Rich Client... (Note jBPM does not currently have a RCP, per post) so that it can as a eclipse standalone application for easier deployment to people who do not have eclipse tool knowledge.

Let me know if this gets you headed down the correct path.

Ted Johnson
wow thank you :) now I have to read and code..
Nils