Using Ivy with pom.xml

It's possible to use Apache Ivy with dependencies defined in pom.xml instead of its native ivy.xml but you will need to apply some workarounds and you're loosing access to some functionality that you might (or might not) need.

The problem is that in a POM you can provide only a subset of settings available in ivy.xml and that Ivy understands only a subset of POM's syntax.
Continue reading →

EMF tips: Accessing model meta data, serializing into element/attribute

Two tips for the Eclipse Modeling Framework (EMF) 2.2.1:
  1. Accessing model's meta model - accessing EClass/attribute by name - so that you can set an attribute when you only know its name and haven't its EAttribute
  2. How to force EMF to serialize an object as an XML element instead of an XML attribute

Continue reading →

EMF: Reading a model from XML - how to correctly declare its namespace - variants

When you use the Eclipse Modeling Framework (EMF) to read a model instance from an XML file, such as a webservice call message payload, it's essential for EMF to be able to match the root XML element with the model's "ePackage" that should be used for (re)constructing the model instance from the XML and this is done by matching the root element's and the ePackage's namespaces (as in XSD). So it's very important to have proper configuration of EMF and proper content of the XML. Since there ale multiple variations of both, there are more ways to get it wrong than right. To learn what I've discovered regarding the valid combinations suitable at different situations, read on.
Continue reading →

Creating dynamic EMF model from XSDs and loading its instances from XML as SDOs

This post describes how to read a dynamic EMF model from a set of XML schema files (XSDs) and how to use that model to transform XMLs to SDO DataObjects or EMF EObjects, all this in a stand-alone environment.
Continue reading →

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here's a high level summary of its overall blog health:

Continue reading →

Most interesting links of December

In the last month of 2010 I've stumbled upon surprisingly few intersting articles, partly due to having a lot to do in my job.
Continue reading →

Tip: Multiple webservice implementation classes available at the same time under WAS7

If you want to experiment with webservices by providing several alternative implementations of the same webservice (represented by the <wsdl:service> element), each having its own URL, and you're using Websphere 7 and JAX-WS, then:
  1. For each alternative implementation, add <wsdl:port> with a unique name under the <wsdl:service> element in the WSDL file. Beware: This is essential to enable multiple implementations.
  2. For each alternative implementation, define a servlet and servlet mapping in web.xml like this:
    <servlet id="$IMPLEMENTATION_CLASS_NAME$">
    		<servlet-name>$IMPLEMENTATION_CLASS_NAME$</servlet-name>
    		<servlet-class>$IMPLEMENTATION_CLASS_NAME$</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>$IMPLEMENTATION_CLASS_NAME$</servlet-name>
    		<url-pattern>/$DESIRED_UNIQUE_URL$</url-pattern>
    	</servlet-mapping>
  3. Create the implementations - likely as POJOs denoted with the @WebService annotation - and set the corresponding portName for each of them (@WebService(portName="<unique port name>", ...))
  4. Deploy and use

Continue reading →

Howto: JAX-WS service with XML Source input instead of JAXB-produced POJOs (similar to JAX-RPC with SOAPElement input)

Sometimes you may want to create a JAX-WS webservice with its input defined by a proper, structured XSD yet accessing the input as raw XML object and not as POJOs produced by JAXB, similarly as with a JAX-RPC webservice having input of the type SOAPElement. This is possible using @WebServiceProvider with javax.xml.ws.Service.Mode.PAYLOAD.


Continue reading →

Creating JAX-WS webservice using Service Data Objects (SDO) instead of JAXB-bound POJOs

If you need to invoke a logic using Service Data Objects (SDOs) from a JAX-WS webservice under Websphere 7 without the SCA Feature Pack, it is possible to do it similarly to the old approach of generating a JAX-RPC webservice from a WSDL with an SDO facade (actually building on it).

The steps are:
  1. Use RAD to generate a JAX-RPC webservice from a WSDL with an SDO facade.
  2. Implement a JAX-WS webservice accessing directly its input as XML data (i.e. implement is as a WebServiceProvider for message payload)
    • Use Transformer and StreamSource/Result to convert from/to String containing XML
  3. Copy the SDO-related classes from the JAX-RPC webservice to the JAX-WS one, exclude just the JAX-RPC webservice interface and implementation
  4. Adjust the generated EMFSOAPElementUtil - change (de)serialize methods to expect/produce a String instead of SOAPElement
  5. Put it all together in the WS implementation class created in #2
  6. Finishing touches - add conversion of org.eclipse.emf.ecore.xml.type.internal.XMLCalendar to javax.xml.datatype.XMLGregorianCalendar

Continue reading →

Ivy resolve downloads but ignores some artifacts (though not modules)

I've had a strange issue with Apache Ivy's resolve task - it resolved and downloaded all my dependencies but didn't put some of them to the classpath (via ivy:cachepath) and certainly wouldn't copy them either (via ivy:retrieve). An indicia was that in the resolve report the number of "artifacts" was zero while the number of "modules" matched the number of the dependencies. The issue was caused by my defaultconfmapping="*->compile" - it turned out that most modules, as interpreted by Ivy, produce their artifacts only for the configuration "master" and not for compile.


Continue reading →

Joshua Bloch: Performance Anxiety - on Performance Unpredictability, Its Measurement and Benchmarking

Joshua Bloch had a great talk called Performance Anxiety (30min, via Parleys; slides also available ) at Devoxx 2010, the main message as I read it was
  1. Nowadays, performance is completely non-predictable. You have to measure it and employ proper statistics to get some meaningful results.
  2. Microbenchmarking is very, very hard to do correctly. No, you misunderstand me, I mean even harder than that! :-)
  3. From the resources: Profiles and result evaluation methods may be very misleading unless used correctly.

Continue reading →

Most interesting links of November

This month has been quite interesting, among others I 've picked up several blogs by Adam Bien. I really like his brief, practical and insightful posts :-)

Continue reading →

Book review: Refactoring by Martin Fowler

I had high expectations for Martin Fowler's Refactoring
Continue reading →

svn fun: <path> has no ancestry information

Subversion is at times really annoying and difficult to use due to its cryptic and confusing error messages and unnecessary failures. An example is when you have an svn-managed folder ('svnProject') where svn -u status and svn info and even commiting individual files work correctly but commit of the complete folder (which is necessary e.g. if you've changes some SVN proprties such as svn:ignore) fails:


.../rootFolder/svnProject$ svn commit .
svn: '/path/to/my/rootFolder' has no ancestry information


There is an easy fix.
Continue reading →

More Eclipse & svn fun: Can't share a project (only Team - Apply Patch)

With Subversive it may happen that it completely ignores some projects while it perfectly works for other ones. If a project seems to have no SVN information in Eclipse (thoug it actually contains all the .svn/ folders) and the Team context manu only contains Apply Patch... (i.e. especially not Share project...) then you have likely mixed up Eclipse metadata about the project (for instance by sharing it previously with Subclipse).

Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob