Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OpenShift is FanPaaStic for JavaEE 6

OpenShift is FanPaaStic for JavaEE 6

OpenShift is FanPaaStic for JavaEE 6

Shekhar Gulati

January 18, 2013
Tweet

More Decks by Shekhar Gulati

Other Decks in Technology

Transcript

  1. About Me ~ Shekhar Gulati • OpenShift Evangelist at Red

    Hat • Hands on developer • Speaker • Writer and Blogger • Twitter @ shekhargulati
  2. PaaS == Platform as a Service A Cloud Application Platform

    Code Deploy Enjoy Save Time and Money Code your app Push-button Deploy, and your App is running in the Cloud!
  3. Why PaaS? • Lets developer focus on his job i.e.

    to write code. • Improves developer productivity. • Brings agility to product development. • Gives developers the power to prototype their ideas quickly and rapidly.
  4. OpenShift – Open PaaS • Polyglot – supports multiple programming

    languages • Support multiple databases • Auto scales • Developer friendly • Flexible • Open source – OpenShift Origin
  5. Why OpenShift? • Strength. OpenShift is built on proven Red

    Hat technologies. • Freedom. In OpenShift, work the way you want. – Choice of Interface: Web Console, Command-line, or IDE – Choice of Middleware: Java(EE6), Ruby, Node.js, PHP, Python, and Perl – Choice of Cloud: Public, Private, or Hybrid Cloud – Choice of Elasticity: Automatic application scaling when needed • Openness. OpenShift’s open source software stack ensures application portability and No Lock-In.
  6. Why I think OpenShift is Best? • Can run any

    thing that's Java – Java EE or Spring does not matter. • Supports both Java 6 and Java 7 • Supports JBoss AS7, JBoss EAP 6.0, and Tomcat • Ability to write to persistent file system • Debugging support • Hot deployment • Eclipse support
  7. Getting Started with OpenShift 1) Sign up with Promo Code

    JUDCON.IN 2) Verify Email https://openshift.redhat.com/app/account/new
  8. What I get after sign up? • OpenShift is free-as-in-beer

    & free-as-in- freedom • You get three free gears, each with 512MB memory and 1GB of disk space. • Need more resources, just ask! • The catch is we are in developer preview right now
  9. Demo 1 – Web Console • Log in to OpenShift

    Web console • Walkthrough various application types • Creating Domain Name • Wordpress Blog in less than 2 minutes • Credentials admin/OpenShiftAdmin
  10. Install Client Tools and Setup Account • Install the client

    tools – Install Ruby 1.8.7 or above – sudo gem install rhc • Install Git • rhc setup -l <openshift_login> – Upload ssh keys – Check if git is installed – Create domain if not exists
  11. Look at Java EE 6 • Java EE 6 provides

    a platform to write enterprise applications in Java • Consists of 28 specifications (Thousands of pages) • Convention over configuration • Less boilerplate code • Promotes POJO programming model • Annotations and types over XML • Introduced EJB Lite • Simplified Packaging • Introduced concept of Profiles
  12. Java EE 6 – The simplest possible and most lightweight

    platform you can currently get Adam Bien
  13. Java EE 6 Specifications • JSF 2.0 • Servlet 3.0

    • JSP 2.2 • EL, JSTL 2.0, etc. • EJB 3.1 • JPA 2.0 • JTA 1.1 • JavaMail etc. • JAX-RS 2.0 • JAX-WS 2.2 • etc... • JAX-WS 2.2 • JAXB 2.2 • JDBC 4.0 • JNDI 1.5 • SAAJ 1.3 • Common 1.1 • CDI (JSR 299)1.0 • @Inject 1.0 • Bean Validation 1.0 • Interceptor 1.1 • Managed Bean 1.0 • JACC 1.0 Java SE 6 Note : This is not a full list
  14. Servlet 3.0 • Ease of development via annotations • Pluggability

    • Async support • File upload support • And many more..
  15. JPA 2.0 • Evolved separately from EJB now – JSR

    317 • Richer mappings • Richer JPQL • Standard config options • Criteria API • And many more..
  16. EJB 3.1 • Optional local interface – Use @Local and

    @Remote • Packaged in war • Asynchronous calls using @Asynchronous annotation • Timer Service supports cron like syntax • And many more @Singleton, Embeddable container,etc.
  17. Demo 2 Servlet 3.0, JPA 2.0, EJB 3.1 • Todo

    Application – JPA 2.0 for persistence – Servlet 3.0 as controller – EJB 3.1 as business service Github repo of demo application https://github.com/shekhargulati/judcon-todo-servlet3-jpa2-ejb31-demo
  18. Demo 2 Steps • Create JBoss EAP 6.0 OpenShift Application

    • Add PostgreSQL support • Create domain model – TodoList 1->n Todo • Add persistence.xml • Create EJB service TodoService • Create TodoServlet to create and find TodoList • Create FileUploadServlet • Add page.jsp to WEB-INF/pages folder • git add . • git commit -am “Todo Application created” • git push
  19. Let's now look at some other specifications • CDI •

    Bean Validation • JSF 2.0 • Interceptors
  20. Bean Validation 1.0 • Enable declarative validation in your applications

    • Constrain Once and Validate Anywhere – restriction on a bean, field or property – not null, size between 1 and 7, valid email... • Standard way to validate constraints • Integration with JPA 2.0 & JSF 2.0
  21. CDI • Stands for Context and Dependency Injection • Glues

    the platform in a way never done before • Provide two main things – Dependency Injection – Manages components in scope • Leads to loose coupling and strong typing using annotations
  22. Interceptors 1.1 • Address cross-cutting concerns in Java EE •

    Separate spec shipped with EJB 3.1 • Can be used with EJBs as well as ManagedBeans • @AroundInvoke • @AroundTimeout for EJB timers
  23. Demo 3 JSF 2.0, CDI, Bean Validation, Events, Interceptors git

    rm -rf src/ pom.xml git commit -am "removed demo 2" git remote add demo2 -m master git://github.com/shekhargulati/judcon-todo-jsf2-cdi- jsr303-events-interceptor-demo.git git pull -s recursive -X theirs demo2 master
  24. Demo 3 • Extending Todo application – CDI for dependency

    injection – JPA 2.0 Criteria API for querying – EJB 3.1 for writing business service – Interceptor for logging – JAX RS for Restful web services
  25. 3 More Sessions ~ All Different • Polyglot Persistence Apps

    on OpenShift - Today • Building Java MongoDB application using Hibernate OGM - Tomorrow • JBoss Forge + OpenShift = Rapid Enterprise Application Development for Cloud – Tomorrow
  26. Conclusion • OpenShift is very easy to use and makes

    life great for developers • Java EE 6 is easy • OpenShift is best platform for Java developers • Did I mention – Free • Sign up with promo code JUDCON.IN