Source Code Cross Referenced for PageSecurityImpl.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » om » page » impl » 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 » jetspeed 2.1.3 » org.apache.jetspeed.om.page.impl 
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.jetspeed.om.page.impl;
018:
019:        import java.util.HashMap;
020:        import java.util.Iterator;
021:        import java.util.List;
022:        import java.util.Map;
023:
024:        import org.apache.jetspeed.om.common.SecurityConstraint;
025:        import org.apache.jetspeed.om.page.PageSecurity;
026:        import org.apache.jetspeed.om.page.SecurityConstraintsDef;
027:        import org.apache.jetspeed.page.document.impl.DocumentImpl;
028:        import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
029:
030:        /**
031:         * PageSecurityImpl
032:         *
033:         * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
034:         * @version $Id$
035:         */
036:        public class PageSecurityImpl extends DocumentImpl implements 
037:                PageSecurity {
038:            private List constraintsDefs;
039:            private List globalConstraintsRefs;
040:
041:            private PageSecurityConstraintsDefList securityConstraintsDefs;
042:            private Map securityConstraintsDefsMap;
043:            private PageSecurityConstraintsRefList globalSecurityConstraintsRefs;
044:
045:            public PageSecurityImpl() {
046:                super (null);
047:            }
048:
049:            /**
050:             * accessConstraintsDefs
051:             *
052:             * Access mutable persistent collection member for List wrappers.
053:             *
054:             * @return persistent collection
055:             */
056:            List accessConstraintsDefs() {
057:                // create initial collection if necessary
058:                if (constraintsDefs == null) {
059:                    constraintsDefs = DatabasePageManagerUtils.createList();
060:                }
061:                return constraintsDefs;
062:            }
063:
064:            /**
065:             * accessGlobalConstraintsRefs
066:             *
067:             * Access mutable persistent collection member for List wrappers.
068:             *
069:             * @return persistent collection
070:             */
071:            List accessGlobalConstraintsRefs() {
072:                // create initial collection if necessary
073:                if (globalConstraintsRefs == null) {
074:                    globalConstraintsRefs = DatabasePageManagerUtils
075:                            .createList();
076:                }
077:                return globalConstraintsRefs;
078:            }
079:
080:            /**
081:             * clearSecurityConstraintsDefsMap
082:             *
083:             * Clear previously cached security constraints definitions map.
084:             */
085:            synchronized void clearSecurityConstraintsDefsMap() {
086:                securityConstraintsDefsMap = null;
087:            }
088:
089:            /* (non-Javadoc)
090:             * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
091:             */
092:            public SecurityConstraint newSecurityConstraint() {
093:                // return specific security constraint definition instance
094:                return new PageSecuritySecurityConstraintImpl();
095:            }
096:
097:            /* (non-Javadoc)
098:             * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDefs()
099:             */
100:            public List getSecurityConstraintsDefs() {
101:                // return mutable constraints defs list
102:                // by using list wrapper to manage
103:                // element uniqueness
104:                if (securityConstraintsDefs == null) {
105:                    securityConstraintsDefs = new PageSecurityConstraintsDefList(
106:                            this );
107:                }
108:                return securityConstraintsDefs;
109:            }
110:
111:            /* (non-Javadoc)
112:             * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsDef()
113:             */
114:            public SecurityConstraintsDef newSecurityConstraintsDef() {
115:                // return specific security constraints definition instance
116:                return new SecurityConstraintsDefImpl();
117:            }
118:
119:            /* (non-Javadoc)
120:             * @see org.apache.jetspeed.om.page.PageSecurity#setSecurityConstraintsDefs(java.util.List)
121:             */
122:            public void setSecurityConstraintsDefs(List definitions) {
123:                // set constraints defs by replacing existing
124:                // entries with new elements if new collection
125:                // is specified
126:                List securityConstraintsDefs = getSecurityConstraintsDefs();
127:                if (definitions != securityConstraintsDefs) {
128:                    // replace all constraints definitions
129:                    securityConstraintsDefs.clear();
130:                    if (definitions != null) {
131:                        securityConstraintsDefs.addAll(definitions);
132:                    }
133:                }
134:                // clear cached security constraints definition map
135:                clearSecurityConstraintsDefsMap();
136:            }
137:
138:            /* (non-Javadoc)
139:             * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDef(java.lang.String)
140:             */
141:            public synchronized SecurityConstraintsDef getSecurityConstraintsDef(
142:                    String name) {
143:                // build and cache security constraints definitions
144:                // map if necessary upon realization or after modification
145:                if ((getSecurityConstraintsDefs() != null)
146:                        && (securityConstraintsDefsMap == null)) {
147:                    securityConstraintsDefsMap = new HashMap(
148:                            (getSecurityConstraintsDefs().size() * 2) + 1);
149:                    Iterator definitionsIter = getSecurityConstraintsDefs()
150:                            .iterator();
151:                    while (definitionsIter.hasNext()) {
152:                        SecurityConstraintsDef definition = (SecurityConstraintsDef) definitionsIter
153:                                .next();
154:                        String definitionName = definition.getName();
155:                        if (!securityConstraintsDefsMap
156:                                .containsKey(definitionName)) {
157:                            securityConstraintsDefsMap.put(definitionName,
158:                                    definition);
159:                        }
160:                    }
161:                }
162:                // lookup constraints definition using cached map 
163:                if (securityConstraintsDefsMap != null) {
164:                    return (SecurityConstraintsDef) securityConstraintsDefsMap
165:                            .get(name);
166:                }
167:                return null;
168:            }
169:
170:            /* (non-Javadoc)
171:             * @see org.apache.jetspeed.om.page.PageSecurity#getGlobalSecurityConstraintsRefs()
172:             */
173:            public List getGlobalSecurityConstraintsRefs() {
174:                // return mutable constraints refs list
175:                // by using list wrapper to manage apply
176:                // order and element uniqueness
177:                if (globalSecurityConstraintsRefs == null) {
178:                    globalSecurityConstraintsRefs = new PageSecurityConstraintsRefList(
179:                            this );
180:                }
181:                return globalSecurityConstraintsRefs;
182:            }
183:
184:            /* (non-Javadoc)
185:             * @see org.apache.jetspeed.om.page.PageSecurity#setGlobalSecurityConstraintsRefs(java.util.List)
186:             */
187:            public void setGlobalSecurityConstraintsRefs(List constraintsRefs) {
188:                // set constraints refs using ordered ref
189:                // names by replacing existing entries with
190:                // new elements if new collection is specified
191:                List globalSecurityConstraintsRefs = getGlobalSecurityConstraintsRefs();
192:                if (constraintsRefs != globalSecurityConstraintsRefs) {
193:                    // replace all constraints ref names
194:                    globalSecurityConstraintsRefs.clear();
195:                    if (constraintsRefs != null) {
196:                        globalSecurityConstraintsRefs.addAll(constraintsRefs);
197:                    }
198:                }
199:            }
200:
201:            /* (non-Javadoc)
202:             * @see org.apache.jetspeed.page.document.Node#getType()
203:             */
204:            public String getType() {
205:                return DOCUMENT_TYPE;
206:            }
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.