SlideShare uma empresa Scribd logo
1 de 39
Enterprise Java Web
 Application Frameworks &
Sample Stack Implementation


       Mert ÇALIŞKAN
         mcaliskan@stm.com.tr

               STM Inc.
                 2009
Who am I?


• The Software Plumber :)
    SCJP certified dude bla bla...
• Open Source Evangelist
  Founder & Author of various Open Source
  Projects
• Member of MyFaces Community
  OpenLogic Expert Community Member
Agenda

• The aim: Enterprise Java WebApp Framework
• Which stack to choose?
•
• The Stack
• Questions are welcome anytime..!
The aim: Enterprise WebApp Framework


• MVC pattern
• Quality & Competency of “The Stack”
• Performance & Scalability
• Learning Curve & Development Speed !
             don’t let cutting edge turn into bleeding edge...
             release early & release often..!


•   Community Factor & Open Source support (forums-
    mailing lists & etc.)
Which stack to choose?
               UI                              Controller/Dep.Inj.
         JSF        Struts                   Spring          Guice         HiveMind

Spring MVC     WebWork        ZK               picoContainer          XWork

   Wicket       Tapestry      GWT
                                             Model/Persistence Layer
      Echo3       Cocoon
                                                  Hibernate          iBatis

     Integration                                          Toplink      KODO

Apache CXF     Apache Axis2             IDE                  EclipseLink

                                   Eclipse     IntelliJ
      Spring WS
                                                IDEA
                               JDeveloper
                                             NetBEANS
• It’s nothing new!
      not “yet another java framework”
• It’s a stack demonstration with OSS
• Released on 01.2009
• http://code.google.com/p/mesir
• 2000+ downloads
DOMAIN MODEL




  AddressBook                      Contact
id                             id
                1       0..*
text                           name
creationDate                   email
contacts                       phone
THE STACK
    VIEW
                       MAVEN
 JSF
                                ECLIPSE
   FACELETS

ORCHESTRA                Apache CXF



                           MODEL
 CONTROLLER
                                    JPA
                        HIBERNATE
                         H.SEARCH
   SPRING
                             H.VALIDATOR
       with SecuRITY
                       ENVERS
JSF-1
•   A standard (v1.2_13 and v2.0.1 FCS)

•   A component oriented & event-driven framework




• Binding makes JSF Powerful
    Bind a bean’s variable to component
    <h:inputText value=“#{person.name}” />

    Bind a method to the action component
    <h:commandButton
               action=“#{personSavePage.savePerson}” />


•   Conversion & Validation
    no hassle with java.util.Date
    extensible - write your own converter & validator
JSF-2

• 3rd Party Ajaxified Frameworks
    PrimeFACES - Crazy Turks
    RichFACES - JBoss
    IceFACES - Sun
    ADFFaces - Oracle

• IDE Support
    (Eclipse - NetBeans - JDeveloper)


• Everything’s gonna be alright with JSF 2.0 :)
FACELETS

• ViewHandler created for JSF
• mixing JSF + JSP for JSF 1.x
• well balanced HTML : xhtml
• Templating
• Composite Components
SPRING-1

• Dependency Injection & IoC
    with XML and annotations


• JEE ( JMS, EJBs, JCA ...)


• AOP
• ORM Integration, DAO Support
    tx management, entityManager
SPRING-2
                         ORM
 DAO                                                Web
                        Hibernate
Spring JDBC
                            JPA      JEE        Spring WEB MVC
                         TopLink                    Framework
Transaction
                           JDO                      Integration
management                            JMX
                           OJB                         Struts
                          iBatis       JMS           Tapestry
                                      JCA                JSF
                                    Remoting            JSPs
                                       EJB            Velocity
                                      Email         FreeMarker
              AOP                                 JasperReports
                                                       Excel
                                               Spring Portlet MVC
           Spring AOP
        AspectJ Integration
SPRING-3

<context:property-placeholder location="classpath:application.properties">
...
<context:component-scan base-package="tr.mesir" />
...
<tx:annotation-driven />
...
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-
method="close">
     <property name="driverClassName" value="${database.driver}"/>
     <property name="url" value="${database.uri}"/>
     <property name="username" value="${database.username}"/>
     <property name="password" value="${database.password}"/>
</bean>
...
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
     <property name="entityManagerFactory" ref="entityManagerFactory" />
SPRING-4
@Service("addressBookService")
public class AddressBookServiceImpl implements
AddressBookService {
  ...	
	 @Autowired
	 private AddressBookDAO addressBookDAO;
  ...
}

@Repository
public class AddressBookDAOImpl implements AddressBookDAO {
  ...
	 @PersistenceContext
	 protected EntityManager entityManager;
  ...
}
MyFaces ORCHESTRA


• Conversation Scoped beans &
  Conversation Scoped Persistence Contexts
     LazyInitializationException or NonUniqueObjectException


• Heavily built-on Spring Framework
JPA-1


• Standard (Java EE 5.0)
  object/relational mapping and persistent management interface


• Support from different vendors
  hibernate - toplink - eclipselink - kodo ...

• Enhanced Query Langugage (JPQL)
JPA-2


@Entity
public class AddressBook extends BaseObject {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @OneToMany(cascade={CascadeType.ALL})
	   @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
	   private List<Contact> contacts = new ArrayList<Contact>();
}
JPA-3

Some DAO code:
public AddressBook loadById(Long id) {
	 return entityManager.find(AddressBook.class, id);
}

public void save(AddressBook addressBook) {
	 entityManager.persist(addressBook);
}

public List<String> findAllTitles() {
	 	 return entityManager.createQuery("select ab.title from
AddressBook ab").getResultList();
}
HIBERNATE-1


• Object / Relational Mapping framework
• No hassle with result set handling object
  conversion and SQL, well almost for SQL :)
• Support for any DB with dialects
  Oracle, MySQL, PostgreSQL, HSQL, DB2, Sybase and many more....
Hibernate Search

•   Bringing full text search engine to the
    persistence domain model
                        e.g. : amazon search


•   Apache Lucene™ under the hood

•   Lucene Directory
      File - DB - in mem

•   JPA Triggered Event System
      Persist - Update - Delete
H.S. - How To Use
• Configuration
    Transparent with JPA
      (hibernate entity manager)
      (hibernate annotations)
• Annotation Based
   @Indexed
   @Field(store, index)
   @IndexedEmbedded
   .....
H.S. - Example

@Entity
@Indexed
public class AddressBook extends BaseObject {

    @Field(index=Index.TOKENIZED, store=Store.NO)
    private String title;


    @OneToMany(cascade={CascadeType.ALL})
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    @IndexedEmbedded
    private List<Contact> contacts =
                    new ArrayList<Contact>();
    ....
}
H.S. - Example

   @SuppressWarnings("unchecked")
public List<AddressBook> findByWord(String searchWord) throws ParseException {

	   // Since contacts list is declared as @IndexedEmbedded inside AddressBook,
	   // we can search through the name or email of a contact also.
	   MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] {
	   	 	 "title", "contacts.name", "contacts.email" },
	   	 	 new StandardAnalyzer());
	   Query query = parser.parse(searchWord);

	   FullTextQuery ftq = getFullTextEntityManager().createFullTextQuery(
	   	 	 query, AddressBook.class);
	   return ftq.getResultList();
}
HIBERNATE VALIDATOR-1

• Reference implementation for JSR 303:
  Bean Validation
• DRY (Don’t Repeat Yourself)
                express your domain constraints once..!
                property2DDLSchema


• annotation-based
  @NotNull   @NotEmpty     @Length(min=, max=)       ........
   @Email    @Pattern       @Valid ........


• custom validators
HIBERNATE VALIDATOR-2


@Field
@NotEmpty(message="Name should not be empty")
@Length(min=4, max=40)
private String name;
	
@Field
@NotEmpty(message="Email should not be empty")
@Email
private String email;
HIBERNATE ENVERS-1


• Versioning for JPA entities
• A part of Hibernate with Hib.3.5
• Simple to implement with annotations
  @Audited ....


• Querying on Revisions, Entity at Revisions
HIBERNATE ENVERS-2
                   Entities
R    id=”1”                               id=”4”
e   data=”x”                             data=”p”

v               id=”2”         id=”3”
i              data=”a”       data=”x”

s
     id=”1”     id=”2”
i   data=”y”   data=”b”
o
n               id=”2”                    id=”4”
               data=”c”                  data=”r”
s
HIBERNATE ENVERS-3


@Entity
@Indexed
@Audited
public class Contact extends BaseObject {

    @Field
    @Versioned
    private String name;
}
Apache CXF-1

• open-source services framework
• annotation driven
• JAX-WS & JAX-RS compliant
• soap + rest
• xml + json
Apache CXF-2
@Component("addressBookWebService")
@WebService
public class AddressBookWebService {

	   @Autowired
	   private AddressBookService addressBookService;
	
	   @WebMethod
	   public List<String> allAddressBookTitles() {
	   	 return addressBookService.findAllTitles();
	   }
}

spring configuration:
<jaxws:endpoint id="addressBookWS"
                implementor="#addressBookWebService"
                address="/addressbook" />
Apache CXF-3

http://localhost:8080/mesir/ws/addressbook/allAddressBookTitles
MAVEN

• Stop “building the build” and focus on
  building the application...!
• A uniform build system...
• Project Object Model (POM)
• Guidelines for best practices while doing
  development
  (TDD - Cont. Int. & etc.)
MAVEN - The POM-1

<project ...>	
   <modelVersion>4.0.0</modelVersion>
   <groupId>tr.mc</groupId>
   <artifactId>mesir</artifactId>
   <packaging>war</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>mesir</name>
   <url>http://code.google.com/p/mesir</url>
   <description>Skeleton project for java based web applications</description>
   ...
   ...
   ...
   ...
</project>
MAVEN - The POM-2

    <dependencies>
       ...
	    	 <dependency>
	    	 	 <groupId>org.springframework</groupId>
	    	 	 <artifactId>spring</artifactId>
	    	 	 <version>2.5.6</version>
	    	 </dependency>
	    	 <dependency>
	    	 	 <groupId>org.springframework</groupId>
	    	 	 <artifactId>spring-test</artifactId>
	    	 	 <version>2.5.6</version>
	    	 	 <scope>test</scope>
	    	 </dependency>
       ...
    </dependencies>
MAVEN - The POM-3
	   <repositories>
	   	 <repository>
	   	      <id>mesir-repo</id>
	   	      <url>http://mesir.googlecode.com/svn/trunk/mavenrepo</url>
	   	 </repository>	
	   	 <repository>
	   	 	 <id>jboss</id>
	   	 	 <url>http://repository.jboss.com/maven2</url>
	   	 </repository>
	   	 <repository>
	   	 	 <id>apache-snapshot</id>
	   	 	 <url>http://people.apache.org/repo/m2-snapshot-repository</url>
	   	 </repository>
	   </repositories>
ECLIPSE-1

• Universal toolset for Development
• Open Source IDE
• Extensible architecture based on plugins
• Specified mostly on Java but development
  language is independent...
       CDT - PHP - Cobol


• Plugins used while developing mesir:
     subclipse
     m2eclipse
ECLIPSE-2



•
Thank you...


    http://www.jroller.com/mert

http://www.twitter.com/mertcaliskan

Mais conteúdo relacionado

Mais procurados

What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8PT.JUG
 
Getting Started with Java EE 7
Getting Started with Java EE 7Getting Started with Java EE 7
Getting Started with Java EE 7Arun Gupta
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsMurat Yener
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondOracle
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6Bert Ertman
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServicesMert Çalışkan
 
Finally, EE Security API JSR 375
Finally, EE Security API JSR 375Finally, EE Security API JSR 375
Finally, EE Security API JSR 375Alex Kosowski
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaC4Media
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Hirofumi Iwasaki
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015Edward Burns
 
Seven Points for Applying Java EE 7
Seven Points for Applying Java EE 7Seven Points for Applying Java EE 7
Seven Points for Applying Java EE 7Hirofumi Iwasaki
 
Testing Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianTesting Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianReza Rahman
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewEugene Bogaart
 
Contributors Guide to the Jakarta EE 10 Galaxy
Contributors Guide to the Jakarta EE 10 GalaxyContributors Guide to the Jakarta EE 10 Galaxy
Contributors Guide to the Jakarta EE 10 GalaxyJakarta_EE
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reza Rahman
 

Mais procurados (18)

What's Coming in Java EE 8
What's Coming in Java EE 8What's Coming in Java EE 8
What's Coming in Java EE 8
 
Getting Started with Java EE 7
Getting Started with Java EE 7Getting Started with Java EE 7
Getting Started with Java EE 7
 
Java EE Revisits GoF Design Patterns
Java EE Revisits GoF Design PatternsJava EE Revisits GoF Design Patterns
Java EE Revisits GoF Design Patterns
 
What's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and BeyondWhat's New in WebLogic 12.1.3 and Beyond
What's New in WebLogic 12.1.3 and Beyond
 
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David DelabasseeJavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
JavaCro'15 - Java EE 8 - An instant snapshot - David Delabassee
 
JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6JavaOne 2011: Migrating Spring Applications to Java EE 6
JavaOne 2011: Migrating Spring Applications to Java EE 6
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
 
Finally, EE Security API JSR 375
Finally, EE Security API JSR 375Finally, EE Security API JSR 375
Finally, EE Security API JSR 375
 
Project Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To JavaProject Jigsaw in JDK 9: Modularity Comes To Java
Project Jigsaw in JDK 9: Modularity Comes To Java
 
Move from J2EE to Java EE
Move from J2EE to Java EEMove from J2EE to Java EE
Move from J2EE to Java EE
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015HTTP/2 comes to Java.  What Servlet 4.0 means to you. DevNexus 2015
HTTP/2 comes to Java. What Servlet 4.0 means to you. DevNexus 2015
 
Seven Points for Applying Java EE 7
Seven Points for Applying Java EE 7Seven Points for Applying Java EE 7
Seven Points for Applying Java EE 7
 
Java on Azure
Java on AzureJava on Azure
Java on Azure
 
Testing Java EE Applications Using Arquillian
Testing Java EE Applications Using ArquillianTesting Java EE Applications Using Arquillian
Testing Java EE Applications Using Arquillian
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
Contributors Guide to the Jakarta EE 10 Galaxy
Contributors Guide to the Jakarta EE 10 GalaxyContributors Guide to the Jakarta EE 10 Galaxy
Contributors Guide to the Jakarta EE 10 Galaxy
 
Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!Reactive Java EE - Let Me Count the Ways!
Reactive Java EE - Let Me Count the Ways!
 

Destaque

Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)
Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)
Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)07Shayman
 
The Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongThe Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongJAXLondon2014
 
Harrell - Revisioning Strengths and Virtues in the Context of Gender and Culture
Harrell - Revisioning Strengths and Virtues in the Context of Gender and CultureHarrell - Revisioning Strengths and Virtues in the Context of Gender and Culture
Harrell - Revisioning Strengths and Virtues in the Context of Gender and CultureShelly Harrell
 
Srand011 personal addressbook
Srand011 personal addressbookSrand011 personal addressbook
Srand011 personal addressbookAndroidproject
 
Play Framework workshop: full stack java web app
Play Framework workshop: full stack java web appPlay Framework workshop: full stack java web app
Play Framework workshop: full stack java web appAndrew Skiba
 
AddressBook to Contacts
AddressBook to ContactsAddressBook to Contacts
AddressBook to ContactsTakaaki Tanaka
 
AEGEE - Address Book Project - Agora Aachen
AEGEE - Address Book Project - Agora AachenAEGEE - Address Book Project - Agora Aachen
AEGEE - Address Book Project - Agora Aachenaegee.statutory
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learnedPeter Hilton
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Saeed Zarinfam
 
Lambda Architecture and open source technology stack for real time big data
Lambda Architecture and open source technology stack for real time big dataLambda Architecture and open source technology stack for real time big data
Lambda Architecture and open source technology stack for real time big dataTrieu Nguyen
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1nhepner
 
Software requirements specification
Software  requirements specificationSoftware  requirements specification
Software requirements specificationKrishnasai Gudavalli
 

Destaque (16)

Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)
Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)
Tasks 1, 2 and 3 (User Interface, Assets List, and my MoSCow)
 
The Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh LongThe Full Stack Java Developer - Josh Long
The Full Stack Java Developer - Josh Long
 
User guide
 User guide User guide
User guide
 
HTML5 addressbook
HTML5 addressbookHTML5 addressbook
HTML5 addressbook
 
Harrell - Revisioning Strengths and Virtues in the Context of Gender and Culture
Harrell - Revisioning Strengths and Virtues in the Context of Gender and CultureHarrell - Revisioning Strengths and Virtues in the Context of Gender and Culture
Harrell - Revisioning Strengths and Virtues in the Context of Gender and Culture
 
Srand011 personal addressbook
Srand011 personal addressbookSrand011 personal addressbook
Srand011 personal addressbook
 
Play framework
Play frameworkPlay framework
Play framework
 
Play Framework workshop: full stack java web app
Play Framework workshop: full stack java web appPlay Framework workshop: full stack java web app
Play Framework workshop: full stack java web app
 
AddressBook to Contacts
AddressBook to ContactsAddressBook to Contacts
AddressBook to Contacts
 
AEGEE - Address Book Project - Agora Aachen
AEGEE - Address Book Project - Agora AachenAEGEE - Address Book Project - Agora Aachen
AEGEE - Address Book Project - Agora Aachen
 
Play framework: lessons learned
Play framework: lessons learnedPlay framework: lessons learned
Play framework: lessons learned
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Microsoft Web Technology Stack
Microsoft Web Technology StackMicrosoft Web Technology Stack
Microsoft Web Technology Stack
 
Lambda Architecture and open source technology stack for real time big data
Lambda Architecture and open source technology stack for real time big dataLambda Architecture and open source technology stack for real time big data
Lambda Architecture and open source technology stack for real time big data
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1
 
Software requirements specification
Software  requirements specificationSoftware  requirements specification
Software requirements specification
 

Semelhante a Enterprise Java Web Application Frameworks Sample Stack Implementation

Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingThorsten Kamann
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking TourJoshua Long
 
What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyMohamed Taman
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsRaimonds Simanovskis
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)Daniel Bryant
 
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the CloudJavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the CloudAaron Walker
 
비동기 회고 발표자료
비동기 회고 발표자료비동기 회고 발표자료
비동기 회고 발표자료Benjamin Kim
 
Andrei Niculae - JavaEE6 - 24mai2011
Andrei Niculae - JavaEE6 - 24mai2011Andrei Niculae - JavaEE6 - 24mai2011
Andrei Niculae - JavaEE6 - 24mai2011Agora Group
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7WASdev Community
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7Kevin Sutter
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...J V
 
Iasi code camp 12 october 2013 jax-rs-jee-ecosystem - catalin mihalache
Iasi code camp 12 october 2013   jax-rs-jee-ecosystem - catalin mihalacheIasi code camp 12 october 2013   jax-rs-jee-ecosystem - catalin mihalache
Iasi code camp 12 october 2013 jax-rs-jee-ecosystem - catalin mihalacheCodecamp Romania
 

Semelhante a Enterprise Java Web Application Frameworks Sample Stack Implementation (20)

Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
Spring 3.1: a Walking Tour
Spring 3.1: a Walking TourSpring 3.1: a Walking Tour
Spring 3.1: a Walking Tour
 
What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
Java EE and Glassfish
Java EE and GlassfishJava EE and Glassfish
Java EE and Glassfish
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Extending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on RailsExtending Oracle E-Business Suite with Ruby on Rails
Extending Oracle E-Business Suite with Ruby on Rails
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the CloudJavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
JavaOne 2009 - Full-Text Search: Human Heaven and Database Savior in the Cloud
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
비동기 회고 발표자료
비동기 회고 발표자료비동기 회고 발표자료
비동기 회고 발표자료
 
Offline Html5 3days
Offline Html5 3daysOffline Html5 3days
Offline Html5 3days
 
Andrei Niculae - JavaEE6 - 24mai2011
Andrei Niculae - JavaEE6 - 24mai2011Andrei Niculae - JavaEE6 - 24mai2011
Andrei Niculae - JavaEE6 - 24mai2011
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7AAI 1713-Introduction to Java EE 7
AAI 1713-Introduction to Java EE 7
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
 
Iasi code camp 12 october 2013 jax-rs-jee-ecosystem - catalin mihalache
Iasi code camp 12 october 2013   jax-rs-jee-ecosystem - catalin mihalacheIasi code camp 12 october 2013   jax-rs-jee-ecosystem - catalin mihalache
Iasi code camp 12 october 2013 jax-rs-jee-ecosystem - catalin mihalache
 

Mais de Mert Çalışkan

jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownjDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownMert Çalışkan
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesMert Çalışkan
 
Gelecex - Maven ile Akilli Projeler
Gelecex - Maven ile Akilli ProjelerGelecex - Maven ile Akilli Projeler
Gelecex - Maven ile Akilli ProjelerMert Çalışkan
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsMert Çalışkan
 

Mais de Mert Çalışkan (9)

jDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring SmackdownjDays2015 - JavaEE vs. Spring Smackdown
jDays2015 - JavaEE vs. Spring Smackdown
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFacesJavaOne - 10 Tips for Java EE 7 with PrimeFaces
JavaOne - 10 Tips for Java EE 7 with PrimeFaces
 
Better Career with Java
Better Career with JavaBetter Career with Java
Better Career with Java
 
Test Infected
Test InfectedTest Infected
Test Infected
 
Gelecex - Maven ile Akilli Projeler
Gelecex - Maven ile Akilli ProjelerGelecex - Maven ile Akilli Projeler
Gelecex - Maven ile Akilli Projeler
 
Jdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent ProjectsJdc 2010 - Maven, Intelligent Projects
Jdc 2010 - Maven, Intelligent Projects
 
Fikrim Acik Kodum Acik
Fikrim Acik Kodum AcikFikrim Acik Kodum Acik
Fikrim Acik Kodum Acik
 

Enterprise Java Web Application Frameworks Sample Stack Implementation

  • 1. Enterprise Java Web Application Frameworks & Sample Stack Implementation Mert ÇALIŞKAN mcaliskan@stm.com.tr STM Inc. 2009
  • 2. Who am I? • The Software Plumber :) SCJP certified dude bla bla... • Open Source Evangelist Founder & Author of various Open Source Projects • Member of MyFaces Community OpenLogic Expert Community Member
  • 3. Agenda • The aim: Enterprise Java WebApp Framework • Which stack to choose? • • The Stack • Questions are welcome anytime..!
  • 4. The aim: Enterprise WebApp Framework • MVC pattern • Quality & Competency of “The Stack” • Performance & Scalability • Learning Curve & Development Speed ! don’t let cutting edge turn into bleeding edge... release early & release often..! • Community Factor & Open Source support (forums- mailing lists & etc.)
  • 5. Which stack to choose? UI Controller/Dep.Inj. JSF Struts Spring Guice HiveMind Spring MVC WebWork ZK picoContainer XWork Wicket Tapestry GWT Model/Persistence Layer Echo3 Cocoon Hibernate iBatis Integration Toplink KODO Apache CXF Apache Axis2 IDE EclipseLink Eclipse IntelliJ Spring WS IDEA JDeveloper NetBEANS
  • 6. • It’s nothing new! not “yet another java framework” • It’s a stack demonstration with OSS • Released on 01.2009 • http://code.google.com/p/mesir • 2000+ downloads
  • 7. DOMAIN MODEL AddressBook Contact id id 1 0..* text name creationDate email contacts phone
  • 8. THE STACK VIEW MAVEN JSF ECLIPSE FACELETS ORCHESTRA Apache CXF MODEL CONTROLLER JPA HIBERNATE H.SEARCH SPRING H.VALIDATOR with SecuRITY ENVERS
  • 9. JSF-1 • A standard (v1.2_13 and v2.0.1 FCS) • A component oriented & event-driven framework • Binding makes JSF Powerful Bind a bean’s variable to component <h:inputText value=“#{person.name}” /> Bind a method to the action component <h:commandButton action=“#{personSavePage.savePerson}” /> • Conversion & Validation no hassle with java.util.Date extensible - write your own converter & validator
  • 10. JSF-2 • 3rd Party Ajaxified Frameworks PrimeFACES - Crazy Turks RichFACES - JBoss IceFACES - Sun ADFFaces - Oracle • IDE Support (Eclipse - NetBeans - JDeveloper) • Everything’s gonna be alright with JSF 2.0 :)
  • 11. FACELETS • ViewHandler created for JSF • mixing JSF + JSP for JSF 1.x • well balanced HTML : xhtml • Templating • Composite Components
  • 12. SPRING-1 • Dependency Injection & IoC with XML and annotations • JEE ( JMS, EJBs, JCA ...) • AOP • ORM Integration, DAO Support tx management, entityManager
  • 13. SPRING-2 ORM DAO Web Hibernate Spring JDBC JPA JEE Spring WEB MVC TopLink Framework Transaction JDO Integration management JMX OJB Struts iBatis JMS Tapestry JCA JSF Remoting JSPs EJB Velocity Email FreeMarker AOP JasperReports Excel Spring Portlet MVC Spring AOP AspectJ Integration
  • 14. SPRING-3 <context:property-placeholder location="classpath:application.properties"> ... <context:component-scan base-package="tr.mesir" /> ... <tx:annotation-driven /> ... <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy- method="close"> <property name="driverClassName" value="${database.driver}"/> <property name="url" value="${database.uri}"/> <property name="username" value="${database.username}"/> <property name="password" value="${database.password}"/> </bean> ... <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" />
  • 15. SPRING-4 @Service("addressBookService") public class AddressBookServiceImpl implements AddressBookService { ... @Autowired private AddressBookDAO addressBookDAO; ... } @Repository public class AddressBookDAOImpl implements AddressBookDAO { ... @PersistenceContext protected EntityManager entityManager; ... }
  • 16. MyFaces ORCHESTRA • Conversation Scoped beans & Conversation Scoped Persistence Contexts LazyInitializationException or NonUniqueObjectException • Heavily built-on Spring Framework
  • 17. JPA-1 • Standard (Java EE 5.0) object/relational mapping and persistent management interface • Support from different vendors hibernate - toplink - eclipselink - kodo ... • Enhanced Query Langugage (JPQL)
  • 18. JPA-2 @Entity public class AddressBook extends BaseObject { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @OneToMany(cascade={CascadeType.ALL}) @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) private List<Contact> contacts = new ArrayList<Contact>(); }
  • 19. JPA-3 Some DAO code: public AddressBook loadById(Long id) { return entityManager.find(AddressBook.class, id); } public void save(AddressBook addressBook) { entityManager.persist(addressBook); } public List<String> findAllTitles() { return entityManager.createQuery("select ab.title from AddressBook ab").getResultList(); }
  • 20. HIBERNATE-1 • Object / Relational Mapping framework • No hassle with result set handling object conversion and SQL, well almost for SQL :) • Support for any DB with dialects Oracle, MySQL, PostgreSQL, HSQL, DB2, Sybase and many more....
  • 21. Hibernate Search • Bringing full text search engine to the persistence domain model e.g. : amazon search • Apache Lucene™ under the hood • Lucene Directory File - DB - in mem • JPA Triggered Event System Persist - Update - Delete
  • 22. H.S. - How To Use • Configuration Transparent with JPA (hibernate entity manager) (hibernate annotations) • Annotation Based @Indexed @Field(store, index) @IndexedEmbedded .....
  • 23. H.S. - Example @Entity @Indexed public class AddressBook extends BaseObject { @Field(index=Index.TOKENIZED, store=Store.NO) private String title; @OneToMany(cascade={CascadeType.ALL}) @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) @IndexedEmbedded private List<Contact> contacts = new ArrayList<Contact>(); .... }
  • 24. H.S. - Example @SuppressWarnings("unchecked") public List<AddressBook> findByWord(String searchWord) throws ParseException { // Since contacts list is declared as @IndexedEmbedded inside AddressBook, // we can search through the name or email of a contact also. MultiFieldQueryParser parser = new MultiFieldQueryParser(new String[] { "title", "contacts.name", "contacts.email" }, new StandardAnalyzer()); Query query = parser.parse(searchWord); FullTextQuery ftq = getFullTextEntityManager().createFullTextQuery( query, AddressBook.class); return ftq.getResultList(); }
  • 25. HIBERNATE VALIDATOR-1 • Reference implementation for JSR 303: Bean Validation • DRY (Don’t Repeat Yourself) express your domain constraints once..! property2DDLSchema • annotation-based @NotNull @NotEmpty @Length(min=, max=) ........ @Email @Pattern @Valid ........ • custom validators
  • 26. HIBERNATE VALIDATOR-2 @Field @NotEmpty(message="Name should not be empty") @Length(min=4, max=40) private String name; @Field @NotEmpty(message="Email should not be empty") @Email private String email;
  • 27. HIBERNATE ENVERS-1 • Versioning for JPA entities • A part of Hibernate with Hib.3.5 • Simple to implement with annotations @Audited .... • Querying on Revisions, Entity at Revisions
  • 28. HIBERNATE ENVERS-2 Entities R id=”1” id=”4” e data=”x” data=”p” v id=”2” id=”3” i data=”a” data=”x” s id=”1” id=”2” i data=”y” data=”b” o n id=”2” id=”4” data=”c” data=”r” s
  • 29. HIBERNATE ENVERS-3 @Entity @Indexed @Audited public class Contact extends BaseObject { @Field @Versioned private String name; }
  • 30. Apache CXF-1 • open-source services framework • annotation driven • JAX-WS & JAX-RS compliant • soap + rest • xml + json
  • 31. Apache CXF-2 @Component("addressBookWebService") @WebService public class AddressBookWebService { @Autowired private AddressBookService addressBookService; @WebMethod public List<String> allAddressBookTitles() { return addressBookService.findAllTitles(); } } spring configuration: <jaxws:endpoint id="addressBookWS" implementor="#addressBookWebService" address="/addressbook" />
  • 33. MAVEN • Stop “building the build” and focus on building the application...! • A uniform build system... • Project Object Model (POM) • Guidelines for best practices while doing development (TDD - Cont. Int. & etc.)
  • 34. MAVEN - The POM-1 <project ...> <modelVersion>4.0.0</modelVersion> <groupId>tr.mc</groupId> <artifactId>mesir</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>mesir</name> <url>http://code.google.com/p/mesir</url> <description>Skeleton project for java based web applications</description> ... ... ... ... </project>
  • 35. MAVEN - The POM-2 <dependencies> ... <dependency> <groupId>org.springframework</groupId> <artifactId>spring</artifactId> <version>2.5.6</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>2.5.6</version> <scope>test</scope> </dependency> ... </dependencies>
  • 36. MAVEN - The POM-3 <repositories> <repository> <id>mesir-repo</id> <url>http://mesir.googlecode.com/svn/trunk/mavenrepo</url> </repository> <repository> <id>jboss</id> <url>http://repository.jboss.com/maven2</url> </repository> <repository> <id>apache-snapshot</id> <url>http://people.apache.org/repo/m2-snapshot-repository</url> </repository> </repositories>
  • 37. ECLIPSE-1 • Universal toolset for Development • Open Source IDE • Extensible architecture based on plugins • Specified mostly on Java but development language is independent... CDT - PHP - Cobol • Plugins used while developing mesir: subclipse m2eclipse
  • 39. Thank you... http://www.jroller.com/mert http://www.twitter.com/mertcaliskan