xUML Implementation for Java Callback
You can now import the generated Java xLib to your xUML service model, and implement the Java callback.
JavaLibrary_HTTPServer_Example
Click here to download a simple example model that uses the HTTPServerCallback example from the Java xLib DevKit.
After the import of the library, an interface has been generated under the name specified via the @XumlLibraryClass
annotation (HttpServerCallback). Also, a related factory class for the callback interface is present. It has been generated under the name of <name of your Java class>Factory, e.g. SimpleHttpServerCallbackFactory.

xUML Model Particularities
In your service implementation, you now need to define a class that implements the Java interface (HttpServerCallback), and all of its operations. To do that, do the following:
Create a new class.
Derive that class from the Java interface by setting the Interface attribute in the Attributes panel.
Create class operations for every single interface operation.
You can copy complete interface operations including all parameters from the Java interface to the implementing class.

Regarding the implementation of the operations, you are free to do what you like, as long as all operations and parameters are implemented. You can add more properties and more operations to the class as you need. For the provided example, the class diagram looks like the following:

The implementation of the example returns a variety of messages depending on the request method and URI.
To test this example, you can deploy it and send calls to the HTTP server using a tool like Postman. To be able to reach the HTTP port from outside your PAS environment, you need to configure an endpoint in API Management that points to the service container and port like http://javalibrary-httpcallback-example:11112. The port number is set in operation getPort() and is also a setting variable. For more information on hot to create an API, refer to Creating an API.
The Callback Factory
A factory class for the callback interface has been generated to your service model under the name of <name of your Java class>Factory, e.g. SimpleHttpServerCallbackFactory. The factory’s operations will be used create (setImplementation) an instance of the callback class (HttpServerCallback) on service start, and to get (getImplementation) the contents once a Java callback is performed.
Outside this context, you can use the operations of the factory to e.g.
read the content of the class at any point in your service model (getImplementation)
exchange the implementing class at runtime if you have multiple classes that implement the interface (setImplementation).
Refer to Creating an Implementation Factory for more information on the general usage of the Implementation Factory stereotype.