Thursday January 24, 2008
RESTful representation of "sakila" using GlassFish and NetBeans IDE
"sakila" is the sample database shipped with MySQL (pronounced as my ess-kew-ell). In the context of Sun Microsystems announcing the agreement to acquire MySQL, I'd like to dedicate this entry to show how this sample database can be exposed as a RESTful Web service endpoint and deployed on GlassFish using Jersey Tooling Plugin (0.4.1 with Jersey 0.4) in NetBeans IDE.
Lets get started!
sakila".mysqld-nt --user root
--console' in bin directory on Windows or './bin/mysqld_safe'
from MySQL directory on Unix flavors.sakila".
Choose "GlassFish v2" as the "Server:".Services" tab of NetBeans IDE, expand "Drivers" and add
MySQL
Connector/J driver if it does not exist already.
New", "Entity Classes from
Database...". In "Data Source", select "New Data Source..." and specify the
values as shown below:
film" in "Available Tables" and click on "Add >" as shown
below:
Next >".Create Persistence Unit..." and take all the defaults as shown
below:
Create".sakila" as shown below:
Finish".Configuration Files"
and open "persistence.xml". Specify the username and password
by replacing <properties/> with the following fragment:<properties>
<property name="toplink.jdbc.user" value="root"/>
<property name="toplink.jdbc.password" value=""/>
</properties>Tools", "Plugins", "Available Plugins", "RESTful
Web Services" and then click on "Install". This installs the
Jersey Tooling
Plugin in the IDE.New", "RESTful Web Services from
Entity Classes...".Add >>", take all other defaults as shown
below:
Next >", take all defaults and then "Finish".Test RESTful Web Services".
The following web page is presented in the browser:
films" and then on "Test" as shown
below:
Test" button or the URL "http://localhost:8080/sakila/resources/films/"
shows the RESTful representation of the "Film" table. The
default representation shows 10 records from the table where each entry
returns the "id" of the film and a reference to the detailed
entry.http://localhost:8080/sakila/resources/films/?max=40".
Additional fields from the table can be displayed by adding getter methods
to "converter.FilmRefConverter" class such as:@XmlElement
public String getTitle() {
return entity.getTitle();
}

Here are few more ideas for you to explore:
A JRuby-on-Rails application using MySQL is explained here. TOTD #9 explains how JDBC connection pooling in GlassFish can be used for a JRuby-on-Rails application using MySQL.
The key message here is MySQL can be very easily used with GlassFish and NetBeans IDE makes it possible! Once MySQL becomes part of Sun, this integration is going to be much more seamless for the betterment of community.
All the entries on this blog using MySQL can be found here. And last but not the least, Welcome aboard MySQL!
A NetBeans project with all the source code can be downloaded from here. You will still need to setup the database connection and need to make sure the correct version of Jersey plug-in as well :)
Technorati: glassfish netbeans jersey mysql sakila jpa jmaki rubyonrails
Posted by Arun Gupta in webservices | Comments[28]
|
|
|
|
|
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]
|
|
|
|
|
Wednesday January 09, 2008
jMaki @ Ajax World, New York 2008

Sun Microsystems is a Gold sponsor of Ajax World 2008, New York City.
I'll be speaking on Web
Application Development using jMaki.
jMaki is a light-weight framework to create Rich Internet Applications
using the best tools/libraries and standard practices. I plan to
deliver the talk with lots of demos
and hope you'll be able to correlate them with real-life scenarios
easily. Of course, GlassFish
provides a robust development environment for deploying these
applications.
I liked the fact that they put my name/photo on the front page as shown
below (kinda cool):

This is the first time it happened to me :)
If you have not registered yet, Register
Today (before Jan 18) and save $200.
Find out more about the Products, Solutions, Free Developer Tools, Try and Buy
and Other Cool Stuff for your next generation Web application (aka "Web
2.0") at developers.sun.com/web.
Technorati: conf jmaki glassfish ajaxworld
Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
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]
|
|
|
|
|
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]
|
|
|
|
|
Wednesday October 31, 2007
TOTD #15: Delete/Update Row from Database using jMaki Data Table
A Previous Entry explained how a Data Table widget can be populated from a database using Java Persistence API (JPA). This TOTD extends that entry and explains how a selected row from the Data Table can be deleted from the database. This entry is created based upon a requirement from Dave Briccetti at Silicon Valley Code Camp 2007 last weekend.
The first part of the entry is also a re-write of using NetBeans 6 and the latest jMaki NetBeans plugin.
Web Application'
project and name it as 'jmaki-database'.
Next' button, add 'jMaki Ajax Framework'
and choose 'Standard' layout as shown below:
Finish' button.Runtime' tab, expand Databases, connect
to the default database (with the URL 'jdbc:derby://localhost:1527/sample
[app on APP]'). Specify the username 'app' and password
'app'.Execute Command...'
and issue the command:create table BOOKS (title varchar(255),
author varchar(255),
isbn varchar(255),
description varchar(255),
PRIMARY KEY (isbn))INSERT INTO BOOKS VALUES('Galloway Book of Running', 'Jeff Galloway',
'ABC001', 'The best book on running');
INSERT INTO BOOKS VALUES('The Complete Book of Running', 'James Fixx',
'ABC002', 'Oldest book of running');
INSERT INTO BOOKS VALUES('The Runners Handbook', 'Bob Glover', 'ABC003',
'Bestselling Guide for Beginning and Intermediate Runners');
INSERT INTO BOOKS VALUES('Daniel Running Formula', 'Jack Tupper Daniels',
'ABC004', 'Proven programs 800m to Marathon');
INSERT INTO BOOKS VALUES('Chi Running', 'Danny Drever', 'ABC005',
'Revolutionary approach to effortless, injury-free running');
INSERT INTO BOOKS VALUES('Running for Mortals', 'John Bingham', 'ABC006', 'A
common sense plan for changing your life through running');
INSERT INTO BOOKS VALUES('Marathoning for Mortals', 'John Bingham',
'ABC007', 'Regular person guide to marathon');
INSERT INTO BOOKS VALUES('Marathon', 'Hal Higdon', 'ABC008', 'The Ultimate
Training Guide');jmaki-database',
right-click and select 'New' and choose 'Entity
Classes From Database...'.jdbc/sample' as 'Data Source'.BOOKS' in 'Available Tables' and
click on 'Add' and enter the values as shown below:
Next'.server' as shown below:
Create Persistence Unit...' to create the
persistence unit and enter the values as shown below:
Create'.and click on 'Finish'.
@NamedQuery(name = "Books.findAll", query = "SELECT b FROM Books b")Configuration Files' and open
'persistence.xml'.Add Class' button and choose 'server.Books'
class and click 'OK'. This will ensure that the generated
entity class is explicitly recognized by the EntityManagerFactory.Web Pages', select 'New'
and then 'JSP...'. Give the name as 'data' as
shown:
Finish'.data.jsp' with the
following:<%@ page import="java.util.*" %>
<%@ page import="server.Books" %>
<%@ page import="javax.persistence.*" %>
<%
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("jmaki-databasePU");
EntityManager em = emf.createEntityManager();
List<Books> list = em.createNamedQuery("Books.findAll").getResultList();
out.println("{columns : [" +
"{ label : 'Title', id : 'title'}," +
"{ label :'Author', id : 'author'}," +
"{ label :'ISBN', id : 'isbn'}," +
"{ label :'Description', id : 'description'}" +
"],");
out.println("rows: [");
for (int i=0; i<list.size(); i++) {
Books b = list.get(i);
out.print("{ id: '" + b.getIsbn() + "', " +
"title: '" + b.getTitle() + "'," +
"author: '" + b.getAuthor() + "'," +
"isbn: '" + b.getIsbn() + "'," +
"description: '" + b.getDescription()
+ "'}");
if (i < list.size()-1)
out.println(",");
else
out.println();
}
out.println("] }");
%>index.jsp', drag-and-drop a 'Yahoo Data Table' widget from the jMaki Palette in the 'Main
Content Area'.<a:widget name="yahoo.dataTable"
value="{columns :
[
{ label : 'Title', id : 'title'},
{ label :'Author', id : 'author'},
{ label : 'ISBN', id : 'isbn'},
{ label : 'Description', id : 'description'}
],
rows :
[
{ title : 'Book Title 1', author : 'Author 1', isbn: '4412', description
: 'A Some long description'},
{ id : 'bar', title : 'Book Title 2', author : 'Author 2', isbn :
'4412', description : 'A Some long description'}
]
}" />
<a:widget name="yahoo.dataTable" service="data.jsp" />
The 'service' attribute tells jMaki runtime to retrieve the data
for DataTable widget from 'data.jsp' instead of the using static
data.
Source Packages', 'server',
edit 'Books.java' and add the following NamedQuery:@NamedQuery(name = "Books.deleteByIsbn", query = "DELETE FROM Books b
WHERE b.isbn = :isbn")Web Pages', select 'New'
and then 'JSP...'. Give the name as shown:
Finish'.delete.jsp' with the
following:<%@ page import="javax.persistence.*" %>
<%
String isbn = request.getParameter("isbn");
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("jmaki-databasePU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
em.createNamedQuery("Books.deleteByIsbn").
setParameter("isbn", isbn).
executeUpdate();
em.getTransaction().commit();
%>Web pages' and edit 'glue.js' to add
the following fragment in '*onSelect' subscribe method:jmaki.doAjax({method: "POST",
url: "delete.jsp?isbn=" + encodeURIComponent(args.value.isbn),
callback: function(_req) {
jmaki.publish('/jmaki/table/removeRow', { targetId:
args.value.isbn });
}
});index.jsp' as:<a:widget name="yahoo.dataTable" service="data.jsp" subscribe="/jmaki/table"/>That's it! Now clicking on any row of the table will delete that particular row from the database and also from the table. If jMaki Debugger Console is enabled, then the messages are shown as below:

Using the similar steps described in bullet #9-13, a row can be updated in the database.
Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totd jmaki glassfish netbeans jpa database
Posted by Arun Gupta in web2.0 | Comments[44]
|
|
|
|
|
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]
|
|
|
|
|
Friday October 19, 2007
Mid West Java Tech Days 2007 - Chicago Trip Report
Mid West Java Tech Days concluded in Chicago yesterday.
With approximately 160 participants, the conference attendees were slightly larger in number than the Minneapolis Tech Days. The interaction with the audience was also good. The day started with Tim Bray's key note and it was a repeat of Minneapolis.
I delivered two talks (same as in Minneapolis)- "Metro: Web services interoperability with Microsoft .NET" and "jMaki: Framework for Ajax-enabled Web 2.0 apps". Here are the questions (with answers) that were asked during the presentation:
Metro: Web services interoperability with Microsoft .NET
jMaki: Framework for Ajax-enabled Web 2.0 apps
Here is the picture album:
And I met one my avid blog readers - Roman Kuzmik. He was pretty excited to meet me and it's great to hear you like the content produced on this blog :)
Next stop Silicon Valley Code Camp (Nov 27-28).
Technorati: conf webservices glassfish metro jmaki netbeans
Posted by Arun Gupta in webservices | Comments[2]
|
|
|
|
|
Tuesday October 16, 2007
Mid West Java Tech Days 2007 - Minneapolis Trip Report
Mid West Java Tech Days concluded in Minneapolis earlier today.
First, here are some facts I learned about Minneapolis:
Second, the Internet connection at the hotel is ridiculously slow (at least for me) as shown here:

I talked to other colleagues staying at the same hotel and it seemed to work fine for them. Anyway, it took 6 calls to the Tech Support to resolve the issue partly. Or may be it's 1:15am in the morning here, the usage is down and that's why I'm seeing a better response time ;-) But when I explained the issue to the hotel, they happily removed the ISP charges for my first day stay @ the hotel.
Now back to the event.
The event kick started with Tim Bray's keynote.
Tim Bray gave the keynote to an audience of approx 125 people and talked about "Business and Cultural aspect of Web 2.0" and "Programming Language and Infrastructure". Everybody in the room raised a hand when asked if they were a developer which was kind of cool because typically we see a mix of IT managers, Engineering Managers, Sys Admins and of course Developers.
One of the key messages in the talk was to start thinking about outside-in (how the community is going to interact/provide feedback about the product) and inside-out (how open the discussions can be) for a product and see how the community can be involved.
Tim presented Tree View of the Programming Languages. It shows how different programming languages are getting adopted year-by-year. The data is created by collecting book purchasing data from different publishers and then taggin each book with language. They point to notice is that only JavaScript and Ruby are growing. Here are some of the points that he mentioned about PHP & Rails:
PHP
Rails
Java is a 3-legged stool comprising of APIs, JVM and Java language. All the scripting languages (Ruby, PHP, JavaScript, etc) are supported in the JVM using JSR 223 APIs.
Tim also compared PHP, Rails and Java in terms of scaling, dev speed, dev tools & maintainability. The talk concluded by stating that Single Architecture IT shop is never going away. PHP, Java, Ruby, .NET - all will continue to exist and live together. REST allows a cleaner integration of these technologies. In my talk on Metro, I discussed an alternate strategy for a heterogeneous systems where Java and .NET can co-exist with each using WS-*-based interoperability achieved in GlassFish.
I delivered two talks - "Metro: Web services interoperability with Microsoft .NET" and "jMaki: Framework for Ajax-enabled Web 2.0 apps".
The first talk (Metro) was scheduled to start at 11:15 am and there were only 3 people in the room at that time. I started the talk few minutes late giving time for people to show up but even by 11:25 (after I've done the initial introductions) there were only approx 12 people in the room. And then somebody from the audience mentioned that the previous session just finished and I did see a splurge of audience right around that time. On audience's request, I did a recap and then continued with rest of the presentation. I was glad that the room was full in few more minutes :)
The slides are available here. Here is the list of questions asked with their answers:
The jMaki talk was SRO and we had to borrow multiple chairs from another room to accommodate the audience. The slides are available here. Here is the list of questions asked with their answers:
And, of course, there were some Hudson enthusiasts.
The evening concluded with a great dinner at Solera along with Charlie, Thomas, Tim and Greg and some interesting discussions about scripting languages.
Here is the picture album so far:
Next step Chicago on Oct 18, there is still time to register!
Technorati: conf webservices glassfish metro jmaki netbeans hudson
Posted by Arun Gupta in webservices | Comments[79]
|
|
|
|
|
Today's Page Hits: 2050
Total # blog entries: 1007
| « December 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
5 | ||||||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | ||
| Today | ||||||