Source Code Cross Referenced for SessionAspect.java in  » Net » Terracotta » com » tc » weblogic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Terracotta » com.tc.weblogic 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tc.weblogic;
005:
006:        import weblogic.management.descriptors.webapp.FilterMBean;
007:        import weblogic.management.descriptors.webapp.FilterMappingMBean;
008:        import weblogic.management.descriptors.webapp.ParameterMBean;
009:        import weblogic.management.descriptors.webapp.ServletMBean;
010:        import weblogic.management.descriptors.webapp.UIMBean;
011:        import weblogic.servlet.internal.WebAppServletContext;
012:
013:        import com.tc.aspectwerkz.joinpoint.StaticJoinPoint;
014:        import com.tc.object.bytecode.hook.impl.ClassProcessorHelper;
015:        import com.terracotta.session.SessionFilter;
016:
017:        public class SessionAspect {
018:
019:            private final ThreadLocal dsoFilter = new ThreadLocal();
020:
021:            public Object addFilterIfNeeded(StaticJoinPoint jp,
022:                    weblogic.servlet.internal.WebAppServletContext context)
023:                    throws Throwable {
024:                FilterMBean[] filters = (FilterMBean[]) jp.proceed();
025:                if (filters == null) {
026:                    filters = new FilterMBean[] {};
027:                }
028:
029:                if (isDSOSesisons(context)) {
030:                    FilterMBean filter = new DSOFilterMBean();
031:                    setFilterInstance(context, filter);
032:
033:                    FilterMBean[] withDSO = new FilterMBean[filters.length + 1];
034:                    System.arraycopy(filters, 0, withDSO, 1, filters.length);
035:                    withDSO[0] = filter;
036:                    filters = withDSO;
037:                }
038:                return filters;
039:            }
040:
041:            public Object addFilterMappingIfNeeded(StaticJoinPoint jp,
042:                    weblogic.servlet.internal.WebAppServletContext context)
043:                    throws Throwable {
044:                FilterMappingMBean[] mappings = (FilterMappingMBean[]) jp
045:                        .proceed();
046:                if (mappings == null) {
047:                    mappings = new FilterMappingMBean[] {};
048:                }
049:
050:                if (isDSOSesisons(context)) {
051:                    FilterMappingMBean[] withDSO = new FilterMappingMBean[mappings.length + 1];
052:                    System.arraycopy(mappings, 0, withDSO, 1, mappings.length);
053:                    withDSO[0] = new DSOFilterMappingMBean(
054:                            getFilterInstance(context));
055:                    mappings = withDSO;
056:                }
057:                return mappings;
058:            }
059:
060:            private FilterMBean getFilterInstance(WebAppServletContext context) {
061:                FilterMBean filter = (FilterMBean) dsoFilter.get();
062:                if (filter == null) {
063:                    throw new AssertionError("No filter found for "
064:                            + context.getName());
065:                }
066:                dsoFilter.set(null);
067:                return filter;
068:            }
069:
070:            private void setFilterInstance(WebAppServletContext context,
071:                    FilterMBean filter) {
072:                if (dsoFilter.get() != null) {
073:                    throw new AssertionError("Filter already present for "
074:                            + context.getName());
075:                }
076:                dsoFilter.set(filter);
077:            }
078:
079:            private static boolean isDSOSesisons(WebAppServletContext context) {
080:                String appName = context.getName();
081:                boolean rv = ClassProcessorHelper.isDSOSessions(appName);
082:                return rv;
083:            }
084:
085:            private static class DSOFilterMappingMBean implements 
086:                    FilterMappingMBean {
087:
088:                private final FilterMBean filter;
089:
090:                public DSOFilterMappingMBean(FilterMBean filter) {
091:                    this .filter = filter;
092:                }
093:
094:                public FilterMBean getFilter() {
095:                    return filter;
096:                }
097:
098:                public ServletMBean getServlet() {
099:                    return null;
100:                }
101:
102:                public String getUrlPattern() {
103:                    return "/*";
104:                }
105:
106:                public void setFilter(FilterMBean filtermbean) {
107:                    throw new AssertionError();
108:                }
109:
110:                public void setServlet(ServletMBean servletmbean) {
111:                    throw new AssertionError();
112:                }
113:
114:                public void setUrlPattern(String s) {
115:                    throw new AssertionError();
116:                }
117:
118:                public void addDescriptorError(String s) {
119:                    throw new AssertionError();
120:                }
121:
122:                public String[] getDescriptorErrors() {
123:                    throw new AssertionError();
124:                }
125:
126:                public boolean isValid() {
127:                    throw new AssertionError();
128:                }
129:
130:                public void removeDescriptorError(String s) {
131:                    throw new AssertionError();
132:                }
133:
134:                public void setDescriptorErrors(String[] as) {
135:                    throw new AssertionError();
136:                }
137:
138:                public String getName() {
139:                    throw new AssertionError();
140:                }
141:
142:                public void register() {
143:                    throw new AssertionError();
144:                }
145:
146:                public void setName(String s) {
147:                    throw new AssertionError();
148:                }
149:
150:                public String toXML(int i) {
151:                    throw new AssertionError();
152:                }
153:
154:                public void unregister() {
155:                    throw new AssertionError();
156:                }
157:
158:            }
159:
160:            private static class DSOParameterMBean implements  ParameterMBean {
161:                public String getParamName() {
162:                    return SessionFilter.APP_SERVER_PARAM_NAME;
163:                }
164:
165:                public void setParamName(String s) {
166:                    throw new AssertionError();
167:                }
168:
169:                public String getParamValue() {
170:                    return SessionFilter.BEA_WEBLOGIC;
171:                }
172:
173:                public void setParamValue(String s) {
174:                    throw new AssertionError();
175:                }
176:
177:                public String getDescription() {
178:                    return "Session Filter parameters for BEA Weblogic";
179:                }
180:
181:                public void setDescription(String s) {
182:                    throw new AssertionError();
183:                }
184:            }
185:
186:            private static class DSOFilterMBean implements  FilterMBean {
187:
188:                public void addInitParam(ParameterMBean parametermbean) {
189:                    //
190:                }
191:
192:                public String getFilterClass() {
193:                    return SessionFilter.FILTER_CLASS;
194:                }
195:
196:                public String getFilterName() {
197:                    return SessionFilter.FILTER_NAME;
198:                }
199:
200:                public ParameterMBean[] getInitParams() {
201:                    return new ParameterMBean[] { new DSOParameterMBean() };
202:                }
203:
204:                public UIMBean getUIData() {
205:                    throw new AssertionError();
206:                }
207:
208:                public void removeInitParam(ParameterMBean parametermbean) {
209:                    throw new AssertionError();
210:                }
211:
212:                public void setFilterClass(String s) {
213:                    throw new AssertionError();
214:                }
215:
216:                public void setFilterName(String s) {
217:                    throw new AssertionError();
218:                }
219:
220:                public void setInitParams(ParameterMBean[] aparametermbean) {
221:                    throw new AssertionError();
222:                }
223:
224:                public void setUIData(UIMBean uimbean) {
225:                    throw new AssertionError();
226:                }
227:
228:                public void addDescriptorError(String s) {
229:                    throw new AssertionError();
230:                }
231:
232:                public String[] getDescriptorErrors() {
233:                    throw new AssertionError();
234:                }
235:
236:                public boolean isValid() {
237:                    throw new AssertionError();
238:                }
239:
240:                public void removeDescriptorError(String s) {
241:                    throw new AssertionError();
242:                }
243:
244:                public void setDescriptorErrors(String[] as) {
245:                    throw new AssertionError();
246:                }
247:
248:                public String getName() {
249:                    throw new AssertionError();
250:                }
251:
252:                public void register() {
253:                    throw new AssertionError();
254:                }
255:
256:                public void setName(String s) {
257:                    throw new AssertionError();
258:                }
259:
260:                public String toXML(int i) {
261:                    throw new AssertionError();
262:                }
263:
264:                public void unregister() {
265:                    throw new AssertionError();
266:                }
267:
268:            }
269:
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.