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: http://code.google.com/p/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:

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


eight + 4 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close