com.atlassian.crowd.util.persistence.hibernate
Class MappingResources

java.lang.Object
  extended by com.atlassian.crowd.util.persistence.hibernate.MappingResources
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class MappingResources
extends java.lang.Object
implements org.springframework.beans.factory.InitializingBean

Stores a collection of hbm.xml mapping files. You can either set a list of mappings (hbm.xml file locations) OR a configLocation (a hibernate.cfg.xml). This class relies on a wrapped Hibernate Configuration object (TransparentConfiguration) to do the parsing work. If you set both, the configLocation overrides mappings. This code has been migrated from bucket.


Constructor Summary
MappingResources()
           
 
Method Summary
 void addMapping(java.lang.String mapping)
           
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 org.springframework.core.io.Resource getConfigLocation()
           
 java.util.List getMappings()
           
 java.lang.String[] getMappingsAsArray()
           
 java.util.List getTableNames()
          Retrieves the table names using a transparent configuration object built from the hbm.xml mappings.
 void setConfigLocation(org.springframework.core.io.Resource configLocation)
           
 void setMappings(java.util.List mappings)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingResources

public MappingResources()
Method Detail

setMappings

public void setMappings(java.util.List mappings)

addMapping

public void addMapping(java.lang.String mapping)

getMappings

public java.util.List getMappings()

getConfigLocation

public org.springframework.core.io.Resource getConfigLocation()

setConfigLocation

public void setConfigLocation(org.springframework.core.io.Resource configLocation)

getMappingsAsArray

public java.lang.String[] getMappingsAsArray()

getTableNames

public java.util.List getTableNames()
Retrieves the table names using a transparent configuration object built from the hbm.xml mappings.

Returns:
List table names.

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.