Enterprise Java

Java Code Geeks Andygene Web Archetype

Hello all,

We are happy to announce that the first release of a set of maven archetypes is out!!! The goal of this set is to provide project templates that can fulfill various development needs. You can find the JCG roadmap at the end if this post.

This first release aims to provide a project template – architecture for web applications. The name of the archetype is jcg-andygene-archetype and it is hosted at the following location: https://github.com/javacodegeeks/jcg-andygene-web/

The license for this set of archetypes is Apache License. Developers are free to change it.

Archetype Features

Featured Description

Spring MVC: Spring’s Web MVC framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale and theme resolution as well as support for upload files.

Spring Security: Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications

Dojo: Javascript library for cool user interfaces.

JasperReports: Powerful reporting tool. It can generate reports in a various set of formats.

Drools: Powerful business logic platform . Drools use Rete algorithm for decisions and can be dynamically be configured to change business logic of your application.

Activiti: Powerful bpmn2 implementation that users can use as a link between business people and developers.

CXF: Web Services stack.

ActiveMQ: JMS implementation .The Java Message Service (JMS) API is a Message Oriented Midleware (MOM) API for sending messages between two or more clients.

Ehcache:Second level cache that can boost your application.

Hibernate JPA2: Implementation of JPA2 Specification. An Object Relational Map.

Archetype Requirements

  • Apache Maven 2
  • Tomcat 6
  • (Optional) A development toolset (e.g. Eclipse or SpringSourceTool Suite or any other toolset. For conveniency it would be desirable to support maven integration) for viewing the created project architecture and for developing based on this archetype.

Installation Instructions

Download the archetype. Extract it somewhere in your disk and type the following in the root folder of the archetype:

mvn install

Generating Your First Project

To generate you first project type the following in your workspace directory:

mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=com.javacodegeeks -DarchetypeArtifactId=jcg-andygene-web-archetype

You will be prompted for several parameters of the archetype. An example is the following:

Define value for property 'groupId': : com.javacodegeeks
Define value for property 'artifactId': : MyFirstJCGProject
Define value for property 'version': 1.0-SNAPSHOT: 1.0.0.Final
Define value for property 'package': com.javacodegeeks: com.javacodegeeks
[INFO] Using property: activemqpersistencedir = ~/activemq
[INFO] Using property: activemqpersistencesize = 32mb
[INFO] Using property: activemqsessioncachesize = 100
Define value for property 'activitipassword': : nothing
[INFO] Using property: activitiurl = jdbc\:h2\:mem/activiti
[INFO] Using property: activitiusername = sa
Define value for property 'databasepassword': : nothing
[INFO] Using property: databaseurl = jdbc\:h2\:mem/andygene
[INFO] Using property: databaseusername = sa
[INFO] Using property: db = h2
[INFO] Using property: tomcathost = localhost:8080
Confirm properties configuration:
groupId: com.javacodegeeks
artifactId: MyFirstJCGProject
version: 1.0.0.Final
package: com.javacodegeeks
activemqpersistencedir: ~/activemq
activemqpersistencesize: 32mb
activemqsessioncachesize: 100
activitipassword: nothing
activitiurl: jdbc\:h2\:mem/activiti
activitiusername: sa
databasepassword: nothing
databaseurl: jdbc\:h2\:mem/andygene
databaseusername: sa
db: h2
tomcathost: localhost:8080

This will generate a maven project with name MyFirstJCGProject (Depending on the parameter you provided before)

Below the structure of the main elements of this project is presented:

Under src/main/java:

  • dao: It contains the Data Access Objects (DAOs)
  • domain: It contains the Data Transfer Objects (DTOs)
  • drools: It contains the drool object used.
  • jms: It contains the JMS listener and sender.
  • service and service/impl: It contains the main services.
  • util: It contains various utilities (e.g. validation)
  • web: It contains the controllers.
  • webservices: It contains the soap interfaces.

Under src/main/resources:

  • activiti: It contains the flows.
  • drools: It contains the rules.
  • META-INF: It contains the persistence.xml.
  • META-INF/spring: It contains properties files and application context for spring relates sources.

Under src/test:

  • java: It contains the unit tests.
  • Resources: It contains log4j.

Under src/main/webapp (files for the we application):

  • /WEB-INF/spring: It contains the spring descriptor for web application.
  • /WEB-INF/layouts: It contains the web templates.
  • /WEB-INF/reports: It contains the jasper reports.
  • /WEB-INF/classes: It contains the web properties.
  • /WEB-INF/views: It contains the structure of the web pages.

Running/building Your First Project

To run – build your project, type the following (if your development toolkit has maven integration you can perform the following action from inside your toolkit):

cd MyFirstJCGProject
mvn install

A war file will be generated at target/MyFirstJCGProject.war . Copy this file at TOMCAT_HOME/webapps.
Start Tomcat and point the browser at the following location http://tomcathost/MyFirstJCGProject

Tomcat Configuration

You must edit catalina.sh, for mac or linux ,or catalina.bat, if you are running on windows, located at TOMCAT_HOME/bin and add the following lines:

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 
-server -Xms1536m -Xmx1536m
-XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
-XX:MaxPermSize=256m -XX:+DisableExplicitGC"

Notice: Drools require connection to the internet .If you want to run your project without having access to the internet copy MyFirstJCGProject/src/main/resources/META-INF/spring/drools-spring-1.0.0.xsd to a location to your drive and edit MyFirstJCGProject/src/main/resources/META-INF/spring/applicationContext-drools.xml : Change http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd to file:///path/to/drools-spring-1.0.0.xsd.

Archetype Supported Databases:

  • H2(default) db property value [h2]
  • Postgres db property value [postgres]
  • Mysql db property value [mysql]
  • Oracle db property value [oracle]

Notice: Case you choose oracle you must download oracle, oracle driver and install it to your repository.

JCG Roadmap:

Java Code Geeks plans to provide more tools to the community in the near future. The following projects are in the Roadmap:

jcg-andygene-soa-archetype:

  • Spring Integration
  • Spring Batch
  • Drools
  • Activiti
  • Smooks

jcg-andygene-nosql-archetype:

  • MongoDB
  • HBase(hadoop) 

jcg-andygene-jcr-archetype:

  • JackRabbit

jcg-andygene-telecom-archetype:

  • Mobicents Sip Servlets
  • SMS/MMS

jcg-andygene-console:

  • Human Task Manager
  • JMX Console
  • Rule Hot Deployment
  • Smooks Hot Deployment
  • Activiti Hot Deployment

appboost:

  • Eclipse plugin that combines the above technologies for rapid development of applications.

Related Articles:

Panagiotis Paterakis

Panagiotis is an open source enthusiast. In the morning he works as a freelancer implementing a wide variety of applications/services for the telecom industry (teleconference, NGIN, SOA). As a night job he craves to contribute to several open source projects. His latest activity is a forthcoming open source software that will bring the non trivial applications closer to the cloud
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
Back to top button