Source Code Cross Referenced for AuthorizationService.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » services » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.services 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2001 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.services;
007:
008:        import java.io.IOException;
009:        import java.util.Properties;
010:
011:        import org.apache.commons.logging.Log;
012:        import org.apache.commons.logging.LogFactory;
013:        import org.jasig.portal.AuthorizationException;
014:        import org.jasig.portal.groups.GroupsException;
015:        import org.jasig.portal.groups.IGroupMember;
016:        import org.jasig.portal.security.IAuthorizationPrincipal;
017:        import org.jasig.portal.security.IAuthorizationService;
018:        import org.jasig.portal.security.IAuthorizationServiceFactory;
019:        import org.jasig.portal.security.IPermission;
020:        import org.jasig.portal.security.IPermissionManager;
021:        import org.jasig.portal.security.IUpdatingPermissionManager;
022:        import org.jasig.portal.security.PortalSecurityException;
023:
024:        /**
025:         * @author Bernie Durfee, bdurfee@interactivebusiness.com
026:         * @author Dan Ellentuck
027:         * @version $Revision: 34797 $
028:         */
029:        public class AuthorizationService {
030:
031:            private static final Log log = LogFactory
032:                    .getLog(AuthorizationService.class);
033:
034:            private static AuthorizationService m_instance;
035:            protected IAuthorizationService m_authorization = null;
036:            protected static String s_factoryName = null;
037:            protected static IAuthorizationServiceFactory m_Factory = null;
038:
039:            static {
040:                // Get the security properties file
041:                java.io.InputStream secprops = AuthorizationService.class
042:                        .getResourceAsStream("/properties/security.properties");
043:                // Get the properties from the security properties file
044:                Properties pr = new Properties();
045:                try {
046:                    pr.load(secprops);
047:                    secprops.close();
048:                    // Look for our authorization factory and instantiate an instance of it or die trying.
049:                    if ((s_factoryName = pr
050:                            .getProperty("authorizationProvider")) == null) {
051:                        log
052:                                .error(
053:                                        "AuthorizationProvider not specified or incorrect in security.properties",
054:                                        new PortalSecurityException(
055:                                                "AuthorizationProvider not specified or incorrect in security.properties"));
056:                    } else {
057:                        try {
058:                            m_Factory = (IAuthorizationServiceFactory) Class
059:                                    .forName(s_factoryName).newInstance();
060:                        } catch (Exception e) {
061:                            log.error("Failed to instantiate " + s_factoryName,
062:                                    new PortalSecurityException(
063:                                            "Failed to instantiate "
064:                                                    + s_factoryName));
065:                        }
066:                    }
067:                } catch (IOException e) {
068:                    log.error("Error loading security properties", e);
069:                } finally {
070:                    try {
071:                        if (secprops != null)
072:                            secprops.close();
073:                    } catch (IOException ioe) {
074:                        log.error("Error closing security properties file.",
075:                                ioe);
076:                    }
077:                }
078:            }
079:
080:            /**
081:             *  
082:             */
083:            private AuthorizationService() throws AuthorizationException {
084:                // From our factory get an actual authorization instance
085:                m_authorization = m_Factory.getAuthorization();
086:            }
087:
088:            /**
089:             * @return org.jasig.portal.groups.IGroupMember
090:             * @param principal IAuthorizationPrincipal
091:             * @exception org.jasig.portal.groups.GroupsException
092:             */
093:            public IGroupMember getGroupMember(IAuthorizationPrincipal principal)
094:                    throws GroupsException {
095:                return m_authorization.getGroupMember(principal);
096:            }
097:
098:            /**
099:             * @return Authorization
100:             */
101:            public final static synchronized AuthorizationService instance()
102:                    throws AuthorizationException {
103:                if (m_instance == null) {
104:                    m_instance = new AuthorizationService();
105:                }
106:                return m_instance;
107:            }
108:
109:            /**
110:             * @param owner java.lang.String
111:             * @return org.jasig.portal.security.IPermissionManager
112:             * @exception org.jasig.portal.AuthorizationException
113:             */
114:            public IPermissionManager newPermissionManager(String owner)
115:                    throws AuthorizationException {
116:                return m_authorization.newPermissionManager(owner);
117:            }
118:
119:            /**
120:             * @param key java.lang.String
121:             * @param type java.lang.Class
122:             * @return org.jasig.portal.security.IAuthorizationPrincipal
123:             * @exception org.jasig.portal.AuthorizationException
124:             */
125:            public IAuthorizationPrincipal newPrincipal(String key, Class type)
126:                    throws AuthorizationException {
127:                return m_authorization.newPrincipal(key, type);
128:            }
129:
130:            /**
131:             * @param groupMember
132:             * @return org.jasig.portal.security.IAuthorizationPrincipal
133:             * @exception org.jasig.portal.groups.GroupsException
134:             */
135:            public IAuthorizationPrincipal newPrincipal(IGroupMember groupMember)
136:                    throws GroupsException {
137:                return m_authorization.newPrincipal(groupMember);
138:            }
139:
140:            /**
141:             * @param permission
142:             * @return org.jasig.portal.security.IAuthorizationPrincipal
143:             * @exception org.jasig.portal.AuthorizationException
144:             */
145:            public IAuthorizationPrincipal newPrincipal(IPermission permission)
146:                    throws AuthorizationException {
147:                return m_authorization.getPrincipal(permission);
148:            }
149:
150:            /**
151:             * @param owner java.lang.String
152:             * @return org.jasig.portal.security.IUpdatingPermissionManager
153:             * @exception org.jasig.portal.AuthorizationException
154:             */
155:            public IUpdatingPermissionManager newUpdatingPermissionManager(
156:                    String owner) throws AuthorizationException {
157:                return m_authorization.newUpdatingPermissionManager(owner);
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.