Person case functionality

Two service applications are build in Flex/Java.

One client server application with a back end service which has functionality to create and process Person objects which are provided by the Flex client.

And a messaging service where the back end service feeds a Flex client with Person data.

The Paddle input

Xsd is a powerful way to express the structure and description of context related data.

For communication between client and server data definition is relevant.

The need for data conversion or the definition of validation rules for either client or server can be extracted from the Xsd definitions.

Download

A turnkey package of the Person case with Tomcat + BlazeDS + Spring + Castor can be downloaded here.

Flex and Java Sources + libraries and Person Xsd can be found here.

Person case
Person case

The person case implements two back-end services. A RPC service and a real time messaging service.

The RPC service consists of three different functions which can be used on client-side. One function to create a new Person object, another function which converts the Person object to a XML string and one function which writes a Person object to a Xml file.

The messaging service produces every 5 seconds a list of persons which is available for any client subscribed to the feed service.

At client side the two services are used via two diffent views. One view provides an editable Person form where the RPC service methods are used. Another view displays a grid with persons provided by the Person feed service. So the grid is refreshed every 5 seconds.

Paddle generates the data holder objects for Java back-end and Flex client-side. Paddle uses a Xsd file as input while Xsd is very effective to generate data holders from. A Xsd describes the data structure and relations between data elements.


In the Xsd a Person Document type is defined which exists of a PersonType containing a creation date, name, date of birth, address and an income.

Person Xsd

Castor is executed with the Xsd file. For all Complex types and Simple types java classes are generated. Since Paddle uses custom serialization all Simple type classes made Externalizable. Therefor the writeExternal and readExternal methods are added in the data holder objects.


     /**
     * Serializes object to client.
     *
     * @param out is the stream to serialize ioValue to
     */
    public void writeExternal(ObjectOutput out)
		throws IOException
    {
		out.writeUTF(ioValue.value());
	}

     /**
     * Fetches serialized object from client.
     *
     * @param in is the stream get serialized ioValue from
     */
	public void readExternal(ObjectInput in)
             throws IOException, ClassNotFoundException
	 {
		 ioValue = AddressType2CodeCustom.fromValue(in.readUTF());
	 }