<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JavaBeat &#187; Java EE 6.0</title>
	<atom:link href="http://www.javabeat.net/category/java-j2ee/java-ee-6-0/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javabeat.net</link>
	<description>Java Technology News</description>
	<lastBuildDate>Mon, 13 May 2013 20:10:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Deploying a ZK based Java EE application to Red Hat Open Shift Cloud</title>
		<link>http://www.javabeat.net/2012/05/deploying-zk-javaee-to-openshift/</link>
		<comments>http://www.javabeat.net/2012/05/deploying-zk-javaee-to-openshift/#comments</comments>
		<pubDate>Tue, 29 May 2012 16:46:38 +0000</pubDate>
		<dc:creator>Mohamed Sanaulla</dc:creator>
				<category><![CDATA[Java EE 6.0]]></category>
		<category><![CDATA[Web Frameworks]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[OpenShift]]></category>
		<category><![CDATA[ZK]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=4013</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>OpenShift is a Platform As A Service (Paas) offering from Red Hat joining the likes of Heroku, GAE, Jelastic and others. OpenShift supports Java EE, PHP, Node.js, Ruby, Python and Perl applications. I tried out deploying a simple Java EE application based on ZK Framework, interested people can have a look at the application running [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><a id="dd_start"></a><p><a href="https://openshift.redhat.com/app/" title="OpenShift" target="_blank">OpenShift</a> is a Platform As A Service (Paas) offering from Red Hat joining the likes of Heroku, GAE, Jelastic and others. OpenShift supports Java EE, PHP, Node.js, Ruby, Python and Perl applications. I tried out deploying a simple Java EE application based on <a href="http://www.zkoss.org/" title="ZK Framework" target="_blank">ZK Framework</a>, interested people can have a look at the application running live <a href="http://marathons-mylearning.rhcloud.com/marathonHome.zul" target="_blank">here</a>. </p>
<p>This article would cover:</p>
<ul>
<li>Setting up of OpenShift account, Maven and creating an application on cloud</li>
<li>Developing and deploying the application on cloud</li>
</ul>
<h3>Setting up OpenShift Account, Creating application</h3>
<p>First step to setting up of application is to create an account on the OpenShift website <a href="https://openshift.redhat.com/app" title="OpenShift" target="_blank">here</a>. Once you have registered, you have to download and install the Command line tool for OpenShift cloud control which is <a href="https://openshift.redhat.com/app/getting_started" title="RedHat Console" target="_blank">Redhat Console(rhc)</a>. I used the Ruby gems to install the RHC tool which is as simple as:</p>
<pre class="brush: bash; title: ; notranslate">$ sudo gem install rhc</pre>
<h4>Creating a domain and application</h4>
<p>All the applications deployed on OpenShift are in a namespace which is nothing but the domain you create. Domain names have to be unique and are part of the URL to access the application. </p>
<pre class="brush: bash; title: ; notranslate">
#Creating a domain
$ rhc domain create -l &lt;login&gt; -n &lt;domain name&gt;
Password: &lt;password&gt;
</pre>
<p>Once the domain has been successfully created, the next step is to create an application: </p>
<pre class="brush: bash; title: ; notranslate">
#Creating an application
$rhc app create -a &lt;application_name&gt; -l &lt;loginname&gt; -t jbossas-7.0
</pre>
<p>-t option is used to specify the type of the application, which can be any one of the following:<br />
php-5.3 — for PHP applications<br />
wsgi-3.2 — for Web Server Gateway Interface applications<br />
rack-1.1 — for Ruby Webserver Interface applications<br />
perl-5.10 — for Perl applications<br />
jbossas-7.0 — for JBoss AS applications (used for ZK project)<br />
raw-0.1 — a raw cartridge type used to create applications of no specific type</p>
<p>A Cartridge is the other infrastructure elements that your application would use and these can be added using the same rhc app command. In our application we would not be using any of those and hence not being added.</p>
<p>The same operations can be performed from their web console as well. An advantage of using the command line is that once you create an domain using rhc command line, it adds the necessary ssh-keys, and also while creating the application it sets up the git repository as well. Deploying to OpenShift is as simple and pushing the application to the remote git repository, this is similar to the approach in <a href="http://www.heroku.com/" title="Heroku" target="_blank">Heroku</a>. </p>
<h4>Setting up Maven</h4>
<p>The application is nothing but an Maven project. So if you are interested to run the application locally then you need to setup Maven as well. Download the Maven package from <a href="http://maven.apache.org/download.html" title="Maven" target="_blank">here</a>, and setup the M2_HOME environment variable to the Maven home i.e the folder where the Maven package was extracted and also update the PATH variable to the M2_HOME/bin. </p>
<pre class="brush: bash; title: ; notranslate">
$mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 14:14:56+0530)
Maven home: /home/mohamed/maven
Java version: 1.7.0, vendor: Oracle Corporation
Java home: /home/mohamed/jdk1.7.0/jre
</pre>
<h3>Developing and Deploying the Application</h3>
<p>We would be using <a href="http://www.zkoss.org/" target="_blank">ZK framework</a> for our sample application. The application reads from a JSON source about the Marathon Events in India and plots them on a Google Map. For reading the JSON source we would be using the <a href="http://www.javabeat.net/2012/04/parsing-json-using-java-and-gson-library/" title="Parsing JSON using Java and GSON library" target="_blank">GSON library</a>.<br />
We have to update the contents of <a href="https://github.com/sanaulla123/Marathons/blob/7cbd8c0199d4b17c2001ca9c92727dfe02d02a77/pom.xml" target="_blank">pom.xml</a> to reflect the ZK, GSON and other dependencies. One can even use Eclipse to develop the application and that is exactly what I did:</p>
<pre class="brush: bash; title: ; notranslate">
$ mvn eclipse:eclipse
</pre>
<p>and then load the project in eclipse. Also Eclipse should be able to resolve the libraries used in the application i.e all the ZK jars and the GSON jar. If you find any issue where eclipse complains about not finding the jars, then you must add a variable M2_REPO to Eclipse environment variables which would point to the directory where Maven downloads all the jars.<br />
The <a href="https://github.com/sanaulla123/Marathons/blob/7cbd8c0199d4b17c2001ca9c92727dfe02d02a77/src/main/resources/net/javabeat/marathon_events.json" title="JSON Source" target="_blank">JSON source</a> for the marathon events is constructed from the details available on <a href="http://runinfinity.com/calendar/india-marathon-calendar" title="Marathon Calendar" target="_blank">RunInfinity website</a>.</p>
<p>There are few things to be done to plot the above data on a map:<br />
1. Construct <a href="http://www.zkoss.org/javadoc/zkforge/gmapsz/org/zkoss/gmaps/Gmarker.html" title="Gmarker" target="_blank">Gmarker</a> data from the above data.<br />
2. Obtain the Latitude and Longitude data from the location information. For this we make use of the <a href="https://developers.google.com/maps/documentation/geocoding/" target="_blank">Google Geocoding API</a>.</p>
<p>The Model which holds the Marathon event information is:</p>
<pre class="brush: java; title: ; notranslate">
public class MarathonEvent {
  @SerializedName(&quot;event_url&quot;)
  String url;
  String name;
  String date;
  String location;
  Location geoLocation;
  String formattedContent;
  @Override
  public String toString(){
    if ( formattedContent == null ){
      StringBuilder builder = new StringBuilder();
      builder.append(&quot;Date: &quot;+date);
      builder.append(&quot;&lt;br/&gt;&quot;);
      builder.append(&quot;&lt;a href=\&quot;&quot;+url+&quot;\&quot;&gt;&quot;+name+&quot;&lt;/a&gt;&quot;);
      builder.append(&quot;&lt;br/&gt;&quot;);
      builder.append(geoLocation.name);
      formattedContent = builder.toString();  
    }
    return formattedContent;
  }
}
</pre>
<p>Parsing the JSON source for Marathon Events list where the JSON source is marathon_events.json:</p>
<pre class="brush: java; title: ; notranslate">
InputStream marathonEvenJsonSource = 
    getClass().getResourceAsStream(&quot;marathon_events.json&quot;);

Gson gson = new Gson();

JsonReader jsonReader = new JsonReader(
    new InputStreamReader(marathonEvenJsonSource));

JsonParser jsonParser = new JsonParser();

JsonArray jsonArray = jsonParser.parse(jsonReader).getAsJsonArray();

for ( JsonElement element : jsonArray){
  MarathonEvent marathonEvent = 
      gson.fromJson(element, MarathonEvent.class);
  marathonEvent.geoLocation = getGeoCode(marathonEvent.location);

  Gmarker gmarker = new Gmarker(marathonEvent.location,
      marathonEvent.geoLocation.latitude,
      marathonEvent.geoLocation.longitude);
  gmarker.setContent(marathonEvent.toString());
  
  marathonEvents.add(gmarker);
}
</pre>
<p>if you are not able to follow the JSON parsing code, please read our previous article regarding the same <a href="http://www.javabeat.net/2012/04/parsing-json-using-java-and-gson-library/" title="Parsing JSON using Java and GSON library" target="_blank">here</a>.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<p>The interesting part here is the <code>getGeoCode(marathonEvent.location)</code> call which is defined as:</p>
<pre class="brush: java; title: ; notranslate">
public Location getGeoCode(String location) 
    throws MalformedURLException, IOException{
  String url = 
    &quot;http://maps.googleapis.com/maps/api/geocode/json?address=&quot;+URLEncoder.encode(location, &quot;UTF-8&quot;)+&quot;&amp;sensor=false&quot;;
  Location geoLocation = new Location(location);
  Gson gson = new Gson();
  InputStream in = new URL(url).openStream();
  JsonReader reader = new JsonReader(new InputStreamReader(in));
  JsonParser parser = new JsonParser();
  JsonObject jsonObject = parser.parse(reader).getAsJsonObject();
  //Fetch all the possible latitude/longitude results for this place
  JsonArray resultsArray = jsonObject.getAsJsonArray(&quot;results&quot;);
  
  if ( resultsArray.size() &gt; 0 ){
    //Generally there's only one result, so pick the first. 
    JsonObject geoInformation = 
        resultsArray.get(0).getAsJsonObject();
    String formattedAddress = 
        geoInformation.get(&quot;formatted_address&quot;).getAsString();
    JsonObject locationJsonObj= 
      geoInformation.get(&quot;geometry&quot;)
                    .getAsJsonObject()
                    .get(&quot;location&quot;)
                    .getAsJsonObject();
    String latitude  = locationJsonObj.get(&quot;lat&quot;).getAsString();
    String longitude = locationJsonObj.get(&quot;lng&quot;).getAsString();
    geoLocation.latitude = Double.parseDouble(latitude);
    geoLocation.longitude = Double.parseDouble(longitude);
    geoLocation.name = formattedAddress;
  }
  return geoLocation;
}
</pre>
<p>The above code parses the JSON response obtained from the Google Places API and retrieves the formatted_address field and the latitude(lat) and longitude(lng) values. Here as well the GSON Library is used for parsing. The above two code snippets are part of the MarathonEventsSource class which is our source for model information to the views.</p>
<p>Now lets create a ZK based View and Controller/View Model class.</p>
<h4>ZK Based View</h4>
<pre class="brush: xml; title: ; notranslate">
&lt;zk&gt;
  &lt;script type=&quot;text/javascript&quot; 
  content=&quot;zk.googleAPIkey='AIzaSyAgYZVjw15TQWGxAMFv0ayA8OlAtVFkyx0'&quot; /&gt;
  &lt;window id=&quot;main&quot; width=&quot;100%&quot; height=&quot;100%&quot; apply=&quot;net.javabeat.MarathonHomeComposer&quot;&gt;
    &lt;borderlayout&gt;
      &lt;north size=&quot;70px&quot;&gt;
        &lt;div&gt;
        &lt;html&gt;&lt;![CDATA[
        &lt;h2 style=&quot;color:#0C7A9A;margin-left:10px&quot;&gt;Marathon Events in India&lt;/h2&gt;
        ]]&gt;&lt;/html&gt;
        &lt;/div&gt;
      &lt;/north&gt;
      &lt;center flex=&quot;true&quot;&gt;
        &lt;div id=&quot;contentDiv&quot; &gt;
          &lt;gmaps id=&quot;eventsMap&quot; width=&quot;100%&quot; height=&quot;100%&quot; showSmallCtrl=&quot;true&quot;&gt;
          &lt;attribute name=&quot;onMapClick&quot;&gt;&lt;![CDATA[
          org.zkoss.gmaps.Gmarker gmarker = event.getGmarker();
          if (gmarker != null)
            gmarker.setOpen(true);
          ]]&gt;&lt;/attribute&gt;
          &lt;/gmaps&gt;
        &lt;/div&gt;
      &lt;/center&gt;
      &lt;south size=&quot;20px&quot;&gt;
        &lt;hbox pack=&quot;center&quot; width=&quot;100%&quot;&gt;
        &lt;html&gt;&lt;![CDATA[
        &lt;span style=&quot;color:#0C7A9A&quot;&gt;Developed by Mohamed Sanaulla&lt;/span&gt;
        ]]&gt;&lt;/html&gt;
        &lt;/hbox&gt;
      &lt;/south&gt;
    &lt;/borderlayout&gt;
  &lt;/window&gt;
&lt;/zk&gt;
</pre>
<p>Interesting pieces from the above code:<br />
1. ZK provides different layouts for organising the contents and BorderLayout is one such layout. In this the content can be organized into 4 regions (exactly similar supported by Swing).<br />
2. Gmaps is the component for embedding the Google Maps.<br />
3. Each view can be backed a View Model class by using the apply attribute of window component <code>apply="net.javabeat.MarathonHomeComposer"</code></p>
<p>Lets have a look at the MarathonHomeComposer class which is the View Model/Controller class.</p>
<pre class="brush: java; title: ; notranslate">
public class MarathonHomeComposer extends GenericForwardComposer{

  MapModel mapModel;
  Gmaps eventsMap;
  Div contentDiv;

  public MarathonHomeComposer() 
      throws MalformedURLException, IOException{
    String marathonEventScheduleSource = 
      &quot;http://runinfinity.com/calendar/india-marathon-calendar&quot;;
    MarathonEventsSource marathonEventsSource = 
        new MarathonEventsSource();
    List&lt;Gmarker&gt; marathonEvents = 
        marathonEventsSource.getMarathonEvents();	
    mapModel = new MapModelList(marathonEvents);

  }
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);		
    eventsMap.setModel(mapModel);
    eventsMap.setZoom(9);
  }
}
</pre>
<p>Few observations from the View Model class:<br />
1. It extends the GenericForwardComposer class which supports binding of the components between the View and the View Model based on the ids. For example- gmaps component has an id=&#8221;eventsMap&#8221; and the View Model MarathonHomeComposer class has an instance field by name: eventsMap. This is an easier way of binding the UI element to the Java layer, the other ways can be by using Annotations.<br />
2. The model for the Gmaps is MapModel which is constructed using the MapModelList and the List obtained from the JSON parser (MarathonEventsSource class)<br />
3. doAfterCompose method would have all the components (read Gmaps) initialized and hence we set the model in this method.</p>
<p>If you are interested in the source of this application, you can get it from the git repo <a href="https://github.com/sanaulla123/Marathons" title="Git Repo">here</a>.</p>
<h4>Deploying the application to OpenShift</h4>
<p>As I said earlier, deploying the application is as simple as running git push command. If you run:</p>
<pre class="brush: bash; title: ; notranslate">
$ git remote -v
origin	ssh://ad221d298243438491c77f9cd9a83206@marathons-mylearning.rhcloud.com/~/git/marathons.git/ (fetch)
origin	ssh://ad221d298243438491c77f9cd9a83206@marathons-mylearning.rhcloud.com/~/git/marathons.git/ (push)
</pre>
<p>The remote named origin points to the git repo in the cloud. Deploying the application to OpenShift platform:</p>
<pre class="brush: bash; title: ; notranslate">
$ git push origin
# other output
remote: [INFO] BUILD SUCCESS
remote: [INFO] -------------------------------------------------
remote: [INFO] Total time: 30.888s
remote: [INFO] Finished at: Tue May 29 12:24:43 EDT 2012
remote: [INFO] Final Memory: 11M/111M
remote: [INFO] -------------------------------------------------
#other output
</pre>
<p>Once you have deployed the application, you can access the application by visting: http://-.rhcloud.com/marathonHome.zul</p>
<p>Let me summarize this huge post into:<br />
1. Constructing the Model source for the Map- this involves reading the JSON source, obtaining the latitude and longitude information and then constructing the Gmarker objects.<br />
2. Construct the view- marathonHome.zul which has the gmaps component.<br />
3. Wire the View with the View Model class and also wire up the gmaps component with the model. </p>
<p>This sample application can be accessed <a href="http://marathons-mylearning.rhcloud.com/marathonHome.zul">here</a>.</p>
<p>Some of the useful resources for this sample:<br />
1. <a href="http://www.zkoss.org/javadoc/zkforge/gmapsz/index.html?org/zkoss/gmaps/Gmaps.html" target="_blank">Gmaps Java documentation</a>.<br />
2. <a href="http://www.zkoss.org/javadoc/6.0.1/zk/" target="_blank">ZK Components Java Documentation</a>.<br />
3. <a href="http://www.zkoss.org/zkdemo/reporting/google_map" target="_blank">ZK Live Demo</a>.<br />
4. <a href="https://developers.google.com/maps/documentation/geocoding/" title="Google Geocoding" target="_blank">Google Geocoding API</a><br />
5. <a href="https://openshift.redhat.com/app/getting_started" target="_blank">OpenShift Developer Resources</a>.<br />
6. Git Repository in <a href="https://github.com/sanaulla123/Marathons/" target="_blank">GitHub</a>.</p>
<div class='dd_outer'><div class='dd_inner'><div id='dd_ajax_float'><div class='dd_button_v'><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http%3A%2F%2Fwww.javabeat.net%2Fcategory%2Fjava-j2ee%2Fjava-ee-6-0%2Ffeed%2F" send="false" show_faces="false"  layout="box_count" width="50"  ></fb:like></div><div style='clear:left'></div><div class='dd_button_v'><script type='text/javascript' src='https://apis.google.com/js/plusone.js'></script><g:plusone size='tall' href='http://www.javabeat.net/category/java-j2ee/java-ee-6-0/feed/'></g:plusone></div><div style='clear:left'></div><div class='dd_button_v'><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.javabeat.net/category/java-j2ee/java-ee-6-0/feed/" data-count="vertical" data-text="Java EE 6.0" data-via="javabeat" ></a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div style='clear:left'></div><div class='dd_button_extra_v'><script type="text/javascript">jQuery(document).load(function(){ stLight.options({publisher:'bab47279-62c9-46af-addc-79fd1fe8fee0'}); });</script><div class="st_email_custom"><span id='dd_email_text'>email</span></div></div><div style='clear:left'></div><div class='dd_button_extra_v'><div id='dd_print_button'><span id='dd_print_text'><a href='javascript:window:print()'>print</a></span></div></div><div style='clear:left'></div></div></div></div><script type="text/javascript">var dd_offset_from_content = 44; var dd_top_offset_from_content = 0;</script><script type="text/javascript" src="http://www.javabeat.net/wp-content/plugins/digg-digg//js/diggdigg-floating-bar.js?ver=5.3.0"></script><div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2012/05/deploying-zk-javaee-to-openshift/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New Features in Java EE 6.0</title>
		<link>http://www.javabeat.net/2009/01/new-features-in-java-ee-6-0/</link>
		<comments>http://www.javabeat.net/2009/01/new-features-in-java-ee-6-0/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 13:18:04 +0000</pubDate>
		<dc:creator>krishnas</dc:creator>
				<category><![CDATA[Java EE 6.0]]></category>

		<guid isPermaLink="false">http://www.javabeat.net/?p=220</guid>
		<description><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><p>1.Introduction This article presents what is new in the Java EE 6.0 edition. There is lot of new activities in the JCP expert groups to add more valuable features in Java EE 6.0 version. Roberto Chinnici and Bill Shannon are Spec Leads for the JSR 316. For the past two releases of Java EE versions, [...]</p>]]></description>
				<content:encoded><![CDATA[<p>Connect to us ( <a href="https://twitter.com/javabeat">@twitter</a> | <a href="https://www.facebook.com/javabeat.net">@facebook )</p><div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Rect */
google_ad_slot = "9976259118";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div><h2>1.Introduction</h2>
<p>This article presents what is new in the <strong><em>Java EE 6.0</em></strong> edition. There is lot of new activities in the <strong><em>JCP</em></strong> expert groups to add more valuable features in <strong><em>Java EE 6.0</em></strong> version. <a href="http://weblogs.java.net/blog/robc/" target="_blank">Roberto Chinnici</a> and Bill Shannon are Spec Leads for the <strong><em>JSR 316</em></strong>. For the past two releases of Java EE versions, sun is focusing on making the environment more easier for the developers instead of adding more new technologies.</p>
<p>For example, EJB 2.x is more difficult for the developers particularly the Entity Beans part in the EJB, then it has simplified the <strong><em>EJB 3.0</em></strong> programming model in <strong><em>Java EE 5.0</em></strong> by extensive use of annotations and introduced <strong><em>JPA 1.0</em></strong> to reduce the complexitiy on persistance layer. The same approach continues in the <strong><em>Java EE 6.0</em></strong> version also, they define it in the two topics namingly <strong>Extensibility and Profiles</strong>. Writing about all the changes in one article would become lengthy, so we will see some of the notable changes in this article like <strong><em>Profiles</em></strong>, <strong><em>Modularity</em></strong> and focus on Web tier.</p>
<p><strong>also read:</strong></p>
<ul>
<li><a href="http://www.javabeat.net/j2ee-books/">J2EE Books</a></li>
<li><a href="http://www.javabeat.net/2009/02/servlets-interview-questions/">Servlets interview questions</a></li>
<li><a href="http://www.javabeat.net/2007/08/annotations-in-java-5-0/">Annotations in Java 5.0</a></li>
</ul>
<h2>2.New Features in JEE 6.0</h2>
<p>Before looking into the details of the features, lets list what are the new things to be added in the <strong>Java EE 6.0</strong>. This section will list only the outline of the features with few lines of explanations. As we have already stated, the main goal of this release is ease of development and provide support for the third party frameworks. The new things in 6.0 is, adding new capabilities like Profiles, improving the technology like using annotations instead of XML in most of the technologies(<strong>Servlets 3.0, JPA 2.0</strong>) and removing the features (EJB&#8217;s CMP) which is not widely used by the developers. As rod Lets jump into the features list:</p>
<h3>2.1.Servlets 3.0</h3>
<p>One of the major release in the <strong><em>Java EE 6.0</em></strong> is the new version on <strong><em>Servlet technology</em></strong> which is given more attention by the community. The new version uses annotations to declare the servlets and making the deployment descriptos optional. Apart from using the annotations, as a whole the specification more focued on simplifying the web tier technologies. From <strong><em>Servlets 3.0</em></strong> it is not required to changed <strong><em>web.xml</em></strong> for adding the third party libraries like <strong><em>Struts</em></strong>, <strong><em>Spring</em></strong>, <strong><em>JSF</em></strong>, etc. <strong><em>Servlets 3.0</em></strong> introdues <strong><em>Web Fragments</em></strong> descriptor to specify the details of each libraries which is used by the container. This is one of welcome feature to the web developers since most of them finding hard to integrate the frameworks. There is more detailed article on <strong><em><a href="http://www.javabeat.net/2008/12/new-features-in-servlets-3-0/">New Features in Servlets 3.0</a></em></strong> written by Christy. This article will give you more insight on the features. Please read on.</p>
<h3>2.2.Web Beans 1.0</h3>
<p>The problem with the Java EE edition is, the presentation layers(Servlets, JSP and JSF) and persistance layers(EJB 3.0, JTA, JCA and JPA) are grown seperatly without much closer interactions. There is no common technology to integrate the both web tier and the persistance tier. Web Beans main goal is to address this issue by defining beans which can be interacted by multiple tiers. Web Beans will be compatiable with technologies in the both tiers. Web Beans is influenced by the popular frameworks <a href="http://www.javabeat.net/2007/08/introduction-to-google-guice/">Google Guice</a> and <a href="http://www.javabeat.net/2007/06/introduction-to-jboss-seam/">JBoss Seam</a>. There is more detailed article on <strong><em><a href="http://www.javabeat.net/2008/12/what-is-web-beans/">Web Beans and its Features</a></em></strong>.</p>
<h3>2.3.JPA 2.0</h3>
<p><strong><em>Java Persistance API (JPA 1.0)</em></strong> is released in with the <strong><em>Java EE 5.0</em></strong> edition on May 2006. JPA is one of the crucial technology for the Java platform to develope more flexible and simplified database applications. In the earlier days <strong><em>EJB CMP</em></strong> considered as more complex to develope database applications. So, sun has introdued <strong><em>JPA 1.0</em></strong> with <strong><em>EJB 3.0</em></strong> technology.</p>
<p>An excerpt from the <strong><em>JSR 317</em></strong> says <em>&#8220;including additional object/relational mapping functionality and query language capabilities, a criteria-based query API, and standardization of features currently designated as optional, and to align it with related JSRs that are currently in-process and/on in-plan for the Java EE 6 timeframe.&#8221;</em>. The following are the features may be included in the JPA 2.0 version:</p>
<ul>
<li>Expanded object/relational mapping functionality, including greater flexibility in combining existing mapping options, support for collections of embedded objects, multiple levels of embedded objects, ordered lists, combinations of access types, etc.</li>
<li>Additions to the Java Persistence query language</li>
<li>An API for &#8220;criteria&#8221; queries</li>
<li>Standardization of sets of &#8220;hints&#8221; for query configuration and for entity manager configuration</li>
<li>Standardization of additional metadata to support DDL generation and &#8220;Java2DB&#8221; mapping</li>
<li>Expanded pluggability contracts to support efficient passivation and replication of extended persistence contexts in Java EE environments</li>
<li>Standardization of additional contracts for entity detachment and merge, and persistence context management</li>
<li>Support for validation</li>
</ul>
<h3>2.4.JSF 2.0</h3>
<p><strong><em>JSF 2.0</em></strong> promises to ring lot of new developments to the web application. They classify the changes in this release as Ease of Development, New Features and Fixes, Performance, Technology Adoption. There will be bunch of annotations to be used in the <strong><em>JSF 2.0</em></strong> and try to avoid use of <strong><em>faces-config.xml</em></strong> and <strong><em>web.xml</em></strong>. Everything can be done through annotations how <strong><em>Servlets 3.0</em></strong> has done.</p>
<p>The specification provides lots of new features like expand the request processing life cycle to be aware of Ajax, allow for bookmark able <strong><em>JSF</em></strong> pages, provide a mechanism to easily access persistent store.</p><div class="wpInsert wpInsertInPostAd wpInsertMiddle" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* Article-Middle-Med-Rect */
google_ad_slot = "7805667846";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
<h3>2.5.Other Features in Java EE 6.0</h3>
<p>The mentioned features are the major changes in the new release. Apart from these major changes, there is lot of small changes in the technology. Look into the list of new JSR&#8217;s:</p>
<ul>
<li>JSR-196 Java Authentication SPI for Containers</li>
<li>JSR-236 Timer for Application Servers</li>
<li>JSR-237 Work Manager for Application Servers</li>
<li>JSR-299 Web Beans</li>
<li>JSR-311 JAX-RS: Java API for <strong>RESTful Web Services</strong></li>
</ul>
<p>In the next section I explain about the another new features Profiles and how to pruning the features in Java EE specifications.</p>
<h2>3.Profiles in Java EE 6.0</h2>
<p><strong><em>Profiles</em></strong> feature is major new feature in the <strong><em>Java EE 6.0</em></strong> environment. It brought lot of controversies on its addition to the Java EE. The main goal of the Profiles is to reduce the size of the environment when it is not required. In the existing environment, what ever the small applications you are going to write about, it will come with all the pre existing technologies in the environment. The developer may not intend to use all the technologies provided by the vendor even though he has to adhere everything in one shot. To avoid this situation, Java EE expert group come up with <strong><em>Profiles</em></strong>.</p>
<p><strong><em>Profiles</em></strong> are designed for a particular solution or a specific requirement. For example, you are developing a web project where you are required to use only JSF and JPA. In this case adding all the capabilities not needed and its more expensive. In this case you can use specific profile which suits for the web applications development. This is the basic idea behind designing <strong><em>Profiles</em></strong> into <strong><em>Java EE</em></strong>. As of now <strong><em>Java EE 6.0</em></strong> specification includes only <strong><em>Web Profiles</em></strong> and there is no other profiles defined either. In the future version we can expect more profiles based on the feedback from the community members.</p>
<p>In the initial <strong><em>Java EE 6.0</em></strong>, there will be only Web Profiles added to the platform. Still the technologies to be used for the Web Profiles are not decided. The discussion is under way to make the conclusion. Roberto Chinnici, the spech lead for <strong><em>Java EE 6.0</em></strong> <a href="http://weblogs.java.net/blog/robc/archive/2008/02/profiles_in_the_1.html" target="_blank">blogged</a> about the possible two options for the Web Profiles. He categorised it as the profile A and profile B.<br />
The below table lists all the technologies in both the profiles:</p>
<table border="1" align="center" bgcolor="gray">
<tbody>
<tr>
<td valign="top">
<table>
<tbody>
<tr>
<td align="center" bgcolor="lightblue">Profile A</td>
</tr>
<tr>
<td>Servlet 3.0</td>
</tr>
<tr>
<td>JSP 2.2</td>
</tr>
<tr>
<td>JSR-45</td>
</tr>
<tr>
<td>EL 1.2</td>
</tr>
<tr>
<td>JSTL 1.2</td>
</tr>
<tr>
<td>JSR-250</td>
</tr>
</tbody>
</table>
</td>
<td valign="top">
<table>
<tbody>
<tr>
<td align="center" bgcolor="lightblue">Profile B</td>
</tr>
<tr>
<td>Servlet 3.0</td>
</tr>
<tr>
<td>JSP 2.2</td>
</tr>
<tr>
<td>JSR-45</td>
</tr>
<tr>
<td>EL 1.2</td>
</tr>
<tr>
<td>JSTL 1.2</td>
</tr>
<tr>
<td>JSR-250</td>
</tr>
<tr>
<td>EJB 3.1 (Lite)</td>
</tr>
<tr>
<td>JTA 1.1</td>
</tr>
<tr>
<td>JPA 2.0</td>
</tr>
<tr>
<td>JSF 2.0</td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Web Beans 1.0</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Still the technologies are not finalized by the committee. This feature itself brought lots of discussions on the blogs about its pros and cons. Those who are against this features argues that giving extra on the server doesn&#8217;t harm the developer, also providing many profiles will confuse the developers to choose the right profiles for their applications and also it will end up in compatibility issues if they could not choose the correct profiles. We have to wait and see the implementation for the <strong><em>Web Profiles</em></strong>.</p>
<h2>4.Pruning the Features</h2>
<p>In the past releases, none of the features has been completely removed from the specification. This become drawback for the SDK in terms of size and the installation time. So, the experts comitee decided to remove the features from the specification if the<br />
feature is not widely used by the developers or any alternatives available for the same feature. Here the removal may not happen<br />
immediately since it might break the past releases. The removal process will go through several steps before it is completely removed.</p>
<p>It is performed in the multistep process where a feature is declared in one release may be moved as optional component in the next release. The JSR has few proposals for initial pruning of features. The two suggested proposals are <strong><em>JAX-RPC</em></strong> and <strong><em>EJB CMP</em></strong>.Here <strong><em>JAX-RPC</em></strong> is replaced by the <strong><em>JAX-WS</em></strong> and <strong><em>EJB CMP</em></strong> is replaced by <strong><em>JPA</em></strong> with more simplified manner.</p>
<p><strong>also read:</strong></p>
<ul>
<li><a href="http://www.javabeat.net/j2ee-books/">J2EE Books</a></li>
<li><a href="http://www.javabeat.net/2009/02/servlets-interview-questions/">Servlets interview questions</a></li>
<li><a href="http://www.javabeat.net/2007/08/annotations-in-java-5-0/">Annotations in Java 5.0</a></li>
</ul>
<h2>5.Summary</h2>
<p>In this article I have explained what are the new features in <strong>Java EE 6.0</strong>. This is only the introduction article and there is lot of changes are coming in Java EE 6.0 version. keep watching the section, we will publish more articles on the different topics. The notable changes in the <strong><em>Java EE 6.0</em></strong> version is <strong>Servlets 3.0, Web Beans 1.0 </strong>and the Profiles. Apart from these three improvements, lot of small changes in the new version.</p>
<div class="wpInsert wpInsertInPostAd wpInsertBelow" style="margin: 5px; padding: 0px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-1490953723360528";
/* JB-Footer-LU 468x15 */
google_ad_slot = "8789107210";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>]]></content:encoded>
			<wfw:commentRss>http://www.javabeat.net/2009/01/new-features-in-java-ee-6-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
