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.CoreConfigHelper; |
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 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public class RiceSpringResourceLoaderConfigurer implements BeanFactoryAware, InitializingBean { |
39 | |
|
40 | |
private QName name; |
41 | |
private String localServiceName; |
42 | |
private String serviceNameSpaceURI; |
43 | |
private Set<String> beanNames; |
44 | |
|
45 | |
private BeanFactory beanFactory; |
46 | |
|
47 | |
public void setBeanFactory(BeanFactory beanFactory) throws BeansException { |
48 | 0 | this.beanFactory = beanFactory; |
49 | 0 | } |
50 | |
|
51 | |
public void afterPropertiesSet() throws Exception { |
52 | 0 | if (this.name == null) { |
53 | 0 | if (this.getServiceNameSpaceURI() == null) { |
54 | 0 | this.setServiceNameSpaceURI(CoreConfigHelper.getApplicationId()); |
55 | |
} |
56 | 0 | if (this.getLocalServiceName() == null) { |
57 | 0 | throw new ConfigurationException("Need to give " + this.getClass().getName() + " a LocalServiceName"); |
58 | |
} |
59 | |
} |
60 | |
|
61 | 0 | ResourceLoader beanFactoryRL = new BeanFactoryResourceLoader(getName(), this.beanFactory, this.beanNames); |
62 | 0 | GlobalResourceLoader.addResourceLoaderFirst(beanFactoryRL); |
63 | 0 | } |
64 | |
|
65 | |
public QName getName() { |
66 | 0 | if (this.name == null) { |
67 | 0 | this.setName(new QName(this.getServiceNameSpaceURI(), this.getLocalServiceName())); |
68 | |
} |
69 | 0 | return name; |
70 | |
} |
71 | |
|
72 | |
public void setName(QName name) { |
73 | 0 | this.name = name; |
74 | 0 | } |
75 | |
|
76 | |
public String getLocalServiceName() { |
77 | 0 | return localServiceName; |
78 | |
} |
79 | |
|
80 | |
public void setLocalServiceName(String localServiceName) { |
81 | 0 | this.localServiceName = localServiceName; |
82 | 0 | } |
83 | |
|
84 | |
public String getServiceNameSpaceURI() { |
85 | 0 | return serviceNameSpaceURI; |
86 | |
} |
87 | |
|
88 | |
public void setServiceNameSpaceURI(String serviceNameSpaceURI) { |
89 | 0 | this.serviceNameSpaceURI = serviceNameSpaceURI; |
90 | 0 | } |
91 | |
|
92 | |
public void setBeanNames(Set<String> beanNames) { |
93 | 0 | this.beanNames = beanNames; |
94 | 0 | } |
95 | |
|
96 | |
} |