KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > InterceptorBindingDescriptor


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment;
25
26 import java.util.logging.*;
27 import com.sun.logging.*;
28
29 import java.util.Map JavaDoc;
30 import java.util.HashMap JavaDoc;
31 import java.util.HashSet JavaDoc;
32 import java.util.Set JavaDoc;
33 import java.util.List JavaDoc;
34 import java.util.LinkedList JavaDoc;
35
36 import com.sun.enterprise.util.LocalStringManagerImpl;
37 import com.sun.enterprise.deployment.util.LogDomains;
38
39
40 /**
41  * Contains a single interceptor binding entry.
42  */

43 public class InterceptorBindingDescriptor extends Descriptor
44 {
45     private static LocalStringManagerImpl localStrings =
46         new LocalStringManagerImpl(InterceptorBindingDescriptor.class);
47
48     static Logger _logger = LogDomains.getLogger(LogDomains.DPL_LOGGER);
49
50     public enum BindingType {
51         
52         DEFAULT,
53         CLASS,
54         METHOD
55
56     }
57
58     // Only applies to CLASS and METHOD
59
private String JavaDoc ejbName;
60
61     // Only applies to METHOD
62
private MethodDescriptor businessMethod;
63
64     // Ordered list of interceptor classes.
65
private LinkedList JavaDoc<String JavaDoc> interceptors = new LinkedList JavaDoc<String JavaDoc>();
66
67     // True if interceptor list represents a total ordering.
68
private boolean isTotalOrdering;
69     
70     // Only applies to CLASS or METHOD
71
private boolean excludeDefaultInterceptors;
72
73     // Only applies to METHOD
74
private boolean excludeClassInterceptors;
75
76     private boolean needsOverloadResolution;
77
78     public InterceptorBindingDescriptor() {
79     }
80
81     public BindingType getBindingType() {
82         if( ejbName.equals("*") ) {
83             return BindingType.DEFAULT;
84         } else if( businessMethod == null ) {
85             return BindingType.CLASS;
86         } else {
87             return BindingType.METHOD;
88         }
89     }
90
91     public void setNeedsOverloadResolution(boolean flag) {
92         needsOverloadResolution = flag;
93     }
94
95     public boolean getNeedsOverloadResolution() {
96         return needsOverloadResolution;
97     }
98
99     public void setEjbName(String JavaDoc ejb) {
100         ejbName = ejb;
101     }
102
103     public String JavaDoc getEjbName() {
104         return ejbName;
105     }
106
107     public void setBusinessMethod(MethodDescriptor desc) {
108         businessMethod = desc;
109     }
110
111     public MethodDescriptor getBusinessMethod() {
112         return businessMethod;
113     }
114
115     public void appendInterceptorClass(String JavaDoc interceptor) {
116         interceptors.addLast(interceptor);
117     }
118     
119     public List JavaDoc<String JavaDoc> getInterceptorClasses() {
120         return new LinkedList JavaDoc<String JavaDoc>(interceptors);
121     }
122
123     public void setIsTotalOrdering(boolean flag) {
124         isTotalOrdering = flag;
125     }
126
127     public boolean getIsTotalOrdering() {
128         return isTotalOrdering;
129     }
130
131     public void setExcludeDefaultInterceptors(boolean flag) {
132         excludeDefaultInterceptors = flag;
133     }
134
135     public boolean getExcludeDefaultInterceptors() {
136         return excludeDefaultInterceptors;
137     }
138
139     public void setExcludeClassInterceptors(boolean flag) {
140         excludeClassInterceptors = flag;
141     }
142
143     public boolean getExcludeClassInterceptors() {
144         return excludeClassInterceptors;
145     }
146     
147 }
148
Popular Tags