OpenShift is FanPaaStic For Java EE By Shekhar Gulati Promo Code JUDCON.IN
About Me ~ Shekhar Gulati OpenShift Evangelist at Red Hat Hands on developer Speaker Writer and Blogger Twitter @ shekhargulati
Agenda
PaaS == Platform as a Service A Cloud Application Platform Code Code your app Deploy Push-button Deploy, and your App is running in the Cloud! Enjoy Save Time and Money
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.
OpenShift is PaaS by Red Hat
OpenShift Open PaaS Polyglot supports multiple programming languages Support multiple databases Auto scales Developer friendly Flexible Open source OpenShift Origin
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.
OpenShift is the BEST Platform for Java Developers
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
Getting Started with OpenShift https://openshift.redhat.com/app/account/new 1) Sign up with Promo Code JUDCON.IN 2) Verify Email
What I get after sign up? OpenShift is free-as-in-beer & free-as-infreedom 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
Sign up at OpenShift Booth and get an OpenShift T-Shirt
How To Work with OpenShift Developer IDE Integrations Command Line Tooling Web Browser Console REST APIs
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
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
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
Java EE 6 The simplest possible and most lightweight platform you can currently get Adam Bien
Java EE 6 Specifications JSF 2.0 EJB 3.1 JAX-RS 2.0 Servlet 3.0 JPA 2.0 JAX-WS 2.2 JSP 2.2 JTA 1.1 etc... EL, JSTL 2.0, etc. JavaMail etc. CDI (JSR 299)1.0 JAX-WS 2.2 @Inject 1.0 JAXB 2.2 Bean Validation 1.0 JDBC 4.0 JNDI 1.5 SAAJ 1.3 Common 1.1 Interceptor Managed Bean 1.0 JACC 1.0 1.1 Java SE 6 Note : This is not a full list
Let's now look at some specs Servlet 3.0 JPA 2.0 EJB 3.1
Servlet 3.0 Ease of development via annotations Pluggability Async support File upload support And many more..
JPA 2.0 Evolved separately from EJB now JSR 317 Richer mappings Richer JPQL Standard config options Criteria API And many more..
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.
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
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
Let's now look at some other specifications CDI Bean Validation JSF 2.0 Interceptors
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
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
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
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-cdijsr303-events-interceptor-demo.git git pull -s recursive -X theirs demo2 master
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
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
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