Source Code Cross Referenced for ContextLoader.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » component » impl » 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 » ERP CRM Financial » sakai » org.sakaiproject.component.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/component/tags/sakai_2-4-1/component-api/component/src/java/org/sakaiproject/component/impl/ContextLoader.java $
003:         * $Id: ContextLoader.java 6821 2006-03-21 18:34:36Z ggolden@umich.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.component.impl;
021:
022:        import java.io.IOException;
023:
024:        import javax.servlet.ServletContext;
025:
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:        import org.sakaiproject.component.cover.ComponentManager;
029:        import org.springframework.beans.BeansException;
030:        import org.springframework.beans.factory.support.BeanDefinitionRegistry;
031:        import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
032:        import org.springframework.context.ApplicationContext;
033:        import org.springframework.context.ConfigurableApplicationContext;
034:        import org.springframework.util.StringUtils;
035:        import org.springframework.web.context.ConfigurableWebApplicationContext;
036:        import org.springframework.web.context.WebApplicationContext;
037:
038:        /**
039:         * <p>
040:         * Sakai's extension to Spring's ContextLoader - adds the location of the ComponentManager shared AC, linking the local AC to it as parent, and loading localy hosted components into shared.
041:         * </p>
042:         */
043:        public class ContextLoader extends
044:                org.springframework.web.context.ContextLoader {
045:            /** Our logger. */
046:            private static Log M_log = LogFactory.getLog(ContextLoader.class);
047:
048:            /** Name of servlet context parameter that can specify the config location for loading into the shared component set. */
049:            public static final String SHARED_LOCATION_PARAM = "contextSharedLocation";
050:
051:            /**
052:             * Initialize the local ApplicationContext, link it to the shared context, and load shared definitions into the shared context.
053:             * 
054:             * @param servletContext
055:             *        current servlet context
056:             * @return the new WebApplicationContext
057:             * @throws BeansException
058:             *         if the context couldn't be initialized
059:             */
060:            public WebApplicationContext initWebApplicationContext(
061:                    ServletContext servletContext) throws BeansException {
062:                WebApplicationContext rv = super 
063:                        .initWebApplicationContext(servletContext);
064:
065:                // if we have a parent and any shared bean definitions, load them into the parent
066:                ConfigurableApplicationContext parent = (ConfigurableApplicationContext) rv
067:                        .getParent();
068:                if (parent != null) {
069:                    String sharedConfig = servletContext
070:                            .getInitParameter(SHARED_LOCATION_PARAM);
071:                    if (sharedConfig != null) {
072:                        String[] locations = StringUtils
073:                                .tokenizeToStringArray(
074:                                        sharedConfig,
075:                                        ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS);
076:                        if (locations != null) {
077:                            XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(
078:                                    (BeanDefinitionRegistry) parent
079:                                            .getBeanFactory());
080:
081:                            for (int i = 0; i < locations.length; i++) {
082:                                try {
083:                                    reader.loadBeanDefinitions(rv
084:                                            .getResources(locations[i]));
085:                                } catch (IOException e) {
086:                                    M_log
087:                                            .warn("exception loading into parent: "
088:                                                    + e);
089:                                }
090:                            }
091:                        }
092:                    }
093:                }
094:
095:                return rv;
096:            }
097:
098:            /**
099:             * Access the shared ApplicationContext
100:             * 
101:             * @param servletContext
102:             *        (not used)
103:             * @return The shared application context
104:             */
105:            protected ApplicationContext loadParentContext(
106:                    ServletContext servletContext) throws BeansException {
107:                // get the component manager (we know it's a SpringCompMgr) and from that the shared AC
108:                ConfigurableApplicationContext sharedAc = ((SpringCompMgr) ComponentManager
109:                        .getInstance()).getApplicationContext();
110:
111:                return sharedAc;
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.