Use Connect Java rules to call an external Java interface
This article describes two approaches to importing Java interfaces into Process Commander.
Generally when you have a Java interface, it is implemented by a class. A class may be instantiated with a constructor or it may have a static method such as 'getInstance' by which it returns the interface. Then, anywhere downstream you pass the interface around, and as long as the other classes are written to talk to the interface, you're fine.
But there's always a starting point where you have to get a hook into a Java class; you can't instance an interface.
Rule-Connect-Java rules are good for calling a single method on something. If you're stringing together logic over several calls, it's more difficult to do.
For example, suppose you have one static method on a class, which performs some external integration. And suppose that method takes as input a complex JavaBean. Connect Java rules are fine for that.
But if you need to make a series of calls — for example some class that you need to instantiate, and then call a method to get a proxy, and then call a method on the proxy to do something, etc. - is is better to write a wrapper class that encapsulates that logic into a single method call.
In sum: If there's one class with one method that you need to call, then Connect Java is a good candidate. If you need to make a series of calls, you probably want to wrap them in a function rule or an external Java class that can be boiled down to one method. You can manipulate Javabeans through the clipboard.
Working with Java Objects in Process Commander (V5.3) describes how to implement the data model of an external Java object. It covers:
- Java pages
- Process Commander Java Properties
- the Import Java Beans Accelerator (formerly the Create Import Rules Accelerator)
- linking the data model to an application (work object)
- attaching Java objects to clipboard pages (Java pages,
- retrieving Java objects from clipboard pages
- receiving Java objects from services
- sending Java objects with connectors