Source Code Cross Referenced for AbstractComplementaryConfigurableAction.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » acting » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.acting 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.acting;
018:
019:        import org.apache.avalon.framework.configuration.Configuration;
020:        import org.apache.avalon.framework.configuration.ConfigurationException;
021:        import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
022:        import org.apache.cocoon.Constants;
023:        import org.apache.cocoon.components.source.SourceUtil;
024:        import org.apache.cocoon.environment.SourceResolver;
025:        import org.apache.excalibur.source.Source;
026:
027:        import java.util.HashMap;
028:        import java.util.Map;
029:
030:        /**
031:         * Set up environment for configurable form handling data.  This group
032:         * of actions are unique in that they employ a terciary mapping.
033:         *
034:         * Each configuration file must use the same format in order to be
035:         * effective.  The name of the root configuration element is irrelevant.
036:         *
037:         * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
038:         * @version CVS $Id: AbstractComplementaryConfigurableAction.java 433543 2006-08-22 06:22:54Z crossley $
039:         */
040:        public abstract class AbstractComplementaryConfigurableAction extends
041:                ConfigurableServiceableAction {
042:            private static Map configurations = new HashMap();
043:
044:            /**
045:             * Set up the complementary configuration file.  Please note that
046:             * multiple Actions can share the same configurations.  By using
047:             * this approach, we can limit the number of config files.
048:             * Also note that the configuration file does not have to be a file.
049:             *
050:             * Defaults to reload configuration file it has changed.
051:             */
052:            protected Configuration getConfiguration(String descriptor)
053:                    throws ConfigurationException {
054:                boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
055:                if (this .settings.containsKey("reloadable"))
056:                    reloadable = Boolean.valueOf(
057:                            (String) this .settings.get("reloadable"))
058:                            .booleanValue();
059:                return this .getConfiguration(descriptor, null, reloadable);
060:            }
061:
062:            /**
063:             * @deprecated please use the getConfiguration(String, SourceResolver, boolean)
064:             *             version of this method instead.
065:             */
066:            protected Configuration getConfiguration(String descriptor,
067:                    boolean reloadable) throws ConfigurationException {
068:                return this .getConfiguration(descriptor, null, reloadable);
069:            }
070:
071:            /**
072:             * Set up the complementary configuration file.  Please note that
073:             * multiple Actions can share the same configurations.  By using
074:             * this approach, we can limit the number of config files.
075:             * Also note that the configuration file does not have to be a file.
076:             */
077:            protected Configuration getConfiguration(String descriptor,
078:                    SourceResolver resolver, boolean reloadable)
079:                    throws ConfigurationException {
080:                ConfigurationHelper conf = null;
081:
082:                if (descriptor == null) {
083:                    throw new ConfigurationException(
084:                            "The form descriptor is not set!");
085:                }
086:
087:                synchronized (AbstractComplementaryConfigurableAction.configurations) {
088:                    Source resource = null;
089:                    try {
090:                        resource = resolver.resolveURI(descriptor);
091:                        conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations
092:                                .get(resource.getURI());
093:                        if (conf == null
094:                                || (reloadable && conf.lastModified != resource
095:                                        .getLastModified())) {
096:                            getLogger().debug("(Re)Loading " + descriptor);
097:
098:                            if (conf == null) {
099:                                conf = new ConfigurationHelper();
100:                            }
101:
102:                            SAXConfigurationHandler builder = new SAXConfigurationHandler();
103:                            SourceUtil.parse(this .manager, resource, builder);
104:
105:                            conf.lastModified = resource.getLastModified();
106:                            conf.configuration = builder.getConfiguration();
107:
108:                            AbstractComplementaryConfigurableAction.configurations
109:                                    .put(resource.getURI(), conf);
110:                        } else {
111:                            getLogger().debug(
112:                                    "Using cached configuration for "
113:                                            + descriptor);
114:                        }
115:                    } catch (Exception e) {
116:                        getLogger()
117:                                .error(
118:                                        "Could not configure Database mapping environment",
119:                                        e);
120:                        throw new ConfigurationException(
121:                                "Error trying to load configurations for resource: "
122:                                        + (resource == null ? "null" : resource
123:                                                .getURI()));
124:                    } finally {
125:                        resolver.release(resource);
126:                    }
127:                }
128:
129:                return conf.configuration;
130:            }
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.