| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.core.framework.resourceloader; |
| 17 | |
|
| 18 | |
import javax.xml.namespace.QName; |
| 19 | |
|
| 20 | |
import org.kuali.rice.core.api.config.ConfigurationException; |
| 21 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 22 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 23 | |
import org.kuali.rice.core.api.resourceloader.ResourceLoader; |
| 24 | |
import org.springframework.beans.BeansException; |
| 25 | |
import org.springframework.beans.factory.BeanFactory; |
| 26 | |
import org.springframework.beans.factory.BeanFactoryAware; |
| 27 | |
import org.springframework.beans.factory.InitializingBean; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | 0 | public class RiceSpringResourceLoaderConfigurer implements BeanFactoryAware, InitializingBean { |
| 37 | |
|
| 38 | |
private QName name; |
| 39 | |
private String localServiceName; |
| 40 | |
private String serviceNameSpaceURI; |
| 41 | |
|
| 42 | |
private BeanFactory beanFactory; |
| 43 | |
|
| 44 | |
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { |
| 45 | 0 | this.beanFactory = beanFactory; |
| 46 | 0 | } |
| 47 | |
|
| 48 | |
public void afterPropertiesSet() throws Exception { |
| 49 | 0 | if (this.name == null) { |
| 50 | 0 | if (this.getServiceNameSpaceURI() == null) { |
| 51 | 0 | this.setServiceNameSpaceURI(ConfigContext.getCurrentContextConfig().getServiceNamespace()); |
| 52 | |
} |
| 53 | 0 | if (this.getLocalServiceName() == null) { |
| 54 | 0 | throw new ConfigurationException("Need to give " + this.getClass().getName() + " a LocalServiceName"); |
| 55 | |
} |
| 56 | |
} |
| 57 | |
|
| 58 | 0 | ResourceLoader beanFactoryRL = new BeanFactoryResourceLoader(getName(), this.beanFactory); |
| 59 | 0 | GlobalResourceLoader.addResourceLoaderFirst(beanFactoryRL); |
| 60 | 0 | } |
| 61 | |
|
| 62 | |
public QName getName() { |
| 63 | 0 | if (this.name == null) { |
| 64 | 0 | this.setName(new QName(this.getServiceNameSpaceURI(), this.getLocalServiceName())); |
| 65 | |
} |
| 66 | 0 | return name; |
| 67 | |
} |
| 68 | |
|
| 69 | |
public void setName(QName name) { |
| 70 | 0 | this.name = name; |
| 71 | 0 | } |
| 72 | |
|
| 73 | |
public String getLocalServiceName() { |
| 74 | 0 | return localServiceName; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setLocalServiceName(String localServiceName) { |
| 78 | 0 | this.localServiceName = localServiceName; |
| 79 | 0 | } |
| 80 | |
|
| 81 | |
public String getServiceNameSpaceURI() { |
| 82 | 0 | return serviceNameSpaceURI; |
| 83 | |
} |
| 84 | |
|
| 85 | |
public void setServiceNameSpaceURI(String serviceNameSpaceURI) { |
| 86 | 0 | this.serviceNameSpaceURI = serviceNameSpaceURI; |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
} |