01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.rice.resourceloader.management;
17:
18: import javax.xml.namespace.QName;
19:
20: import org.kuali.rice.core.Core;
21: import org.kuali.rice.resourceloader.ResourceLoader;
22:
23: /**
24: * A simple MBean which wraps a ResourceLoader to provide management functions.
25: *
26: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
27: */
28: public class ResourceLoaderWrapper implements
29: ResourceLoaderWrapperMBean {
30:
31: private ResourceLoader resourceLoader;
32:
33: public ResourceLoaderWrapper(ResourceLoader resourceLoader) {
34: this .resourceLoader = resourceLoader;
35: }
36:
37: public String[] getChildren() {
38: return this .resourceLoader.getResourceLoaderNames().toArray(
39: new String[0]);
40: }
41:
42: public String examineContents() {
43: return this .resourceLoader.getContents("", true);
44: }
45:
46: public void dumpContents() {
47: System.out.println(examineContents());
48: }
49:
50: public String getName() {
51: return this .resourceLoader.getName().toString();
52: }
53:
54: public void setName(String name) {
55: this .resourceLoader.setName(new QName(name, Core
56: .getCurrentContextConfig().getMessageEntity()));
57: }
58:
59: public String getType() {
60: return this .resourceLoader.getClass().getName();
61: }
62:
63: public boolean isStarted() {
64: return this .resourceLoader.isStarted();
65: }
66:
67: public void start() throws Exception {
68: this .resourceLoader.start();
69: }
70:
71: public void stop() throws Exception {
72: this .resourceLoader.stop();
73: }
74:
75: public boolean hasService(String namespaceUri, String localPart) {
76: return this .resourceLoader.getService(new QName(namespaceUri,
77: localPart)) != null;
78: }
79:
80: }
|