1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.core.impl.resourceloader; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import javax.xml.namespace.QName; |
22 | |
|
23 | |
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
24 | |
import org.kuali.rice.core.api.lifecycle.BaseLifecycle; |
25 | |
import org.kuali.rice.core.api.resourceloader.ServiceLocator; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public class SimpleServiceLocator extends BaseLifecycle implements ServiceLocator { |
35 | |
|
36 | 0 | private Map<QName, Object> services = new HashMap<QName, Object>(); |
37 | |
|
38 | |
public String getContents(String indent, boolean servicePerLine) { |
39 | 0 | String contents = indent + "SpringLoader " + this + " services ="; |
40 | |
|
41 | 0 | for (Map.Entry<QName, Object> serviceEntry : this.services.entrySet()) { |
42 | 0 | if (servicePerLine) { |
43 | 0 | contents += indent + "+++" + serviceEntry.getKey() + "=" + serviceEntry.getValue() + "\n"; |
44 | |
} else { |
45 | 0 | contents += serviceEntry.getKey() + "=" + serviceEntry.getValue() + ", "; |
46 | |
} |
47 | |
} |
48 | |
|
49 | 0 | return contents; |
50 | |
} |
51 | |
|
52 | |
public Object getService(QName qname) { |
53 | 0 | return this.services.get(qname); |
54 | |
} |
55 | |
|
56 | |
public void addService(QName name, Object service) { |
57 | 0 | this.services.put(name, service); |
58 | 0 | } |
59 | |
|
60 | |
public void removeService(QName name) { |
61 | 0 | this.services.remove(name); |
62 | 0 | } |
63 | |
} |