GlassFish Blogs

We have just published a White Paper that outlines the steps required to build Ruby on Rails Apps on GlassFish using JRuby. This would be the quickest way to start off with developing RoR applications on GlassFish. The paper outlines the steps through Netbeans and the command line.


Download the paper now.

This tutorial explores the Intelligent Event Processor (IEP) service engine, a component in GlassFish ESB 2.1 that provides powerful support for event-driven architecture (EDA). (Login or registration required.)

Antonio and his book(s)

It's been a while since the last GlassFish Podcast episode and even longer since the last interview, so here it goes - episode #36 an interview with Antonio Goncalves.

Antonio Goncalves has many hats and this discussion covers a lot of ground starting with his recently published Java EE 6 book with GlassFish v3. It also covers his favorite Java EE 6 feature, his role in the JCP as an individual contributor, as the Paris JUG leader, his take on Spring vs. Java EE 6 and some thoughts on JSR 299.

Enjoy the episode. iTunes users can find it here.

ALT DESCR

Ludo parece ganhar a corrida para ser a Primeira a anunciá-la, mas NB6.8 M1 ja está disponível para download. Esta é a primeira construção que fornece suporte JavaEE 6, incluindo um pacote GlassFish v3 (b57).

Veja Novos e Notável e Ludo's Post para mais detalhes. Baixe os diferentes pacotes da pagina NB6.8 M1.

Adicionado - Avaliações de:

• Adam Bien - "Netbeans 6.8m1 - The (lightweight) Java EE 6 IDE"
• James Branajam - More About NB 6.8 M1


先週1週間夏休みを頂き実家の広島に帰省していました。
今回は ETC 割引を利用し、横浜から車で帰ったのですが、
代金片道 2100 円で行く事ができたのでかなり安く帰る
事ができました。
途中、琵琶湖/京都等にも寄って夏休みを満喫して来ました。





さて、休み中に川口耕介さんから重大なアナウンス
ありました。
川口さんを中心にオープンソースで開発が進められてきた、
継続的インテグレーションツールである Hudson がついに
Sun より製品名「Sun Continuous Integration Server」として
リリースされ、正式にサポートを受けることができるようになりました。

この継続的インテグレーションツールである Hudson については
過去に本ブログで紹介した他、開発者である川口さんより直接下記に
連載していますので、是非ご確認頂ければと思います。

技術評論社連載:Hudsonを使ったアジャイルな開発入門

開発現場で必ず役に立つ「Sun Continuous Integration Server」を
是非ご利用ください。





SNMP (Simple Network Management Protocol) est un standard répandu de gestion du réseau qui intègre un protocole, un schema de base de donnée et des objets de données. Etant donné la popularité de SNMP dans les entreprises, GlassFish Enterprise Manager propose son support sous la forme d'un plugin pour GlassFish Portfolio.

La documentation comporte les "Release Notes", l'installation et guide de démarrage, et la référence. Le logiciel est disponible au travers de Sunsolve. Si son utilisation vous intéresse, envoyez donc une demande d'évaluation par courriel. Dans le futur, nous allons proposer un mécanisme d'évaluation plus simple comme l'offre déjà WebStack Enterprise Manager.

ALT DESCR

L'équipe de développement du support SNMP propose un ensemble de billets :

Survol des fonctionnalités par Rashewar.
Plusieurs d'exemples par Marc Kossa.
• Un billet de Sankar sur la configuration du monitoring SNMP.
• Olivier nous parle de MIB: J2EE MIB et navigation de la MIB
• Et encore deux autres de Olivier : Master Agent Integration et SNMP et sécurité.
• et encore un d'Olivier : Monitoring de multiples domaines.

Nazrul propose un survol complet de GlassFish Enterprise Monitor.

In the scenario that the requester asks for delegation tokens from an STS
acting as various users, the security header for the request message to the STS carries
the credentials of the requester and the STS while the payload has the credentials
of the actual users being acted as. It is a perfect case that secure conversation should be
enabled for the STS to optimize the communications between the requester and STS.

To achieve this with Metro:

1. On the STS side, enable secure conversation with SecureConversationToken in the wsdl:
A sample wsdl is provided here. To use it with the delegate sample,
you just need to rename it from sts-sc.wsdl to sts.wsdl.

2. On the client side, one need to use the same STSIssuedTokenConfiguration instance for the different
calls to the STS as illustrated by the following codes for the server:

     public class FSImpl implements IFinancialService {
         @Resource
         private WebServiceContext context;

         private DefaultSTSIssuedTokenConfiguration config = new DefaultSTSIssuedTokenConfiguration();

         public String getAccountBalance(Department dept){

                 ...
     }

     private void ping(){
         PingService service = new PingService();
         Token actAsToken = getActAsToken();
         config.getOtherOptions().put(STSIssuedTokenConfiguration.ACT_AS, actAsToken);
         STSIssuedTokenFeature feature = new STSIssuedTokenFeature(config);

         IPingService stub = service.getCustomBindingIPingService(new WebServiceFeature[]{feature});
         stub.ping(new Holder("1"), new Holder("sun"), new Holder("Passed!"));
     }

     private Token getActAsToken(){
         return new GenericToken(getSAMLAssertion());
     }

     private Element getSAMLAssertion() {
         try {
                Subject subj = SubjectAccessor.getRequesterSubject(context);
                Set set = subj.getPublicCredentials();
                Element samlAssertion = null;
                for (Object obj : set) {
                     if (obj instanceof XMLStreamReader) {
                        XMLStreamReader reader = (XMLStreamReader) obj;
                        //To create a DOM Element representing the Assertion :
                         samlAssertion = SAMLUtil.createSAMLAssertion(reader);
                         return samlAssertion;
                     } else if (obj instanceof Element) {
                         samlAssertion = (Element) obj;
                     }
                 }
             } catch (XMLStreamException ex) {
                 throw new XWSSecurityRuntimeException(ex);
             } catch (XWSSecurityException ex) {
                 throw new XWSSecurityRuntimeException(ex);
             }     return null;
         }
    }

Another important use scenario for using secure conversation with STS is OnBehalf mechanism where
the STS client is used as a proxy to obtain tokens from STS for different users. I will get back
to that in a different blog:

We have been converting our distributions to leverage the new IPS format. Recent conversions to IPS include OpenMQ 4.4 and some distributions of GFv2.1 but the distribution with the largest volume remains GFv3 Preview.

The current release of GFv3 Preview uses pkg.sun.com/glassfish/v3/stable/. These packages were last updated before J1 (except docs) but we will soon push out an update based on an stable promoted build and when that happens you are likely to encounter the New SoftwareUpdate Tool.

ALT DESCR

The SoftwareUpdate tool provides a simplified interface to the standard UpdateTool, normally activated via a PopUp Notice. A single click Starts a Search for all the Apps that can be updated. Once Completed, choose the Apps you want to update, accept the license terms, and install.

The SoftwareUpdate tool will report on the progress of the install: [1], [2], [3]. Once Completed you are done. The underlying machinery is the same used in the UpdateTool, and you can peek into the details, both before installing and after installing, but the SoftwareUpdate experience is faster and simpler, and more appropriate for most users.

IPS is one of the key new technologies that we are leveraging for GlassFish v3; related entries are tagged IPS. If you want more technical details, Christophe has a very good Presentation as part of the IPS Best Practices wiki. Also check the UC2 Blogs.

It's been a while since the last GlassFish Podcast episode and even longer since the last interview, so here it goes - episode #36 an interview with Antonio Goncalves.

Antonio has many hats and this discussion covers a lot of ground starting with his recently published Java EE 6 book with GlassFish v3. We get into his favorite Java EE 6 feature, his role in the JCP as an individual contributor, his take on Spring vs. Java EE 6 and some thought on JSR 299 (the interview predates the inclusion of JSR 330 into Java EE 6). We also discuss Antonio's role as the leader of the Paris JUG inspiring more than a dozen other JUGs across the country.

Enjoy the episode.

SNMP (Simple Network Management Protocol) is a set of standards for network management, including an application layer protocol, a database schema, and a set of data objects. Since SNMP is very popular in some enterprise deployments the GlassFish Enterprise Manager includes an SNMP Monitoring AddOn for customers of the GlassFish Portfolio.

Formal Documentation includes Release Notes, Installation and QuickStart Guide, and Reference. The software is available through Sunsolve; if you are interested in using it, send a Request for Evaluation. Our future plan is to move to simpler distribution and evaluation mechanism, borrowing the lessons from the WebStack Enterprise Manager.

ALT DESCR

The SNMP team has a number of posts on the SNMP monitor:

• Rashewar's Overview of the AddOn.
• Marc Kossa has a nice Set of Examples.
• Sankar on how to Configure SNMP Monitoring.
• Olivier writes about the MIB: J2EE MIB and Browsing the MIB
• Two more from Oliver: Master Agent Integration and Security in SNMP.
• And yet another from Oliver: How to Monitor Different Domains.

Nazrul has an Overview of The GF Enterprise Monitor Offerings that is intended to be up-to-date (I believe Oliver's last post is not yet there).

Formatted notes available at http://blogs.sun.com/glassfishpodcast
Full transcript (thanks Antonio!)

AntonioGoncalves
Interview of Antonio Goncalves, JCP expert group member, writer, JUG leader, consultant, and much more...

Music: Rodolphe Raffalli - Je me voyais deja.

ALT DESCR

Rajeshwar has written a short description on how to use the GlassFish v3 REST Interface to Configure GlassFish; this complements his previous entry REST and Monitoring and, like that one, it also has examples using a Jersey-based client - included in the post.

Related entries are tagged REST+GlassFish+v3.

PS. Picture at left shows the anterior eyes of a Jumping Spider.

ALT DESCR

Preuve que malgré tout le travail consacré à GlassFish v3, beaucoup de nos utilisateurs et clients utilisent (et utiliseront pour un bout de temps encore) GlassFish v2.x, Sun a publié GlassFish v2.1 patch 3. Il s'agit d'une mise à jour qui contient 18 correctifs pour les personnes titulaires d'un contrat de support. GlassFish v2.1p3 est également connu sous le nom de "patch release 9" pour ceux rester sur la numérotation GlassFish v2U2. L'ensemble des mises à jour pour v2.1 (p1, p2 et p3) totalise 170 correctifs.

Ces version de mise à jour sont disponibles dès le premier niveau de support Basic de Sun GlassFish Portfolio. Les versions plus élevées donnent accès à des escalades prioritaires et à des outils de gestion de production comme GlassFish Enterprise Manager

Bien entendu tous les correctifs seront intégrés dans la prochaine version publique : GlassFish 2.1.1. Les détails de ce mécanisme sont présentés dans le billet Modèle de support Sun.

Concernant GlassFish v2.1.1, les dates importantes sont celles-ci:
Hard Code-Freeze: le 24 août
Release Candidates: entre le 9 septembre et le 7 octobre
Version finale le 28 octobre 2009

La page de téléchargement propose aujourd'hui deux formats : (glassfish-image-v2.1.1-b27) et un installeur (glassfish-installer-v2.1.1-b27-sunos_x86.jar).

ALT DESCR

Java EE 6 将包括 JSR 330JSR 299。Roberto 解释了这些更改

• JSR-299 将被更新以使用 JSR-330 注释
• JSR-330 已升级,以考虑自 JSR-299 的要求
• 这两个 JSR 都将成为 Java EE 6 平台的一部分。

感谢每一个人都这么努力的工作来进行这些更改;很明显,我们希望这能在 Java EE 6 的周期内早些时候实现,而且结果将会是一个改进的平台。我们估计,Java EE 6 的最终版本(和 GFv3)将在 11 月左右发布,但下周应有个确定的日期。

查看 Roberto 的声明获取详细信息。

ALT DESCR

Ludo 好像赢得了第一来宣布它,而 NB6.8 M1 现已可下载。这是提供 JavaEE 6 支持的第一个版本,包括捆绑的 GlassFish v3 (b57)。

查看 New And NoteworthyLudo 的博文获取详细信息。从 NB6.8 M1 页面下载不同的捆绑。

另附 - 评论来自:

• Adam Bien - "Netbeans 6.8m1 - The (lightweight) Java EE 6 IDE"

ALT DESCR

JSR 299 et JSR 330 seront intégrés dans Java EE 6. Roberto Chinnici, le responsable de la spécification explique les évolutions:

• JSR-299 sera mis à jour pour utiliser les annotations du JSR-330
• JSR-330 évoluera pour prendre en compte les besoins du JSR-299
• Les deux JSR seront donc intégrés dans la plate-forme Java EE 6.

Merci à tous ceux qui ont travaillé si dur pour arriver à ce résultat. Bien évidemment nous aurions préféré que tout ceci intervienne plus tôt dans le cycle de développement de Java EE 6, mais le travail en vaut la peine et produira une meilleure spécification. Java EE 6 et GlassFish v3 sont désormais attendus en version finale autour du mois de novembre. Des dates précises sont attendues la semaine prochaines.

Lisez donc le billet de Roberto pour plus de détails.

ALT DESCR

Java EE 6 に JSR 330JSR 299 が入ります。 Roberto が その変更について説明しています:

• JSR-299 は JSR-330 アノテーションを使うべく更新されます
• JSR-330 は JSR-299 の要件を考慮すべく発展しました
• 両 JSR 共、 Java EE 6 プラットフォームの一部となります

この変更のためにがんばってくれたみなさん、どうもありがとう。 言うまでもなく、この変更が Java EE 6 サイクルのもっと初期に起こることを 私たちは望んでいたのですが、結果的に、プラットフォームは改善されました。 Java EE 6 (と GlassFish v3) の最終リリースは 11 月辺りになると予想していますが、 来週には、日程をお伝えできると思います。

詳細は Roberto の 発表 をご覧下さい。


Now that Apache Wicket 1.4 is available, migrating from previous versions is pretty straight forward.

Change the version in your POM file as:

<wicket.version>1.4.0</wicket.version>

And that's it!

The complete dependency may look like:

<dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket</artifactId>
  <version>1.4.0</version>
</dependency>

or

<dependency>
  <groupId>org.apache.wicket</groupId>
  <artifactId>wicket</artifactId>
  <version>${wicket.version}</version>
</dependency>

You may encounter the following error:

2009-08-05 05:58:49.387::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
ERROR - DiskPageStore              - Couldn't load DiskPageStore index from file /Users/arungupta/workspaces/runner~subversion/wicket/runner/target/work/wicket.runner-filestore/DiskPageStoreIndex.
java.lang.ClassNotFoundException: org.apache.wicket.util.concurrent.ConcurrentHashMap
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:319)

At least I did :)

Fortunately the fix is simple and intuitive. Instead of running "mvn jetty:run", invoke the command:

mvn clean jetty:run

Basically, "clean" will clean out references to older version of Wicket jars in your project and voila!

If you are deploying as WAR file, then bundle Wicket jars in WEB-INF/lib instead of copying them to the shared folder of your application server.

Other Wicket tips on this blog are available here. Specifically TOTD #86 shows how to get started with Apache Wicket on GlassFish.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all the tips is available here.

Technorati: wicket glassfish migration

It is possible with Glassfish V2.1 to monitor different domains. In this blog, we will explain how to proceed.

Relationships between domain/DAS/ SNMP

The DAS (Domain administrative server) is the central piece of administration. A DAS is corresponding to a specific domain associated to a given administrative port.


 DAS with server instance, cluster instances within same domain

Glassfish V2.1 allows to create server and cluster instances instances within the same domain. Glassfish SNMP V2.1 allows to monitor SNMP at:

  • DAS level
  • standalone instance level
  • cluster instance level

It is even possible possible to deploy the snmp war file on the DAS, and on cluster instances at the same time by using different SNMP port. This is described in the SNMP documentation at:

Configuring Glassfish SNMP to monitor different domains

In this section, is shown how to monitor different domains through Glassfish SNMP. Let's assume that we create 3 different domains: domain1, domain2, domain3. Those 3 domains need to have 3 different administrative ports (4849, 4850, 4851)

asadmin create-domain --port 4849 domain1 --user admin
asadmin create-domain --port 4850 domain2 --user admin
asadmin create-domain --port 4851 domain3 --user admin

The user needs to  assign a specfic SNMP port for each domain:

asadmin set --port 4849 --user admin server.property.snmp-adapter-port=10163
asadmin set --port 4849 --user admin server.property.snmp-adapter-port=10164
asadmin set --port 4849 --user admin server.property.snmp-adapter-port=10165

The user  should restart each domain for each snmp-adapter port value to be taken account

asadmin stop-domain domain1
asadmin start-domain domain1
asadmin stop-domain domain2
asadmin start-domain domain2
asadmin stop-domain domain3
asadmin start-domain domain3

The user can now deploy the Glassfish snmp war file within each domain

asadmin deploy --port 4849 __assnmp.war
asadmin deploy --port 4850 __assnmp.war
asadmin deploy --port 4851 __assnmp.war



Viewing snmp data within the different domains

snmpwalk -c public -v 1 <hostname>:10163 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain1"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:13:56 MEST 2009"

 snmpwalk -c public -v 1 <hostname>:10164 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain2"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:11:43 MEST 2009"
snmpwalk -c public -v 1 hostname:10165 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain3"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:14:37 MEST 2009" 
  

TroubleShooting Glassfish Snmp

If you are not able to see the SNMP values, you check the glassfish server.log log file, and see within the log file to check that the SNMP value is correct for this specific domain:

  • SNMP Adapter Port: <value port> ( or example 10164 in case of domain2)



With all the great coverage of the Web Stack Enterprise Manager by Sriram, Jeff, and Irfan, I thought I should show an example of how useful it is.


I was recently running some benchmarks with the Web Stack when I saw that memcached was no longer accepting connections.  Wondering what happened, I fired up the Enterprise Manager and saw this:Web Stack Enterprise Manager

With the Enterprise Manager, it was easy to see that the connections were topping out at 1024 users.  To fix this, I increased the maximum number of connections memcached could handle with the "-c" parameter.


What other statistics are available for memcached?  Have a look:


TOTD #86 explained how to get started with deploying a Apache Wicket application on GlassFish. This Tip Of The Day (TOTD) will show how to add pagination to your Wicket application.

The blog entry "JPA/Hibernate and Wicket Repeating Views with Netbeans" Part 1 and 2 explain in detail how to create a CRUD application using NetBeans, JPA, Hibernate and Wicket. This blog uses the data created in TOTD #38 for the database table.
  1. After creating the JPA Controller, adding the IDataProvider and DataView implementations and hooking together, the application is available at "http://localhost:8080/helloworld" and looks like:



    As noticed in the output, all the states are listed in one page. The HTML markup looks like:

    <html>
        <head>
            <title>Wicket Quickstart Archetype Homepage</title>
        </head>
        <body>
            <strong>Wicket Quickstart Archetype Homepage</strong>
            <br/><br/>
            <span wicket:id="message">message will be here</span>
            <table>
                <tr>
                    <th>ID</th>
                    <th>Abbreviation</th>
                    <th>Name</th>
                </tr>
                <tr wicket:id="rows">
                    <td><span wicket:id="id">ID</span></td>
                    <td><span wicket:id="abbrev">Abbreviation</span></td>
                    <td><span wicket:id="name">Name</span></td>
                </tr>
            </table>

        </body>
    </html>

    The backing POJO looks like:

    package org.glassfish.samples;

    import java.util.Iterator;
    import org.apache.wicket.PageParameters;
    import org.apache.wicket.markup.html.basic.Label;
    import org.apache.wicket.markup.html.WebPage;
    import org.apache.wicket.markup.repeater.Item;
    import org.apache.wicket.markup.repeater.data.DataView;
    import org.apache.wicket.markup.repeater.data.IDataProvider;
    import org.apache.wicket.model.CompoundPropertyModel;
    import org.apache.wicket.model.IModel;
    import org.apache.wicket.model.LoadableDetachableModel;
    import org.glassfish.samples.controller.StatesJpaController;
    import org.glassfish.samples.model.States;

    /**
     * Homepage
     */
    public class HomePage extends WebPage {

        private static final long serialVersionUID = 1L;

        // TODO Add any page properties or variables here

        /**
         * Constructor that is invoked when page is invoked without a session.
         *
         * @param parameters
         *            Page parameters
         */
        public HomePage(final PageParameters parameters) {

            // Add the simplest type of label
            add(new Label("message", "If you see this message wicket is properly configured and running"));

            // TODO Add your page's components here

                    // create a Data Provider
            IDataProvider statesProvider = new IDataProvider() {
                public Iterator iterator(int first, int count) {
                    StatesJpaController sc = new StatesJpaController();
                    return sc.findStatesEntities(count, first).iterator();
                }

                public int size() {
                    StatesJpaController sc = new StatesJpaController();
                    return sc.getStatesCount();
                }

                public IModel model(final Object object) {
                    return new LoadableDetachableModel() {
                        @Override
                        protected States load() {
                            return (States)object;
                        }
                    };
                }

                public void detach() {
                }
            };

            // TODO Add your page's components here

            DataView dataView = new DataView("rows", statesProvider) {

                @Override
                protected void populateItem(Item item) {
                    States state = (States)item.getModelObject();
                    item.setModel(new CompoundPropertyModel(state));
                    item.add(new Label("id"));
                    item.add(new Label("abbrev"));
                    item.add(new Label("name"));
                }
            };

            add(dataView);
        }
    }

    and "persistence.xml" looks like:

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
      <persistence-unit name="helloworld" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>org.glassfish.samples.model.States</class>
        <properties>
          <property name="hibernate.connection.username" value="app"/>
          <property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.ClientDriver"/>
          <property name="hibernate.connection.password" value="app"/>
          <property name="hibernate.connection.url" value="jdbc:derby://localhost:1527/sample"/>
        </properties>
      </persistence-unit>
    </persistence>
  2. Lets add pagination to this simple sample.
    1. In the POJO, change DataView constructor so that it looks like:

              DataView dataView = new DataView("rows", statesProvider, 5)

      where "5" is the number of entries displayed per page. Alternatively you can also set the number of items per page by invoking:

      dataView.setItemsPerPage(5);

    2. In the HTML page, add the following right after "<table/>":

      <span wicket:id="pager">message will be here</span><br>

      as the last line. This is the placeholder for pagination controls.
    3. In the POJO, add the following:

              PagingNavigator pager = new PagingNavigator("pager", dataView);
              add(pager);

      right after "add(dateView);".

      The output now looks like:



      and clicking on ">" shows:



      And finally clicking on ">>" shows



      The information is now nicely split amongst multiple pages.
So just adding a pagination controls placeholder in the HTML and a corresponding configuration in DataView (in the backing POJO) did the trick for us.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all the tips is available here.

Technorati: wicket glassfish pagination

As I previously posted, the program ended and here is an official result.

PSPs and T-shirts were already sent to award winners.

photo

Thank you for all the people participated and worked on localization. Looking forward to work with you again.

ALT DESCR

O próximo lançamento público da Família GlassFish v2 é o GlassFish v2.1.1. As principais datas são: Hard Code-Freeze: Aug. 24; Release Candidates: Sept. 9 - Oct. 7; Release Oct. 28.

Atualmente disponível em dois formatos a partir da página de download: (imagem-b24-darwin) e (installer-b24-darwin); a versão final incluirá também todas as outras distribuições padrão esperado pelos nossos clientes pagantes.

ALT DESCR

Java EE 6 will include JSR 330 and JSR 299. Roberto explains the changes:

• JSR-299 will be updated to use the JSR-330 annotations
• JSR-330 has evolved to take into account requirements from JSR-299
• Both JSRs will be part of the Java EE 6 Platform

Thanks to everybody that worked so hard to make these changes; obviously we wished this had happened earlier in the Java EE 6 cycle but the result will be an improved platform. We estimate that the final release of Java EE 6 (and GFv3) will be around November but we should have specific dates next week.

Check out Roberto's Announcement for details.

This tutorial provides a comprehensive, hands-on introduction to the OpenESB technology that is making its way into Sun commercial products--GlassFish ESB and Java CAPS 6. (Login or registration required.)

• Small (and welcome) Java EE 6 delay to accomodate JSR299/JSR330 (and to include both in the platform). Expect GlassFish v3 to shift as well.
OpenDS 2.0 released - full Java LDAP server now ready for prime-time.
Web Stack 1.5 released. More than an optimized and integrated (L)AMP stack it also buys you support for Hudson and uses IPS (like GlassFish v3) for fully relocatable installs.
NetBeans 6.7.1 shipped. Now with JavaFX and lots of bug fixes (including some related to Maven support). You can simply update an existing 6.7 install. 6.8 will have Java EE 6 support and recent GlassFish v3 as the default (Milestone 1 is just out).
JRuby guys moving to EngineYard (and confirming the GlassFish praises).
GlassFish v2.1 patch 3, for paying customers.
NetNewsWire now has web version via Google Reader

ALT DESCR

Ludo seems to win the race to be the First to Announce it, but NB6.8 M1 is now available for download. This is the first build that provides JavaEE 6 support, including a bundled GlassFish v3 (b57).

See New And Noteworthy and Ludo's Post for details. Download the different bundles from the NB6.8 M1 page.

Added - Reviews from:

• Adam Bien - "Netbeans 6.8m1 - The (lightweight) Java EE 6 IDE"
• James Branajam - More About NB 6.8 M1

ALT DESCR

2009 年 8 月 6 日,这个星期四,上午 10-11 点,我们将举办第一个中文研讨会。Judy (Ms FishCAT) 届时将出席;她是的母语就是中文,已在多个场合下介绍过 GlassFish,包括在线方式个人方式

要注册,请参照 Webinar Page 中的链接。

中国是 GlassFish 的使用正在增长的国家(一般用于开源);希望您能够加入 Judy;特别感谢 Anne Hecht 组织这次研讨会。

REST Interface to Configure GlassFish In my earlier blog I talked about REST interface to monitor and manage GlassFish. We have seen how to monitor GlassFish using REST interface. Now, I would like to demonstrate how we can manage (configure) GlassFish through this interface.  The url for management root resource is http://{host}:{port}/management/domain, where {host} is the server host and {port} is the administration port.
Domain Resource Lets access http://localhost:4848/management/domain through browser. Here we are addressing the management root resource, Domain, on my local GlassFish v3 install using its REST url. Domain resource has some attributes and children. By clicking through the child resource links you can access the entire GlassFish configuration model.

So far we have seen how to read GlassFish configuration using browser. Using java client, we can see how to write configuration.  Through browser we were using html representations, whereas, with java client we will use JSON and XML representations.

You can download java client by clicking  here.  Java client uses Jersey client API's  and we used this client earlier to demonstrate GlassFish monitoring.

For example, lets create a new iiop listener. In this example, we will use XML and  JSON representations interchangeably to demonstrate REST interface support for these formats-

Step 1. GET iiop listeners
rget http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/iiop-listener "application/xml
"
<IiopListener>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/orb-listener-1</child-resource>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/SSL</child-resource>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/SSL_MUTUALAUTH</child-resource>
</IiopListener>
We see that three are three iiop-listeners available. How do I know whether I can create a fourth one and if yes, how do I know what input representation to use? Well, we can use OPTIONS method to query this.


Step 2. Get OPTIONS for iiop listeners
roptions http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/iiop-listener "
application/json"
{
  "Method":"POST",
  "Message Parameters":{
    "id":{"Acceptable Values":"","Default Value":"",
      "Type":"class java.lang.String","Optional":"false"},
    "enabled":{"Acceptable Values":"","Default Value":"true",
      "Type":"class java.lang.Boolean","Optional":"true"},
    "securityenabled":{"Acceptable Values":"","Default Value":"false",
      "Type":"class java.lang.Boolean","Optional":"true"},
    "iiopport":{"Acceptable Values":"","Default Value":"1072",
      "Type":"class java.lang.String","Optional":"true"},
    "listeneraddress":{"Acceptable Values":"","Default Value":"",
      "Type":"class java.lang.String","Optional":"false"},
    "target":{"Acceptable Values":"","Default Value":"",
      "Type":"class java.lang.String","Optional":"true"},
    "property":{"Acceptable Values":"","Default Value":"",
      "Type":"class java.util.Properties","Optional":"true"}
  }


  "Method":"GET"
}
For the meta-data, id and listeeneraddress are madatory parameters. To create new iiop-listener we must, at least provide these two parameters.


Step 3. Create (POST) new iiop listener
rpost http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/iiop-listener "
{\"id\" : \"my-new-listener\", \"listeneraddress\" : \"0.0.0.0\"}" "
application/json"
201
"http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/iiop-listener/my-new-listener" created successfully.


Step 4. GET iiop listeners
rget http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/iiop-listener "
application/xml"
<IiopListener>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/orb-listener-1</child-resource>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/SSL</child-resource>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/SSL_MUTUALAUTH</child-resource>
 <child-resource>http://localhost:4848/management/domain/configs/config/
 server-config/iiop-service/iiop-listener/my-new-listener
</child-resource>
</IiopListener>
Now we see that the fourth iiop listener, my-new-listener, is available on the server.


Step 5. GET iiop listener, my-new-listener
rget http://localhost:4848/management/domain/configs/config/server-config/
iiop-service/
iiop-listener/my-new-listener "application/xml"
<IiopListener id="my-new-listener" port="1072" enabled="true" address="0.0.0.0" security-enabled="false" lazy-init="false">
</IiopListener>


Through this example, above, we saw read, write of GlassFish configuration through REST interface using different representations (HTML, JSON and XML).

This Tip Of The Day (TOTD) explains how to add pagination to your Rails application.
  1. Create a simple Rails scaffold as:

    ~/samples/jruby >~/tools/jruby/bin/jruby -S rails paginate
    ~/samples/jruby/paginate >~/tools/jruby/bin/jruby script/generate scaffold book title:string author:string
    ~/samples/jruby/paginate >sed s/'adapter: sqlite3'/'adapter: jdbcsqlite3'/ <config/database.yml >config/database.yml.new
    ~/samples/jruby/paginate >mv config/database.yml.new config/database.yml
    ~/samples/jruby/paginate >~/tools/jruby/bin/jruby -S rake db:migrate

  2. Edit "test/fixtures/books.yml" and specify the content as:

    # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

    one:
      title: Ultramarathon Man Confessions of an All-Night Runner
      author: Dean Karnazes

    two:
      title: My Life on the Run
      author: Bart Yasso

    three:
      title: 50/50 Secrets I Learned Running 50 Marathons in 50 Days
      author: Dean Karnazes

    four:
      title: Born to Run
      author: Christopher Mcdougall

    five:
      title: Four Months to a Four-hour Marathon
      author: Dave Kuehls

    six:
      title:  Galloway's Book on Running
      author: Jeff Galloway

    seven:
      title: Marathoning for Mortals
      author: John Bingham and Jenny Hadfield

    eight:
      title:  Marathon You Can Do It!
      author: Jeff Galloway

    nine:
      title: Marathon The Ultimate Training Guide
      author: Hal Higdon

    ten:
      title: Running for Mortals
      author: John Bingham and Jenny Hadfield

    and load the fixtures as:

    ~/samples/jruby/paginate >~/tools/jruby/bin/jruby -S rake db:fixtures:load
    (in /Users/arungupta/samples/jruby/paginate)

  3. Run the application as:

    ~/samples/jruby/paginate >~/tools/jruby/bin/jruby -S glassfish -l
    Starting GlassFish server at: 129.145.132.8:3000 in development environment...
    Writing log messages to: /Users/arungupta/samples/jruby/paginate/log/development.log.

    . . .

    Jul 29, 2009 2:06:44 PM com.sun.grizzly.scripting.pool.DynamicPool$1 run
    INFO: New instance created in 7,488 milliseconds

    The application is accessible at "http://localhost:3000/books" and looks like:



    The page shows 10 rows, all in one page.
  4. Lets add pagination to this simple sample.
    1. Install will_paginate gem as:

      /tools/jruby >./bin/jruby -S gem install will_paginate
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
      Successfully installed will_paginate-2.2.2
      1 gem installed
      Installing ri documentation for will_paginate-2.2.2...
      Installing RDoc documentation for will_paginate-2.2.2...

      There are other methods of installation as well.
    2. Edit "config/environment.rb" and add

      require "will_paginate"

      as the last line.
    3. Edit the "index" action in "app/controllers/books_controller.rb" as:

      @books = Book.paginate(:page => params[:page], :per_page => 5)
      #@books = Book.all

      ":per_page" specifies the number of items to be displayed in each page.
    4. In "app/views/books/index.html.erb", add:

      <%= will_paginate @books %>

      right after "</table>".

      The output now looks like:



      and clicking on "Next" shows:



      The information is nicely split amongst 2 pages.
An important point to remember is that will_paginate only adds pagination to your Rails app. You are still required to display all the values.

But essentially replacing "@books = Book.all" with "@books = Book.paginate(:page => params[:page], :per_page => 5)" in the Controller and adding
"<%= will_paginate @books %>" did the trick for us.

Clean and simple!

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all the tips is available here.

Technorati: jruby rubyonrails glassfish pagination will_paginate