Source Code Cross Referenced for ParticipantSpringWeb.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » rep » participants » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.rep.participants 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: ParticipantSpringWeb.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.rep.participants;
009:
010:        import java.io.InputStream;
011:        import java.net.MalformedURLException;
012:        import java.net.URL;
013:        import java.util.Enumeration;
014:        import java.util.Set;
015:        import java.util.Vector;
016:
017:        import javax.servlet.RequestDispatcher;
018:        import javax.servlet.Servlet;
019:        import javax.servlet.ServletContext;
020:        import javax.servlet.ServletException;
021:
022:        import org.springframework.beans.factory.BeanFactory;
023:        import org.springframework.web.context.ContextLoader;
024:        import org.springframework.web.context.support.WebApplicationContextUtils;
025:
026:        import com.uwyn.rife.rep.BlockingParticipant;
027:
028:        public class ParticipantSpringWeb extends BlockingParticipant {
029:            private BeanFactory mBeanFactory = null;
030:
031:            public ParticipantSpringWeb() {
032:                setInitializationMessage("Obtaining the Spring web application context ...");
033:                setCleanupMessage("Releasing the Spring web application context ...");
034:            }
035:
036:            protected void initialize() {
037:                ServletContext context = (ServletContext) getRepository()
038:                        .getContext();
039:                if (getParameter() != null && !getParameter().equals("")) {
040:                    ContextLoader loader = new ContextLoader();
041:                    mBeanFactory = loader
042:                            .initWebApplicationContext(new ServletContextWrapper(
043:                                    context));
044:                } else {
045:                    mBeanFactory = WebApplicationContextUtils
046:                            .getWebApplicationContext(context);
047:                }
048:            }
049:
050:            protected Object _getObject() {
051:                return mBeanFactory;
052:            }
053:
054:            protected Object _getObject(Object key) {
055:                if (null == key) {
056:                    return null;
057:                }
058:
059:                return mBeanFactory.getBean(String.valueOf(key));
060:            }
061:
062:            public class ServletContextWrapper implements  ServletContext {
063:                private ServletContext mDelegate;
064:                private Vector mInitParamNames = new Vector();
065:
066:                ServletContextWrapper(ServletContext delegate) {
067:                    mDelegate = delegate;
068:
069:                    Enumeration names_enum = mDelegate.getInitParameterNames();
070:                    while (names_enum.hasMoreElements()) {
071:                        mInitParamNames.add(names_enum.nextElement());
072:                    }
073:                    if (!mInitParamNames
074:                            .contains(ContextLoader.CONFIG_LOCATION_PARAM)) {
075:                        mInitParamNames
076:                                .add(ContextLoader.CONFIG_LOCATION_PARAM);
077:                    }
078:                }
079:
080:                public Object getAttribute(String name) {
081:                    return mDelegate.getAttribute(name);
082:                }
083:
084:                public Enumeration getAttributeNames() {
085:                    return mDelegate.getAttributeNames();
086:                }
087:
088:                public ServletContext getContext(String uripath) {
089:                    return mDelegate.getContext(uripath);
090:                }
091:
092:                public String getInitParameter(String name) {
093:                    if (ContextLoader.CONFIG_LOCATION_PARAM.equals(name)) {
094:                        return getParameter();
095:                    }
096:
097:                    return mDelegate.getInitParameter(name);
098:                }
099:
100:                public Enumeration getInitParameterNames() {
101:                    return mInitParamNames.elements();
102:                }
103:
104:                public int getMajorVersion() {
105:                    return mDelegate.getMajorVersion();
106:                }
107:
108:                public String getMimeType(String file) {
109:                    return mDelegate.getMimeType(file);
110:                }
111:
112:                public int getMinorVersion() {
113:                    return mDelegate.getMinorVersion();
114:                }
115:
116:                public RequestDispatcher getNamedDispatcher(String name) {
117:                    return mDelegate.getNamedDispatcher(name);
118:                }
119:
120:                public String getRealPath(String path) {
121:                    return mDelegate.getRealPath(path);
122:                }
123:
124:                public RequestDispatcher getRequestDispatcher(String path) {
125:                    return mDelegate.getRequestDispatcher(path);
126:                }
127:
128:                public URL getResource(String path)
129:                        throws MalformedURLException {
130:                    return mDelegate.getResource(path);
131:                }
132:
133:                public InputStream getResourceAsStream(String path) {
134:                    return mDelegate.getResourceAsStream(path);
135:                }
136:
137:                public Set getResourcePaths(String path) {
138:                    return mDelegate.getResourcePaths(path);
139:                }
140:
141:                public String getServerInfo() {
142:                    return mDelegate.getServerInfo();
143:                }
144:
145:                public Servlet getServlet(String name) throws ServletException {
146:                    return mDelegate.getServlet(name);
147:                }
148:
149:                public String getServletContextName() {
150:                    return mDelegate.getServletContextName();
151:                }
152:
153:                public Enumeration getServletNames() {
154:                    return mDelegate.getServletNames();
155:                }
156:
157:                public Enumeration getServlets() {
158:                    return mDelegate.getServlets();
159:                }
160:
161:                public void log(Exception exception, String msg) {
162:                    mDelegate.log(exception, msg);
163:                }
164:
165:                public void log(String message, Throwable throwable) {
166:                    mDelegate.log(message, throwable);
167:                }
168:
169:                public void log(String msg) {
170:                    mDelegate.log(msg);
171:                }
172:
173:                public void removeAttribute(String name) {
174:                    mDelegate.removeAttribute(name);
175:                }
176:
177:                public void setAttribute(String name, Object object) {
178:                    mDelegate.setAttribute(name, object);
179:                }
180:            }
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.