Custom Java Objects
   
 
 
|Creating Custom Java Objects
 
1
 
Creating Custom Java Objects
 
This is a very brief description of how to customize zeroCode. You can create your own custom objects that give better control over run-time behavior. The basic idea is to create your own classes that implement the DataPort-related interfaces. zeroCode enables this by allowing each UDM tree node to have its own designated DataPort.
 
Let us start with an e.g. to understand where the need for writing custom Java objects is felt:
 
A custom UDM named company can have a vector node called Stock prices. The stock prices may vary by date. If you want to list the stock prices based on date and weather conditions, you may not have the temperature value and the weather chart of a particular place in your database. In this case you can write your own set of Java objects with Dataports. These objects should be written in such a way that they should go and link up with the database of other resources which may have the required weather report. These objects can capture the data and can list the stock prices based on date and weather conditions.
 

                                                                           Company
                                                                                       |
                                                                                       | -----Stock price
                                                                                                          |--- Date
                                                                                                          |--- Price  
                                                                                                          |--- Weather

 
Another example where the usage of custom java objects takes place is displaying the latest(current) news headlines in the site. A news media site in India can give the instant news from anywhere in the world by capturing the news from other resourceful sites of the respective place throughout the world. Writing Java Objects to perform the above function is more powerful.
 
There are several of Dataport interfaces:
List of interfaces supported
If a node is allowed to retrieve data (i.e., it isn't insert-only), then its data port must be a Java class that implements  the SingleValueDataSource interface if it is a non-vector node, and the MultiValueDataSource interface if it is a vector node.
If a node is allowed to store data, its data port must implement the DataStore interface.
Note that the DbObjectStore class implements all of these interfaces, and so it can be used as data port for any UDM tree node.
To get the machinery to work correctly, every DataPort class must have a corresponding DataPortDescriptor class (one that implements the DataPortDescriptor interface). The latter class is used at design time, by the zDE, to determine the properties of the DataPort class.
 
     
1