net.xoetrope.optional.data.pojo
Class XPojoHibernateDataSource

java.lang.Object
  extended by net.xoetrope.data.XDataSource
      extended by net.xoetrope.optional.data.pojo.XPojoDataSource
          extended by net.xoetrope.optional.data.pojo.XPojoHibernateDataSource

public class XPojoHibernateDataSource
extends XPojoDataSource

A data source for working with Hibernate POJOs. When the application is loaded the datasources are instantiated and in the case of a XPojoDataSource the XPojoRoot instance specified by the root element is instantiated and configured. The configuration project involves traversing the class hierarchy and setting up XPojoModel 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) Xoetrope Ltd., 2001-2006
License: see license.txt


Field Summary
 
Fields inherited from class net.xoetrope.optional.data.pojo.XPojoDataSource
adapters, overrides, pojoContext, pojoRootModel
 
Fields inherited from class net.xoetrope.data.XDataSource
currentProject
 
Constructor Summary
XPojoHibernateDataSource(XProject project)
          Creates a new instance of XPojoHibernateDataSource
 
Method Summary
protected  XPojoAdapter createAdapter(java.lang.Class pojoClass)
          Creates and returns a new instance of XPojoHibernateAdapter
protected  XPojoModel createPojoModel(XModel parent, java.lang.Object pojo)
          Creates and returns the new instance of XPojoModel
protected  XPojoModel createPojoModel(XModel parent, java.lang.String subPath)
          Creates and returns a new instance of XPojoModel
protected  void customizeProperty(XPojoAdapter adapter, XmlElement propertyElement)
           
protected  XPojoContext instantiatePojoContext(java.lang.String className, java.lang.ClassLoader classLoader)
          Creates and returns new XPojoHibernateContext object
protected  void overrideAdapter(XPojoAdapter adapter)
          Override the adapter specification loaded via reflection and add the customization specified by the configuration
 
Methods inherited from class net.xoetrope.optional.data.pojo.XPojoDataSource
getAdapter, getPojoContext, loadTable
 
Methods inherited from class net.xoetrope.data.XDataSource
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

XPojoHibernateDataSource

public XPojoHibernateDataSource(XProject project)
Creates a new instance of XPojoHibernateDataSource

Parameters:
project - the owner project
Method Detail

instantiatePojoContext

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

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

createAdapter

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

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

createPojoModel

protected XPojoModel createPojoModel(XModel parent,
                                     java.lang.String subPath)
Creates and returns a new instance of XPojoModel

Overrides:
createPojoModel in class XPojoDataSource
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:
XPojoModel object

createPojoModel

protected XPojoModel createPojoModel(XModel parent,
                                     java.lang.Object pojo)
Creates and returns the new instance of XPojoModel

Overrides:
createPojoModel in class XPojoDataSource
Parameters:
parent - the parent model node
Returns:
XPojoModel object

overrideAdapter

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

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

customizeProperty

protected void customizeProperty(XPojoAdapter adapter,
                                 XmlElement propertyElement)
Overrides:
customizeProperty in class XPojoDataSource