Source Code Cross Referenced for RootContainer.java in  » J2EE » Expresso » com » jcorporate » expresso » kernel » 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 » J2EE » Expresso » com.jcorporate.expresso.kernel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:         * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
003:         *
004:         * Copyright (c) 1995-2003 Jcorporate Ltd. All rights reserved.
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         *
010:         * 1. Redistributions of source code must retain the above copyright
011:         *    notice, this list of conditions and the following disclaimer.
012:         *
013:         * 2. Redistributions in binary form must reproduce the above copyright
014:         *    notice, this list of conditions and the following disclaimer in
015:         *    the documentation and/or other materials provided with the
016:         *    distribution.
017:         *
018:         * 3. The end-user documentation included with the redistribution,
019:         *    if any, must include the following acknowledgment:
020:         *       "This product includes software developed by Jcorporate Ltd.
021:         *        (http://www.jcorporate.com/)."
022:         *    Alternately, this acknowledgment may appear in the software itself,
023:         *    if and wherever such third-party acknowledgments normally appear.
024:         *
025:         * 4. "Jcorporate" and product names such as "Expresso" must
026:         *    not be used to endorse or promote products derived from this
027:         *    software without prior written permission. For written permission,
028:         *    please contact info@jcorporate.com.
029:         *
030:         * 5. Products derived from this software may not be called "Expresso",
031:         *    or other Jcorporate product names; nor may "Expresso" or other
032:         *    Jcorporate product names appear in their name, without prior
033:         *    written permission of Jcorporate Ltd.
034:         *
035:         * 6. No product derived from this software may compete in the same
036:         *    market space, i.e. framework, without prior written permission
037:         *    of Jcorporate Ltd. For written permission, please contact
038:         *    partners@jcorporate.com.
039:         *
040:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
041:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
042:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
043:         * DISCLAIMED.  IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
044:         * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
045:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
046:         * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
047:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
048:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
049:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
050:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
051:         * SUCH DAMAGE.
052:         * ====================================================================
053:         *
054:         * This software consists of voluntary contributions made by many
055:         * individuals on behalf of the Jcorporate Ltd. Contributions back
056:         * to the project(s) are encouraged when you make modifications.
057:         * Please send them to support@jcorporate.com. For more information
058:         * on Jcorporate Ltd. and its products, please see
059:         * <http://www.jcorporate.com/>.
060:         *
061:         * Portions of this software are based upon other open source
062:         * products and are subject to their respective licenses.
063:         */
064:        package com.jcorporate.expresso.kernel;
065:
066:        import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
067:        import com.jcorporate.expresso.kernel.digester.ExpressoServicesConfig;
068:        import com.jcorporate.expresso.kernel.exception.ConfigurationException;
069:        import com.jcorporate.expresso.kernel.management.ExpressoRuntimeMap;
070:
071:        import java.lang.ref.WeakReference;
072:        import java.util.Collections;
073:        import java.util.HashMap;
074:        import java.util.Map;
075:
076:        /**
077:         * This is the default root container interface.  It is essentially the root of
078:         * the Expresso Runtime tree.
079:         *
080:         * @author Michael Rimov
081:         */
082:        public class RootContainer extends ContainerComponentBase implements 
083:                RootContainerInterface {
084:            private Boolean showStackTrace;
085:            private LogManager logManager = null;
086:            private Map setupValues = new HashMap();
087:            private String httpPort;
088:            private String servletAPI;
089:            private String sslPort;
090:
091:            /**
092:             * The location of the services file so we can reload the config if
093:             * necessary
094:             */
095:            private java.net.URL servicesFile;
096:
097:            /**
098:             * Weak Reference that contains the expresso configuration file. To save
099:             * memory, we allow the tree to be gc'ed if nobody else maintains a
100:             * reference to it.  We reload the system upon request at that point.
101:             */
102:            private WeakReference systemConfiguration = null;
103:
104:            /**
105:             * Default constructor
106:             */
107:            public RootContainer() {
108:            }
109:
110:            /**
111:             * Set the ExpressoServicesConfig bean.  This is usually done by the System
112:             * factory, or possibly the management tools.
113:             *
114:             * @param theConfig the new Expresso services config file.
115:             */
116:            public synchronized void setExpressoServicesConfig(
117:                    ExpressoServicesConfig theConfig) {
118:                this .systemConfiguration = new WeakReference(theConfig);
119:            }
120:
121:            /**
122:             * Retrieve the current ExpressoServicesConfiguration file bean.
123:             * <p/>
124:             * <p/>
125:             * <b>Note</b> An important aspect of memory saving that RootContainer does
126:             * is that it maintains the local copy of the ExpressoServicesConfig as a
127:             * weak reference.  It then reloads from scratch if absolutely necessary.
128:             * Because of this, you cannot modify ExpressoServicesConfig, lose your
129:             * reference, and call getExpressoServicesConfig() again to retrieve your
130:             * changes.  Maintain a reference yourself if you want to save changes
131:             * later!
132:             * </p>
133:             *
134:             * @return the Root ExpressoServicesconfig
135:             */
136:            public synchronized ExpressoServicesConfig getExpressoServicesConfig() {
137:                ExpressoServicesConfig sc;
138:
139:                if (systemConfiguration.get() == null) {
140:                    sc = new ExpressoServicesConfig();
141:                    sc.setExpressoServicesFile(servicesFile);
142:                    sc.loadExpressoServices();
143:                    systemConfiguration = new WeakReference(sc);
144:                }
145:
146:                return (ExpressoServicesConfig) systemConfiguration.get();
147:            }
148:
149:            /**
150:             * Set the HTTP port of the server
151:             *
152:             * @param httpPort the new value for this configuration setting
153:             */
154:            public synchronized void setHttpPort(String httpPort) {
155:                this .httpPort = httpPort;
156:            }
157:
158:            /**
159:             * Retrieve the HTTP port of this server
160:             *
161:             * @return java.lang.String
162:             */
163:            public synchronized String getHttpPort() {
164:                return httpPort;
165:            }
166:
167:            /**
168:             * Set the log manager for the entire expresso system
169:             *
170:             * @param newManager the new LogManager for the system
171:             */
172:            public synchronized void setLogManager(LogManager newManager) {
173:                logManager = newManager;
174:            }
175:
176:            /**
177:             * Retrieve the LogManager object for the system
178:             *
179:             * @return the LogManager for the system
180:             */
181:            public synchronized LogManager getLogManager() {
182:                return this .logManager;
183:            }
184:
185:            /**
186:             * Sets the ULR location of the services file.  This is usually called by
187:             * the SystemFactory
188:             *
189:             * @param url the location of the services file.
190:             */
191:            public synchronized void setServicesFileLocation(java.net.URL url) {
192:                servicesFile = url;
193:            }
194:
195:            /**
196:             * Retrieves the URL location of the services file location.  May be inside
197:             * a jar/war file
198:             *
199:             * @return java.net.URL
200:             */
201:            public synchronized java.net.URL getServicesFileLocation() {
202:                return servicesFile;
203:            }
204:
205:            /**
206:             * Set the servlet API of the system
207:             *
208:             * @param servletAPI the new value for the system
209:             */
210:            public synchronized void setServletAPI(String servletAPI) {
211:                this .servletAPI = servletAPI;
212:            }
213:
214:            /**
215:             * Retrieve the servlet API of the system
216:             *
217:             * @return the current servlet API string
218:             */
219:            public synchronized String getServletAPI() {
220:                return servletAPI;
221:            }
222:
223:            /**
224:             * Retrieve a specific setup value for the container.
225:             *
226:             * @param key the key for the global setup value
227:             * @return java.lang.String
228:             */
229:            public synchronized String getSetupValue(String key) {
230:                return (String) setupValues.get(key);
231:            }
232:
233:            /**
234:             * Retrieve all the setup values for the root container.
235:             *
236:             * @return Map of all setup values.
237:             */
238:            public synchronized Map getSetupValues() {
239:                return Collections.synchronizedMap(setupValues);
240:            }
241:
242:            /**
243:             * Sets whether stack traces should be shown or not.
244:             *
245:             * @param showStackTrace the new value.
246:             * @throws IllegalArgumentException if showStackTrace is null
247:             */
248:            public synchronized void setShowStackTrace(Boolean showStackTrace) {
249:                if (showStackTrace == null) {
250:                    this .showStackTrace = Boolean.FALSE;
251:                }
252:
253:                this .showStackTrace = showStackTrace;
254:            }
255:
256:            /**
257:             * Get the show stack trace.  This is backwards compatible with the old
258:             * method of doing things in misc.ConfigManager.
259:             *
260:             * @return java.lang.Boolean
261:             */
262:            public synchronized Boolean getShowStackTrace() {
263:                return showStackTrace;
264:            }
265:
266:            /**
267:             * Retrieve whether stack traces should be shown or not.
268:             *
269:             * @return boolean true if stacktrace should be shown
270:             */
271:            public synchronized boolean isShowStackTrace() {
272:                return showStackTrace.booleanValue();
273:            }
274:
275:            /**
276:             * Set the SSL port property of this root container
277:             *
278:             * @param sslPort the new location for the SSL port
279:             */
280:            public synchronized void setSslPort(String sslPort) {
281:                this .sslPort = sslPort;
282:            }
283:
284:            /**
285:             * Retrieve the location of the Expresso SSL port.  This method is to
286:             * eventually be removed to another separate component
287:             *
288:             * @return java.lang.String
289:             */
290:            public synchronized String getSslPort() {
291:                return sslPort;
292:            }
293:
294:            /**
295:             * Configure the global container including type conversion for default
296:             * values.
297:             *
298:             * @param newConfig The Configuration 'dynabean'
299:             * @throws ConfigurationException upon error
300:             */
301:            public synchronized void configure(Configuration newConfig)
302:                    throws ConfigurationException {
303:                Map setupMap = newConfig.getMappedProperties("SetupValue");
304:
305:                if (setupMap != null) {
306:                    setupValues = new ConcurrentReaderHashMap(setupMap);
307:                }
308:
309:                setShowStackTrace((Boolean) newConfig.get("ShowStackTrace"));
310:
311:                setHttpPort((String) newConfig.get("HttpPort"));
312:                setServletAPI((String) newConfig.get("ServletAPI"));
313:                setSslPort((String) newConfig.get("SslPort"));
314:            }
315:
316:            /**
317:             * Destroys the container and unregisters itself from the
318:             * ExpressoRuntimeMap
319:             */
320:            public synchronized void destroy() {
321:                ExpressoRuntimeMap.unregisterRuntime(this 
322:                        .getExpressoServicesConfig().getName());
323:                this .getContainerImplementation().destroyContainer();
324:            }
325:
326:            /**
327:             * Default Initializer
328:             */
329:            public synchronized void initialize() {
330:                return;
331:            }
332:
333:            /**
334:             * Reconfigure the global container
335:             *
336:             * @param newConfig the new configuration.
337:             * @throws ConfigurationException upon reconfiguration error
338:             */
339:            public synchronized void reconfigure(Configuration newConfig)
340:                    throws ConfigurationException {
341:                setShowStackTrace(null);
342:                setHttpPort(null);
343:                setServletAPI(null);
344:                setSslPort(null);
345:                setupValues = new HashMap();
346:                configure(newConfig);
347:            }
348:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.