com.orchestranetworks.schema
Interface ValueFunction


public interface ValueFunction

Computes an adaptation value when this value is not persisted by EBX.Platform.

Use examples

Schema definition

The specific function must be declared under the element xs:annotation/xs:appinfo (see Computed Values):

 <osd:function class="com.foo.MyFunction"/>
 
where com.foo.MyFunction is the fully qualified name of the class implementing this interface. It is also possible to set additional JavaBean properties:
 <osd:function class="com.foo.MyFunction">
 	  <param1>...</param1>
 	  <param2>...</param2>
 </osd:function>
where param1 and param2 are JavaBean properties of the class specified.

For more information, read JavaBeans specification.

Life cycle

  1. When the schema is loaded:
    1. the class specified is instantiated through its default constructor and the JavaBean properties' setters are called (in the example above, setParam1(...) and setParam2(...));
    2. the method setup(ValueFunctionContext) is called on the new instance.
  2. In operational phase: the method getValue(Adaptation) is called each time this is needed (for example when the adaptation is displayed or exported).

Performance warning

See getValue(Adaptation).


Method Summary
 Object getValue(Adaptation anAdaptation)
          Returns the value in the context of the adaptation specified.
 void setup(ValueFunctionContext aContext)
          This method is called when the schema is loaded, for checking the consistency of this function regarding the schema that defines it.
 

Method Detail

getValue

public Object getValue(Adaptation anAdaptation)
Returns the value in the context of the adaptation specified.

The value returned must be in conformity with the associated schema declaration (type, cardinality, facets).

Performance warning

If the function is attached to a table with N occurrences, some operations will call this method N times. This is the case for:

Hence for a table with large volumes of occurrences, it may be necessary to optimize the implementation (for example, by ensuring some caching in this instance).

Multi-threading

For a single instance of this interface, this method may be called concurrently by several threads.


setup

public void setup(ValueFunctionContext aContext)
This method is called when the schema is loaded, for checking the consistency of this function regarding the schema that defines it.



(report a bug)
EBX.Platform 4.5.0 [0598]
Copyright Orchestra Networks 2000-2008. All rights reserved.