Skip to content

Commit

Permalink
fix #40
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurgregorio committed Dec 22, 2018
1 parent 7327870 commit f5e27c2
Showing 1 changed file with 34 additions and 55 deletions.
89 changes: 34 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
# Library

A simple demo application to show how to work with the default technologies of JavaEE version 7.
A simple demo application to show how to work with the default technologies of JavaEE version 8. This conceptual architecture makes use of the following technologies:

This conceptual architecture makes use of the following technologies:

The core:

- Hibernate 5 for JPA 2.1
- Weld 2.4 for CDI 1.1
- Mojarra for JSF 2.2 + Primefaces 6.2 + AdminLTE 2.4 + Bootstrap 3
- Apache Delta Spike Data Module for database querying and repositories functionality
- Java 11 and Java EE 8 with Wildfly 14+ and PostgreSQL 10+
- Hibernate 5 for JPA 2.2
- Weld 3.0 for CDI 2.0
- Mojarra for JSF 2.3 + Primefaces 6.2 + AdminLTE 2.4 + Bootstrap 3
- Apache Delta Spike JPA and Data Module for database querying and repositories management
- Apache Shiro 1.4 through [ShiroEE](https://github.com/arthurgregorio/shiro-ee) for Security with LDAP/AD and database authentication support
- Maven for building and dependency management
- Flyway for database migrations

The extras:

- Maven for dependency management and build
- Flyway 5.2 for database migrations
- Database audit with Hibernate Envers 5
- Hibernate Validator for Bean Validation
- Omnifaces and PrimefacesExt for JSF utilities
- Jackson for JSON support
- Lombok, Google Guava and Coomons Lang for class level utilities
- Omnifaces 3 and PrimefacesExt for JSF utilities
- Jackson for JSON support
- Lombok, Google Guava and Apache Commons-lang for class level utilities
- Mustache for e-mail templating
- Webservices with JAX-RS (RestEasy)

The demo makes use of a custom implementation of [AdminLTE](https://adminlte.io/) integrated with Boostrap 3 and Primefaces for a better UI with modern features and mobile support.
The demo makes use of a custom implementation of [AdminLTE](https://adminlte.io/) integrated with Boostrap 3 and Primefaces for a better UI, modern features and mobile support.

And also, inside the application you can find (already functional) a simple CRUD of Users and User Groups with permission based authentication and LDAP/AD integration with local bind accounts, all of this provided by ShiroEE.
Also, inside the application you can find (already functional) a simple CRUD of Users and User Groups with permission based authentication and LDAP/AD integration with local bind accounts, all of this provided by ShiroEE.

It's not much say, that if you want a **production ready architecture**, this is the project that you are looking for.
It's not much say, that if you want a **production ready architecture**, this is the project you are looking for.

## How to: configure

First of all, you will need to download the latest version of Wildfly application server. This is the homologated version, maybe, with a little bit of changes ~~or no~~ you can run this on Payara, Glassfish or any other JEE 7 server.
First of all, you will need to download the latest version of Wildfly application server. This is the homologated version, maybe, with a little bit of changes ~~or no~~ you can run this on Payara, Glassfish or any other JEE 7+ server.

Download Wildfly [here](http://wildfly.org/downloads/) and configure the datasource for the application by editing the ``` standalone.xml``` or ```standalone-full.xml``` (you will know which one to change) to add this lines to the datasource section of the file:

Expand Down Expand Up @@ -61,7 +56,10 @@ Download Wildfly [here](http://wildfly.org/downloads/) and configure the datasou
</datasource>
```

And these lines to the mail subsystem (search for ```mail-session```) to enable the demo sending e-mail messages:
> **Quick note**: the datasource will not work if you don't have the PostgreSQL driver enabled in the wildfly modules. To do this, follow [this blog post](https://bok.stenusys.com/index.php/2018/02/12/how_to_setup_postgresql_datasource_with_wildfly/).

If you want to send e-mails, these lines should be added to the mail subsystem (search for ```mail-session```):

```xml
<mail-session name="my-email" debug="true" jndi-name="java:/mail/library" from="[email protected]">
Expand All @@ -77,7 +75,7 @@ And the e-mail socket to the ```socket-binding-group``` at the end of the file:
</outbound-socket-binding>
```

After this, create the database on you local instance of PostgreSQL 9+ to match the Wildfly configurations and enable the deployment of the application:
After this, create the database on you local instance of PostgreSQL 10+ to match the Wildfly configurations and enable the deployment of the application:

```sql
-- the user
Expand All @@ -101,7 +99,15 @@ CREATE USER sa_library WITH
CONNECTION LIMIT = -1;
```

The tables and the initial data (default user, group and authorizations) will be created by Flyway with the migrations strategy.
The tables and the initial data (default user, group and authorizations) will be created by Flyway with the migrations strategy. If you want to run this application
in development mode, Hibernate will create the tables, but you should create the schemes by hands on PgAdmin or another similar software:

```sql
CREATE SCHEMA configuration AUTHORIZATION sa_library;
CREATE SCHEMA registration AUTHORIZATION sa_library;
CREATE SCHEMA configuration_audit AUTHORIZATION sa_library;
CREATE SCHEMA registration_audit AUTHORIZATION sa_library;
```

## How to: run on IDE

Expand All @@ -112,42 +118,15 @@ Just import the maven project and deploy to you already configured Wildfly serve
Build the project. On the root folder run:

```shell
mvn clean package
mvn clean package -Prelease
```

This will trigger the maven build to work with the default profile, *ALPHA*, with the following configurations available on the *pom.xml* file:

```xml
<profile>
<id>ALPHA</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<application.version>
${project.version}-ALPHA
</application.version>
<skip.tests>false</skip.tests>
<jsf.stage>Development</jsf.stage>
<ldap.enabled>false</ldap.enabled>
<ldap.url>ldap://localhost</ldap.url>
<ldap.baseDn>OU=Usuarios,DC=arthurgregorio,DC=eti,DC=br</ldap.baseDn>
<ldap.user>CN=usuaribind,OU=Aplicacoes,DC=arthurgregorio,DC=eti,DC=br</ldap.user>
<ldap.password>minha-senha</ldap.password>
</properties>
</profile>
```
If no profile is used, this will tell maven to build the development version with no migrations and the database need to be initialized manually like is said above.

The configuration also have other profiles for you to configure according to your need:
The build configuration also have other profiles for you to configure according to your need:

- *BETA* for beta releases
- *RC* for release candidate releases
- *RELEASE* for the final, production ready releases

To use a specific profile, run the maven build with:

```shell
mvn -P(the-profile) clean package
```

After the build, open the wildfly admin console on the web browser and in the deployments section, upload the war file created by the build in the target folder (named *library-1.0.0-(selected-profile)*) inside the project and access it on the default URL: https://localhost:8080/, and you're done! Enjoy the demo.
After the build, open the wildfly admin console on the web browser and in the deployments section, upload the war file created by the build in the target folder (named *library-1.0.0-(selected-profile)*) inside the project and access it on the default URL: https://localhost:8443/, and you're done! Enjoy the demo.

0 comments on commit f5e27c2

Please sign in to comment.