Source Code Cross Referenced for TurbineRole.java in  » Project-Management » turbine » org » apache » turbine » om » 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 » Project Management » turbine » org.apache.turbine.om.security 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.om.security;
002:
003:        /*
004:         * Copyright 2001-2005 The Apache Software Foundation.
005:         *
006:         * Licensed under the Apache License, Version 2.0 (the "License")
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         *
010:         *     http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         */
018:
019:        import java.sql.Connection;
020:        import java.util.Iterator;
021:
022:        import org.apache.turbine.services.security.TurbineSecurity;
023:        import org.apache.turbine.util.security.PermissionSet;
024:        import org.apache.turbine.util.security.TurbineSecurityException;
025:
026:        /**
027:         * This class represents a role played by the User associated with the
028:         * current Session.
029:         *
030:         * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
031:         * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
032:         * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
033:         * @version $Id: TurbineRole.java 278822 2005-09-05 19:53:05Z henning $
034:         */
035:        public class TurbineRole extends SecurityObject implements  Role {
036:            /** Serial Version UID */
037:            private static final long serialVersionUID = -1354408789347969126L;
038:
039:            /**
040:             * Constructs a new Role
041:             */
042:            public TurbineRole() {
043:                super ();
044:            }
045:
046:            /**
047:             * Constructs a new Role with the sepcified name.
048:             *
049:             * @param name The name of the new object.
050:             */
051:            public TurbineRole(String name) {
052:                super (name);
053:            }
054:
055:            /** The permissions for this role. */
056:            private PermissionSet permissionSet = null;
057:
058:            /**
059:             * Returns the set of Permissions associated with this Role.
060:             *
061:             * @return A PermissionSet.
062:             * @exception Exception a generic exception.
063:             */
064:            public PermissionSet getPermissions() throws Exception {
065:                return permissionSet;
066:            }
067:
068:            /**
069:             * Sets the Permissions associated with this Role.
070:             *
071:             * @param permissionSet A PermissionSet.
072:             */
073:            public void setPermissions(PermissionSet permissionSet) {
074:                this .permissionSet = permissionSet;
075:            }
076:
077:            // These following methods are wrappers around TurbineSecurity
078:
079:            /**
080:             * Creates a new Role in the system.
081:             *
082:             * @param name The name of the new Role.
083:             * @return An object representing the new Role.
084:             * @throws TurbineSecurityException if the Role could not be created.
085:             */
086:            public Role create(String name) throws TurbineSecurityException {
087:                //Role role = new Role(name);
088:                Role role = new TurbineRole(name);
089:                TurbineSecurity.addRole(role);
090:                return role;
091:            }
092:
093:            /**
094:             * Makes changes made to the Role attributes permanent.
095:             *
096:             * @throws TurbineSecurityException if there is a problem while
097:             *  saving data.
098:             */
099:            public void save() throws TurbineSecurityException {
100:                TurbineSecurity.saveRole(this );
101:            }
102:
103:            /**
104:             * not implemented
105:             *
106:             * @param conn
107:             * @throws Exception
108:             */
109:            public void save(Connection conn) throws Exception {
110:                throw new Exception("not implemented");
111:            }
112:
113:            /**
114:             * not implemented
115:             *
116:             * @param dbname
117:             * @throws Exception
118:             */
119:            public void save(String dbname) throws Exception {
120:                throw new Exception("not implemented");
121:            }
122:
123:            /**
124:             * Removes a role from the system.
125:             *
126:             * @throws TurbineSecurityException if the Role could not be removed.
127:             */
128:            public void remove() throws TurbineSecurityException {
129:                TurbineSecurity.removeRole(this );
130:            }
131:
132:            /**
133:             * Renames the role.
134:             *
135:             * @param name The new Role name.
136:             * @throws TurbineSecurityException if the Role could not be renamed.
137:             */
138:            public void rename(String name) throws TurbineSecurityException {
139:                TurbineSecurity.renameRole(this , name);
140:            }
141:
142:            /**
143:             * Grants a Permission to this Role.
144:             *
145:             * @param permission A Permission.
146:             * @throws TurbineSecurityException if there is a problem while assigning
147:             * the Permission.
148:             */
149:            public void grant(Permission permission)
150:                    throws TurbineSecurityException {
151:                TurbineSecurity.grant(this , permission);
152:            }
153:
154:            /**
155:             * Grants Permissions from a PermissionSet to this Role.
156:             *
157:             * @param permissionSet A PermissionSet.
158:             * @throws TurbineSecurityException if there is a problem while assigning
159:             * the Permissions.
160:             */
161:            public void grant(PermissionSet permissionSet)
162:                    throws TurbineSecurityException {
163:                for (Iterator permissions = permissionSet.iterator(); permissions
164:                        .hasNext();) {
165:                    TurbineSecurity
166:                            .grant(this , (Permission) permissions.next());
167:                }
168:            }
169:
170:            /**
171:             * Revokes a Permission from this Role.
172:             *
173:             * @param permission A Permission.
174:             * @throws TurbineSecurityException if there is a problem while unassigning
175:             * the Permission.
176:             */
177:            public void revoke(Permission permission)
178:                    throws TurbineSecurityException {
179:                TurbineSecurity.revoke(this , permission);
180:            }
181:
182:            /**
183:             * Revokes Permissions from a PermissionSet from this Role.
184:             *
185:             * @param permissionSet A PermissionSet.
186:             * @throws TurbineSecurityException if there is a problem while unassigning
187:             * the Permissions.
188:             */
189:            public void revoke(PermissionSet permissionSet)
190:                    throws TurbineSecurityException {
191:                for (Iterator permissions = permissionSet.iterator(); permissions
192:                        .hasNext();) {
193:                    TurbineSecurity.revoke(this , (Permission) permissions
194:                            .next());
195:                }
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.