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 java.util.Set; |
19 | |
|
20 | |
import javax.xml.namespace.QName; |
21 | |
|
22 | |
import org.kuali.rice.core.api.config.ConfigurationException; |
23 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
24 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
25 | |
import org.kuali.rice.core.api.resourceloader.ResourceLoader; |
26 | |
import org.springframework.beans.BeansException; |
27 | |
import org.springframework.beans.factory.BeanFactory; |
28 | |
import org.springframework.beans.factory.BeanFactoryAware; |
29 | |
import org.springframework.beans.factory.InitializingBean; |
30 | |
import org.kuali.rice.ksb.messaging.config.ServiceHolder; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | 0 | public class RiceSpringResourceLoaderConfigurer implements BeanFactoryAware, InitializingBean { |
40 | |
|
41 | |
private QName name; |
42 | |
private String localServiceName; |
43 | |
private String serviceNameSpaceURI; |
44 | |
private Set<String> beanNames; |
45 | |
|
46 | |
private BeanFactory beanFactory; |
47 | |
|
48 | |
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { |
49 | 0 | this.beanFactory = beanFactory; |
50 | 0 | } |
51 | |
|
52 | |
public void afterPropertiesSet() throws Exception { |
53 | 0 | if (this.name == null) { |
54 | 0 | if (this.getServiceNameSpaceURI() == null) { |
55 | 0 | this.setServiceNameSpaceURI((new ServiceHolder()).getServiceNameSpaceURI()); |
56 | |
} |
57 | 0 | if (this.getLocalServiceName() == null) { |
58 | 0 | throw new ConfigurationException("Need to give " + this.getClass().getName() + " a LocalServiceName"); |
59 | |
} |
60 | |
} |
61 | |
|
62 | 0 | ResourceLoader beanFactoryRL = new BeanFactoryResourceLoader(getName(), this.beanFactory, this.beanNames); |
63 | 0 | GlobalResourceLoader.addResourceLoaderFirst(beanFactoryRL); |
64 | 0 | } |
65 | |
|
66 | |
public QName getName() { |
67 | 0 | if (this.name == null) { |
68 | 0 | this.setName(new QName(this.getServiceNameSpaceURI(), this.getLocalServiceName())); |
69 | |
} |
70 | 0 | return name; |
71 | |
} |
72 | |
|
73 | |
public void setName(QName name) { |
74 | 0 | this.name = name; |
75 | 0 | } |
76 | |
|
77 | |
public String getLocalServiceName() { |
78 | 0 | return localServiceName; |
79 | |
} |
80 | |
|
81 | |
public void setLocalServiceName(String localServiceName) { |
82 | 0 | this.localServiceName = localServiceName; |
83 | 0 | } |
84 | |
|
85 | |
public String getServiceNameSpaceURI() { |
86 | 0 | return serviceNameSpaceURI; |
87 | |
} |
88 | |
|
89 | |
public void setServiceNameSpaceURI(String serviceNameSpaceURI) { |
90 | 0 | this.serviceNameSpaceURI = serviceNameSpaceURI; |
91 | 0 | } |
92 | |
|
93 | |
public void setBeanNames(Set<String> beanNames) { |
94 | 0 | this.beanNames = beanNames; |
95 | 0 | } |
96 | |
|
97 | |
} |