Benson Margulies schrieb:
With Java5, Aegis is still quite handy when you want to talk a pojo and pass it around via a web service without adding references to JAXB annotation classes. What I'm missing is why anyone minds adding annotations to the service interface or implementation. Those things are specifically parts of the web service, so why not annotate?
In general I think you are right. People tend to turn from aegis to JAXB.
I do not generally object to annotations but they sometimes mix responsibilities. Let´s take the example of a service described as a java interface. If you want to export the service using jaxb you have to add annotations that are only neccessary for this type of export. If you then also want to export the service via rmi you still have the webservice annotations in it. So the rmi client will depend on the annotation jars because he uses the interface though he does not really need or want these annotations.
A particular bad case of this happened to me when I wrote an interface between two applications that were talking through special database tables. The contract of the interface said that a particular enumeration instance had to include a space like "metric tons". A direct translation to the enumeration was not possible as java would not allow spaces in an enumeration instance. So I added a string representation directly in the annotation like this MetricTons("metric tons"). This coupled the representation inside the database to the java code. So when the instance was printed in the application it also said "metric tons" though I perhaps would wanted another representation there. Later I facored out the string representation for the database into a map outside the enumeration.
Drawing it together I think web service annotations make sense if the only purpose of the objects is doing web services. So if you export your inner business services through a special facade you won´t have many problems with annotations. But if you want to transparently export your inner business services without a separate java facade you will want some abstraction and mapping outside the java interfaces and classes.
Best regards Christian -- Christian Schneider --- http://www.liquid-reality.de
