Tuesday January 29, 2008
JRuby-on-Rails deployed on GlassFish - Success Story
There are several reasons you may deploy JRuby-on-Rails application on GlassFish:
Technorati: glassfish netbeans jruby rubyonrails mediacast stories
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Friday January 18, 2008
Travel Plans for Q1 2008 - Fairfax, Little Rock, Orlando, Hyderabad, New York, Las Vegas
Here are my tentative travel plans for the next 3 months:
| Event | Dates | Location |
| Partner Preso | Jan 23 | Fairfax, Virginia |
| Partner Preso | Jan 24 | Little Rock, Arkansas |
| Rails for All | Feb 8-9 | Orlando, Florida |
| Sun Tech Days | Feb 27-29 | Hyderabad, India |
| Ajax World | Mar 18-20 | New York |
| The Server Side Java Symposium | Mar 26-28 | Las Vegas |
Posted by Arun Gupta in webservices | Comments[1]
|
|
|
|
|
Monday December 31, 2007
Screencast #Web11: Travel Map - Another Real-life app using jMaki & Jersey
In my role of Technology Evangelist, I get the opportunity to meet a lot of community (folks like you :) all around the world. In the year 2007, I represented GlassFish (and related technologies - Metro, jMaki and Jersey) at multiple conferences. This blog introduces a new real-life application that plots all the places I visited this year on a jMaki-wrapped Google Map widget. Clicking on the marker shows more information about the event such as dates and the blog entry covering the event.
Play the video below to see how the application looks like.
Here is the architecture of this application:

It consists of a server-side and a client-side applications - developed as NetBeans projects.
Both the server-side and client-side are deployed on GlassFish.
This is only a sample application so optimizations are certainly possible and corner cases (such as no blog entry for a particular visit) are not accounted for. But the application still demonstrates the concept. The fully built application looks like as shown below:

My first presentation in this role was Sun Tech Days Atlanta (highlighted in the image). This application generates an interactive Google Map so feel free to zoom in/out and click
And one last thing before we build the application. Here is
the list of technologies and associated concepts used to build this
application:
And finally, lets build this application. Lets build the
RESTful Web service endpoint project first.
jdbc:derby://localhost:1527/sample
[app on APP]" (right-click and select "Connect...").Execute
Command..." and create a table by giving the following
command:create table EVENTS (id int GENERATED ALWAYS AS
IDENTITY,
event_name varchar(255),
dates varchar(20),
venue varchar(255),
blogs varchar(2056),
PRIMARY KEY (id))Execute
Command..." to add data to the table by giving the
following command:
INSERT INTO EVENTS (event_name, dates, venue,
blogs) VALUES('SunTech Days - Atlanta', 'Jan 16 - Jan 17',
'Cobb Galleria Center, Two
Galleria Parkway, Atlanta, Georgia, 30339',
'http://blogs.sun.com/arungupta/entry/wsit_and_web_2_0');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('jMaki Day', '
Feb 23', '4150
Network Circle Santa Clara, CA 95054',
'http://blogs.sun.com/arungupta/entry/sun_internal_jmaki_day_review');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Ajax World - New
York', 'Mar 19 - Mar 21', 'The
Roosevelt Hotel, 45 E 45th St, New York, NY 10017',
'http://blogs.sun.com/arungupta/entry/sun_ajax_world');
INSERT
INTO
EVENTS (event_name, dates, venue, blogs) VALUES('The Server Side Java
Symposium - Las Vegas', 'Mar 22', '3355 Las Vegas Blvd. South
Las
Vegas, NV 89109',
'http://blogs.sun.com/arungupta/entry/sun_the_server_side_java,
http://blogs.sun.com/arungupta/entry/tango_at_venetian_las_vegas');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('JavaOne - San
Francisco', 'May 7 - May 11', 'Moscone
Center, 747 Howard Street, San Francisco, CA 94103',
'http://blogs.sun.com/arungupta/entry/slides_for_ts_4865,
http://blogs.sun.com/arungupta/entry/javaone_2007_day_1_finished,
http://blogs.sun.com/arungupta/entry/javaone_2007_day_1,
http://blogs.sun.com/arungupta/entry/javascript_everywhere_javaone_2007_demo,
http://blogs.sun.com/arungupta/entry/excel_using_wsit_javaone_2007,
http://blogs.sun.com/arungupta/entry/ts_4865_takes_two_to,
http://blogs.sun.com/arungupta/entry/communityone_glassfish_day_report,
http://blogs.sun.com/arungupta/entry/javaone_2007_backstage,
http://blogs.sun.com/arungupta/entry/javaone_2007_is_almost_here,
http://blogs.sun.com/arungupta/entry/my_javaone_2007_picks');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Rails Conf -
Portland', 'May 17 - May 20', '777 NE MLK, Jr. Blvd. Portland,
OR
97232',
'http://blogs.sun.com/arungupta/entry/tim_bray_s_keynote_session,
http://blogs.sun.com/arungupta/entry/sun_rails_conf_2007_keep,
http://blogs.sun.com/arungupta/entry/getting_started_with_jruby_tutorial,
http://blogs.sun.com/arungupta/entry/jmaki_netbeans_and_glassfish_in');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Google Developer
Day - San Jose', 'May 31', '150 W San Carlos St San Jose, CA 95113',
'http://blogs.sun.com/arungupta/entry/google_developer_day_report');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Mashup Camp -
Mountain View', 'Jul 18 - Jul 19', 'Computer History Museum, 1401 N
Shoreline Blvd., Mountain View, CA 94043',
'http://blogs.sun.com/arungupta/entry/jmaki_at_mashup_camp_report,
http://blogs.sun.com/arungupta/entry/jmaki_mashup_camp');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('OSCON -
Portland',
'Jul 23 - Jul 27', '777 NE MLK, Jr. Blvd. Portland, OR 97232',
'http://blogs.sun.com/arungupta/entry/jmaki_oscon');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('JRuby Hack Day -
San Francisco', 'Aug 8', '1201 8th St, San Francisco, CA 94107',
'http://blogs.sun.com/arungupta/entry/jruby_on_rails_hackday_report,
http://blogs.sun.com/arungupta/entry/learn_jruby_on_rails_free');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Rich Web
Experience - San Jose', 'Sep 6 - Sep 8', '170 S Market St, San
Jose,
CA 95113',
'http://blogs.sun.com/arungupta/entry/the_rich_web_experience_2007,
http://blogs.sun.com/arungupta/entry/jmaki_javafx_the_rich_web');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Rails Conf Europe
- Berlin', 'Sep 17 - Sep 19', 'Maritim Pro Arte,
Friedrichstrasse 151,
10117 Berlin',
'http://blogs.sun.com/arungupta/entry/rails_conf_europe_2007_day2,
http://blogs.sun.com/arungupta/entry/rails_conf_europe_2007_day1,
http://blogs.sun.com/arungupta/entry/rails_conf_europe_2007_day,
http://blogs.sun.com/arungupta/entry/jmaki_netbeans_and_glassfish_in1');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Sun Tech Days -
Rome', 'Sep 24 - Sep 25', 'Meliá Roma Aurelia Antica, Vía
Aldobrandeschi, 223
Rome ITALY 00163',
'http://blogs.sun.com/arungupta/entry/netbeans_day_rome_2007,
http://blogs.sun.com/arungupta/entry/travel_tips_to_rome,
http://blogs.sun.com/arungupta/entry/glassfish_metro_jersey_and_jmaki');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Sun Tech Days -
Milan', 'Sep 26 - Sep 28', 'ATA Hotel Quark - Via Lampedusa 11/a 20141
Milano, Italia',
'http://blogs.sun.com/arungupta/entry/glassfish_day_milan_2007');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Mid West Java
Tech Days - Minneapolis', 'Oct 16', 'University of St Thomas,
MPL 201,
1000 LaSalle Avenue,
Minneapolis, MN 55403-2005',
'http://blogs.sun.com/arungupta/entry/mid_west_java_tech_days,
http://blogs.sun.com/arungupta/entry/metro_and_jmaki_in_minneapolis');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Mid West Java
Tech Days
- Chicago', 'Oct 18', 'Donald E Stephens Convention Center, 9301, W
Bryn Mawr Ave,
Rosemont IL 60018',
'http://blogs.sun.com/arungupta/entry/mid_west_java_tech_days1,
http://blogs.sun.com/arungupta/entry/crowne_plaza_chicago_o_hare,
http://blogs.sun.com/arungupta/entry/metro_and_jmaki_in_minneapolis');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Silicon Valley
Code Camp
- Los Altos', 'Oct 27', 'Foothill College, Los Altos, CA',
'http://blogs.sun.com/arungupta/entry/silicon_valley_code_camp_trip,
http://blogs.sun.com/arungupta/entry/metro_jmaki_silicon_valley_code');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('Sun Tech Days -
Beijing', 'Nov 1 - Nov 3', 'Beijing International Convention
Center,
No.8
Beichendong Road Chaoyang District, Beijing',
'http://blogs.sun.com/arungupta/entry/glassfish_day_beijing_2007_by,
http://blogs.sun.com/arungupta/entry/wangfujing_street_authentic_china_in,
http://blogs.sun.com/arungupta/entry/sun_tech_days_beijing_talent,
http://blogs.sun.com/arungupta/entry/sun_tech_days_beijing_day,
http://blogs.sun.com/arungupta/entry/travel_tips_to_beijing,
http://blogs.sun.com/arungupta/entry/glassfish_day_beijing');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('Partner
Preso
- Toronto', 'Nov 21', 'Toronto City Center',
'http://blogs.sun.com/arungupta/entry/metro_jmaki_jruby_glassfish_q');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('Partner
Preso
- Montreal', 'Nov 21', 'Montreal City Center',
'http://blogs.sun.com/arungupta/entry/metro_jmaki_jruby_glassfish_q');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('GlassFish
- Delhi University',
'Dec 3', 'New Delhi',
'http://blogs.sun.com/arungupta/entry/glassfish_delhi_university');
INSERT
INTO EVENTS (event_name, dates, venue, blogs) VALUES('FOSS.IN -
Bangalore', 'Dec 4', 'India Institute of Science, Bangalore',
'http://blogs.sun.com/arungupta/entry/packaging_java_apps_for_ubuntu,
http://blogs.sun.com/arungupta/entry/foss_in_schedules_now_available,
http://blogs.sun.com/arungupta/entry/glassfish_foss_in_2007');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('Partner
Preso
- Bangalore', 'Dec 4', 'Bangalore',
'http://blogs.sun.com/arungupta/entry/glassfish_bangalore_chennai_and_pune');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('Partner
Preso
- Chennai', 'Dec 5', 'Chennai',
'http://blogs.sun.com/arungupta/entry/glassfish_bangalore_chennai_and_pune');
INSERT INTO EVENTS (event_name, dates, venue, blogs) VALUES('Partner
Preso
- Pune', 'Dec 6', 'Pune',
'http://blogs.sun.com/arungupta/entry/glassfish_bangalore_chennai_and_pune');
INSERT INTO EVENTS (event_name, dates,
venue, blogs) VALUES('Partner
Preso
- San Francisco', 'Dec 17', 'San Francisco',
'http://blogs.sun.com/arungupta/');VALUES
clause to match accordingly.WebApplication3", package name is "events" and the table name to
generate Entity classes is EVENTS. Take everything else as the defaults.events
package as:
@javax.xml.bind.annotation.XmlRootElement
public class EventsList {
@javax.xml.bind.annotation.XmlElement
protected java.util.List<Events> events;
public EventsList() {
if (events == null)
events = new
java.util.ArrayList<Events>();
}
public void add(Events name) {
events.add(name);
}
public java.util.List<Events> getValue() {
return events;
}
}service.EventsResource,
change the method associated with GET to:public EventsList get() {
EventsList eventsList = new EventsList();
List<Events> list =
PersistenceService.getInstance().createQuery("SELECT e FROM Events
e").getResultList();
for (Events e : list) {
eventsList.add(e);
}
return eventsList;
}
http://localhost:8080/WebApplication3/resources/events"
now return a complete RESTful representation of all the rows from the
database table EVENTS. Ajax
Framework" and choose the "Standard"
layout for "index.jsp". Lets say the
project name is "WebApplication4".id="mymap" attribute to the
Google Map widget. The updated widget looks like as shown below:<a:widget name="google.map" id="mymap"
args="{ centerLat : 37.4041960114344,
centerLon : -122.008194923401 }" />
id="mymap" will allow the Map widget to be accessed by
name later.args="{label:'Plot Events'}"
attribute to thes Yahoo button widget. The updated widget looks like as
shown below:<a:widget name="yahoo.button" args="{label:'Plot Events'}"/>glue,js, add the following
code to *onClick subscribe method:var url = jmaki.xhp + "?id=events";
var _map = jmaki.getWidget("mymap").map;
_map.setZoom(2);
_map.clearOverlays();
_map.enableInfoWindow();
jmaki.doAjax({method: "GET",
url: url,
callback: function(_req)
{
var xmlobject = (new DOMParser()).parseFromString(_req.responseText,
"text/xml");
var root = xmlobject.getElementsByTagName('eventsList')[0];
var events = root.getElementsByTagName('events');
for (var i = 0 ; i < events.length ; i++) {
var event = events[i];
var eventName =
event.getElementsByTagName('eventName')[0].firstChild.nodeValue;
var venue = event.getElementsByTagName('venue')[0].firstChild.nodeValue;
var blogs = event.getElementsByTagName('blogs')[0].firstChild.nodeValue;
var dates = event.getElementsByTagName('dates')[0].firstChild.nodeValue;
var
id = event.getElementsByTagName('id')[0].firstChild.nodeValue;
var encodedLocation = encodeURIComponent("location=" + venue);
var url = jmaki.xhp + "?id=yahoogeocoder&urlparams=" +
encodedLocation;
jmaki.myHandler(url, eventName, blogs, dates, id, _map);
}
}
});*onClick
subscribe method:// "Function closure" used from
http://econym.googlepages.com/basic1.htm
// Creates local copy of "marker" and "html" variables to be preserved
for later use
function createMarker(point,html) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click",
function() {
marker.openInfoWindowHtml(html);
});
return marker;
};
// Function closure that preserves "eventName", "blogs", "dates and "id"
// Gets the latitude/longitude from Yahoo Geocoding service and plots
them on the map
// Also creates meaningful markers
jmaki.myHandler = function(_url, eventName, blogs, dates, id, _map) {
jmaki.doAjax({url: _url,
callback : function(req) {
if (req.responseText.length > 0) {
jmaki.log("name: " + eventName);
var response = eval("(" + req.responseText + ")");
var coordinates = response.coordinates;
jmaki.publish("/jmaki/plotmap", coordinates);
jmaki.log("plotting " + eventName);
var latlng = new GLatLng(coordinates[0].latitude,
coordinates[0].longitude);
var blogHtml = "";
b = blogs.split(', ');
for (i=0; i<b.length; i++) {
blogHtml += '<a href="' + b[i] + '">' + (i+1) +
'</a>';
if (i<b.length-1)
blogHtml += ", ";
}
var txt = '<table>' +
'<tr><td>#' + id + ": " + eventName +
'</td></tr>' +
'<tr>Dates: ' + dates + ',
2007</td></tr>' +
'<tr><td>Blogs: ' + blogHtml +
'</td></tr>' +
'</table>';
var marker = createMarker(latlng, txt);
_map.addOverlay(marker);
marker.openInfoWindowHtml(txt);
} else {
jmaki.log("Failed to get coordinates for " + location );
}
}
});
};,
{"id": "events",
"url":"http://localhost:8080/WebApplication3/resources/events/"
}WebApplication3 is the project where RESTful Web service endpoint is hosted.<script type="text/javascript">
in index.jsp can be generated as <script
type="text/javascript;
e4x=1">.Technorati: screencast conf jmaki jersey netbeans glassfish jpa javascript googlemaps restful web2.0 jmakimashups
Posted by Arun Gupta in web2.0 | Comments[9]
|
|
|
|
|
Friday December 14, 2007
|
|
I presented on GlassFish and related
technologies (Metro,
JRuby-on-GlassFish
and jMaki) at the Department of Computer Science,
Delhi University last week. The
slides are available
here. The talk was very well attended with approximately 120 students and 4 faculty members. The students were pretty excited and had great a interactive session. |
|
Being an alumni of the school (many years ago ;), it was great seeing the new building of the department, meeting the faculty and interacting with the students. I reached there an hour earlier so that I can mingle with the staff and students and it was a lot of fun.
The department faculty proposed to use GlassFish instead of Tomcat for their next semester assignment. I believe this is a great move as it will allow the students to understand the simplicity and power of a great open-source and Java EE 5 compliant Application server.
I initiated the process of recruiting a Campus Ambassador from Delhi University and this will help establish a better relationship between this University and Sun Microsystems.
Here are the questions and answers that were asked during the session:
Here are couple of more links that provide a comparison between the IDEs:
The detailed differences are highlighted here.
Windows"
menu item and then "Services". Right-click on "Servers",
select "Add Server...", select "GlassFish V2"
in the "Choose Server" dialog box. Click on "Next"
and follow the instructions.The complete album is here:
Technorati: conf glassfish webservices metro ruby jruby jmaki web2.0 delhiuniversity delhi netbeans q&a
Posted by Arun Gupta in webservices | Comments[3]
|
|
|
|
|
Thursday December 13, 2007
GlassFish @ Bangalore, Chennai and Pune - Metro, jMaki & JRuby
I presented on GlassFish and other related technologies (Metro, jMaki and JRuby) in Bangalore, Chennai and Pune last week. The slides used during the preso are here. And here is the list of questions (along with answers) for you:
Is Metro plugin available for NetBeans version < 6.0 ?
Yes, Metro plugin is available for NetBeans 5.5.1. This is clearly explained
in
screencast
#ws4. NetBeans 6.0 is now
released and is the recommended version of the IDE.
jMaki.js is the initialization script (18kb) for jMaki that is
loaded when the web application is loaded. This script provides
multiple features, included but not limited to:The jMaki wrapper is a minimal code that needs to be written anyway to invoke the code anyway so there is no additional overhead there.
Is Comet supported in GlassFish/jMaki?
Yes, read about Comet support in GlassFish
The Grizzly Comet and
Writing a Comet application using GlassFish. Also try a simple sample
that demonstrates how
jMaki and Comet (read the
explanation) work nicely with each other.
Can GlassFish deploy EJB 2.0 apps ?
GlassFish is Java EE 5 compliant which maintains backwards compatibility
with J2EE 1.4 and so EJB 2.0 applications can be deployed.
Do GlassFish support Active and Passive cluster ?
In GlassFish the cluster instances talk to each other for health monitoring
through GMS (of Shoal). The buddy
instances talk to each other for replication of the session state. When a
failure is detected the LoadBalancer can failover the request to any
instance in the cluster. The session in question will be fetched from a
replica to this instance in order to continue the conversational state of
the session. In this sense, we have an active cluster.
GlassFish does not have a concept of a standby or passive cluster which will
take over when an active cluster fails altogether. That is usually
considered a high cost approach for redundancy and not advisable.
Read more discussion
here.
Can we add a Metro Web service wrapper be created around
EJB 2.0 ?
Nope, Metro Web service wrapper can be created around EJB 3.0 only.
How can an application deployed on WebLogic be migrated
to GlassFish ?
Migrate2GlassFish
helps automate the migration of J2EE/Java EE applications to GlassFish.
Can Entity beans be configured only as read-only beans -
caching server for these beans ?
Yes, read about the
characteristics, good practices, how to deploy and refresh read-only
beans.
How can jMaki applications run behind the firewall ?
Add the following Servlet parameters to web.xml:
<context-param>
<param-name>proxyHost</param-name>
<param-value>PROXY_HOST</param-value>
</context-param>
<context-param>
<param-name>proxyPort</param-name>
<param-value>PROXY_PORT</param-value>
</context-param>
This is described in detail at
https://ajax.dev.java.net/xmlhttpproxy.html.
Technorati: conf webservices web2.0 ruby jruby projecmetro glassfish netbeans q&a
Posted by Arun Gupta in webservices | Comments[7]
|
|
|
|
|
Wednesday December 12, 2007
TOTD #20: How to create a new jMaki widget ?
This TOTD explains how to create a new jMaki widget and make it available in the NetBeans palette.
In order to create a jMaki widget, it's important to understand the jMaki Widget Model.
![]() |
Basically, "component.htm", "component.js" and an optional "component.css" together make a jMaki widget. |
Here are the files for a Hello World widget that takes an argument, concatenates it with the string "Hello" and displays the result on the page.
component.htm
<div id="${uuid}" class="hello"></div> |
component.js
jmaki.namespace("jmaki.widgets.hello"); |
component.css
.hello { |
The following files are required if you like to package your component as a reusable widget library in the NetBeans IDE:
hello.jsp
<a:widget name="hello" args="{name: 'Duke'}"
/> |
Bundle.properties (top-level)
jMaki.Library.Name=jMaki Hello Widget |
Bundle.properties (templates)
NAME_templates.hello=Hello |
widget.json
{ |
Package these files together in the following directory structure (choose any zip file name):
Bundle.properties |
And then you zip up these files together, that's it! Now this zip file can be added to the jMaki palette in the NetBeans IDE as shown here. Really simple!
After the widget is added to NetBeans palette, it looks like as shown below:

Now, just like any other jMaki widget, you can drag-and-drop "Hello"
from the jMaki palette in your JSP page and the following code fragment is
generated:
<a:widget name="hello" args="{name: 'Duke'}" />
After the application is deployed, the page is rendered in the browser as shown below:

Couple of points ...
templates directory. This enables drag-and-drop of your widget
in those languages as well.Bundle.properties otherwise they will not be recognized.Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totd jmaki web2.0 widgets ajax netbeans
Posted by Arun Gupta in web2.0 | Comments[12]
|
|
|
|
|
Wednesday November 28, 2007
Metro, jMaki & JRuby/GlassFish Q&A from a Preso - Toronto & Montreal
I presented on Metro, jMaki and JRuby-on-GlassFish at a partner meeting on Nov 21 in Toronto and Montreal (yeah, both cities in the same day). That makes it 3 cities (the first one being Seattle) total for now!
I've given multiple talks all over the world to different types of audience but this was my first experience in terms of talking for 3 hours in the morning, flying to another city and then repeating the sessions. GlassFish (both v2 and v3), NetBeans IDE and Windows Vista behaved properly through all the demos. And my talks are typically demo intensive so it was fun! I enjoyed the overall experience (talking, demos, flying) :)
As always, the fun part was interaction with the audience and I always learn something new every time. And, in order to share the knowledge with you, here is the consolidated list of questions from both the cities:
Although the jmaki framework will work on these browsers some widgets may not work (such as those that use SVG) depending on the browser.
And now for the Metro session:
And finally for the JRuby-on-GlassFish session:
Feel free to ask any other questions in Metro Forum and jMaki Forum or GlassFish forum or JRuby user list.
Technorati: conf webservices metro jmaki glassfish jrubyonglassfish ruby jruby netbeans web2.0 q&a
Posted by Arun Gupta in webservices | Comments[0]
|
|
|
|
|
Tuesday November 20, 2007
Metro and jMaki Q&A from a Preso
I presented on Metro and jMaki in a invitation-only gathering on Nov 15. The audience in both the sessions was pretty interactive. Even though the sessions were invitation-only, I'm posting some of the questions asked during the sessions along with their answers.
Jmaki.php and XmlHttpProxy.php.And now for the Metro session:
wsit-on-glassfish.xml script and can
be used to override the jars in an existing
GlassFish v2
installation.Metro team also presented a BoF 2526 on these improvements at JavaOne 2006.
Feel free to ask any other questions in Metro Forum and jMaki Forum.
Technorati: conf webservices jmaki glassfish netbeans web2.0 q&a
Posted by Arun Gupta in webservices | Comments[1]
|
|
|
|
|
Wednesday November 07, 2007
Screencast #Web10: CRUD using jMaki and JPA
![]() |
This screencast shows how to create a simple
jMaki application, using
NetBeans IDE, that performs
some of the
CRUD operations on a Data Table widget. It uses Java Persistence API
(JPA) to connect to the database and the application is deployed on
GlassFish. The rest of the CRUD
operations can be easily built using the same methodology. The steps followed in this screencast are also described in detail. Enjoy it here! |
Technorati: screencast jmaki netbeans glassfish jpa database crud
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Thursday November 01, 2007
Sun Tech Days Beijing - Day 1 Report
1500 developers kick started 10th anniversary Tech Day event at the Beijing International Convention Center earlier today.
Joey Shen, Angela Caicedo, Doris Chen and Chuk Munn Lee demonstrated Swing/Java2D, Sun SPOTs, jMaki and JavaFX demo respectively as part of the demo showcase. All the demos were really good and showcased different technologies from Sun. I personally liked Sun SPOT demo which showcased how Robosapiens can be easily controlled using the JVM. It very well resonated with "Internet of Things" that Lionel Kim (President Greater China and COO APAC Sun Microsystems) mentioned in his keynote earlier in the morning.
According to Lionel, there are three factors driving global innovation:
Rise of communities - Time magazine awarded YOU (community) as Person of The Year award for 2006. And that indeed is the most important factor in driving innovation.
Carla provided a great coverage of Jim Hughes keynote (during which I was busy with local translators for my upcoming session :) This is the 10th anniversary year of Tech Days and we celebrated by cutting a birthday cake. There is lot of backstage work (audio, video, rehearsal, logistics and all sort of things) that often goes unnoticed and some of the photographs below highlight that work.
![]() |
Right after the keynote, I gave a talk on "Java EE5, GlassFish and Their Future" and the slides are
available
here. It was great talking about
GlassFish to a 560 capacity room full of audience.
Leon showed a demo of
localized version of GlassFish and how it can be configured in a
clustered environment. Jim Jiang offered to give away 10 copies of his recently published book on GlassFish. You can order it online here. Jim Jiang and Wang Yu are the primary authors with content contributed from Jason Huang, Ada Li, Liang Ye and Evrin Yan. It was great meeting most of these individuals face-to-face. If you missed being one of the lucky winners of the book, then attend GlassFish Day on Saturday, Nov 3 and there will be many more copies distributed. |
I also attended Chuk's talk on Metro and REST. He really presented the concept very well and it was fun seeing somebody else present Metro :)
I spent rest of the day talking to people on the GlassFish booth. Once again, Jim Jiang helped me connect with the local audience. I'll prepare a summary of the questions and then provide answers to them in a subsequent blog. In the meanwhile, here are some links for you to get started:
The evening ended with Yanjing Beer and Beijing Duck dinner. And as always, enjoy the pictures from through out the day:
Follow the complete coverage in Sun Tech Days Event blog.
Technorati: conf suntechdays metro webservices jmaki web2.0 glassfish netbeans beijing
Posted by Arun Gupta in webservices | Comments[0]
|
|
|
|
|
Tuesday October 30, 2007
Silicon Valley Code Camp Trip Report
Rama and I presented on Metro and jMaki in Silicon Valley Code Camp last Saturday. Here are the pictures
It was good to meet Peter Kellner (SVCC Orgaznier, Aaron Houston (Program Coordinator for JUGs), Van Riper (Silicon Valley JUG Founder), Kevin Nelson (Silicon Valley Web JUG Founder), Juval Lowy (of iDesign) and many others.
And here is a recap of the question/answers asked during the two sessions:
There are changed signatures when using JAX-WS
2.1.3 with JDK 6. How does it work ?
JDK 6 U3 contains JAX-WS 2.0 APIs. JAX-WS 2.1.x contains JAX-WS 2.1
APIs. In order to override the default APIs, the endorsed directory
mechanism needs as explained
here.
Next stop, GlassFish Day @ Beijing.
Technorati: conf siliconvalleycodecamp metro webservices interoperability jmaki web2.0 glassfish netbeans
Posted by Arun Gupta in webservices | Comments[2]
|
|
|
|
|
Tuesday October 23, 2007
Metro & jMaki @ Silicon Valley Code Camp - FREE event on Oct 27 & 28
|
|
Metro (Takes 2 to Tango: Java Web services and .NET interoperability) | Room 4306 | Saturday (10/27) | 11:15am |
| jMaki: Multiple Languages, Multiple Toolkits | Room 4204 | Saturday (10/27) | 1:45pm |
Venue: Foothill College, Los Altos Hills, CA
In the first session (Metro), I'll show how Metro enables interoperability with .NET 3.0 platform. The talk shows how a Secure and Reliable Web service deployed on GlassFish V2 can be invoked from Excel 2007 spreadsheet. It also shows how such a Web service can be easily built using NetBeans 6 IDE.
The second talk explains how jMaki provides a light-weight framework to build Ajax-enabled applications using standard practices and using the best toolkits and libraries. Using multiple demos, it shows how this framework spans multiple languages.
Aaron promised to distribute some nice goodies if you attend these two talks :)
Technorati: conf siliconvalleycodecamp metro webservices interoperability jmaki web2.0 glassfish netbeans
Posted by Arun Gupta in webservices | Comments[6]
|
|
|
|
|
Tuesday October 16, 2007
Web 2 Summit - Cool Applications on Industry-grade Operating System
![]() |
Sun Microsystems is a gold sponsor of Web 2 Summit (nee Web 2.0 Conference). Registration to this conference by invitation only. If you are an attendee, here is one session that you don't want to miss: |
In this session, Sun Chief OS Platform Strategist Ian Murdock, Joyent CTO Jason Hoffman and Director of Systems Ben Rockwood will show that the latest innovations in operating system technology are happening in OpenSolaris and will explore how even though the OS is invisible to developers much of the time, it very much still matters for writing cool "Web 2.0" applications.
Technorati: conf opensolaris web2summit web2.0
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Thursday September 13, 2007
Tuesday September 11, 2007
Sun Microsystems kicks off 2007-2008 Tech Days and marks the 10th anniversary of the developer event. This blog celebrates the decade by announcing "Sun Tech Days Event Map" - a real-life RIA created using jMaki. It allows you to choose the date on a web page using a rich calendar widget, shows the city where Sun Tech Days event is happening during that month and then shows that city location in a map. Play the video below to see how the application looks like:
This application shows several concepts of jMaki:
This application is built using NetBeans IDE 5.5.1, jMaki 0.9.7.3 and deployed on GlassFish RC4. Let's get started.
Web" in "Categories"
and "Web application" in "Projects". Click on
"Next >".SunTechDays" and choose
GlassFish as the "Server" and take all other values
default. Click on "Next >".jMaki Ajax Framework" and choose "Two
Fixed Right Sidebars" layout.Finish".index.jsp"Top Right Column" by dragging-and-dropping "Dojo
Combobox".Right Column" with "Yahoo Calendar".Left Column" with a "Google Map".Runtime" tab, expand "Databases",
right-select the node with the value "jdbc:derby://localhost:1527/sample"
and select "Connect".app".Execute Command...".
Create the table using the following SQLcreate table TECHDAYS_SCHEDULE (startDate date,
endDate date,
location varchar(255),
PRIMARY KEY (startDate, endDate))INSERT INTO TECHDAYS_SCHEDULE VALUES ('9/11/2007', '9/12/2007',
'Boston, United States');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('9/24/2007', '9/25/2007', 'Rome,
Italy');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('9/26/2007', '9/28/2007', 'Milan,
Italy');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('10/19/2007', '10/19/2007',
'Taipei, Taiwan');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('10/23/2007', '10/25/2007',
'Shanghai, China');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('11/1/2007', '11/3/2007',
'Beijing, China');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('11/6/2007', '11/8/2007', 'Tokyo,
Japan');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('12/3/2007', '12/5/2007',
'Frankfurt, Germany');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('1/9/2008', '1/10/2008', 'Atlanta,
United States');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('2/27/2008', '2/29/2008',
'Bangalore, India');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('3/4/2008', '3/6/2008', 'Sydney,
Australia');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('3/11/2008', '3/13/2008',
'Johannesburg, South Africa');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('4/1/2008', '4/1/2008', 'St
Petersburg, Russia');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('4/1/2008', '5/1/2008', 'Manila,
Philippines');
INSERT INTO TECHDAYS_SCHEDULE VALUES ('5/21/2008', '5/23/2008', 'Mexico
City, Mexico');New",
"Entity Classes from Database...".New Entity Classes from Database" dialog
window, choose "Data Source" and select "jdbc/sample"
value.Available Tables".
Select "TECHDAYS_SCHEDULE" and click on "Add >".Next >".suntech".Create Persistence Unit...".Create Persistence Unit..." dialog window take all
the default values and click on "Create".Finish".Configuration Files", open "persistence.xml",
click on "Add Class", click "Cancel", click on
"Add Class" again and now select "suntech.TechdaysSchedule"
and click on "OK".Source Packages", "suntech" node
and open "TechdaysSchedule.java".@NamedQuery(name = "TechdaysSchedule.findByMonth", query = "SELECT
t FROM TechdaysSchedule t WHERE t.techdaysSchedulePK.startdate >= :firstdate
and t.techdaysSchedulePK.enddate <= :lastdate"),Web Pages", open "glue.js" and add
the following code at the end of the file:jmaki.subscribe("/yahoo/calendar/onSelect",
function(args) {
var newDate;
if (typeof args.value == "undefined") {
var tempDate = new Date();
newDate = (tempDate.getMonth()+1) + "/" + tempDate.getDate()
+ "/" + tempDate.getFullYear();
} else {
var str = "" + args.value;
newDate = str.split(" ")[1] + "/" + str.split(" ")[2] + "/" +
str.split(" ")[3];
}
jmaki.doAjax({method: "POST",
url: "data.jsp?date=" +
encodeURIComponent(newDate),
callback: function(_req) {
var tmp = _req.responseText;
var obj = eval("(" + tmp + ")");
jmaki.log("tmp "+ obj);
jmaki.publish('/dojo/combobox/setValues',
obj);
// handle any errors
}
});
});
jmaki.subscribe("/dojo/combobox/onSelect", function(item) {
var location = item.value.split(',')[0] + ", " + item.value.split(',')[1];
var start = item.value.indexOf('(');
var stop = item.value.lastIndexOf(')');
var encodedLocation = encodeURIComponent("location=" + location);
// jmaki.xhp is provided as part of jmaki and maps to the XMLHttpProxy
var url = jmaki.xhp + "?id=yahoogeocoder&urlparams=" + encodedLocation;
jmaki.doAjax({url: url, callback : function(req) {
if (req.responseText.length > 0) {
// convert the response to an object
var response = eval("(" + req.responseText +
")");
var coordinates = response.coordinates;
v = {results:coordinates};
jmaki.publish("/jmaki/plotmap", coordinates);
} else {
jmaki.log("Failed to get coordinates for " +
location );
}
}
});
});<a:widget name="dojo.combobox" service="data.jsp"/>New" and then "JSP..."
using the name "data". Notice, the IDE automatically picks
up the file extension.<%@ page import="java.util.*" %>
<%@ page import="suntech.*" %>
<%@ page import="javax.persistence.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
String dateParam = request.getParameter("date");
Date date = null;
if (dateParam == null || "".equals(dateParam))
date = Calendar.getInstance().getTime();
else {
SimpleDateFormat sdf = new SimpleDateFormat("MMM/dd/yyyy");
date = sdf.parse(dateParam);
}
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("SunTechDaysPU");
EntityManager em = emf.createEntityManager();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DATE, 1);
Date firstDateOfMonth = cal.getTime();
cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
Date lastDateOfMonth = cal.getTime();
List<TechdaysSchedule> list =
em.createNamedQuery("TechdaysSchedule.findByMonth").
setParameter("firstdate",
firstDateOfMonth).
setParameter("lastdate",
lastDateOfMonth).
getResultList();
out.println("[");
boolean first = true;
int count = 0;
SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy");
for (TechdaysSchedule t : list) {
StringBuffer buf = new StringBuffer();
buf.append(sdf.format(t.getTechdaysSchedulePK().getStartdate()));
buf.append(" - ");
buf.append(sdf.format(t.getTechdaysSchedulePK().getEnddate()));
String city = t.getLocation() + ", (" + buf.toString() + ")";
out.println("{");
out.println("name: \"" + t.getLocation() + "\", ");
out.println("label: \"" + city + "\", ");
out.println("value: \"" + city + "\"");
if (first) {
out.println(", selected: " + true);
first = false;
}
out.println("}");
if (count++ < list.size()-1)
out.println(",");
}
out.println("]");
%>And that's it!
Carla and I conceived this application together and Greg and helped with gluing the widgets.
Here are some potential fun improvements:
Technorati: jmaki netbeans glassfish suntechdays jpa screencast web2.0
Posted by Arun Gupta in web2.0 | Comments[14]
|
|
|
|
|
Today's Page Hits: 5469
Total # blog entries: 1002