001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.core.interceptor;
018:
019: import org.apache.openejb.core.Operation;
020:
021: import java.lang.reflect.Method;
022: import java.util.ArrayList;
023: import java.util.List;
024: import java.util.Collections;
025:
026: /**
027: * @version $Rev: 538389 $ $Date: 2007-05-15 16:47:50 -0700 $
028: */
029: public class InterceptorData {
030:
031: private Class clazz;
032:
033: private final List<Method> aroundInvoke = new ArrayList<Method>();
034:
035: private final List<Method> postConstruct = new ArrayList<Method>();
036: private final List<Method> preDestroy = new ArrayList<Method>();
037:
038: private final List<Method> postActivate = new ArrayList<Method>();
039: private final List<Method> prePassivate = new ArrayList<Method>();
040:
041: public InterceptorData(Class clazz) {
042: this .clazz = clazz;
043: }
044:
045: public Class getInterceptorClass() {
046: return clazz;
047: }
048:
049: public List<Method> getAroundInvoke() {
050: return aroundInvoke;
051: }
052:
053: public List<Method> getPostConstruct() {
054: return postConstruct;
055: }
056:
057: public List<Method> getPreDestroy() {
058: return preDestroy;
059: }
060:
061: public List<Method> getPostActivate() {
062: return postActivate;
063: }
064:
065: public List<Method> getPrePassivate() {
066: return prePassivate;
067: }
068:
069: public List<Method> getMethods(Operation operation) {
070: switch (operation) {
071: case BUSINESS:
072: return getAroundInvoke();
073: case BUSINESS_WS:
074: return getAroundInvoke();
075: case REMOVE:
076: return getAroundInvoke();
077: case POST_CONSTRUCT:
078: return getPostConstruct();
079: case PRE_DESTROY:
080: return getPreDestroy();
081: case ACTIVATE:
082: return getPostActivate();
083: case PASSIVATE:
084: return getPrePassivate();
085: case AFTER_BEGIN:
086: return getAroundInvoke();
087: case AFTER_COMPLETION:
088: return getAroundInvoke();
089: case BEFORE_COMPLETION:
090: return getAroundInvoke();
091: }
092: return Collections.EMPTY_LIST;
093: }
094:
095: public boolean equals(Object o) {
096: if (this == o)
097: return true;
098: if (o == null || getClass() != o.getClass())
099: return false;
100:
101: final InterceptorData that = (InterceptorData) o;
102:
103: if (clazz != null ? !clazz.equals(that.clazz)
104: : that.clazz != null)
105: return false;
106:
107: return true;
108: }
109:
110: public int hashCode() {
111: return (clazz != null ? clazz.hashCode() : 0);
112: }
113: }
|