Create a new data binding


Data bindings are the internal representation of WPS in- and outputs. They are returned by parsers and are wrapping the actual data objects that can be used in the processes for computation. The results of the computation again are wrapped in data bindings that are passed to a specific generator to produce the WPS outputs in the desired format.

Several data bindings for Literal- BoundingBox- and ComplexData are already shipped with the WPS. For each input type new bindings could be developed, though most likely new bindings for ComplexData will be needed.

Data bindings need to implement the IData interface. Implementing one of the sub-interfaces ILiteral, IBBOX, or IComplexData is recommended.

In the following an example of a binding for ComplexData wrapping a GML time instant will be shown:

As we will use the GeoTools library to parse the input, we will call the class GTGMLTimeInstantDataBinding.

public class GTGMLTimeInstantDatabinding implements IComplexData {

public Object getPayload() {

return null;

}

public Class getSupportedClass() {

return null;

}

public void dispose() { }

} 

Three methods have to be implemented:
  • getPayload, to access the wrapped data object,
  • getSupportedClass, to get information about the class of the wrapped data object,
  • dispose, will be called if the binding is not needed any more and is released.
We will modify the parameters of the getPayload and getSupportedClass methods to match the desired data type, in this case we will use the DefaultInstant class of GeoTools.

public DefaultInstant getPayload() {

return null;

}

public Class<DefaultInstant> getSupportedClass() {

return DefaultInstant.class;

} 

Next we will add a variable that will hold the wrapped data and a constructor that gets a DefaultInstant as parameter.

private DefaultInstant payload;

public GTGMLTimeInstantDatabinding(DefaultInstant payload){

this.payload = payload;

}

public DefaultInstant getPayload() {

return payload;

} 

And that's about it. We have created a new data binding for GML time instants. You can download the complete class here: GTGMLTimeInstantDataBinding.java
Topic revision: r1 - 01 May 2014, BenjaminPross
Legal Notice | Privacy Statement


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback