01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.core;
18:
19: import javax.xml.namespace.QName;
20:
21: import org.kuali.rice.lifecycle.BaseLifecycle;
22: import org.kuali.rice.lifecycle.Lifecycle;
23: import org.kuali.rice.resourceloader.GlobalResourceLoader;
24:
25: /**
26: * A lifecycle that wraps a service. This fetches and calls a lifecycle available
27: * in the GRL and calls lifecycle methods on that.
28: *
29: * @author rkirkend
30: * @author ewestfal
31: */
32: public class ServiceDelegatingLifecycle extends BaseLifecycle {
33:
34: private QName serviceName;
35:
36: public ServiceDelegatingLifecycle(QName serviceName) {
37: this .serviceName = serviceName;
38: }
39:
40: public ServiceDelegatingLifecycle(String serviceName) {
41: this (new QName(serviceName));
42: }
43:
44: public void start() throws Exception {
45: ((Lifecycle) GlobalResourceLoader.getService(serviceName))
46: .start();
47: super .start();
48: }
49:
50: public void stop() throws Exception {
51: ((Lifecycle) GlobalResourceLoader.getService(serviceName))
52: .stop();
53: super.stop();
54: }
55:
56: }
|