Saturday, October 1, 2011

Changing Buttons alignment in JOptionPane

Ever wondered how to change the alignment of options in Swing JOptionPage dialog?

It's just one line of code:
UIManager.getDefaults().put("OptionPane.buttonOrientation", SwingConstants.RIGHT);

The list of all component properties is available here:

Wednesday, November 17, 2010

Setting Correlation Id in the JMS Service Client with IBM WebSphere 7.0 WSFP

For those who are interested in how to set Correlation Id in SOAP over JMS Service client for IBM WebSphere Web Service Feature Pack it might be set using RequestContext of the Proxy (See below).

According to IBM documentation, transport headers should be set using Constants.REQUEST_TRANSPORT_PROPERTIES as a key name for RequestContext and the value should be a HashMap with name/value pairs for each Transport header, however, if you will try to set JMSCorrelationID property with that HashMap, you will get JMSCC0050 error, as this JMS header property should only be set using the setter method on the Message object (setJMSCorrelationId).

However, the Correlation Id may be set to the RequestContext using JMSConstants.ASYNC_CORRELATION_ID as the key and the the value of the correlation id as the value. Then, the WSFP implementation will set the value on the JMS Message using a setter, as it suppose to be done.

String correlationId = java.util.UUID.randomUUID();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(JMSConstants.ASYNC_CORRELATION_ID, correlationId);

Thursday, May 28, 2009

Service versioning based on namespace considerations

The approach should be based on the granularity and design of your service and it capabilities.

You never consume a service - you consume it particular capability, so you versioning approach should be defined keeping that in mind.

If you designed coarse-grained, document-centric entity service (which means that all capabilities (operations) has the same input - the entity document, and almost the same output), you should definitely define you namespace per document, which in most cases would be one schema per service (e.g.

However, if you designed fine-grained, parameter-centric capabilities, then you should decouple capabilities one from another by defining separate namespaces for each capability to leverage better versioning and easier governance (e.g.

You should also consider externalizing common shared schema components (data domains or any other components) to the secondary schema, which should be maintained and versioned by its own.

Sunday, January 18, 2009

“Get” is not a Service

The major factor in SOA success is governance. And good governance could not be done without a systematic approach to a service definition and inventory organization.

From "A methodology for Service Architectures" [OASIS]:
A common mistake when defining services is to have “services” called “GetCustomer” “UpdateCustomer” etc, these are not services, they are just invocation points “The why” elements on the services. The service is “Customer”, which has an interaction point of “Get”. Services are collections of processes, not individual processes themselves, hence the reason that “Get” is not a service.

Tuesday, February 19, 2008

MyFaces Trinidad: Working with large tables - sorting, paging, data on demand.

During all my development practice with JSF time to time issue with large data tables arises - how to fetch the data on demand and to not load the whole RecordSet to memory?

When I started to use ADF Faces with ADF BC problem dissapered, however there are still projects where we use just ADF Faces part (now MyFaces Trinidad) and there are no out-of-the-box solution to fetch the data on demand.

Recently I found one example, which is describing the solution to use with classic JSF DatModel, on MyFaces wiki site -

I have adopted this example to be more universal and to work with ADF Faces table sorting and paging.

Example consists of three classes -
, and data fetch listener interface which should be implemented in the model binding/service layer.

Whenever new page is needed, listener will be called.

There is also one additional interface
which is used to better leverage ADF Table rowKey conception. This interface could be implemented by the Entity class (single table row) in order to provide rowKey to the ADF Table.

You can download complete example JDeveloper workspace from here:

Update: Broken link has been fixed.

To use the example you will need to setup MyFaces Trinidad 1.0.X libraries.

Thursday, February 14, 2008

ADF: Using ISO 8601 date (XSD) with Web Service DataControl

JavaBean mapping, generated by JDeveloper from the Web Service return type contains java.util.Date type for the XSD date based attributes, however java.util.Date can not handle ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss) date.

What you need to do is to create a simple Java class extending java.util.Date which can handle ISO 8601 date format and specify it instead of standard java.util.Date in the JavaBean mapping file (to find the file you can use mapping file namespace:

Here is the sample of simple Java ISODate class:

public class ISODate extends java.util.Date {
public ISODate(String value) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date d;

try {
d = sdf.parse(value);
} catch (ParseException e) {
throw new RuntimeException(e);


ADF: Enabling sorting on Web Service based DataControl

Sorting is disabled by default in the ADF Table when using Web Service DataControl based Iterator, however you can enable it by changing AdapterDataControl element's SupportsSortCollection property to true in the DataControls.dcx file.

Same could be achieved using JDeveloper UI. See screenshot below.