Source Code Cross Referenced for HandlerConfiguration.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » webapps » authentication » configuration » 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.webapps.authentication.configuration 
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.webapps.authentication.configuration;
018:
019:        import java.io.Serializable;
020:        import java.util.HashMap;
021:        import java.util.Hashtable;
022:        import java.util.Map;
023:
024:        import org.apache.avalon.framework.configuration.Configuration;
025:        import org.apache.avalon.framework.configuration.ConfigurationException;
026:        import org.apache.cocoon.ProcessingException;
027:        import org.apache.cocoon.environment.Request;
028:        import org.apache.cocoon.webapps.authentication.components.PipelineAuthenticator;
029:        import org.apache.excalibur.source.SourceParameters;
030:
031:        /**
032:         * The authentication Handler.
033:         *
034:         * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
035:         * @deprecated This block is deprecated and will be removed in future versions.
036:         * @version CVS $Id: HandlerConfiguration.java 433543 2006-08-22 06:22:54Z crossley $
037:         */
038:        public final class HandlerConfiguration implements  Serializable {
039:
040:            /** The unique name of the handler */
041:            private final String name;
042:
043:            /** The redirect-to URI */
044:            private String redirectURI;
045:
046:            /** The redirect parameters */
047:            private SourceParameters redirectParameters;
048:
049:            /** The authentication resource */
050:            private String authenticationResource;
051:
052:            /** The logout resource */
053:            private String logoutResource;
054:
055:            /** The class name of the authenticator to use */
056:            private String authenticatorClass;
057:
058:            /** The authentication resource parameters */
059:            private SourceParameters authenticationResourceParameters;
060:
061:            /** The load resource (optional) */
062:            private String loadResource;
063:
064:            /** The load resource (optional) parameters */
065:            private SourceParameters loadResourceParameters;
066:
067:            /** The save resource (optional) */
068:            private String saveResource;
069:
070:            /** The save resource (optional) parameters */
071:            private SourceParameters saveResourceParameters;
072:
073:            /** The Application Configurations */
074:            private Map applications = new Hashtable(3, 2);
075:
076:            /** The configuration fragments */
077:            private Map configurations;
078:
079:            /** Save the context on logout */
080:            private boolean saveOnLogout = false;
081:
082:            /**
083:             * Create a new handler object.
084:             */
085:            public HandlerConfiguration(String name) {
086:                this .name = name;
087:                this .configurations = new HashMap(3, 2);
088:            }
089:
090:            /**
091:             * Configure
092:             */
093:            public void configure(Request request, Configuration conf)
094:                    throws ProcessingException, ConfigurationException {
095:                // get login (required)
096:                Configuration child = conf.getChild("redirect-to", false);
097:                if (child == null)
098:                    throw new ConfigurationException("Handler '" + this .name
099:                            + "' needs a redirect-to URI.");
100:                this .redirectURI = child.getAttribute("uri");
101:                if (this .redirectURI.startsWith("cocoon:")) {
102:                    final int pos = this .redirectURI.indexOf('/');
103:                    if (pos != -1 && this .redirectURI.length() > pos) {
104:                        if (this .redirectURI.charAt(pos + 1) == '/') {
105:                            this .redirectURI = this .redirectURI.substring(
106:                                    pos + 2).trim();
107:                            this .redirectURI = request.getContextPath() + "/"
108:                                    + this .redirectURI;
109:                        } else {
110:                            this .redirectURI = this .redirectURI.substring(
111:                                    pos + 1).trim();
112:                        }
113:                    }
114:                }
115:
116:                this .redirectParameters = SourceParameters.create(child);
117:
118:                // get load resource (required)
119:                child = conf.getChild("authentication", false);
120:                if (child == null) {
121:                    throw new ConfigurationException("Handler '" + this .name
122:                            + "' needs authentication configuration");
123:                }
124:                this .authenticatorClass = child.getAttribute("authenticator",
125:                        PipelineAuthenticator.class.getName());
126:                if (PipelineAuthenticator.class.getName().equals(
127:                        authenticatorClass)) {
128:                    this .authenticationResource = child.getAttribute("uri");
129:                } else {
130:                    // the uri attribute is optional for other authenticators
131:                    this .authenticationResource = child.getAttribute("uri",
132:                            null);
133:                }
134:                // optinal logout resource
135:                this .logoutResource = child.getAttribute("logout-uri", null);
136:                this .authenticationResourceParameters = SourceParameters
137:                        .create(child);
138:
139:                // get load resource (optional)
140:                child = conf.getChild("load", false);
141:                if (child != null) {
142:                    this .loadResource = child.getAttribute("uri");
143:                    this .loadResourceParameters = SourceParameters
144:                            .create(child);
145:                }
146:
147:                // get save resource (optional)
148:                child = conf.getChild("save", false);
149:                if (child != null) {
150:                    this .saveResource = child.getAttribute("uri");
151:                    this .saveResourceParameters = SourceParameters
152:                            .create(child);
153:                    this .saveOnLogout = child.getAttributeAsBoolean(
154:                            "saveOnLogout", false);
155:                }
156:
157:                // And now: Applications
158:                child = conf.getChild("applications", false);
159:                if (child != null) {
160:                    Configuration[] appConfs = child.getChildren("application");
161:                    Configuration appconf;
162:
163:                    if (appConfs != null) {
164:                        for (int i = 0; i < appConfs.length; i++) {
165:                            appconf = appConfs[i];
166:
167:                            // get name
168:                            String appName = appconf.getAttribute("name");
169:
170:                            // test if handler is unique
171:                            if (this .applications.get(appName) != null) {
172:                                throw new ConfigurationException(
173:                                        "Application names must be unique: "
174:                                                + appName);
175:                            }
176:
177:                            // create handler
178:                            ApplicationConfiguration apphandler = new ApplicationConfiguration(
179:                                    this , appName);
180:
181:                            // store handler
182:                            this .applications.put(appName, apphandler);
183:
184:                            // configure
185:                            apphandler.configure(appconf);
186:                        }
187:                    }
188:                }
189:
190:                // get configurations (optional)
191:                Configuration[] configurations = conf
192:                        .getChildren("configuration");
193:                if (configurations != null) {
194:                    for (int i = 0; i < configurations.length; i++) {
195:                        child = configurations[i];
196:                        String value = child.getAttribute("name");
197:                        if (this .getConfiguration(value) != null) {
198:                            throw new ConfigurationException(
199:                                    "Configuration names must be unique for application "
200:                                            + this .name + ": " + value);
201:                        }
202:                        this .configurations.put(value, child);
203:                    }
204:                }
205:
206:            }
207:
208:            /**
209:             * Get the handler name.
210:             */
211:            public String getName() {
212:                return name;
213:            }
214:
215:            /**
216:             * Get the redirect URI
217:             */
218:            public String getRedirectURI() {
219:                return this .redirectURI;
220:            }
221:
222:            /**
223:             * Get the redirect parameters
224:             */
225:            public SourceParameters getRedirectParameters() {
226:                return this .redirectParameters;
227:            }
228:
229:            /**
230:             * Get the authentication resource
231:             */
232:            public String getAuthenticationResource() {
233:                return this .authenticationResource;
234:            }
235:
236:            /**
237:             * Get the authentication resource
238:             */
239:            public SourceParameters getAuthenticationResourceParameters() {
240:                return this .authenticationResourceParameters;
241:            }
242:
243:            /**
244:             * Get the logout resource
245:             */
246:            public String getLogoutResource() {
247:                return this .logoutResource;
248:            }
249:
250:            /** Get the save resource */
251:            public String getSaveResource() {
252:                return this .saveResource;
253:            }
254:
255:            /** Get the load resource */
256:            public String getLoadResource() {
257:                return this .loadResource;
258:            }
259:
260:            /** Should we save on logout? */
261:            public boolean saveOnLogout() {
262:                return this .saveOnLogout;
263:            }
264:
265:            /** Get the save resource */
266:            public SourceParameters getSaveResourceParameters() {
267:                return this .saveResourceParameters;
268:            }
269:
270:            /** Get the load resource parameters */
271:            public SourceParameters getLoadResourceParameters() {
272:                return this .loadResourceParameters;
273:            }
274:
275:            /**
276:             * Get the applications map
277:             */
278:            public Map getApplications() {
279:                return applications;
280:            }
281:
282:            /**
283:             * Get the configuration
284:             */
285:            public Configuration getConfiguration(String name) {
286:                return (Configuration) this .configurations.get(name);
287:            }
288:
289:            /**
290:             * toString()
291:             */
292:            public String toString() {
293:                return "authentication handler '" + this .name + "' ("
294:                        + super .toString() + ')';
295:            }
296:
297:            /**
298:             * Return the authenticator class
299:             */
300:            public String getAuthenticatorClassName() {
301:                return this.authenticatorClass;
302:            }
303:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.