com.atlassian.sal.spring.component
Class SpringHostContextAccessor

java.lang.Object
  extended by com.atlassian.sal.spring.component.SpringHostContextAccessor
All Implemented Interfaces:
HostContextAccessor, org.springframework.context.ApplicationContextAware

public class SpringHostContextAccessor
extends Object
implements HostContextAccessor, org.springframework.context.ApplicationContextAware

Implements the host context accessor for Spring environments


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.sal.spi.HostContextAccessor
HostContextAccessor.HostTransactionCallback<T>
 
Constructor Summary
SpringHostContextAccessor(org.springframework.transaction.PlatformTransactionManager transactionManager)
           
 
Method Summary
 Object doInTransaction(HostContextAccessor.HostTransactionCallback callback)
          Runs an action in a transaction and returns a optional value.
<T> Map<String,T>
getComponentsOfType(Class<T> iface)
          Gets all beans of a given type
protected  org.springframework.transaction.support.DefaultTransactionDefinition getTransactionDefinition()
           
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringHostContextAccessor

public SpringHostContextAccessor(org.springframework.transaction.PlatformTransactionManager transactionManager)
Method Detail

getComponentsOfType

public <T> Map<String,T> getComponentsOfType(Class<T> iface)
Description copied from interface: HostContextAccessor
Gets all beans of a given type

Specified by:
getComponentsOfType in interface HostContextAccessor
Parameters:
iface - The interface to use
Returns:
A map of String keys and object instances

doInTransaction

public Object doInTransaction(HostContextAccessor.HostTransactionCallback callback)
Description copied from interface: HostContextAccessor
Runs an action in a transaction and returns a optional value.

Specified by:
doInTransaction in interface HostContextAccessor
Parameters:
callback - The callback class to execute
Returns:
Optional result of the operation. May be null

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

getTransactionDefinition

protected org.springframework.transaction.support.DefaultTransactionDefinition getTransactionDefinition()


Copyright © 2010 Atlassian. All Rights Reserved.