01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.jee;
18:
19: import javax.xml.bind.annotation.XmlAccessType;
20: import javax.xml.bind.annotation.XmlAccessorType;
21: import javax.xml.bind.annotation.XmlElement;
22: import javax.xml.bind.annotation.XmlType;
23:
24: /**
25: * The lifecycle-callback type specifies a method on a
26: * class to be called when a lifecycle event occurs.
27: * Note that each class may have only one lifecycle callback
28: * method for any given event and that the method may not
29: * be overloaded.
30: * <p/>
31: * If the lifefycle-callback-class element is missing then
32: * the class defining the callback is assumed to be the
33: * component class in scope at the place in the descriptor
34: * in which the callback definition appears.
35: */
36: @XmlAccessorType(XmlAccessType.FIELD)
37: @XmlType(name="lifecycle-callbackType",propOrder={"lifecycleCallbackClass","lifecycleCallbackMethod"})
38: public class LifecycleCallback implements CallbackMethod {
39:
40: @XmlElement(name="lifecycle-callback-class")
41: protected String lifecycleCallbackClass;
42: @XmlElement(name="lifecycle-callback-method",required=true)
43: protected String lifecycleCallbackMethod;
44:
45: public LifecycleCallback() {
46: }
47:
48: public LifecycleCallback(java.lang.reflect.Method method) {
49: this .lifecycleCallbackClass = method.getDeclaringClass()
50: .getName();
51: this .lifecycleCallbackMethod = method.getName();
52: }
53:
54: public LifecycleCallback(String lifecycleCallbackClass,
55: String lifecycleCallbackMethod) {
56: this .lifecycleCallbackClass = lifecycleCallbackClass;
57: this .lifecycleCallbackMethod = lifecycleCallbackMethod;
58: }
59:
60: public String getLifecycleCallbackClass() {
61: return lifecycleCallbackClass;
62: }
63:
64: public void setLifecycleCallbackClass(String value) {
65: this .lifecycleCallbackClass = value;
66: }
67:
68: public String getLifecycleCallbackMethod() {
69: return lifecycleCallbackMethod;
70: }
71:
72: public void setLifecycleCallbackMethod(String value) {
73: this .lifecycleCallbackMethod = value;
74: }
75:
76: public String getClassName() {
77: return getLifecycleCallbackClass();
78: }
79:
80: public String getMethodName() {
81: return getLifecycleCallbackMethod();
82: }
83: }
|