The Source for Java Technology Collaboration
User: Password:



Felipe Gaucho's Blog

Web Services and XML Archives


Fishing the glass during Jazoon'08

Posted by felipegaucho on May 26, 2008 at 02:57 AM | Permalink | Comments (1)

Let's check the conference guide to see where to find a good fish in Zürich, more precisely, where are the best Jazoon'08 presentations for Glassfish users and web-service developers.

From my last conferences experience, I learned to create a conference schedule divided in topics instead of just going there and selecting the topic of the day. I first collect the list of conference's topics and then I prioritize them by day. For every day, I know the two or three presentation I must go, the ones I want to go, and the ones I would like to go. I also include some community slots in my schedule and, of course, some free slots - to give me a chance to checkout something I've never heard about. It is not a scientific method, but at least it gives me a chance to monitor my conference day-by-day, avoiding myself of missing that fantastic session because I was watching an impressive demo in a commercial booth :)

Jazoon'08 Fish Menu: Glassfish and Web-Services

Nowadays I am focused in web-services, specially SOAP web services and Glassfish/Metro technologies, so let's check the Jazoon'08 fish menu:

  • Monday, 2008-06-23, 09:00 - 15:00, Arena 7

    GlassFish Community Day: six hours fully dedicated to the latest novelties on Glassfish technologies. Commanded by Jerome Dochez - the Glassfish architect - it is one of the unmissable sessions for any glassfisherman.

  • Tuesday, 2008-06-24, 15:00 - 15:50, Arena 5

    SAML: Identity Federation in Practice: you know, strange fishes deserve precautions about how they are prepared. Security is the base of comfort when you try something exotic and it is even better if you know the cooker and from where the fished are coming from. Security and person identification is a key concern in interoperability between web-services, and I am definitely interested about that session.

  • Wednesday, 2008-06-25, 11:00 - 11:50, Arena 6

    JAX-RS: The Java API for RESTful Web Services: a small and fast fish served flambé, a kind of spiced web-services. If well prepared, it can offer you a surprisingly experience, and be aware you can eventually becomes addictive to it. Why not?

  • Wednesday, 2008-06-25, 11:00 - 11:50, Arena 6

    JAX-RS: The Java API for RESTful Web Services: a small and fast fish served flambéed, a kind of spiced web-services. If well prepared, it can offer you a surprisingly experience, and be aware you can eventually becomes addictive to it. Why not?

  • Wednesday, 2008-06-25, 14:00 - 14:50, Arena 9

    Integration Profile for GlassFish v3: in case you swallow a spine of fish, it is better to do a checkup. This session bring us a way to find out where are the dangerous spines of our JEE applications.

  • Wednesday, 2008-06-25, 16:30 - 17:20, Arena 6

    Web Services and Transactions: a good dinner ends with bittered bill, and while you taste your wakeup expresso you should pay the bill and finish the transaction. This simple scenario in a restaurant becomes weird if you have the cooker, the waiter and the clients in separate rooms :).

  • Thursday, 2008-06-26, 14:00 - 14:50, Arena 9

    Glassfish V2/V3 - the killer appserver for development and production: visit our kitchen - this session introduces a guide tour to the Glassfish server's features. An unmissable session for a new fisherman.

It is just my Glassfish guide for Jazoon'08, I hope we can meet there and share ideas on how to produce better web-services based on Glassfish.



Cejug-Classifieds goes Metro

Posted by felipegaucho on April 04, 2008 at 12:24 AM | Permalink | Comments (0)

Since it was created, the cejug-classifieds project served as a proof of concept for a lot of technologies. Now it comes back with a new set of SOA technologies.

I plan to post our detailed plans asap, but until I find time to create better documents, I published a collaboration diagram in the cejug-classifieds home page and I also published a WAR file you can run in Glassfish for testing - the deployment descriptor included in the WAR is only ready for Glassfish, and I am looking for a volunteer to adapt it to Tomcat or JBoss :). If you prefer to inspect the code snapshot, you can checkout the complete source code from SVN.

Take the subway and visit us at the Cejug-Classifieds, we are waiting for your best tips about our new plans.

cejug-classifieds



Loading Properties from XML (revisited)

Posted by felipegaucho on October 29, 2007 at 12:23 PM | Permalink | Comments (3)

My last blog about using JAXB instead of Properties for loading configuration of Java applications was a bit verbose - so, I decided to print a summary in order to facilitate the comprehension about the original proposal. I will not expose the discussion again, just present the below comparison sheet:

java.util.Properties JAXB
The configuration files:
text=word
primitive=2
anobj.name=test
anobj.integer=3
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<myConfig text="word" primitive="2" >
   <my.obj name="test" integer="3"/>
</myConfig>
The code required for loading the configuration in the memory:
// Read properties file.
Properties properties = new Properties();
properties.load(new FileInputStream("filename.properties"));
// Unmarshal the properties XML file into a Java Object
JAXBContext jc = JAXBContext.newInstance(
		AbstractJaxbFootprintStream.FOOTPRINT_CONTEXT, this.getClass()
				.getClassLoader());

Unmarshaller unmarshaller = jc.createUnmarshaller();
unmarshaller.setEventHandler(new FootprintConfigValidationHandler());
unmarshaller.setListener(listener);
SchemaFactory sf = SchemaFactory
		.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(getClass().getClassLoader().getResource(
		"config.xsd"));
unmarshaller.setSchema(schema);

MyConfig properties = (JAXBElement) unmarshaller
		.unmarshal(new FileInputStream("filename.xml")).getValue();
Reading the configuration values:
// A String:
String text = properties.getProperties("text");

// Other primitive values:
int number = Integer.parseInt(properties.getProperties("primitive"));

// An object:
String name = properties.getProperties("anobject.name");
int integer = properties.getProperties("anobject.integer");
Object yourObj = new YourObj(name, integer);
// A String: 
String text = properties.getText();

// Other primitive values:
int number = properties.getPrimitive();

// An object: 
Object yourObj = properties.getMyObject();
My arguments for adopting JAXB instead of java.util.Properties:
  • The red text are hard-codes occurrences. Even if you create constants, you continue with the issue to remembers its names, and if you commit a typo or other minor mistake, nor the IDE neither the compiler will help you to avoid problems under production.
  • Other issue is about creating complex types: you are responsible for converting the key/values pairs in Java Objects in case of complex types. You need to check if the attributes required for creating the object are present and also its types and/or if the value associated to the key is not null.
  • Property files cannot be checked against its syntax or contents, since it is just a plain text file.
  • Complex types should be simulated by a set of key/value pairs and later converted in a non-bullet-proof code.
  • If the application requires different set of properties, it should rely on several different files. These files are independent and you must create a custom code to manage it in your application.
  • No hard-codes, you don't need to check which string map to a certain object.
  • No types conversion by code - the methods you use to retrieve the values from the Configuration Object are defined with the correct type.
  • There is no risk of deploying typos or minor mistakes since the compiler and the IDE will notify your mstakes on the fly.
  • XML Property files can be verified against its Schema definition.
  • Support for complex types.
  • Different set of properties can be modeled in a unique file, using nested elements. Even if you need to use different XML properties files, you can import files in a master definition, creating a formal relationship between them.

* The title of this blog is an intentional reference to this 4 years old article.





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds