Monday Oct 04, 2010

RedFX: JavaFX Widget Library for GlassFish

RedFX provides a JavaFX widget library that connects front-end JavaFX widgets with services running on GlassFish, without writing any boiler plate code.

Why they picked GlassFish ?

  • Its the Reference Implementation of Java EE 6 and contains all the latest specifications implemented.
  • First-class open source application server
  • Quality is very very good
  • Scalability is enormous
  • Code is very easy to understand

Hear Johan Vos share all the juicy details in this video captured at the recently concluded JavaOne:

A requirement for one of their application was to be "scalable as hell" and GlassFish very well handled few hundred thousand users/hour with about 40 requests/user. Read more about the library here.

The library can be downloaded here.

Coming soon on a GlassFish Update Center on your desktop ...

Technorati: conf javaone javafx glassfish javaee6 widgets

Monday Dec 07, 2009

TOTD #116: GlassFish v3 Administration using JavaFX front-end - JNLP available

As mentioned in TOTD #113, this Tip Of The Day (TOTD) provides a working version of the JavaFX front-end for GlassFish v3 administration.

Please click here to launch the JNLP or click here to a page that provides some introduction along with the link to JNLP. You may like to enable Java Console as explained in TOTD #114 for any log messages.

See a video of the tool in action:

Many thanks to Rajeshwar for providing feedback and helping me understand the RESTful interface better. TOTD #96 explains how the REST interface can be used.

Here is a TODO list in no particular order:

  • Show a splash screen after the startup to indicate server status
  • Allow the administration host/port to be changed
  • Tie the "server stats" with the server uptime instead of fetching once and then binding it locally
  • Provide dynamic updates of the monitoring data, currently its a snapshot
  • Convert the monitoring levels text boxes to radio buttons
  • Provide complete hints on setting monitoring level based upon the engines
  • Enable/Disable the buttons based upon the status of server running (or not)
  • Introduce charts to track dynamic shrink/expand of threads/pools/etc.
  • Probably something else that I'm forgetting :-)

How are you using JavaFX with GlassFish ?

How will you use GlassFish v3 REST interface in your tools ?

Technorati: totd javafx glassfish v3 rest web jruby rubyonrails rest administration monitoring management

Tuesday Nov 10, 2009

TOTD #113: JavaFX front-end for GlassFish v3 Administration - Using REST interface

GlassFish v3 provides a REST interface to management and monitoring information as discussed in TOTD #96. As mentioned in that blog "the REST interface is a lower level API that enables toolkit developers and IT administrators to write their custom scripts/clients using language of their choice". This blog introduces a tool that uses the REST API to provide management and monitoring of GlassFish v3 and is written using JavaFX.

This tool is only a proof-of-concept that demonstrates that GlassFish v3 REST interface is functionally very rich and can indeed be used to write third-party administration tools. The tool uses a subset of the REST interface and exposes only a limited amount of management and monitoring capabilities otherwise exposed. After all this is a proof-of-concept :-)

A screencast of this tool in action along with a downloadable JNLP version will soon be available. For now, here is a snapshot of the main window of this tool:

The main screen allows you to enter a URL for the GlassFish administration. Then the GlassFish instance can be stopped/restarted from the main window using the buttons on top right. There is an animation at the bottom of the screen where the glassfish is swimming in the ocean and is directly related to the state of server running in the background. If the server is running, the animation works. If the server is not running then the animation stops as well.

The main screen has three main buttons:

  • "List Applications" - list all the applications deployed on the running instance
  • "Show Monitoring Levels" - show/Update all the monitoring levels
  • "Server Stats" - show statistics of the running server

Clicking on "List Applications" shows the list of applications deployed on this particular instance. Here is how a snapshot looks like for an instance running on my localhost at port 4848:

As shown in the screen, it shows a radio-bulleted list of all the applications. Each bullet is also accompanied by an image indicating the type of application - Web or Rails for now. Select the application and click on "Monitor" button to monitor that particular application. The REST API exposes a vast amount of monitoring data but a subset of monitoring data is displayed for Web and Rails application for now. Here is a snapshot of the monitoring data published for a Web application:

As evident by the list of engines, this web application has EJBs bundled as well. It also shows total number of Servlets/JSPs loaded, number of requests made to this web application and some other monitoring data.

Here is a snapshot of the monitoring data published for a Rails application:

It shows number of JRuby runtimes configured for the application, number of requests sent to the application, number of responses with different HTTP access codes and some other data.

The monitoring levels of different containers can be easily updated by clicking on "Show Monitoring Levels" as shown below:

And finally some server statistics are shown by clicking on "Server Stats" as shown below:

It shows when the server was started, host/port information, version and finally how long the server has been running for. The dials are an animation that shows the server up time.

Here are other related JavaFX and GlassFish related blogs published earlier:

How are you going to use the REST interface exposed by GlassFish v3 in your environment ?

Are you using JavaFX with GlassFish together in any way ?

Leave a comment on this blog if you do!

Technorati: javafx glassfish v3 rest web jruby rubyonrails rest administration monitoring management

Thursday Nov 05, 2009

Java EE 6 & GlassFish v3 swimming to Amsterdam - JFall 2009

JFall is the annual conference of NL JUG - the 11 year old JUG of Netherlands. This year its happening on Nov 11 at SPANT!

I'll be speaking on Java EE 6 & GlassFish v3 (14:20 - 15:10) there and have lots of cool demos to show through out the talk. And also stay tuned for a brand new demo that shows JavaFX and GlassFish v3 integration.

With over 1000 attendees, the conference is already sold out so if you have not registered yet then you have to wait until next year :)


Here is the list of several Sun sessions:

Here are the sessions that I'd like to attend:

Most of the sessions are in Dutch so may have to fall back on English speaking sessions :(

Here are some quick data points ...

Also trying to arrange a slot in the local Amsterdam Ruby Meetup to talk about JRuby/Rails/GlassFish, lets see if it works out. Otherwise we might somewhere in the hotel lobby :)

And as always, I'm looking for running trails in Amsterdam & Bussum. Any body interested in running together ?

Technorati: glassfish v3 javaee javafx sun amsterdam nljug jfall ams.rb meetup

Tuesday Mar 24, 2009

EclipseCon 2009 Day 2 in Pictures


Here are some pictures I took at EclipseCon earlier today:


Meet us at the Sun booths in EclipseCon and learn all the goodness about GlassFish, GlassFish Tools Bundle for Eclipse, Open Solaris, and Java FX! And we got nice schwag too ;)

And the evolving photo album below:



Technorati: conf sun glassfish opensolaris javafx eclipse eclipsecon

GlassFish Beanie, Open Solaris CD, Cool shirts, 2 GB SD Card - Goodies at Sun booth in #eclipsecon




Meet us at the Sun booths in EclipseCon and learn all the goodness about GlassFish, GlassFish Tools Bundle for Eclipse, Open Solaris, and Java FX!

Technorati: conf sun glassfish opensolaris javafx eclipse eclipsecon

Monday Jan 19, 2009

Sun Tech Days 2009, Singapore - Day 1

The Sun Tech Days Singapore started earlier this morning - over 1100 developers, an outstanding audience!!!

The kick off had a good local flare when the Gods of Longevity, Fortune, and Prosperity (Fu Lu Shou) showed up to start the event ;-) The build up to their appearance was really exciting as evident from the video below:


This particular event will also be recorded in Singapore Book of Records for the largest numbers of Sun developers playing a rattle together :) Here are some pictures from the event:


A Toshiba laptop and an iPod was raffled to the audience and the lucky winners are:


And found another loyal reader of my blog:



Gosh, he even took my autograph ;-)

The steps to reproduce the different GlassFish demos shown during the key note are explained below.
  1. GlassFish v3 OSGi-compliance and quick startup time

    Download GlassFish v3 Prelude from here, unzip, and start the server as

    glassfish/bin/asadmin start-domain --verbose

    to see a message something like:

    INFO: GlassFish v3 Prelude startup time : Felix(1732ms) startup services(1091ms) total(2823ms)

    The GlassFish v3 container starts up fairly quickly, 2.8 secs in this case, without starting any application-specific container. The container is using OSGi R4 APIs and Apache Felix as the runtime. This allows any standard OSGi bundle to be easily deployed in GlassFish v3. The underlying OSGi runtime can be easily replaced with Knopflerfish or Equinox because standard R4 APIs are used. As you notice, Felix start up time is explicitly shown in the startup message.

    The quick start up is possible because containers, such as Web container that serves web applications, is started only when the first Web application is deployed. No web application, no web container - simple! The same is true as other types of applications are deployed, for example a Rails application. The containers are started and stopped on demand giving a higher utilization of resources.
  2. Auto-deploy of Servlets and preserving servlet session state across multiple re-deploys using NetBeans and Eclipse. This feature is really useful as it tremendously reduces your development time. Focus on what you are good at i.e. adding business logic and let NetBeans and GlassFish together take care of your deployment worries. And why should you loose your session state just because the application is re-deployed!
  3. Modularity and Extensibility of GlassFish v3 by running/debugging a Rails application. GlassFish certainly supports traditional Java EE applications. But starting with GlassFish v3 the newer Web frameworks like Rails can also be deployed natively. The screencast #26 shows how to develop, run and debug a Rails application natively deployed on GlassFish. And this capability of deploying a Rails application is added as an OSGi module and also demonstrates the extensibility of GlassFish.

    It provides future protection as well because any other Web framework can be easily deployed as a standard OSGi module.
  4. Extensibility of GlassFish v3 by dropping a JAR in the "/modules" directory. The admin console is a one-stop interface for the administration of your GlassFish instance such as deploying WAR/EAR, creating JDBC/JMS resource, and creating clusters. Starting with GlassFish v3, even the admin console is extensible. There are clearly defined extension points that allows you to write a "admin console module" and extend the capability of your admin console. The demo showed dropping a JAR in the standard "modules" directory and admin cosole recognizing the module. A sample project that shows all the integration points to GlassFish v3 Admin Console is available here.
Other demos showcased JavaFX, Open Solaris and jMaki Webtop technology. I particularly enjoyed the JavaFX demo by our "resident mad scientist" - Simon Ritter :) It was an interesting use of technology to create something fun. Enjoy the demo below:



Also met Colin Charles, Community Relations Manager for MySQL at Sun Microsystems. It was certainly great to know that similar thought process is applied for promoting both GlassFish and MySQL - state the facts, offer an alternative, and let the customers decide. Both MySQL and GlassFish are open source offerings with complete enterprise support available from Sun Microsystems. And together with OpenSolaris, NetBeans and many other open source offerings they make a killer platform for developing/deploying any kind of web applications.

And if you have not signed up for Cloud Camp event happening in Singapore tomorrow at 6pm, register here!

Here is the complete photo album so far:




Follow the latest updates on twitter.com/arungupta.

Technorati: conf suntechdays singapore glassfish mysql javafx netbeans

Wednesday Dec 03, 2008

JavaFX 1.0 launched - access services hosted on embedded GlassFish


Today Sun announces the availability of Java FX 1.0.

JavaFX 1.0 is a rich client platform for creating and delivering Rich Internet Applications across all screens (desktop, browser, and mobile) of your life. It consists of the following key components:


  • JavaFX SDK includes JavaFX script compiler and runtime tools, and a host of libraries to create RIAs for desktop, browser and mobile platforms, command-line tools & Ant tasks and other goodies.
  • NetBeans 6.5 support (as plugin or bundled with IDE) that allows to build, preview and debug JavaFX applications using NetBeans IDE. If you prefer CLI support then SDK can be downloaded.
  • Production Suite is a suite of tools and plugins for creative tools (such as Illustrator CS3+) that allows graphical assets to be exported to JavaFX applications.
The beauty of JavaFX is that its fully integrated with the Java Runtime and takes advantage of the performance and ubiquity of Sun's Java Runtime Environment that is installed on literally billions of devices worldwide. Hence, JavaFX applications will run on any desktop, browser, mobile device or any other connected device that runs the Java Runtime Environment.

This blog shows how to create a simple JavaFX application using NetBeans IDE. The application plays a movie, allows the viewer to cast a vote if they liked it, and see aggregate response from other viewers. The application is developed using NetBeans 6.5, JavaFX 1.0 plugin, and coded using JavaFX Script. The voting engine is deployed as a RESTful Web service using Jersey on GlassFish.

In terms of user experience, running the NetBeans project shows a window playing the movie. The first mouse hover over the window allows the viewer to click on "I love it" or "Not so great" and cast their vote as shown below:



Any subsequent mouse hover shows aggregated results from other viewers as shown below:



The results are not interesting if there is a single viewer of the movie. But for a production environment, this movie will be played by multiple users concurrently and the percentage numbers will be more meaningful. You can close the window and run the project again to vote again, as many times as you like :)

For those who like to see quick results, here is a 4-step guide to get started:
  1. In NetBeans 6.5 IDE, install JavaFX plugin as explained here and RESTful Web services plugin as explained here. Both the plugins may be installed in one step by selecting the required plugins together.
  2. Download NetBeans project for JavaFX client from here and add Jersey dependencies as explained in bullet #5 below. 
  3. Download Web service endpoint Maven project from here and deploy the endpoint as explained in bullet #4 below.
  4. Run the JavaFX application as explained here.
The remainder of this blog explains the details and shows how to construct the demo from scratch.

Lets first create the JavaFX application that plays the video movie.
  1. In NetBeans 6.5, install "JavaFX SDK" plugin.  In the "Tools" menu, "Plugins", search on "JavaFX", select "JavaFX SDK" and click on "Install".
  2. Create a new project of type "JavaFX", "JavaFX Script Application". Take the default values as shown below:



    and click on "Finish".
  3. The source code for this class can be downloaded from here or alternatively constructed as explained in the sub-bullets.
    1. In the newly created class, change the Stage (root area for all scene content) to:

      Stage {
         title: "GlassFish Media Player"
         width: 625
         height: 360
         resizable: false
         scene: myScene
      }
    2. Create a scene that contains the view of the media to be played and controls the display of the Vote or Result nodes:

      var myScene: Scene = Scene {
         content: MediaView {
                 fitWidth: 625
                 fitHeight: 360
                 mediaPlayer: bind myPlayer

                 onMouseEntered: function( e: MouseEvent ):Void {
                     println("mouse entered");
                     if (voted == false) {
                         insert Vote{} into myScene.content;
                     } else {
                         insert Result{} into myScene.content;
                     }
                 }

                 onMouseExited: function( e: MouseEvent ):Void {
                     delete myScene.content[1]
                 }

             }
      }
    3. Create a Media Player to use with the scene:

      var myPlayer: MediaPlayer = MediaPlayer{
          autoPlay: true
          media: bind myMedia
      };
    4. Create the media object to be used with the Media Player:

      var myMedia: Media = Media {
          source: "http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2957290001_DayEarth-Bluray.flv"
         };

      You can change the location of the movie here in the media player. For example, changing it to "http://mediacast.sun.com/users/ArunGupta/media/v3prelude-nb65-webapp.flv" will start playing the screencast #27.
    5. Create a Vote class that is a CustomNode and appears when a user's mouse enters the scene where the video is playing. The user can select whether he likes the clip or not and the vote is recorded making a Web service call using Jersey Client APIs:

      class Vote extends CustomNode {
         override function create():Node {
             return Group {
                 content: [
                     Rectangle {
                         fill: Color.GREEN
                         x: 185
                         y: 145
                         width: 243
                         height: 38
                         arcWidth: 20
                         arcHeight: 20
                     },

                     Text {
                         x: 195
                         y: 170
                         fill: Color.WHITE
                         font: Font {
                             size: 18
                         }
                         content: "I love it"
                     },

                     Rectangle{
                         x: 191
                         y: 148
                         smooth: false
                         width: 73
                         height: 32
                         fill: Color.TRANSPARENT

                         onMouseClicked: function( e: MouseEvent ):Void {
                             println("clicked I love it");
                             voted = true;
                             wsClient.voteLoveIt();
                             delete myScene.content[1]
                         }
                     },

                     Text{
                         x: 305
                         y: 170
                         fill: Color.WHITE
                         font: Font {
                             size: 18
                         }
                         content: "Not so great"
                         },

                     Rectangle {
                         x: 301
                         y: 148
                         smooth: false
                         width: 118
                         height: 32
                         fill: Color.TRANSPARENT
                        
                         onMouseClicked: function( e: MouseEvent ):Void {
                             voted = true;
                             println("clicked Not so great");
                             wsClient.voteNotSoGreat();
                             delete myScene.content[1]
                         }
                     }
                 ]
             }
         }
      };
    6. Create a Result class that is a CustomNode and simply reports on how many voters like this clip:

      class Result extends CustomNode {
         override function create():Node {
             var resultPercent = wsClient.showResults();
             var resultString = "{resultPercent} voters liked this clip";

             return Group {
                 content: [
                     Rectangle {
                         fill: Color.BLUE
                         x: 187
                         y: 145
                         width: 244
                         height: 38
                         arcWidth: 20
                         arcHeight: 20

                         onMouseClicked: function( e: MouseEvent ):Void {
                             delete myScene.content[1]
                         }
                     },

                     Text {
                         x: 199
                         y: 170
                         fill: Color.WHITE
                         font: Font {
                             size: 18
                         }
                         content: resultString
                     }
                 ]
             }
         }
      };
    7. Add two instance variables:

      var voted = false;
      var wsClient = new WebserviceClient;

      The first variable captures if the viewer has already voted and the second variable is an instance to the RESTful Web service client.
    8. Add the following import statements:

      import javafx.scene.\*;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.media.Media;
      import javafx.scene.media.MediaPlayer;
      import javafx.scene.media.MediaView;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.scene.text.Font;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      "Fix Imports" should be able to fix them and bug #154307 is already filed for that.
  4. Create a new class that is used to capture the Vote as:

    @javax.xml.bind.annotation.XmlRootElement
    public class VoteBean {
        public static enum VOTE { LOVE_IT, NOT_SO_GREAT };
       
        public VOTE vote;

        public VoteBean() { vote = VOTE.LOVE_IT; }
        public VoteBean(VOTE vote) {
            this.vote = vote;
        }
    }

    This is a simple Javabean with a standard JAXB annotation. This ensures that XML is used as the data format for transfering results between client and endpoint. The source code for this class is available here.
  5. Add Jersey libraries to the project by right-clicking on Project, select Libraries, click on "Add Library...", select "JAX-RS 1.0" and "Jersey 1.0 (JAX-RS RI)", and click on "Add Library".



    If these libraries are not available then install the "RESTful Web Services" plugin from the Plugin Center.
  6. And finally add the class that invokes the RESTful Webservice endpoint:

    public class WebserviceClient {

        private static com.sun.jersey.api.client.WebResource createWebResource() {
            return com.sun.jersey.api.client.Client.create().
                    resource("http://localhost:8080/movie-feedback-webapp/webresources/myresource");
        }

        public static void voteLoveIt() {
            createWebResource().type("application/json").
                    post(new VoteBean(VoteBean.VOTE.LOVE_IT));
        }

        public static void voteNotSoGreat() {
            createWebResource().type("application/json").
                    post(new VoteBean(VoteBean.VOTE.NOT_SO_GREAT));
        }

        public static String showResults() {
            return createWebResource().get(String.class);
        }
    }

    The Webservice endpoint will be hosted at "http://localhost:8080/movie-feedback-webapp/webresources/myresource". A WebResource is created from the Client. The POST methods are used to cast the user vote and GET method is used to retrieve the aggregated results. The source code for this class is available here.
Now lets create the RESTful endpoint using Jersey and deploy on GlassFish.
  1. Create and deploy a RESTful Web service endpoint
    1. Create a template RESTful Web service endpoint as described in TOTD #56. Lets use the artifactId as "movie-feedback-webapp".
    2. Create the bean "VoteBean" in "org.glassfish.samples" package. This is the exactly same bean used earlier by the client:

      @javax.xml.bind.annotation.XmlRootElement
      public class VoteBean {
          public static enum VOTE { LOVE_IT, NOT_SO_GREAT };
          public VOTE vote;

          public VoteBean() { vote = VOTE.LOVE_IT; }
          public VoteBean(VOTE vote) {
              this.vote = vote;
          }
      }
    3. Update the generated resource
      1. Add @com.sun.jersey.spi.resource.Singleton as class annotation so that only one instance of the resource is created for the entire web application. This allows to save state (preferences from other users) in the RESTful resource.
      2. Add two instance variables:

            int loveIt;
            int noSoGreat;
      3. Add a method that will process HTTP POST requests as:

            @POST
            public void postOneVote(VoteBean bean) {
                if (bean.vote == VoteBean.VOTE.LOVE_IT) {
                    loveIt++;
                } else {
                    noSoGreat++;
                }
                System.out.println("In POST: " + bean.vote);
            }

        This method stores the vote in the resource. The handling of POST request messages by Jersey is explained in TOTD #58.
      4. Add a method that will process HTTP GET requests as:

            @GET
            @Produces("text/plain")
            public String getOpinion() {
                if (loveIt == 0 && noSoGreat == 0)
                    return "No votes cast yet!";
                return (loveIt \* 100) / (loveIt + noSoGreat) + "%";
            }

        This method calculates the percentage of viewers who liked the movie.
    4. Deploy the endpoint using "mvn glassfish:run" in "movie-feedback-webapp" directory.
Now run the JavaFX application by right-clicking on the project and selecting "Run Project" and start voting! The percentage results will vary if the movie is voted upon more than once.

This blog showed:
  • How to install JavaFX capabilities to an existing NetBeans 6.5 installation
  • How to create a simple JavaFX application that plays media files
  • Integrate it with existing Java libraries (Jersey client libraries in this case)
  • Invoke services hosted on GlassFish
The steps followed in this blog allows for rapid development/debugging of JavaFX application accessing resources using embeddable GlassFish but are not ideal for production deployments. A future blog will show how this JavaFX application can be deployed as a Java Web Start application and scaled for mulitple users.

The javafx.com/samples has loads of samples and javafx.com/tutorials shows how to build your own applications. The JavaFX Community Wiki is a great place to collaborate.

Send your Jersey questions to users@jersey.dev.java.net, GlassFish questions to GlassFish Forum, and JavaFX questions to JavaFX Forums.

Technorati: glassfish v3 jersey webservices javafx netbeans

Wednesday Jan 30, 2008

TOTD #23: JavaFX Client invoking a Metro endpoint

This TOTD is inspired by Learning JavaFX Script - Part 3. The original article explains how to invoke a Web service from a JavaFX client using NetBeans 5.5.1 and GlassFish v1. Newer version of both NetBeans and GlassFish are available since the article was written. This TOTD (tip of the day) explains how to invoke a Metro endpoint deployed on GlassFish v2 from a JavaFX client - all using NetBeans 6.

  1. Following screencast #ws7, create a plain (without Security or Reliability enabled) Metro endpoint using NetBeans 6 and GlassFish v2.
  2. In NetBeans 6 IDE, install the JavaFX plugin as described here.
  3. Create Web service client library - Creating a Web service client in JavaFX Script Application is causing a NullPointerException (issue #126352). The workaround I used is to create a separate library with client-side artifacts and then include it as dependency in the JavaFX client project.
    1. Create a new project of type "Java Class Library" as shown below:



      and click on "Finish".
    2. Enter the project name as "MetroClientLibrary" as shown below:



      and click on "Finish".
    3. Right-click on the newly created project, select "New", "Web Service Client...".
    4. Click on "Browse..." button next to "Project" radio button and select the deployed Web service from Metro endpoint project. If the Web service is deployed on a different machine then you may specify the WSDL URL. Specify the package name "client" as shown below:



      and click on "Finish".
    5. Once the Web service client-side artifacts are generated (indicated by expandable Web Service References tree node), right-click on the project and select "Build". This generates a JAR file that will be utilized later. The location of this jar file is shown in the Output console. In our case, it is

      C:\\workarea\\samples\\javafx\\MetroClientLibrary\\dist\\MetroClientLibrary.jar.
  4. Create JavaFX project
    1. Create a new JavaFX project by right-clicking in the Project explorer, selecting "New Project" and entering the values as shown below:

    2. Click on "Next >" and enter the values as shown below:



      and click on "Finish".
    3. Right-click on the newly created project, "Properties", "Libraries", "Add JAR/Folder" and select the JAR file created in "MetroClientLibrary" project as shown below:



      and click on "OK".

      Notice, Java SE 6 U4 is used to compile and run this project. If you are using an earlier version of Java SE 6, then you need to override JAX-WS 2.1 and JAXB 2.1 jars using endorsed mechanism as explained here. The classes in these jars are already bundled in Java SE 6 U4.
    4. In metroclient.Main.fx file, replace "// place your code here" with the following code:

      import java.lang.\*;
      import javafx.ui.\*;

      import client.NewWebServiceService;
      import client.NewWebService;

      class InputModel {
          attribute name: String?;
      }
      var inputModel = InputModel { };
      var nameField = TextField { };
      nameField.action = operation() {
          inputModel.name = nameField.value;
      };

      class ButtonClickModel {
          attribute result: String;
      }
      var model = new ButtonClickModel();

      Frame {
          title: "JavaFX Client -> Metro endpoint"
          width: 350
          height: 200
          content: GridPanel {
              rows: 3
              vgap: 5
              cells:
              [SimpleLabel {
                  text: "Name : "
              },
              nameField,
              SimpleLabel {
                  text: "Result from endpoint : "
              },
              Label {
                  text: bind "{model.result}"
              },
              Button {
                  text: "Invoke Web Service!"
                  action: operation() {
                      do {
                          try {
                              var service: NewWebServiceService = new NewWebServiceService();
                              var port: NewWebService = service.getNewWebServicePort();
                              var name: String = "{nameField.value}";
                              var result: String = port.sayHello(name);
                              System.out.println("response: {result}");
                              model.result = result;
                          } catch (e:Exception) {
                              System.out.println("exception: {e}");
                          }
                      }
                  }
              }
              ]
          }
          visible: true
      };
  5. Invoke the JavaFX client project
    1. Right-click on the recently create project ("MetroClient") and select "Run Project". The following window is displayed:

    2. Enter "Duke" in the text box and click on "Invoke Web Service!" button to see the result as shown below:

After following these steps, you have created a JavaFX client that can invoke a Metro endpoint project deployed on GlassFish - all using NetBeans IDE.

Now Metro provides secure, reliable, transactional and .NET 3.0 interoperable Web service. Have you tried/used any of those features in Metro ?

Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.

Technorati: totdd javafx metro glassfish netbeans webservices

Saturday Sep 08, 2007

The Rich Web Experience 2007 Trip Report

The first ever The Rich Web Experience 2007 just got over and I enjoyed participating in the conference.

This conference is part of No Fluff Just Stuff Symposium series and truly lived up to it's name and these are some of my reasons:

  • There indeed was no "fluff", just real meaty talks full of "stuff".
  • This indeed was an "experience" - not just a conference. Everything ranging from the
    • Courteous Conference staff
    • Geeky attendees (we love them!)
    • Quality of food (one of the best conference foods, probably THE best - only comparable to Google Developer Day)
    • Daily Raffles (an iPhone every lunch and dinner, an iMac on the 2nd day & for the best speaker and other giveaways)
    • Great goodies for each attendee (a Wii or $250 Amazon certificate - will be shipped afterwards because of "delivery problems" :)
    • Great venue (driving distance from home)

      everything was just superb!
  • The conference size was small and this allowed us to have more closer 1-1 interactions with a lot of attendees. We had some real good interactions with the attendees and looking forward to helping them out.

At the venue, we asked for Internet connectivity for the desktop machines to be used for demonstration.

For the quoted price ($850 for 2 days) I thought for a moment that we are getting a "really cheap" dedicated direct satellite connection. But then I realized it was just the usual broadband wired connection. Gosh! That was a ridiculous price so we finally used our laptop for all the demos as wireless connectivity was free, courtesy Rich Web Experience.

It gives an impression that San Jose Fairmont is not convention-ready yet!

Both of Greg & Ludo's talks (Project jMaki - Enabling Web 2.0 Application Developers and Web Design for Server-Side Developers) were well attended.

And so was Tom Ball's JavaFX: Evolution of the Java client.
We gave out a new tee-shirt at the conference with the juggling Duke and attendees were flocking towards it. And if you missed it then hopefully you can get it at an upcoming conference.  Any guesses on the "balls" ?

We also conducted daily raffles for a Sun Spot Java Development Kit during the first two days of the conference. The winners on both the days were extremely thrilled and came back the very next day and shared their experience. Congratulations!

All the information about the kit can be found at sunspotworld.com. I recommend reading the FAQ that provides information on the types of sensors and other useful information. The Users Guide and other Documentation provide other useful information to get started. If you were not lucky to win the raffle, you can always buy them here!

Here are some of the demos that we showed at the conference:

And others will be available on ajax.dev.java.net soon.

It was really nice to meet Jason Lee - one of the first GlassFish Champion 2007 & GlassFish 2 TV Contest Winner. He got lucky at the conference again and won an iPhone on the second day dinner-time raffle. Read his RWE Day 1 and Day 2 experience. Jason, go buy a lottery ticket and you may be one of the four winners next time :)

Jay Zimmerman announced that Rich Web Experience will visit Atlanta in April 2008 and back in San Jose in September 2008. Thank you for organizing a great conference and looking forward to our future participation.

No Fluff Just Stuff is the way to go!

Technorati: sun richwebexperience jmaki javafx conf fairmont netbeans glassfish nofluffjuststuff sunspot

About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
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
   
       
Today