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 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(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()
           
 List<String> getMappings()
           
 String[] getMappingsAsArray()
           
 List<String> 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(List<String> 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

addMapping

public void addMapping(String mapping)

afterPropertiesSet

public void afterPropertiesSet()
                        throws IllegalStateException,
                               IOException
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:
IllegalStateException - if no mappings have been configured, either directly or via configLocation
IOException - if the URL for the configLocation cannot be parsed

getConfigLocation

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

getMappings

public List<String> getMappings()

getMappingsAsArray

public String[] getMappingsAsArray()

getTableNames

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

Returns:
table names.

setConfigLocation

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

setMappings

public void setMappings(List<String> mappings)


Copyright © 2013 Atlassian. All Rights Reserved.