<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Santiago Pericas-Geertsen&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/" />
<modified>2008-08-13T15:00:36Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/spericas/216</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, spericas</copyright>
<entry>
<title>Developing MEP Connectors - Part II</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2008/08/developing_mep_1.html" />
<modified>2008-08-13T15:00:36Z</modified>
<issued>2008-08-13T15:00:36Z</issued>
<id>tag:weblogs.java.net,2008:/blog/spericas/216.10275</id>
<created>2008-08-13T15:00:36Z</created>
<summary type="text/plain">In the first installment of these series we&apos;ve looked at the architecture of a MEP connector and briefly discuss the main abstractions in the ECBO (Enterprise Connector Business Object) API: BusinessObject and BusinessObject provider. In this second part, we&apos;ll discuss an actual implementation of the BusinessObject abstraction used to create a connector that synchronizes data against a relational database.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Mobility</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>In the first installment of these series we've looked at the architecture of a MEP connector and briefly discuss the main abstractions in the ECBO (Enterprise Connector Business Object) API: <tt>BusinessObject</tt> and <tt>BusinessObject</tt> provider. In this second part, we'll discuss an actual implementation of the <tt>BusinessObject</tt> abstraction used to create a connector that synchronizes data against a relational database.</p>

<p>We will use the MusicDB sample application provided with MEP to demonstrate how to use the ECBO API. The Enterprise Connector in this application acts as the intermediary between a client on a mobile device and a database. In this particular demo, the database will be accessed using the Java Database Connectivity (JDBC) API. The source code for the MusicDB Enterprise Connector is included in the MEP client bundle <a href="http://www.sun.com/software/products/mep/get.jsp">available for download here</a>. In the directory where you unzipped the client bundle, it is in the subdirectory <tt>sjsmep-client-1_0-fcs/samples/ecbo/</tt>.</p>

<p>As stated in Part I, the ECBO API provides two essential abstractions: BusinessObject and BusinessObjectProvider. Due to the nature of the synchronization process, every enterprise connector must provide the ability to CRUD (create, retrieve, update and delete) business objects. In addition to providing the data model for the entities being synchronized, the BusinessObject abstraction also provides support for CUD, i.e. each object provides the ability to create, update and delete itself. The R operation, or retrieve, is implemented by the BusinessObjectProvider.</p>

<p>Let us start by describing the <tt>MusicAlbum</tt> which extends <tt>BusinessObject</tt>. Every business object in MEP must have a unique name (its identity) and this is stored in the <tt>name</tt> variable in <tt>BusinessObject</tt> which can be accessed via <tt>getName()</tt> and <tt>setName(String)</tt> in a subclass. The other variables in the subclass complete the <emph>model</emph> for the business object in question, a music album in our case.</p>

<pre>
public class MusicAlbum extends BusinessObject<MusicAlbumProvider> {

    private static final String DEFAULT_VALUE = "$$default$$"; 

    /**
     * Album's artist.
     */ 
    String artist;

    /**
     * Date when the album was published.
     */
    Calendar datePublished;
    
    /**
     * Album's rating from 1 to 5.
     */
    int rating;

    ...
</pre>

<p>All business objects must provide the ability to serialize and deserialized to a byte array. The actual format used for serialization is open ended, but must be part of the contract between the connector and the mobile client application. For music albums, serialization is implemented using <tt>DataOutputStream</tt> and <tt>DataInputStream</tt>.</p>

<pre>
    public byte[] serialize() throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        DataOutputStream dOut = new DataOutputStream(out);

        dOut.writeUTF(getName());
        dOut.writeUTF(getArtist() != null ? getArtist() : DEFAULT_VALUE);
        dOut.writeUTF(getDatePublished() != null ? getDatePublished() : DEFAULT_VALUE);
        dOut.writeUTF(Integer.toString(getRating()));
        dOut.flush();
        return out.toByteArray();
    }

    public void deserialize(byte[] array) throws IOException {
        ByteArrayInputStream in = new ByteArrayInputStream(array);
        DataInputStream dIn = new DataInputStream(in);
        
        setName(dIn.readUTF());
        artist = dIn.readUTF();
        if (artist.equals(DEFAULT_VALUE)) {
            artist = null;
        }
        String date = dIn.readUTF();
        if (date.equals(DEFAULT_VALUE)) {
            datePublished = null;
        }
        else {
            setDatePublished(date);
        }
        rating = Integer.parseInt(dIn.readUTF());
    }
</pre>

<p>As stated above, a business object must also implement CUD operations. Three new classes, namely, <tt>MusicAlbumInsertCommand</tt>, <tt>MusicAlbumUpdateCommand</tt> and <tt>MusicAlbumDeleteCommand</tt> are defined as extensions to <tt>InsertCommand</tt>, <tt>UpdateCommand</tt> and <tt>DeleteCommand</tt>, respectively.</p>

<pre>
    @Override
    public MusicAlbumInsertCommand getInsertCommand() {
        return new MusicAlbumInsertCommand(this, getSQLConnection(),
                getInsertString());
    }
    
    @Override
    public MusicAlbumUpdateCommand getUpdateCommand() {
        return new MusicAlbumUpdateCommand(this, getSQLConnection(),
                getUpdateString());
    }
    
    @Override
    public MusicAlbumDeleteCommand getDeleteCommand() {
        return new MusicAlbumDeleteCommand(this, getSQLConnection(),
                getDeleteString());
    }
</pre>

<p>The reader is referred to the client bundle (see folder location above) for the complete sources of all these command classes. The methods above use utility methods to construct SQL statements. The MusicDB album table is comprised of 5 columns: name, artist, datePublished, rating and username. The last column holds the name of the user that created the entry; this last column enables multiple users to share the same physical table. As an example, <tt>getDeleteString()</tt> is implemented as follows:</p>

<pre>
    public String getDeleteString() {
        stringBuilder.setLength(0);
        stringBuilder.append("DELETE FROM album WHERE name = '")
                     .append(getName())
                     .append("' AND username = '" 
                            + getBusinessObjectProvider().getUsername() + "'");
        return stringBuilder.toString();
    }
</pre>

<p>The last method that <tt>MusicAlbum</tt> must override is <tt>getExtension()</tt>. Business objects are stored as files on a mobile device, and due to compatibility issues among devices, it is easier to store them in the same folder. If multiple MEP applications are installed on a device, then the client MEP library must have a quick and unambiguous way to distinguish these objects. This is currently done by defining a unique file extension which is returned by the <tt>getExtension()</tt> method.</p>

<pre>
    @Override
    public String getExtension() {
        return ".alb";
    }
</pre>

<p>By introducing the <tt>MusicAlbum</tt> class we have shown how to create a sample MEP business object. This is about half of the work needed to write a MEP connector; the other half would involve the implementation of a <tt>MusicAlbumProvider</tt> that extends <tt>BusinessObjectProvider</tt>. This will be the subject of our next blog entry. Stay tuned!</p>

]]>

</content>
</entry>
<entry>
<title>Developing MEP Connectors - Part 1</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2008/07/developing_mep.html" />
<modified>2008-07-30T15:28:00Z</modified>
<issued>2008-07-30T15:27:53Z</issued>
<id>tag:weblogs.java.net,2008:/blog/spericas/216.10199</id>
<created>2008-07-30T15:27:53Z</created>
<summary type="text/plain">Developing an application using the Sun Java Mobile Enterprise Platform (MEP) requires writing two components: a sync client application that runs on the mobile device and an enterprise connector that enables the MEP gateway to access the back-end system where the data is located. Ryan has already provided an intro on the architecture and features of the client SDK, so in this blog entry I&apos;ll introduce the Enterprise Connector Business Object (ECBO) API which is part of the server SDK and can be used to write enterprise connectors.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Mobility</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>Developing an application using the Sun Java Mobile Enterprise Platform (MEP) requires writing two components: a sync client application that runs on the mobile device and an enterprise connector that enables the MEP gateway to access the back-end system where the data is located. In <a href="http://weblogs.java.net/blog/ryan_shoemaker/archive/2008/07/a_closer_look_a.html">this blog entry</a>, Ryan has already provided an intro on the architecture and features of the client SDK, so in this blog entry I'll introduce the Enterprise Connector Business Object (ECBO) API which is part of the server SDK and can be used to write enterprise connectors.</p>

<p>An enterprise connector is an extension to the MEP gateway that enables data synchronization with a specific data source. A data source could be an EIS system, an RDBMS, a file system, etc. It is similar in nature to a J2EE connector in that it provides access to a (possibly) proprietary system, but it does so using a high-level <b>business object</b> abstraction. Business objects are the entities being synchronized. They are serialized into <b>data records</b> which can be carried in SyncML packets and are used by the MEP gateway to detect changes. </p>

<p>The following diagram shows the architecture of an enterprise connector in MEP:</p>

<center>
<img alt="ecbo1.jpg" src="http://weblogs.java.net/blog/spericas/archive/ecbo1.jpg" width="584" height="319" />
</center>

<p>Internally, every enterprise connector is viewed by the MEP gateway as a JCR-based repository with a specific node structure, well-defined node names, etc. As seen in the diagram above, it is possible to write a connector directly on top of JCR, but this is an arduous task and not recommended given how much easier it is to write one using the ECBO API. A typical enterprise connector also relies on other APIs such as JCA, to access J2EE connectors that know how to retrieve data from an EIS, or JDBC, to access RDBMS systems, for example.</p>

<p>The ECBO API provides two essential abstractions: <tt>BusinessObject</tt> and <tt>BusinessObjectProvider</tt>. Due to the nature of the synchronization process, every enterprise connector must provide the ability to CRUD (create, retrieve, update and delete) business objects. In addition to providing the data model for the entities being synchronized, the <tt>BusinessObject</tt> abstraction also provides support for CUD, i.e. each object provides the ability to create, update and delete itself. The R operation, or retrieve, is implemented by the <tt>BusinessObjectProvider</tt>.</p>

<p>Stay tuned for the next installment when we drill down into the details of the business object and business object provider abstractions. In the meantime, don't forget that you can <a href="http://www.sun.com/software/products/mep/get.jsp">download MEP from here</a> and try it out!<p>]]>

</content>
</entry>
<entry>
<title>Sun Java Mobile Enterprise Platform 1.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2008/07/sun_java_mobile.html" />
<modified>2008-07-14T21:59:30Z</modified>
<issued>2008-07-14T21:59:25Z</issued>
<id>tag:weblogs.java.net,2008:/blog/spericas/216.10113</id>
<created>2008-07-14T21:59:25Z</created>
<summary type="text/plain">I&apos;m thrilled to announce that we have just released a new product called the Sun Java Mobile Enterprise Platform, or MEP for short. MEP is a framework for developing mobile enterprise applications. Based on robust synchronization technologies, it enables end users to synchronize enterprise data (from back-end systems like Siebel or SAP) on their mobile devices. See complete blog entry for more details.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>It's been several months since my last blog. The reason is that I have been deeply involved in this new product called MEP (Mobile Enterprise Platform) and I really couldn't say much about it. However, version 1.0 has just been released, so it's time to open the blog gates. See <a href="http://blogs.sun.com/mobility/">announcement here</a> for additional info about MEP.</p>

<p>MEP is a framework for developing mobile enterprise applications. Based on robust synchronization technologies, it enables enterprise users to synchronize enterprise data (from back-end systems like Siebel or SAP) with their mobile devices. In a nutshell, MEP enables enterprise users to <emph>carry the enterprise in their pockets</emph>.
</p>

<p>MEP is completely based on open standards, including OMA DS (formerly SyncML), J2EE, CLDC, CDC and MIDP. It runs on, and it is bundled with, the best application server (yeah, yeah, I'm a bit biased): <a href="https://glassfish.dev.java.net/">Glassfish</a>. An enterprise application built using MEP is comprised of three main components: a J2ME client, the MEP gateway, and a back-end system. The back-end system could be practically anything: e.g., an EIS system such as Siebel or SAP, a relational database system, a datastore in a file system, a datastore accessible via a web services interface, etc., you get the point --the only requirement is for the back-end system to support CRUD operations. All it is needed is an MEP connector to access the datastore. As part of the platform, MEP also includes what we call adapters which enable MEP connectors to access popular EIS systems. These adapters originate from another Sun project, namely, the Sun Java Composite Application Platform Suite (JavaCAPS).</p>

<p>MEP is a very interesting product because it appeals to enterprises as much as it appeals to mobile phone carriers. MEP flexible architecture enables what we call 1-tier and 2-tier deployments. In the 1-tier deployment, both the MEP gateway and the back-end system reside within the same (firewalled) network.<p>

<p><center>
<img alt="1-tier.gif" src="http://weblogs.java.net/blog/spericas/archive/1-tier.gif" width="568" height="345" />
</center></p>

<p>In the 2-tier deployment, the MEP gateway communicates using SOAP-based web services to an MEP connector running on the second tier (i.e., on a different instance of Glassfish). This connector is assumed to reside in the same network as the back-end system.<p>

<p><center>
<img alt="2-tier.gif" src="http://weblogs.java.net/blog/spericas/archive/2-tier.gif" width="602" height="348" />
</center></p>

<p>The 2-tier deployment can be appealing to mobile phone carriers. In particular, mobile phone carriers can host and maintain the MEP gateway, thereby providing a new service to their customers.</p>

<p>As you can imagine, there's a lot more to say about MEP. This is just the beginning. Here is the official <a href="http://www.sun.com/software/products/mep/">product page</a>. Stay tuned for more blog entries about MEP in the upcoming weeks!
]]>

</content>
</entry>
<entry>
<title>What&apos;s New in Japex 1.1.4?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/10/whats_new_in_ja.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-10-05T20:57:41Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.8381</id>
<created>2007-10-05T20:57:41Z</created>
<summary type="text/plain">More users usually translates into more requests for features. A few more developers have picked up Japex in the last month, and a couple have asked me to provide additional features for their benchmarks. I&apos;ll use this blog to introduce a couple of new features in Japex version 1.1.4.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>More users usually translates into more requests for features. A few more developers have picked up Japex in the last month, and a couple have asked me to provide additional features for their benchmarks. Two new global parameters are supported in Japex 1.1.4: <tt>japex.runIterationDelay</tt> and <tt>japex.singleClassLoader</tt>.</p>

<p>Support for <tt>japex.runIterationDelay</tt> was requested by Vitaliy O. who is using Japex to benchmark a CMS system and needs to introduce a delay between calls to <tt>run()</tt> in order to simulate multiple users accessing the system. Naturally, any Japex driver can introduce a delay by calling <tt>System.sleep()</tt> but this will obviously impact the throughput computed by the Japex engine. In other words, the Japex engine needs to be aware of this parameter so that it can adjust the throughput computation accordingly. This is the reason why this new parameter was introduced.</p>

<p>In order to provide isolation between the drivers, the Japex engine creates a new instance of <tt>JapexClassLoader</tt> for each driver. The value of the driver parameter <tt>japex.classPath</tt> is used to initialize each class loader. This isolation permits testing multiple versions of the same software (with classed in the same namespaces) and works well in most cases. However, Ken C. reported problems with a micro-benchmark that tests IIOP  implementations. In some cases, SPIs in the JDK runtime system can cache implementation classes making it difficult to compare the performance of multiple implementations of the same SPI by only allowing the first driver to be loaded. This can be solved if a single instance of <tt>JapexClassLoader</tt> is used for the entire benchmark rather than one per driver. That is precisely the purpose of the new boolean parameter <tt>japex.singleClassLoader</tt>.</p>

<p>I'll report on more Japex adoptions in my next blog entry. In the meantime, happy benchmarking!</p> ]]>

</content>
</entry>
<entry>
<title>W3C Efficient XML Interchange Public Draft Available</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/07/w3c_efficient_x_2.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-07-20T17:48:37Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7894</id>
<created>2007-07-20T17:48:37Z</created>
<summary type="text/plain">I&apos;m a few days late in reporting that the first public working draft of the Efficient XML Interchange (EXI) format is now available from W3C. And, naturally, the &quot;binary XML&quot; threads have resumed on xml-dev and in a few other places. Without trying to address all the questions raised in those threads, I&apos;ll talk about how EXI compares to Fast Infoset.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>I'm a few days late in reporting that the first public working draft of the <a href="http://www.w3.org/TR/exi/">Efficient XML Interchange (EXI)</a> format is now available from W3C. And, naturally, the <a href="http://lists.xml.org/archives/xml-dev/200707/threads.html#00055">"binary XML" threads</a> have resumed on xml-dev and in a few other places. Without trying to address all the questions raised in those threads, I'll talk about how EXI compares to Fast Infoset.</p>

<p>Rather than going throw all the features in EXI, and given that I have participated in both Fast Infoset (FI) and EXI working groups, let me talk about the differences and similarities between these formats. First, Fast Infoset was in fact one the candidates submitted to the EXI WG for consideration. Although regarded as a strong format in many ways, it was deemed not compact enough for certain use cases. Generally speaking, the more you know about the entity being encoded, the more compact the encoding can be. Thus, knowing that XML (or an XML infoset to be precise) is being encoded helps, but knowing what XML vocabulary (e.g., SVG, XHTML, etc.) is being encoded helps even more. This is why there's is typically a <i>schema</i> mode and a <i>schema-less</i> mode in these type of formats. One of the reasons why EXI can be more compact than FI is due to its stronger support for schemas. In fact, perhaps the best feature of EXI is that it uses essentially the same encoding and decoding algorithm in both modes.</p>

<p>Another reason why EXI can be more compact than FI is that, at least in its default mode of operation, it is <i>bit</i> rather than <i>byte</i> aligned. Thus, in many cases, it can pack more information than FI in a single byte. The downside of bit alignment is that, generally speaking, it requires more CPU instructions per byte so it tends to be less efficient to process. However, when in an "XML interchange", CPU processing time isn't the only variable in play: the time to write those bytes to the network, disk, etc. can be significant as well. Thus, there's a delicate balance between the time it takes to produce and consume a document versus the time it takes to transfer a document from the producer to the consumer (and this is precisely why general compression like GZIP works in some cases but not in others).</p>

<p>By this time, you're probably asking yourself: Will EXI be faster than FI? The answer to this question is not that simple. First, when talking about processing efficiency, we can talk about why certain format features can enable (or disable) it, but it ultimately comes down to implementations. Second, as I tried to explain above, it may depend on the type of "interchange" in your application. For applications that rely on a low-bandwidth network (no, no, I won't try to quantify "low" in this case, so don't ask :), EXI is likely to offer improved performance. For other types of applications, well, we'll have to wait and see how good the EXI implementations will be. An implementation of Efficient XML, on which EXI is based, showed promising results in the measurements conducted by the group &#151;although I must say this implementation was only available to the W3C not the WG members so, personally, I never had a chance to kick its tires.</p>

<p>On the subject of implementations, soon (hopefully, very soon) there will be an announcement regarding an open source implementation of EXI. As it often happens in projects of this kind, there are some legal hurdles that we need to clear first before the project can be announced. Stay tuned ...</p>]]>

</content>
</entry>
<entry>
<title>Adding Typed Support to the StAX API - Part 2</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/06/adding_typed_su_1.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-06-14T22:17:38Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7640</id>
<created>2007-06-14T22:17:38Z</created>
<summary type="text/plain">In an earlier blog entry I talked about a discussion to extend the StAX API with XML data types. The discussion is still ongoing and we have actually written some Java interfaces to solidify our ideas. These interfaces are now available as part of the Woodstox subversion repository. </summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>In an <a href="http://weblogs.java.net/blog/spericas/archive/2007/05/adding_typed_su.html">earlier blog entry</a> I talked about a discussion to extend the StAX API with XML data types. The discussion is still ongoing and we have actually written some Java interfaces to solidify our ideas. These interfaces are available as part of the <a href="http://woodstox.codehaus.org/">Woodstox</a> subversion repository in the <tt>org.codehaus.stax2.typed</tt> package. </p>

<p>For a Web interface, you can use <a href="http://fisheye.codehaus.org/browse/woodstox/wstx/trunk/src/java/org/codehaus/stax2/typed">Codehaus' Fisheye view of the package</a>. See my earlier post on how to participate in the <a href="mailto:stax_builders@yahoogroups.com">stax_builders@yahoogroups.com</a> discussions.]]>

</content>
</entry>
<entry>
<title>Woodstox rocks Glassfish v2</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/06/woodstox_rocks.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-06-01T16:59:23Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7542</id>
<created>2007-06-01T16:59:23Z</created>
<summary type="text/plain">This is a great example of how your opinion counts and how a community can work together to improve a product. We kept hearing from many of you about how good the Woodstox XML parser was, especially how well it performed. Your voice has been heard, Woodstox is now officially part of Glassfish and this is the story of how it happened. </summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>This is a great example of how your opinion counts and how a community can work together to improve a product. We kept hearing from many of you about how good the <a href="http://woodstox.codehaus.org/">Woodstox XML parser</a> was, especially how well it performed. Your voice has been heard, Woodstox is now officially part of <a href="https://glassfish.dev.java.net">Glassfish</a> and this is the story of how it happened.</p>

<p>I don't have any official data, but I suspect that Woodstox is one of the most popular StAX parsers in the market. Tatu Saloranta, Woodstox' creator, has done a fantastic job not only writing the code but also building an active community around it. Our internal testing showed that Woodstox was both robust and fast, but there were a couple of wrinkles that needed ironing before we could make it part of Glassfish. First, <a href="https://jax-ws.dev.java.net">JAX-WS</a> (or more specifically <a href="https://jaxb.dev.java.net">JAXB</a>) uses some backdoor methods in <a href="https://sjsxp.dev.java.net">SJSXP</a> to optimize serialization performance which were not available in Woodstox. Second, conformance testing showed that Woodstox 3.2.0 failed a couple of TCK tests.</p>

<p>About two months ago I contacted Tatu with the intention of addressing these problems and working together to make Woodstox a viable option in Glassfish. Tatu was incredibly supportive and within 10 days or so he had a new release of Woodstox (3.2.1) ready for us to test. As part of our discussion, I learned that he did not have access to the StAX TCKs, so I wrote some tests that would mimic the behavior of the TCKs. As a result, Woodstox 3.2.1 now passes all the TCK tests.</p>

<p>Enough history, how can I try it out? Bhakti has written a nice blog about how to <a href="http://weblogs.java.net/blog/bhaktimehta/archive/2007/06/woodstox_in_gla_1.html">enable Woodstox in Glassfish</a>. Try it out and let us know; some of our internal data (WSpex running on top of <a href="https://japex.dev.java.net">Japex</a>) has shown that using Woodstox you can get a significant improvement (30-40%) in some cases.</p>
]]>

</content>
</entry>
<entry>
<title>W3C EXI Performance Testing Framework</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/06/w3c_exi_perform.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-06-01T16:10:08Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7540</id>
<created>2007-06-01T16:10:08Z</created>
<summary type="text/plain">The W3C Efficient XML Interchange (EXI) Performance Testing Framework is now publicly available for download. This is the testing framework used by the EXI WG to evaluate properties of &quot;binary XML&quot; candidates. Specifically, the framework can be used to measure Processing Efficiency and Compactness, and includes support for in-memory and network testing. It is also a great example on how to build a benchmark using the Japex framework.  </summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>The W3C Efficient XML Interchange (EXI) <a href="http://www.w3.org/News/2007#item109">Performance Testing Framework</a> is now publicly available for download. This is the testing framework used by the EXI WG to evaluate properties of "binary XML" candidates. Specifically, the framework can be used to measure <a href="http://www.w3.org/TR/xbc-properties/#processing-efficiency">Processing Efficiency</a> and <a href="http://www.w3.org/TR/xbc-properties/#compactness">Compactness</a>, and includes support for in-memory and network testing.</p>

<p>The EXI testing framework is built on top of the Glassfish-community project <a href="https://japex.dev.java.net">Japex</a>,
which provides basic functionality for timing, drawing charts and generating XML and HTML reports. The WG has received over a thousand XML documents for testing and has hand picked about 100 ranging over 20 different schemas to be included in the framework. The selection has been done very carefully to ensure having representatives for each of the use cases.</p>

<p>The framework includes drivers for several Java and
C/C++ candidates submitted to the EXI WG. The Java drivers use the SAX
API, the C/C++ drivers use either a SAX-like API or a typed API (data
binding). Writing a driver for a candidate that has not been submitted to the WG should be straightforward using any of the existing candidates (such as <a href="https://jaxp.dev.java.net">JAXP</a>) as a template.
To simplify the creation of new drivers, the EXI testing framework includes additional functionality on top of what is provided by Japex that allows the framework to be executed in memory or over the
network. However, due to the cost associated with the JNI interface in
Java, network support isn't available to C/C++ candidates, so these
candidates can only be tested in memory. Drawing conclusions by
comparing Java candidates vs. C/C++ candidates is non-trivial due to
significant differences in the APIs and the underlying platforms. For
these reasons, we opted for separating the Japex configuration files
to avoid producing reports that mix Java and native drivers.</p>

<p>Drivers for the following candidates are included as part of the framework: ASN.1 BER, ASN.1 PER, Efficient XML, ESXML, Fast Infoset, Libxml2, FXDI, Xebu and Xals. Note that the framework does not include the libraries needed by any of these drivers; see the <a href="http://www.w3.org/XML/EXI/framework/RELEASE_NOTES.txt">Release Notes</a> for further information.</p>
]]>

</content>
</entry>
<entry>
<title>JAXP 1.4.2 RI is available now!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/05/jaxp_142_ri_is.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-05-31T15:38:06Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7531</id>
<created>2007-05-31T15:38:06Z</created>
<summary type="text/plain">Two months after releasing JAXP RI version 1.4.1, we are now releasing version 1.4.2. There have been a few important bug fixes but the main driver for this release has been a problem found using the 1.4.1 RI on top of JDK 1.4. We discovered this last week while integrating a few bug fixes into an update release of JDK 6. Read on if you have plans to use the latest RI on top of JDK 1.4. </summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>Two months after releasing <a href="http://weblogs.java.net/blog/spericas/archive/2007/03/jaxp_141_is_ava.html">JAXP RI version 1.4.1</a>, we are now releasing version 1.4.2. 
This is therefore the second update release to the FCS version from last year that is also part of JDK 6. Note that all these RI releases correspond to the same <a href="http://jcp.org/en/jsr/detail?id=206">JAXP 1.4 Specification</a>. Although there have been talks about a new JAXP specification, no official work has been started yet.</p>

<p>There have been a few important bug fixes (for more information please refer to the <a href="https://jaxp.dev.java.net/1.4/1.4.2/changelog.html">JAXP 1.4.2 RI Changelog</a>) but the main driver for this release has been a problem found using the 1.4.1 RI on top of JDK 1.4. We discovered this last week while integrating a few bug fixes into an update release of JDK 6. And earlier this week we've got reports of a JAXP user (Matthew R.) confirming the problem.</p>

<p>In a nutshell, the 1.4.1 RI jars are missing a few classes that are also part of JDK 5 runtime system. Thus, the problem goes unnoticed if running on JDK 5 but as soon as you try the same application on JDK 1.4, you get a NoClassDefFoundError. As an example, trying to use XPath in this scenario results in the following exception being thrown:</p>
<pre><code><small>
java.lang.NoClassDefFoundError:
      com/sun/org/apache/xalan/internal/extensions/ExpressionContext 
      at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.eval(XPathImpl.java: 201) 
      at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java: 275) 
      ...
</small></code></pre>

<p>The 1.4.2 version of the RI should fix this problem. And rest assured we fixed our build script to make sure that compatibility with JDK 1.4 is preserved in future releases.</p>]]>

</content>
</entry>
<entry>
<title>Adding Typed Support to the StAX API</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/05/adding_typed_su.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-05-21T20:42:37Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7467</id>
<created>2007-05-21T20:42:37Z</created>
<summary type="text/plain">A discussion has been started in the stax_builders@yahoogroups.com mailing list about typed extensions to the StAX API. We hope this discussion will serve as the basis for a proposal to be incorporated in the next release of the API. Subscribe to the mailing list (it is moderated) if you are interested in influecing this next-gen API.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>A discussion has been started in the <a href="mailto:stax_builders@yahoogroups.com">stax_builders@yahoogroups.com</a> mailing list about typed extensions to the StAX API. We hope this discussion will serve as the basis for a proposal to be incorporated in the next release of the API. Subscribe to the mailing list (it is moderated) if you are interested in influecing this next-gen API.</p>

<p>Here is the <a href="http://tech.groups.yahoo.com/group/stax_builders/join">subscription page</a> and the <a href="http://tech.groups.yahoo.com/group/stax_builders/">mailing list archive</a> for the mailing list. To this point the discussion has been centered around (i) the scope of this work and (ii) how to actually extend the API with methods like <tt>getElementAsDouble()</tt> or <tt>writeElementFromByteArray(byte[])</tt>. See you there.</p>]]>

</content>
</entry>
<entry>
<title>JAXP.next Community Discussion Wiki</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/04/jaxpnext_commun.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-04-20T20:00:30Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.7110</id>
<created>2007-04-20T20:00:30Z</created>
<summary type="text/plain">As a follow up to a blog I wrote back in December about simplifying the JAXP API, I have created a community wiki page to continue this discussion. We have received some interesting feedback (see comments in the alluded blog) but feel many of you haven&apos;t had a chance to voice your opinion. I&apos;ve created the community wiki page for this very purpose. </summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>As a follow up to a <a href="http://weblogs.java.net/blog/spericas/archive/2006/12/simplifying_the.html">blog I wrote back in December</a> about simplifying the JAXP API, I have created a <a href="http://wiki.glassfish.java.net/gfwiki/Wiki.jsp?page=JaxpNextDiscussion">community wiki page</a> to continue this discussion. We have received some interesting feedback (see comments in the alluded blog) but feel many of you haven't had a chance to voice your opinion. I've created the community wiki page for this very purpose.</p>

<p>Hopefully the use of a wiki will encourage more participation and serve as a reference for a future JCP working group. This is your chance to help improve future APIs on the Java platform. See you there.</p>

]]>

</content>
</entry>
<entry>
<title>JAXP 1.4.1 is available now!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/03/jaxp_141_is_ava.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-03-21T15:22:27Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.6876</id>
<created>2007-03-21T15:22:27Z</created>
<summary type="text/plain">The JAXP 1.4.1 RI is now available. This is an update release to the FCS version that we released a few months back, and that is also included in JDK 6.0. The change log shows that approximately 36 issues have been addressed in this release. Thanks for your help on improving JAXP!</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>The <a href="https://jaxp.dev.java.net/1.4/index.html">JAXP 1.4.1 RI</a> is now available. This is an update release to the FCS version that we released a few months back, and that is also included in JDK 6.0. The <a href="https://jaxp.dev.java.net/1.4/1.4.1/changelog.html">change log</a> shows that approximately 36 issues have been addressed in this release. As always, if you have plans to use this new version on top of JDK 6.0, you must use the <a href="http://java.sun.com/j2se/1.4.2/docs/guide/standards/">endorsed standards override mechanism</a> available on the platform.</p>

<p>As Joe points out in <a href="http://blogs.sun.com/joew/entry/the_java_api_for_xml">his blog</a>, we have also created a new Java.net forum to improve our communication with you, the developer. Here is the link to <a href="http://forums.java.net/jive/forum.jspa?forumID=114">the new forum</a>. See you there!</p>]]>

</content>
</entry>
<entry>
<title>Japex 1.1 is now available!</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/03/japex_11_is_now.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-03-15T16:06:56Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.6827</id>
<created>2007-03-15T16:06:56Z</created>
<summary type="text/plain">It&apos;s been a while since the last time I blogged about Japex. Over the last year or so there have been many incremental improvements (resulting in 30 different releases) and with the recent addition of combined bar charts (more on this later), I thought it was time to make this the official 1.1 release.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>It's been a while since the last time I blogged about <a href="https://japex.dev.java.net">Japex</a>. Over the last year or so there have been many incremental improvements (resulting in 30 different releases) and with the recent addition of combined bar charts, I thought it was time to make this the official 1.1 release.</p>

<p>I won't talk about all the features that we have added during the last 12 months, instead I'll concentrate on the very latest one: support for combined bar charts. The output parameter <tt>japex.resultValue</tt> denotes the value produced by driver A on test case T. I.e., there is one value of <tt>japex.resultValue</tt> for each driver-test case combination. The unit of this value is defined by <tt>japex.resultUnit</tt> which by default it is set to TPS (transactions per second).</p>

<p>Since the introduction of <a href="http://weblogs.java.net/blog/spericas/archive/2005/11/scatter_plots_i.html">scatter charts in Japex</a>, a new value axis was added together with the output parameter <tt>japex.resultValueX</tt>. The "X" suffix in this parameter refers to the X axis in a scatter chart. This X axis is never computed by the Japex engine, but drivers are free to assign values to <tt>japex.resultValueX</tt>. If the main axis (or the Y axis) was used to calculate performance, say in TPS, this new axis could be used to calculate some other property such as message size, memory usage, etc. Even though these values would always be shown in HTML tables, they were only plotted if the type of chart selected was <tt>scatterchart</tt>.</p>

<p>Unfortunately, scatter charts are not the easiest charts to read at times. This is where combined bar charts are useful. Rather than explaining how one of these charts would look like, let me show you one generated using the FastInfoset sample that comes with Japex:</p>

<center>
<img alt="combinedbarchart.jpg" src="http://weblogs.java.net/blog/spericas/archive/combinedbarchart.jpg" width="600" height="450" />
</center>

<p>Note that in this chart values are normalized with respect to the JAXPDriver. The top part of the chart shows message sizes (relative to the XML message size) and the bottom part shows throughput.</p> 

<p>Using these type of bar charts, it is now possible to simultaneously look at two different properties in the same chart and, as in the example above, find possible correlations between message size and throughput. The 1.1 release of Japex is <a href="https://japex.dev.java.net/servlets/ProjectDocumentList">now available for download</a>. Happy benchmarking!</p>]]>

</content>
</entry>
<entry>
<title>XML Schema Validation with JAXP 1.4 and JDK 6.0</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/03/xml_schema_vali.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-03-01T19:20:54Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.6719</id>
<created>2007-03-01T19:20:54Z</created>
<summary type="text/plain">A few people have found problems validating DOM instances with JAXP 1.4/JDK 6.0. I saw this quesion raised in the Java Technology and XML forum, and at least 3 bugs were filed about this in the last few weeks. I&apos;ll use this blog entry to explain what the problem is and how to easily fix your code.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>
<dc:subject>Community: Java Web Services and XML</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>A few people have found problems validating DOM instances with JAXP1.4/JDK 6.0. I saw this quesion raised in the <a href="http://forum.java.sun.com/forum.jspa?forumID=34">Java Technology and XML forum</a>, and at least 3 bugs were filed for this in the last few weeks. I'll use this blog entry to explain what the problem is and how to easily fix your code.</p>

<p>Let's start by showing a snippet of the problematic code, which basically parses an XML file into a DOM and tries to validate it against an XML schema.</p>
<pre>
<code>
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     DocumentBuilder parser = dbf.newDocumentBuilder();
     Document document = parser.parse(getClass().getResourceAsStream("test.xml"));
            
     // create a SchemaFactory capable of understanding XML schemas
     SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            
     // load an XML schema
     Source schemaFile = new StreamSource(getClass().getResourceAsStream("test.xsd"));
     Schema schema = factory.newSchema(schemaFile);
            
     // create a Validator instance and validate document
     Validator validator = schema.newValidator();
     validator.validate(new DOMSource(document));
</code>
</pre>
<p>Can you spot any problems in this code? Well, there's nothing obviously wrong with it, except that if you try this with JAXP 1.4 RI or JDK 6.0, you're going to get an error like,</p>
<pre>
<code>
     org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration 
           of element 'foo'. at ...
</code>
</pre>
<p>So what is the problem then? Namespace processing. By default, and for historical reasons, namespace awareness isn't enabled in a DocumentBuilderFactory, which means the document that is passed to the validator object isn't properly constructed. You can fix this problem by adding just one line,</p>
<pre>
<code>
     DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     dbf.setNamespaceAware(true);      // Must enable namespace processing!!
     DocumentBuilder parser = dbf.newDocumentBuilder();
     ...
</code>
</pre>

<p>By now you may be asking yourself why is this even reported as a problem. Naturally, XML Schema validation requires namespace processing. It turns out that in JDK 5.0 this magically worked in many cases. Notice the use of the term "magically". By that I mean, "we don't know how it worked before but we are certainly looking into it". </p>

<p>So for now I'm just reporting the problem and proposing a fix for it. But I still owe you a better explanation as to why this worked before --or maybe you know why and you can tell me? </p>]]>

</content>
</entry>
<entry>
<title>SJSXP 1.0.1 available from Java.net</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/spericas/archive/2007/02/sjsxp_101_avail.html" />
<modified>2008-06-24T19:17:03Z</modified>
<issued>2007-02-20T17:01:27Z</issued>
<id>tag:weblogs.java.net,2007:/blog/spericas/216.6637</id>
<created>2007-02-20T17:01:27Z</created>
<summary type="text/plain">The Sun Java Streaming XML Parser (SJSXP) 1.0.1 is now available for download from Java.net. This is our first release since FCS back in April 2006. In his new blog, Joe Wang has already talked about this new release as well as some of the fixes and features in it. SJSXP is the underlying parser used in Glassfish as part of the JAX-WS runtime. I&apos;ll elaborate on one of the performance improvements aim at processing small messages at a high transaction rate.</summary>
<author>
<name>spericas</name>

<email>Santiago.Pericasgeertsen@Sun.COM</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/spericas/">
<![CDATA[<p>The <a href="https://sjsxp.dev.java.net">Sun Java Streaming XML Parser (SJSXP) 1.0.1</a> is now available for download from Java.net. This is our first release since FCS back in April 2006. In his new blog, <a href="http://blogs.sun.com/joew/">Joe Wang</a> has already talked about this new release as well as some of the fixes and features in it. SJSXP is the underlying parser used in Glassfish as part of the JAX-WS runtime. I'll elaborate on one of the performance improvements aim at processing small messages at a high transaction rate.</p>

<p>We have nearly double the throughput on small documents by implementing a new buffering allocation strategy in SJSXP. When parsing small documents (say of less than 2K) the time spent setting up the parser before initiaing the parsing process tends to be dominant factor. Typically, when a parser is initialized, it sets up some buffers to be used during the parsing process. Even if these buffers are small, say a few KBs, when hundreds or thoudsans of documents are processed during one second, the amount of memory gargage generated by these buffers is very significant and can easily become the dominant factor. That is, no matter how much you improve the actual parsing process, it will not make any difference given that the VM's time will be mostly dedicated to memory allocation and collection. By implementing a simple buffer allocator that allocates and frees memory chunks, we have nearly duplicated the number of transactions per second in SJSXP. This is evident when analyzing the lastest performance numbers reported by the JAX-WS team. See <a href="http://weblogs.java.net/blog/kohsuke/archive/2007/02/jaxws_ri_21_ben.html">Kohsuke's blog</a> for more information.</p>

<p>Yes, I know, there isn't any rocket science in these findings, but it is amazing how often programmers overlook the cost of allocating a small buffer. So next time you do that, don't forget to think about the consequences of your decision, especially if your object will be part of the main loop in high transaction system.</p>

<p>This release of SJSXP can be <a href="https://sjsxp.dev.java.net/servlets/ProjectDocumentList?folderID=5119&expandFolder=5119&folderID=0">downloaded from Java.net</a>. The <a href="mailto:users@sjsxp.dev.java.net">SJSXP users mailing list</a> can be used to send comments or questions. Happy parsing!</p>]]>

</content>
</entry>

</feed>