[PDK Series] Using the Plugin Development Kit for BW 6.x

In the previous post, we learnt how to install the new Plugin Development Kit for BW 6.x to enable the capabilities to create our own custom palettes. Now, we are going to create our first one and test it in one real TIBCO BW process.


To do that, we need to launch the BusinessWorks Designer and launch the option to create a new plug-in BW project.

InstallingThePDK_5

After that, we have to choose between two options we can see in the modal dialog that the tool throw to us. In our case we are going to choose the left one because we need to create a new BW palette and not editing one.

UsingPDK1

Now, we will face a wizard style dialog to create our new palette. The first page we are going to specify the plug-in name, the root package and the icon. Then, we are going to specify our first activity relate to the plug-in specifying its name the activity type (Asyncrhonous, Synchronous, Signalin, Process Starter or Abstract and the icon related to this activity. In our case we are going to do a Synchronous one because we only want to implement a Hello World!.

In the next page click the Go! button we have to specify the interface of the activity and the configuration values in we need some of them. In this case, as we are only implementing a very simple acitivty that do a HelloWorld we only specify the Output Schema, using the XSD Editor the tool provide to us and creating only a new field labeled “out” and String type.

And after that the wizard completes and we come back to our known Design perspective but we could see a several project has been created:

UsingPDK2

Now, we need to add the logic to this new activity we created and the one we cannot see anywhere around the TIBCO Business Studio. To do that we have to launch another Business Studio with this new plugin, and we have to go to Run –> Run Configuration and create a new Eclipse Application configuration with this VM Arguments:

– Windows: -Dorg.osgi.framework.bootdelegation=javax.xml.* –
XX:MaxPermSize=256m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+UseParNewGC -Xms512m -Xmx768m
– GNU/Linux: -Dorg.osgi.framework.bootdelegation=javax.xml.* –
XX:MaxPermSize=256m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+UseParNewGC -Xms512m -Xmx768m
– Mac OS X: -XstartOnFirstThread -Dorg.osgi.framework.bootdelegation=javax.xml.* -XX:MaxPermSize=512m -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -XX:+UseParNewGC -Xms512m -Xmx768m

And in this new Business Studio we import the projects related to the BW6 plug-in and we need to modify the Java code to introduce our custom behavior in our case we are going to HelloWorldTestSynchronousActivity:

private  void buildStructuredOutput(N inputData, N HelloWorldTestOutput, ProcessingContext processingContext, Object data) throws Exception {
 MutableModel mutableModel = processingContext.getMutableContext().getModel();
 NodeFactory noteFactory = mutableModel.getFactory(HelloWorldTestOutput);
//if the element's MaxOccurs and MinOccurs are 1, that means this element's size is 1
 N out = noteFactory.createElement("", "out", "");
 mutableModel.appendChild(HelloWorldTestOutput, out);
 //set default value here, please set value by your business
 N outvalueNode = noteFactory.createText("Hello World!");
 mutableModel.appendChild(out, outvalueNode);
 // begin-custom-code
 // add your own business code here
 // end-custom-code
 }

And that’s it! We have all things ready to use our new palette. In this child Business Studio, we create a new BW project to test it. And we could see our new Palette named “Example” with our custom icon:

UsingPDK3

And that’s it, We already have our new plug-in developed and available. In the next post we are going to learn how to package this plug-in to use in our developments.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s