You can directly deploy the repository of a Java service to a node instance via the E2E Bridge.
Deploying a Java Service Repository via the E2E Bridge
Only users who are member of a group, to which the role ADMIN or MODELER has been assigned, are allowed to deploy Java services. Users, who have only MODELER access rights, may only replace a Java service, if they themselves or a member of the same group deployed it.
Select the navigation item Deployment in the Domain section of the navigation on the left to deploy a new service or overwrite an existing one.
Browse for the repository of a Java service by clicking Browse. This repository has to be provided as a JAR file and it's structure is explained further below.
Click Select ... to proceed setting the deployment options.
Option | Description |
---|---|
Overwrite Service | If the Java service you want to deploy already exists, check this option, if you want to overwrite it. |
Startup Service | To run, the Node.js service has to be started. Select this option, if you want the Node.js service to be started automatically right after its deployment. |
After you have set the deployment options, deploy the service by clicking Upload.
If you have deployed a new service, it will be displayed in the navigation, below the node instance to which it has been deployed.
Structure of a Java Service Repository
A Java service repository has to be a self-contained JAR file containing also a folder META-INF/MANIFEST.MF holding the meta information of the Java Service.
You need to add the following name/values to META-INF/MANIFEST.MF.
Name | Mandatory | Description | Example |
---|---|---|---|
E2E-Service-Name | Name of the service. Must be unique for each E2E Bridge you deploy to. | E2E-Service-Name=helloworld | |
E2E-Service-Version | Version of the service. Can be any string. It is not parsed by the E2E Bridge. | E2E-Service-Version=1.2.3 | |
E2E-Service-Description | Short description of the service. | E2E-Service-Description=Hello World Service |
Adding Information to META-INF/MANIFEST.MF
You cannot directly create or edit the MANIFEST.MF. There are two ways to add information to this file:
- Use the command line JAR tool as described in the Java tutorial Modifying a Manifest File.
- Do it within Java code as described in Add Manifest into JAR File Using Java.
Building the JAR File
The Java service repository has to be a self-contained JAR file. With the open-source tool One-Jar you can create such a file.
An easy way to start developing a new Java service with One-Jar is the Application Generator approach.
This approach provides you with a complete Eclipse/Ant application directory, that you can use as a starting point for your own One-JAR application. The application generator is driven by a template built into the one-jar-appgen.jar file (see one-jar-appgen).
- Download one-jar-appgen-0.97.jar.
Generate the application, build, and run it.
$ java -jar one-jar-appgen-0.97.jar Enter project path (project name is last segment): c:/tmp/test-one-jar Enter java package name: com.example.onejar $ cd c:/tmp/test-one-jar $ ant $ cd build $ java -jar test-one-jar.jar test_one_jar main entry point, args=[] test_one_jar main is running test_one_jar OK.
Add source code to the src directory, library jars to the lib directory, and rebuild.
If you are using IntelliJ IDEA, you can import the project template BridgeJavaServiceTemplate.jar which uses the Gradle plugin gradle-one-jar.
Use
- Gradle task jar for building repositories without dependencies
- task selfContainedJar for building repositories which are depending on the Java libraries you added to the service.
Target Directory of the Deployment
Java services get deployed to a folder java_<name of the service> in the E2E Bridge data directory of the node instance. This folder contains the service repository (repository.jar) and a sub-folder logs to store the logs in.
Java Preferences of the Service
The Java preferences of the Java services (Java version used to run the service) is supplied via the preferences section of the xUML services as described in Preferences of the xUML Services.