Source Code Cross Referenced for AuthenticationDocument.java in  » GIS » deegree » org » deegree » security » 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 » GIS » deegree » org.deegree.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$HeadURL$
002:        /*----------------    FILE HEADER  ------------------------------------------
003:         This file is part of deegree.
004:         Copyright (C) 2001-2008 by:
005:         Department of Geography, University of Bonn
006:         http://www.giub.uni-bonn.de/deegree/
007:         lat/lon GmbH
008:         http://www.lat-lon.de
009:
010:         This library is free software; you can redistribute it and/or
011:         modify it under the terms of the GNU Lesser General Public
012:         License as published by the Free Software Foundation; either
013:         version 2.1 of the License, or (at your option) any later version.
014:         This library is distributed in the hope that it will be useful,
015:         but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017:         Lesser General Public License for more details.
018:         You should have received a copy of the GNU Lesser General Public
019:         License along with this library; if not, write to the Free Software
020:         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021:         Contact:
022:
023:         Andreas Poth
024:         lat/lon GmbH
025:         Aennchenstr. 19
026:         53177 Bonn
027:         Germany
028:         E-Mail: poth@lat-lon.de
029:
030:         Prof. Dr. Klaus Greve
031:         Department of Geography
032:         University of Bonn
033:         Meckenheimer Allee 166
034:         53115 Bonn
035:         Germany
036:         E-Mail: greve@giub.uni-bonn.de
037:         ---------------------------------------------------------------------------*/
038:
039:        package org.deegree.security;
040:
041:        import java.io.File;
042:        import java.io.IOException;
043:        import java.io.Reader;
044:        import java.lang.reflect.Constructor;
045:        import java.net.MalformedURLException;
046:        import java.net.URL;
047:        import java.util.ArrayList;
048:        import java.util.HashMap;
049:        import java.util.List;
050:        import java.util.Map;
051:
052:        import org.deegree.datatypes.QualifiedName;
053:        import org.deegree.datatypes.parameter.InvalidParameterValueException;
054:        import org.deegree.framework.xml.NamespaceContext;
055:        import org.deegree.framework.xml.XMLFragment;
056:        import org.deegree.framework.xml.XMLParsingException;
057:        import org.deegree.framework.xml.XMLTools;
058:        import org.deegree.ogcbase.CommonNamespaces;
059:        import org.w3c.dom.Document;
060:        import org.w3c.dom.Element;
061:        import org.w3c.dom.Node;
062:        import org.xml.sax.SAXException;
063:
064:        /**
065:         * 
066:         * 
067:         * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
068:         * @author last edited by: $Author: poth $
069:         * 
070:         * @version $Revision: 6251 $, $Date: 2007-03-19 16:59:28 +0100 (Mo, 19 Mrz 2007) $
071:         */
072:        public class AuthenticationDocument extends XMLFragment {
073:
074:            private static final long serialVersionUID = 9122355584178027980L;
075:
076:            private static NamespaceContext nsc = CommonNamespaces
077:                    .getNamespaceContext();
078:
079:            /**
080:             * 
081:             * 
082:             */
083:            public AuthenticationDocument() {
084:                super ();
085:            }
086:
087:            /**
088:             * 
089:             * @param doc
090:             * @param systemId
091:             * @throws MalformedURLException
092:             */
093:            public AuthenticationDocument(Document doc, String systemId)
094:                    throws MalformedURLException {
095:                super (doc, systemId);
096:            }
097:
098:            /**
099:             * 
100:             * @param element
101:             */
102:            public AuthenticationDocument(Element element) {
103:                super (element);
104:            }
105:
106:            /**
107:             * 
108:             * @param file
109:             * @throws MalformedURLException
110:             * @throws IOException
111:             * @throws SAXException
112:             */
113:            public AuthenticationDocument(File file)
114:                    throws MalformedURLException, IOException, SAXException {
115:                super (file);
116:            }
117:
118:            /**
119:             * 
120:             * @param elementName
121:             */
122:            public AuthenticationDocument(QualifiedName elementName) {
123:                super (elementName);
124:            }
125:
126:            /**
127:             * 
128:             * @param reader
129:             * @param systemId
130:             * @throws SAXException
131:             * @throws IOException
132:             */
133:            public AuthenticationDocument(Reader reader, String systemId)
134:                    throws SAXException, IOException {
135:                super (reader, systemId);
136:            }
137:
138:            /**
139:             * 
140:             * @param url
141:             * @throws IOException
142:             * @throws SAXException
143:             */
144:            public AuthenticationDocument(URL url) throws IOException,
145:                    SAXException {
146:                super (url);
147:            }
148:
149:            /**
150:             * parses the authentications document and returns the content as an
151:             * instance of {@link Authentications}
152:             * @return new Authentications object
153:             * @throws XMLParsingException
154:             */
155:            public Authentications createAuthentications()
156:                    throws XMLParsingException {
157:
158:                List<Node> methodNodes = XMLTools.getNodes(getRootElement(),
159:                        "//Method", nsc);
160:                List<AbstractAuthentication> authentications = new ArrayList<AbstractAuthentication>();
161:                for (Node node : methodNodes) {
162:                    String name = XMLTools.getRequiredNodeAsString(node,
163:                            "./@name", nsc);
164:                    String className = XMLTools.getRequiredNodeAsString(node,
165:                            "./class/text()", nsc);
166:
167:                    // parameter type for map of init-params and authentication name
168:                    Class[] cl = new Class[2];
169:                    cl[0] = String.class;
170:                    cl[1] = Map.class;
171:
172:                    // set parameter to submitt to the constructor
173:                    Object[] o = new Object[2];
174:                    o[0] = name;
175:                    o[1] = createInitParams(node);
176:
177:                    try {
178:                        Class clzz = Class.forName(className);
179:                        Constructor con = clzz.getConstructor(cl);
180:                        authentications.add((AbstractAuthentication) con
181:                                .newInstance(o));
182:                    } catch (Exception e) {
183:                        throw new InvalidParameterValueException(
184:                                e.getMessage(), "class", className);
185:                    }
186:                }
187:                return new Authentications(authentications);
188:            }
189:
190:            /**
191:             * 
192:             * @param methodNode
193:             * @return
194:             * @throws XMLParsingException
195:             */
196:            private Map<String, String> createInitParams(Node methodNode)
197:                    throws XMLParsingException {
198:                List<Node> nodes = XMLTools.getNodes(methodNode,
199:                        "./init-param", nsc);
200:                Map<String, String> map = new HashMap<String, String>();
201:                for (Node node : nodes) {
202:                    String name = XMLTools.getRequiredNodeAsString(node,
203:                            "./name/text()", nsc);
204:                    String value = XMLTools.getRequiredNodeAsString(node,
205:                            "./value/text()", nsc);
206:                    map.put(name, value);
207:                }
208:                return map;
209:            }
210:
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.