2. About Me
CTO & Co-Founder @ Signature App House
Software Architecture @ FICO.com
Blogger at thjug.blogspot.com
Twitter Addict
Programmer lover <3
(c) copyright 2013 nuboat in wonderland
Sunday, June 16, 13
3. Requirement
Java SDK 7u21 or latest
Netbeans JavaEE 7.3 or latest
PostgreSQL 9.2 or latest
Chrome Browser latest version
Postman - REST Client
(c) copyright 2013 nuboat in wonderland
Sunday, June 16, 13
4. Topics
Netbeans - Create Development Test Deploy
Maven - Library Management
Servlet + JAX-RS - RESTful Webservice
Guice - Transaction & Dependency Injection
JPA - Object Relational Mapping
Shiro - Encrypt Password
TestNG - Unit Test Framework
(c) copyright 2013 nuboat in wonderland
Sunday, June 16, 13
5. Netbeans
NetBeans IDE lets you quickly and easily develop Java desktop, mobile, and
web applications, while also providing great tools for PHP and C/C++
developers. It is free and open source and has a large community of users
and developers around the world.
Best Support for Latest Java Technologies
NetBeans IDE provides first-class comprehensive support for the newest
Java technologies and latest Java enhancements before other IDEs. It is the
first IDE providing support for JDK 7, Java EE 7, and JavaFX 2.
With its constantly improving Java Editor, many rich features and an
extensive range of tools, templates and samples, NetBeans IDE sets the
standard for developing with cutting edge technologies out of the box
Sunday, June 16, 13
6. Maven
Standard Build Infrastructure
Build Tool
Dependency Management Tool
Quality Tool
Opensource Apache Project
(c) copyright 2013 nuboat in wonderland
http://thjug.blogspot.com/2013/04/what-is-maven-1.html
Sunday, June 16, 13
7. MVN Standard Directory
(c) copyright 2013 nuboat in wonderland
my-app
|-- pom.xml
|-- target
|-- src
|-- main
| `-- java
| `-- resources
| `-- webapp
|
|-- test
`-- java
`-- resources
Sunday, June 16, 13
8. Jersey
Jersey is the open source, production quality, JAX-RS (JSR 311 & JSR 339)
Reference Implementation for building RESTful Web services. But, it is also
more than the Reference Implementation. Jersey provides an API so that
developers may extend Jersey to suit their needs.
Sunday, June 16, 13
9. Guice
Google Guice (pronounced "juice")[1] is an open source software
framework for the Java platform released by Google under the Apache
License. It provides support for dependency injection using annotations to
configure Java objects.[2] Dependency injection is a design pattern whose
core principle is to separate behavior from dependency resolution.
Example
@InjectLogger Logger logger;
@Inject SigninFacade facade;
@Inject EntityManager em;
Sunday, June 16, 13
10. JPA
Development of a new version of JPA, namely JPA 2.0 JSR 317 was started
in July 2007. JPA 2.0 was approved as final on December 10, 2009.
The focus of JPA 2.0 was to address features that were present in some of
the popular ORM vendors but couldn't gain consensus approval for JPA 1.0.
The main features included in this update are:
• Expanded object-relational mapping functionality
• support for collections of embedded objects, linked in the ORM with a
many-to-one relationship
• multiple levels of embedded objects
• ordered lists
• combinations of access types
• A criteria query API
• standardization of query 'hints'[clarify]
• standardization of additional metadata to support DDL generation
• support for validation
Sunday, June 16, 13
11. (c) copyright 2013 nuboat in wonderland
Create Project
Sunday, June 16, 13
12. (c) copyright 2013 nuboat in wonderland
Create Project
Sunday, June 16, 13
13. pom.xml
Model Attribute
(c) copyright 2013 nuboat in wonderland
<modelVersion>4.0.0</modelVersion>
<groupId>com.thjug</groupId>
<artifactId>Services</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Services</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Sunday, June 16, 13
35. (c) copyright 2013 nuboat in wonderland
Facade Pattern
http://java.dzone.com/articles/design-patterns-uncovered-1
Sunday, June 16, 13
36. (c) copyright 2013 nuboat in wonderland
Facade Pattern in Project
Signin SigninFacade
SigninService
HistoryService
Client Facade
Class 1
Class 2
Sunday, June 16, 13
37. (c) copyright 2013 nuboat in wonderland
import com.google.inject.ImplementedBy;
import com.thjug.facade.impl.SigninFacadeImpl;
@ImplementedBy(value = SigninFacadeImpl.class)
public interface SigninFacade {
! public boolean authen(final String username, final String password)
! ! ! throws Exception;
}
SigninFacade.java
Sunday, June 16, 13