org.formaria.data.pojo
Class PersistentPojoDataSource

java.lang.Object
  extended by org.formaria.data.DataSource
      extended by org.formaria.data.pojo.PojoDataSource
          extended by org.formaria.data.pojo.PersistentPojoDataSource
Direct Known Subclasses:
HibernatePojoDataSource

public class PersistentPojoDataSource
extends PojoDataSource

A data source for working with Persistent POJOs. When the application is loaded the datasources are instantiated and in the case of a PojoDataSource the PojoRoot instance specified by the root element is instantiated and configured. The configuration project involves traversing the class hierarchy and setting up PojoModel nodes or proxies for each class in the pojo hierarchy. The configuration can specify naming overrides if the names established by reflection are not suitable

Copyright (c) Formaria Ltd., 2008
License: see license.txt


Field Summary
 
Fields inherited from class org.formaria.data.pojo.PojoDataSource
adapters, overrides, pojoContext, pojoRootModel
 
Fields inherited from class org.formaria.data.DataSource
currentProject
 
Constructor Summary
PersistentPojoDataSource(Project project)
          Creates a new instance of PersistentPojoDataSource
 
Method Summary
protected  PojoAdapter createAdapter(java.lang.Class pojoClass)
          Creates and returns a new instance of PersistentPojoAdapter
protected  PojoModel createPojoModel(DataModel parent, java.lang.Object pojo)
          Creates and returns a new instance of PojoModel
protected  PojoModel createPojoModel(DataModel parent, java.lang.String subPath)
          Creates and returns a new instance of PersitentPojoModel
protected  void customizeProperty(PojoAdapter adapter, XmlElement propertyElement)
           
protected  PojoContext instantiatePojoContext(java.lang.String className, java.lang.ClassLoader classLoader)
          Creates and returns new PersistenceController object
protected  void overrideAdapter(PojoAdapter adapter)
          Override the adapter specification loaded via reflection and add the customization specified by the configuration
 
Methods inherited from class org.formaria.data.pojo.PojoDataSource
createProxyAdapter, getAdapter, getOverrideXml, getPojoContext, loadTable
 
Methods inherited from class org.formaria.data.DataSource
outputModel, outputModel, outputModel, read, read, readDataSource, setUseValueAsId, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentPojoDataSource

public PersistentPojoDataSource(Project project)
Creates a new instance of PersistentPojoDataSource

Parameters:
project - the owner project
Method Detail

instantiatePojoContext

protected PojoContext instantiatePojoContext(java.lang.String className,
                                             java.lang.ClassLoader classLoader)
                                      throws java.lang.Exception
Creates and returns new PersistenceController object

Overrides:
instantiatePojoContext in class PojoDataSource
Parameters:
the - name of the class, the instance of which should be returned
classLoader - ClassLoader object to load the specified class defintion
Returns:
PersistentceController object
Throws:
java.lang.Exception

createAdapter

protected PojoAdapter createAdapter(java.lang.Class pojoClass)
Creates and returns a new instance of PersistentPojoAdapter

Overrides:
createAdapter in class PojoDataSource
Parameters:
pojoClass - the class to be adapted by the returned adapter
Returns:
PersitentPojoAdapter object

createPojoModel

protected PojoModel createPojoModel(DataModel parent,
                                    java.lang.String subPath)
Creates and returns a new instance of PersitentPojoModel

Overrides:
createPojoModel in class PojoDataSource
Parameters:
parent - the parent model of the model node which is to be created
subpath - String consisting of pojo properties, must be in the format: propertyName(arguments...)[idx]
Returns:
PojoModel object

createPojoModel

protected PojoModel createPojoModel(DataModel parent,
                                    java.lang.Object pojo)
Creates and returns a new instance of PojoModel

Overrides:
createPojoModel in class PojoDataSource
Parameters:
parent - the parent model node
Returns:
PojoModel object

overrideAdapter

protected void overrideAdapter(PojoAdapter adapter)
Override the adapter specification loaded via reflection and add the customization specified by the configuration

Overrides:
overrideAdapter in class PojoDataSource
Parameters:
adapter - the adapter being customized

customizeProperty

protected void customizeProperty(PojoAdapter adapter,
                                 XmlElement propertyElement)
Overrides:
customizeProperty in class PojoDataSource