Commit 5a37cec999d9649c988836c0ee5d538e2d96e0bf

Authored by Benjamin Rühl
1 parent 88b289e5

Extend documentation about JBoss

docu/img/jboss/jboss-admin-console.png 0 → 100644

22.1 KB

docu/jboss.md
... ... @@ -4,8 +4,32 @@ The intent of this file is not to provide a full documentation about JBoss, EJBs
4 4  
5 5 ## Main configuration file
6 6  
7   -A JBoss application server is configured mostly using XML files. The most important one is the `standalone.xml` which is located in `docker/wildfly/standalone.xaml`.
  7 +A JBoss application server is configured mostly using XML files. The most important one is the `standalone.xml` which is located in [docker/wildfly/standalone.xml](../docker/wildfly/standalone.xml).
  8 +The basic structure seems to be generated (guess made by second project team) but manual modifications hab do be made, too. For example the connection of the PostgreSQL JDBC driver is configured here.
8 9  
9 10 ## Building and deploying the services
10 11  
11   -When building with gradle, the modules result in seperate `.war` archives which are copied into the JBoss docker container. JBoss should then reload them automatically.
12 12 \ No newline at end of file
  13 +To see how to run the application, go to the [readme](../README.md) file.
  14 +
  15 +When building with gradle, the modules result in seperate `.war` archives which are copied into the JBoss docker container. JBoss should then reload them automatically.
  16 +In case you are unsure whether the deployment succeeded following the console output, you can use the JBoss admin web app to see if the services have been deployed into the running server.
  17 +The web app can be entered at <http://localhost:9990/>. When credentials are requested, enter `admin` as username and `Admin` as password (case sensitive!) which is the default for this console. Navigate to `Deployments` where the modules should be listed if deployment worked fine.
  18 +
  19 +![JBoss admin console](img/jboss/jboss-admin-console.png)
  20 +
  21 +## Using depedency injection to request services
  22 +
  23 +To use an EJB it can be requested using dependency injection. The dependency injection provider which is responsible for the work behind the system is `JNDI`. Use the following style to request an EJB instance.
  24 +
  25 +```java
  26 +@Resource(lookup = "java:global/global/ApplicationBean")
  27 +private Application application;
  28 +```
  29 +
  30 +The 'global' part of the lookup uri is unrelated to the `global` module but means that a globally available service is required. The field type has to be an interface type and the name at the end of the lookup uri has to be the appropriate implementation.
  31 +
  32 +## Providing services for dependency injection
  33 +
  34 +Declaring a class as EJB makes it automatically available for usage per dependency injection. Therefor an interface with the `@Remote` annotation is required if the service should be available in other modules as well. Use `@Local` otherwise.
  35 +The implementing service class can have either `@Stateless`, `@Stateful` or `@Singleton`. It is recommended to use stateless EJBs if possible.
  36 +EJBs should always be created and managed by JBoss and never be instantiated manually using the `new` keyword. This is mandatory to make things like dependency injection work.
13 37 \ No newline at end of file
... ...