Monday October 12, 2009
Oracle Open World 2009 - Day 2 Report
Content available at: http://blog.arungupta.me/2009/10/oracle-open-world-2009-day-2-report/.
Posted by Arun Gupta in General | Comments[3]
|
|
|
|
|
Sunday October 11, 2009
Oracle Open World 2009 - Day 1 Report
Content available at: http://blog.arungupta.me/2009/10/oracle-open-world-2009-day-1-report/.
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Thursday October 08, 2009
TOTD #112: Exposing Oracle database tables as RESTful entities using JAX-RS, GlassFish, and NetBeans
Content available at: http://blog.arungupta.me/2009/10/totd-112-exposing-oracle-database-tables-as-restful-entities-using-jax-rs-glassfish-and-netbeans/.
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Friday October 02, 2009
TOTD #109: How to convert a JSF managed bean to JSR 299 bean (Web Beans) ?
Content available at http://blog.arungupta.me/2009/10/totd-109-how-to-convert-a-jsf-managed-bean-to-jsr-299-bean-web-beans/>.
Posted by Arun Gupta in General | Comments[3]
|
|
|
|
|
Wednesday September 30, 2009
TOTD #106: Connect to Oracle database using NetBeans
Content available at: http://blog.arungupta.me/2009/09/totd-106-connect-to-oracle-database-using-netbeans/.
Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Wednesday September 02, 2009
Track your running miles using Apache Wicket, GlassFish, NetBeans, MySQL, and YUI Charts
Content available at: http://blog.arungupta.me/2009/09/track-your-running-miles-using-apache-wicket-glassfish-netbeans-mysql-and-yui-charts/.
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Monday August 17, 2009
TOTD
#93
showed how to get started with Java EE 6
using NetBeans
6.8 M1 and
GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web
application. TOTD
#94 built upon it by using Java Server Faces 2 instead of
Servlet 3.0 for displaying the results. However we are still using a
POJO
for all the database interactions. This works fine if we are only
reading values from the database but that's not how a typical web
application behaves. The web application would typically perform all
CRUD operations. More typically they like to perform one or more CRUD
operations within the context of a transaction. And how do you do
transactions in the context of a web application ? Java EE 6 comes to
your rescue.
The EJB 3.1
specification (another new specification in Java EE 6) allow
POJO classes to be annotated with @EJB and bundled within
WEB-INF/classes of a WAR file. And so you get all transactional
capabilities in your web application very easily.
This Tip
Of The Day (TOTD) shows how
to enhance the application created in TOTD #94 and use EJB 3.1 instead
of the JSF managed bean
for
performing the business logic. There are two ways to achieve this
pattern as described below.
Lets call this TOTD #95.1
| @javax.ejb.Stateless @ManagedBean public class StateList { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |


| @Stateless public class StateBeanBean { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |
| @ManagedBean public class StateList { @EJB StateBeanBean bean; public List<States> getStates() { return bean.getStates(); } } |
| @Stateless public class StateBeanBean { @PersistenceContext EntityManager em; public List<States> getStates() { return em.createNamedQuery("States.findAll").getResultList(); } } |

Posted by Arun Gupta in General | Comments[1]
|
|
|
|
|
Friday August 14, 2009
TOTD
#93
showed how to get started with Java EE 6
using NetBeans
6.8 M1 and
GlassFish v3 by
building a simple Servlet 3.0 + JPA 2.0 web
application. JPA 2.0 + Eclipselink was used for the database
connectivity
and Servlet 3.0 was used for displaying the results to the user. The
sample demonstrated how the two technologies can be mixed to create a
simple web application. But Servlets are meant for server-side
processing rather than displaying the results to end user. JavaServer
Faces 2 (another new specification in Java EE 6) is designed
to fulfill
that purpose.
This Tip
Of The Day (TOTD) shows how
to enhance the application created in TOTD #93 and use JSF 2 for
displaying the results.


| package server; import java.util.List; import javax.faces.bean.ManagedBean; import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceUnit; import states.States; /** * @author arungupta */ @ManagedBean public class StateList { @PersistenceUnit EntityManagerFactory emf; public List<States> getStates() { return emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); } } |
| Show States |
|
<h:dataTable var="state" value="#{stateList.states}"
border="1"> <h:column><h:outputText value="#{state.abbrev}"/></h:column> <h:column><h:outputText value="#{state.name}"/></h:column> </h:dataTable> |


Posted by Arun Gupta in General | Comments[3]
|
|
|
|
|
Thursday August 13, 2009
NetBeans
6.8 M1 introduces support for creating Java EE 6 applications
... cool!
This Tip Of The Day (TOTD) shows how
to create a simple web application using JPA 2.0 and Servlet 3.0 and
deploy on GlassFish v3 latest
promoted build (58
as of this writing). If you can work with the one week older build then
NetBeans 6.8 M1 comes pre-bundled with 57. The example below should
work fine on that as well.
| ~/tools/glassfish/v3/58/glassfishv3/bin >sudo mysql --user root Password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1592 Server version: 5.1.30 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database states; Query OK, 1 row affected (0.02 sec) mysql> CREATE USER duke IDENTIFIED by 'glassfish'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL on states.* TO duke; Query OK, 0 rows affected (0.24 sec) mysql> use states; Database changed mysql> CREATE TABLE STATES ( -> id INT, -> abbrev VARCHAR(2), -> name VARCHAR(50), -> PRIMARY KEY (id) -> ); Query OK, 0 rows affected (0.16 sec) mysql> INSERT INTO STATES VALUES (1, "AL", "Alabama"); INSERT INTO STATES VALUES (2, "AK", "Alaska"); . . . mysql> INSERT INTO STATES VALUES (49, "WI", "Wisconsin"); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO STATES VALUES (50, "WY", "Wyoming"); Query OK, 1 row affected (0.00 sec) |
| ~/tools/glassfish/v3/58/glassfishv3/bin >asadmin start-domain |
| ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin
create-jdbc-connection-pool --datasourceclassname
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype
javax.sql.DataSource --property
"User=duke:Password=glassfish:URL=jdbc\:mysql\://localhost/states"
jdbc/states Command create-jdbc-connection-pool executed successfully. ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin ping-connection-pool jdbc/states Command ping-connection-pool executed successfully. ~/tools/glassfish/v3/58/glassfishv3/bin >./asadmin create-jdbc-resource --connectionpoolid jdbc/states jdbc/jndi_states Command create-jdbc-resource executed successfully. |





| @PersistenceUnit EntityManagerFactory emf; |
|
List<States> list =
emf.createEntityManager().createNamedQuery("States.findAll").getResultList(); out.println("<table border=\"1\">"); for (States state : list) { out.println("<tr><td>" + state.getAbbrev() + "</td><td>" + state.getName() + "</td></tr>"); } out.println("</table>"); |



Posted by Arun Gupta in General | Comments[5]
|
|
|
|
|
Friday August 07, 2009
TOTD #91: Retrieve JSON libraries using Maven dependency: json-lib
So you need to include JSON
libraries in your Maven project. The only option that seems to be
currently available is using json-lib
with the following dependencies:
|
<dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.3</version> <classifier>jdk15</classifier> </dependency> |

Posted by Arun Gupta in web2.0 | Comments[6]
|
|
|
|
|
Wednesday July 29, 2009
TOTD# 86: Getting Started with Apache Wicket on GlassFish
![]() |
Apache Wicket is an application framework to build web applications using HTML for markup and POJOs to capture the business logic and all other processing. Why Wicket digs more into the motivation behind this framework. |
| ~/samples/wicket
>mvn
archetype:create -DarchetypeGroupId=org.apache.wicket
-DarchetypeArtifactId=wicket-archetype-quickstart
-DarchetypeVersion=1.3.6 -DgroupId=org.glassfish.samples
-DartifactId=helloworld [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:create] [WARNING] This goal is deprecated. Please use mvn archetype:generate instead [INFO] Defaulting package to group ID: org.glassfish.samples [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: wicket-archetype-quickstart:1.3.6 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: org.glassfish.samples [INFO] Parameter: packageName, Value: org.glassfish.samples [INFO] Parameter: package, Value: org.glassfish.samples [INFO] Parameter: artifactId, Value: helloworld [INFO] Parameter: basedir, Value: /Users/arungupta/samples/wicket [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /Users/arungupta/samples/wicket/helloworld [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Tue Jul 28 15:30:21 PDT 2009 [INFO] Final Memory: 12M/80M [INFO] ------------------------------------------------------------------------ |
| ~/samples/wicket/helloworld
>mvn jetty:run [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'jetty'. [INFO] ------------------------------------------------------------------------ [INFO] Building quickstart [INFO] task-segment: [jetty:run] [INFO] ------------------------------------------------------------------------ [INFO] Preparing jetty:run [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Compiling 2 source files to /Users/arungupta/samples/wicket/helloworld/target/classes [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:testCompile] [INFO] Compiling 2 source files to /Users/arungupta/samples/wicket/helloworld/target/test-classes [INFO] [jetty:run] [INFO] Configuring Jetty for project: quickstart [INFO] Webapp source directory = /Users/arungupta/samples/wicket/helloworld/src/main/webapp [INFO] Reload Mechanic: automatic [INFO] Classes = /Users/arungupta/samples/wicket/helloworld/target/classes 2009-07-28 15:31:35.820::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = /helloworld [INFO] Tmp directory = determined at runtime [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml [INFO] Web overrides = none . . . INFO - WebApplication - [WicketApplication] Started Wicket version 1.3.6 in development mode ******************************************************************** *** WARNING: Wicket is running in DEVELOPMENT mode. *** *** ^^^^^^^^^^^ *** *** Do NOT deploy to your live server(s) without changing this. *** *** See Application#getConfigurationType() for more information. *** ******************************************************************** 2009-07-28 15:31:37.333::INFO: Started SelectChannelConnector@0.0.0.0:8080 [INFO] Started Jetty Server |

| ~/samples/wicket/helloworld
>mvn package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building quickstart [INFO] task-segment: [package] . . . [INFO] Processing war project [INFO] Webapp assembled in[494 msecs] [INFO] Building war: /Users/arungupta/samples/wicket/helloworld/target/helloworld-1.0-SNAPSHOT.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6 seconds [INFO] Finished at: Tue Jul 28 15:35:59 PDT 2009 [INFO] Final Memory: 14M/80M [INFO] ------------------------------------------------------------------------ |
| ~/samples/wicket/helloworld
>~/tools/glassfish/v3/preview/glassfishv3/bin/asadmin deploy
target/helloworld-1.0-SNAPSHOT.war Command deploy executed successfully. |

Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Tuesday July 28, 2009
Track your running miles using JRuby, Ruby-on-Rails, GlassFish, NetBeans, MySQL, and YUI Charts
This blog introduces a new application that will provide basic tracking
of your running distance and generate charts to monitor progress. There
are numerous similar applications that are already available/hosted and
this is a very basic application. What's different about this ?
The first version of this application is built using JRuby,
Ruby-on-Rails, GlassFish Gem, MySQL, and NetBeans IDE. This combination
of technologies is a high quality Rails stack that is used in production
deploymnet at various places. Still nothing different ?
A similar version of this application
will be built using a variety of Web frameworks such as Java EE, Grails, Wicket, Spring and Struts2 (in
no particular order). The goal is to provide a similar application,
slightly bigger than "Hello World," built using different frameworks
and deploy on GlassFish.
Each framework will then be evaluated based upon the criteria ranging
from the basic principles of framework, ease-of-use in
design/development/testing/debugging/production of this web app,
database interaction, tools support, ability to add 3rd party
libraries, browser compatibility and other points.
An important point to note is that this is not an exhaustive
evaluation of different Web frameworks and the scope is limited only to
this application.
A complete list of frameworks planned is available here.
The criteria used to evaluate each framework is described here.
Your feedback in terms of Web frameworks and evaluation criteria is
highly appreciated. Please share your feedback on the users list.
Now the first version of application. The complete instructions to
check out and run the Rails version of
this application are available here.
Here are some charts generated using the application:

and

YUI is
used for all the charting capabilities.
And here is a short video that explains how the application work:
If you are a runner, check out the application and use it for tracking
your miles. A sample runlog is available in "test/fixtures/runlogs.yml"
and races in "test/fixtures/races.yml".
If you know Rails, please provide feedback if the application is DRY
and using the right set of helpers.
If you'd like the existing list of web frameworks to be pruned or
include another one to the list, let us know.
Share you feedback at users@runner.kenai.com.
Technorati: jruby
rubyonrails
glassfish
netbeans
mysql
yahoo
yui chart running miles framework
Posted by Arun Gupta in Running | Comments[2]
|
|
|
|
|
Wednesday July 08, 2009
Received a "certificate of attendance as speaker" for recently
concluded FISL 10.

This is sweet, thanks FISL organizers! It certainly adds a personal
touch to the whole experience.
I don't remember receiving a personal certificate like this :)
Technorati: conf
fisl brazil glassfish
netbeans
mysql
eclipse
Posted by Arun Gupta in General | Comments[3]
|
|
|
|
|
Tuesday June 30, 2009
FISL 2009 wrapped up over the weekend. Even though the
conference officially ended on Saturday but the connections made there
will certainly allow us to continue all the great momentum. The
conference celebrates open source and it was certainly great to see
Federal Government and Banks with their booths in the exhibitor halls.
The visit by Brazilian President Lula certainly highlights the
importance of this conference to the local community. There were booths
from Debian, Firefox, Ubuntu and other major open source softwares.
Some commercial vendors had a booth as well and of course Sun
Microsystems had a big presence with GlassFish,
Open Solaris, NetBeans, MySQL and other offerings.
I delivered 3 talks and participated in 1 talk show:

Friday June 26, 2009
Digital TV-based Banking using GlassFish, NetBeans and MySQL - Ginga community in Brazil
Learn how GlassFish
and NetBeans
helped Ginga community
to build a TV Banking application in Brazil. See a live demo of the
product, it's really exciting!
Why GlassFish ? - They love how NetBeans tooling completely hides the
complexity of what's happening underneath and the ease-of-use with
GlassFish.
Thanks Hugo Lavalle for the interview and good luck with your product!
Technorati: conf
fisl brazil glassfish
story
netbeans
mysql
ginga
digitaltv
banking
Posted by Arun Gupta in General | Comments[4]
|
|
|
|
|
Today's Page Hits: 4222
Total # blog entries: 994
| « November 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
1 | 2 | 4 | 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 | |||||
| Today | ||||||