Source Code Cross Referenced for DatabasePageManager.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » 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.page.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Licensed to the Apache Software Foundation (ASF) under one or more
0003:         * contributor license agreements.  See the NOTICE file distributed with
0004:         * this work for additional information regarding copyright ownership.
0005:         * The ASF licenses this file to You under the Apache License, Version 2.0
0006:         * (the "License"); you may not use this file except in compliance with
0007:         * the License.  You may obtain a copy of the License at
0008:         * 
0009:         *      http://www.apache.org/licenses/LICENSE-2.0
0010:         * 
0011:         * Unless required by applicable law or agreed to in writing, software
0012:         * distributed under the License is distributed on an "AS IS" BASIS,
0013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014:         * See the License for the specific language governing permissions and
0015:         * limitations under the License.
0016:         */
0017:        package org.apache.jetspeed.page.impl;
0018:
0019:        import java.util.Collection;
0020:        import java.util.HashMap;
0021:        import java.util.Iterator;
0022:        import java.util.List;
0023:        import java.util.Map;
0024:
0025:        import javax.security.auth.Subject;
0026:
0027:        import org.apache.jetspeed.JetspeedActions;
0028:        import org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport;
0029:        import org.apache.jetspeed.om.common.SecurityConstraint;
0030:        import org.apache.jetspeed.om.common.SecurityConstraints;
0031:        import org.apache.jetspeed.om.folder.Folder;
0032:        import org.apache.jetspeed.om.folder.FolderNotFoundException;
0033:        import org.apache.jetspeed.om.folder.InvalidFolderException;
0034:        import org.apache.jetspeed.om.folder.MenuDefinition;
0035:        import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
0036:        import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
0037:        import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
0038:        import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
0039:        import org.apache.jetspeed.om.folder.impl.FolderImpl;
0040:        import org.apache.jetspeed.om.folder.impl.FolderMenuDefinitionImpl;
0041:        import org.apache.jetspeed.om.folder.impl.FolderMenuExcludeDefinitionImpl;
0042:        import org.apache.jetspeed.om.folder.impl.FolderMenuIncludeDefinitionImpl;
0043:        import org.apache.jetspeed.om.folder.impl.FolderMenuOptionsDefinitionImpl;
0044:        import org.apache.jetspeed.om.folder.impl.FolderMenuSeparatorDefinitionImpl;
0045:        import org.apache.jetspeed.om.folder.impl.FolderSecurityConstraintImpl;
0046:        import org.apache.jetspeed.om.page.ContentPage;
0047:        import org.apache.jetspeed.om.page.ContentPageImpl;
0048:        import org.apache.jetspeed.om.page.Fragment;
0049:        import org.apache.jetspeed.om.page.Link;
0050:        import org.apache.jetspeed.om.page.Page;
0051:        import org.apache.jetspeed.om.page.PageSecurity;
0052:        import org.apache.jetspeed.om.page.SecurityConstraintsDef;
0053:        import org.apache.jetspeed.om.page.impl.FragmentImpl;
0054:        import org.apache.jetspeed.om.page.impl.FragmentPreferenceImpl;
0055:        import org.apache.jetspeed.om.page.impl.FragmentSecurityConstraintImpl;
0056:        import org.apache.jetspeed.om.page.impl.LinkImpl;
0057:        import org.apache.jetspeed.om.page.impl.LinkSecurityConstraintImpl;
0058:        import org.apache.jetspeed.om.page.impl.PageImpl;
0059:        import org.apache.jetspeed.om.page.impl.PageMenuDefinitionImpl;
0060:        import org.apache.jetspeed.om.page.impl.PageMenuExcludeDefinitionImpl;
0061:        import org.apache.jetspeed.om.page.impl.PageMenuIncludeDefinitionImpl;
0062:        import org.apache.jetspeed.om.page.impl.PageMenuOptionsDefinitionImpl;
0063:        import org.apache.jetspeed.om.page.impl.PageMenuSeparatorDefinitionImpl;
0064:        import org.apache.jetspeed.om.page.impl.PageSecurityConstraintImpl;
0065:        import org.apache.jetspeed.om.page.impl.PageSecurityImpl;
0066:        import org.apache.jetspeed.om.page.impl.PageSecuritySecurityConstraintImpl;
0067:        import org.apache.jetspeed.om.page.impl.SecurityConstraintsDefImpl;
0068:        import org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl;
0069:        import org.apache.jetspeed.om.preference.FragmentPreference;
0070:        import org.apache.jetspeed.page.DelegatingPageManager;
0071:        import org.apache.jetspeed.page.FolderNotRemovedException;
0072:        import org.apache.jetspeed.page.FolderNotUpdatedException;
0073:        import org.apache.jetspeed.page.LinkNotRemovedException;
0074:        import org.apache.jetspeed.page.LinkNotUpdatedException;
0075:        import org.apache.jetspeed.page.PageManager;
0076:        import org.apache.jetspeed.page.PageManagerEventListener;
0077:        import org.apache.jetspeed.page.PageManagerSecurityUtils;
0078:        import org.apache.jetspeed.page.PageManagerUtils;
0079:        import org.apache.jetspeed.page.PageNotFoundException;
0080:        import org.apache.jetspeed.page.PageNotRemovedException;
0081:        import org.apache.jetspeed.page.PageNotUpdatedException;
0082:        import org.apache.jetspeed.page.document.DocumentException;
0083:        import org.apache.jetspeed.page.document.DocumentNotFoundException;
0084:        import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
0085:        import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
0086:        import org.apache.jetspeed.page.document.NodeException;
0087:        import org.apache.jetspeed.page.document.NodeSet;
0088:        import org.apache.jetspeed.page.document.impl.NodeImpl;
0089:        import org.apache.ojb.broker.core.proxy.ProxyHelper;
0090:        import org.apache.ojb.broker.query.Criteria;
0091:        import org.apache.ojb.broker.query.QueryByCriteria;
0092:        import org.apache.ojb.broker.query.QueryFactory;
0093:
0094:        /**
0095:         * DatabasePageManager
0096:         * 
0097:         * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
0098:         * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
0099:         * @version $Id: $
0100:         */
0101:        public class DatabasePageManager extends
0102:                InitablePersistenceBrokerDaoSupport implements  PageManager {
0103:            private static final int DEFAULT_CACHE_SIZE = 128;
0104:            private static final int MIN_CACHE_EXPIRES_SECONDS = 30;
0105:            private static final int DEFAULT_CACHE_EXPIRES_SECONDS = 150;
0106:
0107:            private static Map modelClasses = new HashMap();
0108:            static {
0109:                modelClasses.put("FragmentImpl", FragmentImpl.class);
0110:                modelClasses.put("PageImpl", PageImpl.class);
0111:                modelClasses.put("FolderImpl", FolderImpl.class);
0112:                modelClasses.put("LinkImpl", LinkImpl.class);
0113:                modelClasses.put("PageSecurityImpl", PageSecurityImpl.class);
0114:                modelClasses.put("FolderMenuDefinitionImpl",
0115:                        FolderMenuDefinitionImpl.class);
0116:                modelClasses.put("FolderMenuExcludeDefinitionImpl",
0117:                        FolderMenuExcludeDefinitionImpl.class);
0118:                modelClasses.put("FolderMenuIncludeDefinitionImpl",
0119:                        FolderMenuIncludeDefinitionImpl.class);
0120:                modelClasses.put("FolderMenuOptionsDefinitionImpl",
0121:                        FolderMenuOptionsDefinitionImpl.class);
0122:                modelClasses.put("FolderMenuSeparatorDefinitionImpl",
0123:                        FolderMenuSeparatorDefinitionImpl.class);
0124:                modelClasses.put("PageMenuDefinitionImpl",
0125:                        PageMenuDefinitionImpl.class);
0126:                modelClasses.put("PageMenuExcludeDefinitionImpl",
0127:                        PageMenuExcludeDefinitionImpl.class);
0128:                modelClasses.put("PageMenuIncludeDefinitionImpl",
0129:                        PageMenuIncludeDefinitionImpl.class);
0130:                modelClasses.put("PageMenuOptionsDefinitionImpl",
0131:                        PageMenuOptionsDefinitionImpl.class);
0132:                modelClasses.put("PageMenuSeparatorDefinitionImpl",
0133:                        PageMenuSeparatorDefinitionImpl.class);
0134:                modelClasses.put("SecurityConstraintsImpl",
0135:                        SecurityConstraintsImpl.class);
0136:                modelClasses.put("FolderSecurityConstraintImpl",
0137:                        FolderSecurityConstraintImpl.class);
0138:                modelClasses.put("PageSecurityConstraintImpl",
0139:                        PageSecurityConstraintImpl.class);
0140:                modelClasses.put("FragmentSecurityConstraintImpl",
0141:                        FragmentSecurityConstraintImpl.class);
0142:                modelClasses.put("LinkSecurityConstraintImpl",
0143:                        LinkSecurityConstraintImpl.class);
0144:                modelClasses.put("PageSecuritySecurityConstraintImpl",
0145:                        PageSecuritySecurityConstraintImpl.class);
0146:                modelClasses.put("SecurityConstraintsDefImpl",
0147:                        SecurityConstraintsDefImpl.class);
0148:                modelClasses.put("FragmentPreferenceImpl",
0149:                        FragmentPreferenceImpl.class);
0150:            }
0151:
0152:            private DelegatingPageManager delegator;
0153:
0154:            private int cacheSize;
0155:
0156:            private int cacheExpiresSeconds;
0157:
0158:            private PageManager pageManagerProxy;
0159:
0160:            public DatabasePageManager(String repositoryPath, int cacheSize,
0161:                    int cacheExpiresSeconds, boolean isPermissionsSecurity,
0162:                    boolean isConstraintsSecurity) {
0163:                super (repositoryPath);
0164:                delegator = new DelegatingPageManager(isPermissionsSecurity,
0165:                        isConstraintsSecurity, modelClasses);
0166:                this .cacheSize = Math.max(cacheSize, DEFAULT_CACHE_SIZE);
0167:                if (cacheExpiresSeconds < 0) {
0168:                    this .cacheExpiresSeconds = DEFAULT_CACHE_EXPIRES_SECONDS;
0169:                } else if (cacheExpiresSeconds == 0) {
0170:                    this .cacheExpiresSeconds = 0;
0171:                } else {
0172:                    this .cacheExpiresSeconds = Math.max(cacheExpiresSeconds,
0173:                            MIN_CACHE_EXPIRES_SECONDS);
0174:                }
0175:                DatabasePageManagerCache.cacheInit(this );
0176:            }
0177:
0178:            /**
0179:             * getCacheSize
0180:             *
0181:             * @return configured cache size
0182:             */
0183:            public int getCacheSize() {
0184:                return cacheSize;
0185:            }
0186:
0187:            /**
0188:             * getCacheExpiresSeconds
0189:             *
0190:             * @return configured cache expiration in seconds
0191:             */
0192:            public int getCacheExpiresSeconds() {
0193:                return cacheExpiresSeconds;
0194:            }
0195:
0196:            /**
0197:             * getPageManagerProxy
0198:             *
0199:             * @return proxied page manager interface used to
0200:             *         inject into Folder instances to provide
0201:             *         transaction/interception
0202:             */
0203:            public PageManager getPageManagerProxy() {
0204:                return pageManagerProxy;
0205:            }
0206:
0207:            /**
0208:             * setPageManagerProxy
0209:             *
0210:             * @param proxy proxied page manager interface used to
0211:             *              inject into Folder instances to provide
0212:             *              transaction/interception
0213:             */
0214:            public void setPageManagerProxy(PageManager proxy) {
0215:                // set/reset page manager proxy and propagate to cache
0216:                if (pageManagerProxy != proxy) {
0217:                    pageManagerProxy = proxy;
0218:                    DatabasePageManagerCache.setPageManagerProxy(proxy);
0219:                }
0220:            }
0221:
0222:            /* (non-Javadoc)
0223:             * @see org.apache.jetspeed.page.PageManager#getConstraintsEnabled()
0224:             */
0225:            public boolean getConstraintsEnabled() {
0226:                return delegator.getConstraintsEnabled();
0227:            }
0228:
0229:            /* (non-Javadoc)
0230:             * @see org.apache.jetspeed.page.PageManager#getPermissionsEnabled()
0231:             */
0232:            public boolean getPermissionsEnabled() {
0233:                return delegator.getPermissionsEnabled();
0234:            }
0235:
0236:            /* (non-Javadoc)
0237:             * @see org.apache.jetspeed.page.PageManager#newPage(java.lang.String)
0238:             */
0239:            public Page newPage(String path) {
0240:                return delegator.newPage(path);
0241:            }
0242:
0243:            /* (non-Javadoc)
0244:             * @see org.apache.jetspeed.page.PageManager#newFolder(java.lang.String)
0245:             */
0246:            public Folder newFolder(String path) {
0247:                return delegator.newFolder(path);
0248:            }
0249:
0250:            /* (non-Javadoc)
0251:             * @see org.apache.jetspeed.page.PageManager#newLink(java.lang.String)
0252:             */
0253:            public Link newLink(String path) {
0254:                return delegator.newLink(path);
0255:            }
0256:
0257:            /* (non-Javadoc)
0258:             * @see org.apache.jetspeed.page.PageManager#newPageSecurity()
0259:             */
0260:            public PageSecurity newPageSecurity() {
0261:                return delegator.newPageSecurity();
0262:            }
0263:
0264:            /* (non-Javadoc)
0265:             * @see org.apache.jetspeed.page.PageManager#newFragment()
0266:             */
0267:            public Fragment newFragment() {
0268:                return delegator.newFragment();
0269:            }
0270:
0271:            /* (non-Javadoc)
0272:             * @see org.apache.jetspeed.page.PageManager#newPortletFragment()
0273:             */
0274:            public Fragment newPortletFragment() {
0275:                return delegator.newPortletFragment();
0276:            }
0277:
0278:            /* (non-Javadoc)
0279:             * @see org.apache.jetspeed.page.PageManager#newFolderMenuDefinition()
0280:             */
0281:            public MenuDefinition newFolderMenuDefinition() {
0282:                return delegator.newFolderMenuDefinition();
0283:            }
0284:
0285:            /* (non-Javadoc)
0286:             * @see org.apache.jetspeed.page.PageManager#newFolderMenuExcludeDefinition()
0287:             */
0288:            public MenuExcludeDefinition newFolderMenuExcludeDefinition() {
0289:                return delegator.newFolderMenuExcludeDefinition();
0290:            }
0291:
0292:            /* (non-Javadoc)
0293:             * @see org.apache.jetspeed.page.PageManager#newFolderMenuIncludeDefinition()
0294:             */
0295:            public MenuIncludeDefinition newFolderMenuIncludeDefinition() {
0296:                return delegator.newFolderMenuIncludeDefinition();
0297:            }
0298:
0299:            /* (non-Javadoc)
0300:             * @see org.apache.jetspeed.page.PageManager#newFolderMenuOptionsDefinition()
0301:             */
0302:            public MenuOptionsDefinition newFolderMenuOptionsDefinition() {
0303:                return delegator.newFolderMenuOptionsDefinition();
0304:            }
0305:
0306:            /* (non-Javadoc)
0307:             * @see org.apache.jetspeed.page.PageManager#newFolderMenuSeparatorDefinition()
0308:             */
0309:            public MenuSeparatorDefinition newFolderMenuSeparatorDefinition() {
0310:                return delegator.newFolderMenuSeparatorDefinition();
0311:            }
0312:
0313:            /* (non-Javadoc)
0314:             * @see org.apache.jetspeed.page.PageManager#newPageMenuDefinition()
0315:             */
0316:            public MenuDefinition newPageMenuDefinition() {
0317:                return delegator.newPageMenuDefinition();
0318:            }
0319:
0320:            /* (non-Javadoc)
0321:             * @see org.apache.jetspeed.page.PageManager#newPageMenuExcludeDefinition()
0322:             */
0323:            public MenuExcludeDefinition newPageMenuExcludeDefinition() {
0324:                return delegator.newPageMenuExcludeDefinition();
0325:            }
0326:
0327:            /* (non-Javadoc)
0328:             * @see org.apache.jetspeed.page.PageManager#newPageMenuIncludeDefinition()
0329:             */
0330:            public MenuIncludeDefinition newPageMenuIncludeDefinition() {
0331:                return delegator.newPageMenuIncludeDefinition();
0332:            }
0333:
0334:            /* (non-Javadoc)
0335:             * @see org.apache.jetspeed.page.PageManager#newPageMenuOptionsDefinition()
0336:             */
0337:            public MenuOptionsDefinition newPageMenuOptionsDefinition() {
0338:                return delegator.newPageMenuOptionsDefinition();
0339:            }
0340:
0341:            /* (non-Javadoc)
0342:             * @see org.apache.jetspeed.page.PageManager#newPageMenuSeparatorDefinition()
0343:             */
0344:            public MenuSeparatorDefinition newPageMenuSeparatorDefinition() {
0345:                return delegator.newPageMenuSeparatorDefinition();
0346:            }
0347:
0348:            /* (non-Javadoc)
0349:             * @see org.apache.jetspeed.page.PageManager#newSecurityConstraints()
0350:             */
0351:            public SecurityConstraints newSecurityConstraints() {
0352:                return delegator.newSecurityConstraints();
0353:            }
0354:
0355:            /* (non-Javadoc)
0356:             * @see org.apache.jetspeed.page.PageManager#newFolderSecurityConstraint()
0357:             */
0358:            public SecurityConstraint newFolderSecurityConstraint() {
0359:                return delegator.newFolderSecurityConstraint();
0360:            }
0361:
0362:            /* (non-Javadoc)
0363:             * @see org.apache.jetspeed.page.PageManager#newPageSecurityConstraint()
0364:             */
0365:            public SecurityConstraint newPageSecurityConstraint() {
0366:                return delegator.newPageSecurityConstraint();
0367:            }
0368:
0369:            /* (non-Javadoc)
0370:             * @see org.apache.jetspeed.page.PageManager#newFragmentSecurityConstraint()
0371:             */
0372:            public SecurityConstraint newFragmentSecurityConstraint() {
0373:                return delegator.newFragmentSecurityConstraint();
0374:            }
0375:
0376:            /* (non-Javadoc)
0377:             * @see org.apache.jetspeed.page.PageManager#newLinkSecurityConstraint()
0378:             */
0379:            public SecurityConstraint newLinkSecurityConstraint() {
0380:                return delegator.newLinkSecurityConstraint();
0381:            }
0382:
0383:            /* (non-Javadoc)
0384:             * @see org.apache.jetspeed.page.PageManager#newPageSecuritySecurityConstraint()
0385:             */
0386:            public SecurityConstraint newPageSecuritySecurityConstraint() {
0387:                return delegator.newPageSecuritySecurityConstraint();
0388:            }
0389:
0390:            /* (non-Javadoc)
0391:             * @see org.apache.jetspeed.page.PageManager#newSecurityConstraintsDef()
0392:             */
0393:            public SecurityConstraintsDef newSecurityConstraintsDef() {
0394:                return delegator.newSecurityConstraintsDef();
0395:            }
0396:
0397:            /* (non-Javadoc)
0398:             * @see org.apache.jetspeed.page.PageManager#newFragmentPreference()
0399:             */
0400:            public FragmentPreference newFragmentPreference() {
0401:                return delegator.newFragmentPreference();
0402:            }
0403:
0404:            /* (non-Javadoc)
0405:             * @see org.apache.jetspeed.page.PageManager#addListener(org.apache.jetspeed.page.PageManagerEventListener)
0406:             */
0407:            public void addListener(PageManagerEventListener listener) {
0408:                delegator.addListener(listener);
0409:            }
0410:
0411:            /* (non-Javadoc)
0412:             * @see org.apache.jetspeed.page.PageManager#removeListener(org.apache.jetspeed.page.PageManagerEventListener)
0413:             */
0414:            public void removeListener(PageManagerEventListener listener) {
0415:                delegator.removeListener(listener);
0416:            }
0417:
0418:            /* (non-Javadoc)
0419:             * @see org.apache.jetspeed.page.PageManager#reset()
0420:             */
0421:            public void reset() {
0422:                // propagate to delegator
0423:                delegator.reset();
0424:
0425:                // clear cache to force subsequent refreshs from persistent store
0426:                DatabasePageManagerCache.cacheClear();
0427:            }
0428:
0429:            /* (non-Javadoc)
0430:             * @see org.apache.jetspeed.page.PageManager#getPage(java.lang.String)
0431:             */
0432:            public Page getPage(String path) throws PageNotFoundException,
0433:                    NodeException {
0434:                // construct page attributes from path
0435:                path = NodeImpl.getCanonicalNodePath(path);
0436:
0437:                // optimized retrieval from cache by path if available
0438:                NodeImpl cachedNode = DatabasePageManagerCache
0439:                        .cacheLookup(path);
0440:                if (cachedNode instanceof  Page) {
0441:                    // check for view access on page
0442:                    cachedNode.checkAccess(JetspeedActions.VIEW);
0443:
0444:                    return (Page) cachedNode;
0445:                }
0446:
0447:                // retrieve page from database
0448:                try {
0449:                    Criteria filter = new Criteria();
0450:                    filter.addEqualTo("path", path);
0451:                    QueryByCriteria query = QueryFactory.newQuery(
0452:                            PageImpl.class, filter);
0453:                    Page page = (Page) getPersistenceBrokerTemplate()
0454:                            .getObjectByQuery(query);
0455:
0456:                    // return page or throw exception
0457:                    if (page == null) {
0458:                        throw new PageNotFoundException("Page " + path
0459:                                + " not found.");
0460:                    }
0461:
0462:                    // check for view access on page
0463:                    page.checkAccess(JetspeedActions.VIEW);
0464:
0465:                    return page;
0466:                } catch (PageNotFoundException pnfe) {
0467:                    throw pnfe;
0468:                } catch (SecurityException se) {
0469:                    throw se;
0470:                } catch (Exception e) {
0471:                    throw new PageNotFoundException("Page " + path
0472:                            + " not found.", e);
0473:                }
0474:            }
0475:
0476:            /* (non-Javadoc)
0477:             * @see org.apache.jetspeed.page.PageManager#getContentPage(java.lang.String)
0478:             */
0479:            public ContentPage getContentPage(String path)
0480:                    throws PageNotFoundException, NodeException {
0481:                // return proxied page
0482:                return new ContentPageImpl(getPage(path));
0483:            }
0484:
0485:            /* (non-Javadoc)
0486:             * @see org.apache.jetspeed.page.PageManager#getLink(java.lang.String)
0487:             */
0488:            public Link getLink(String path) throws DocumentNotFoundException,
0489:                    NodeException {
0490:                // construct link attributes from path
0491:                path = NodeImpl.getCanonicalNodePath(path);
0492:
0493:                // optimized retrieval from cache by path if available
0494:                NodeImpl cachedNode = DatabasePageManagerCache
0495:                        .cacheLookup(path);
0496:                if (cachedNode instanceof  Link) {
0497:                    // check for view access on link
0498:                    cachedNode.checkAccess(JetspeedActions.VIEW);
0499:
0500:                    return (Link) cachedNode;
0501:                }
0502:
0503:                // retrieve link from database
0504:                try {
0505:                    Criteria filter = new Criteria();
0506:                    filter.addEqualTo("path", path);
0507:                    QueryByCriteria query = QueryFactory.newQuery(
0508:                            LinkImpl.class, filter);
0509:                    Link link = (Link) getPersistenceBrokerTemplate()
0510:                            .getObjectByQuery(query);
0511:
0512:                    // return link or throw exception
0513:                    if (link == null) {
0514:                        throw new DocumentNotFoundException("Link " + path
0515:                                + " not found.");
0516:                    }
0517:
0518:                    // check for view access on link
0519:                    link.checkAccess(JetspeedActions.VIEW);
0520:
0521:                    return link;
0522:                } catch (DocumentNotFoundException dnfe) {
0523:                    throw dnfe;
0524:                } catch (SecurityException se) {
0525:                    throw se;
0526:                } catch (Exception e) {
0527:                    throw new DocumentNotFoundException("Link " + path
0528:                            + " not found.", e);
0529:                }
0530:            }
0531:
0532:            /**
0533:             * Given a securityConstraintName definition and a set of actions,
0534:             * run a security constraint checks
0535:             */
0536:            public boolean checkConstraint(String securityConstraintName,
0537:                    String actions) {
0538:                try {
0539:                    PageSecurity security = this .getPageSecurity();
0540:                    SecurityConstraintsDef def = security
0541:                            .getSecurityConstraintsDef(securityConstraintName);
0542:                    if (def != null) {
0543:                        return PageManagerSecurityUtils.checkConstraint(def,
0544:                                actions);
0545:                    }
0546:                } catch (Exception e) {
0547:                    e.printStackTrace();
0548:                }
0549:                return false;
0550:            }
0551:
0552:            /* (non-Javadoc)
0553:             * @see org.apache.jetspeed.page.PageManager#getPageSecurity()
0554:             */
0555:            public PageSecurity getPageSecurity()
0556:                    throws DocumentNotFoundException, NodeException {
0557:                // construct document attributes from path
0558:                String path = Folder.PATH_SEPARATOR
0559:                        + PageSecurity.DOCUMENT_TYPE;
0560:
0561:                // optimized retrieval from cache by path if available
0562:                NodeImpl cachedNode = DatabasePageManagerCache
0563:                        .cacheLookup(path);
0564:                if (cachedNode instanceof  PageSecurity) {
0565:                    // check for view access on document
0566:                    cachedNode.checkAccess(JetspeedActions.VIEW);
0567:
0568:                    return (PageSecurity) cachedNode;
0569:                }
0570:
0571:                // retrieve document from database
0572:                try {
0573:                    Criteria filter = new Criteria();
0574:                    filter.addEqualTo("path", path);
0575:                    QueryByCriteria query = QueryFactory.newQuery(
0576:                            PageSecurityImpl.class, filter);
0577:                    PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate()
0578:                            .getObjectByQuery(query);
0579:
0580:                    // return page or throw exception
0581:                    if (document == null) {
0582:                        throw new DocumentNotFoundException("Document " + path
0583:                                + " not found.");
0584:                    }
0585:
0586:                    // check for view access on document
0587:                    document.checkAccess(JetspeedActions.VIEW);
0588:
0589:                    return document;
0590:                } catch (DocumentNotFoundException dnfe) {
0591:                    throw dnfe;
0592:                } catch (SecurityException se) {
0593:                    throw se;
0594:                } catch (Exception e) {
0595:                    throw new DocumentNotFoundException("Document " + path
0596:                            + " not found.", e);
0597:                }
0598:            }
0599:
0600:            /* (non-Javadoc)
0601:             * @see org.apache.jetspeed.page.PageManager#getFolder(java.lang.String)
0602:             */
0603:            public Folder getFolder(String folderPath)
0604:                    throws FolderNotFoundException, InvalidFolderException,
0605:                    NodeException {
0606:                // construct folder attributes from path
0607:                folderPath = NodeImpl.getCanonicalNodePath(folderPath);
0608:
0609:                // optimized retrieval from cache by path if available
0610:                NodeImpl cachedNode = DatabasePageManagerCache
0611:                        .cacheLookup(folderPath);
0612:                if (cachedNode instanceof  Folder) {
0613:                    // check for view access on folder
0614:                    cachedNode.checkAccess(JetspeedActions.VIEW);
0615:
0616:                    return (Folder) cachedNode;
0617:                }
0618:
0619:                // retrieve folder from database
0620:                try {
0621:                    Criteria filter = new Criteria();
0622:                    filter.addEqualTo("path", folderPath);
0623:                    QueryByCriteria query = QueryFactory.newQuery(
0624:                            FolderImpl.class, filter);
0625:                    Folder folder = (Folder) getPersistenceBrokerTemplate()
0626:                            .getObjectByQuery(query);
0627:
0628:                    // return folder or throw exception
0629:                    if (folder == null) {
0630:                        throw new FolderNotFoundException("Folder "
0631:                                + folderPath + " not found.");
0632:                    }
0633:
0634:                    // check for view access on folder
0635:                    folder.checkAccess(JetspeedActions.VIEW);
0636:
0637:                    return folder;
0638:                } catch (FolderNotFoundException fnfe) {
0639:                    throw fnfe;
0640:                } catch (SecurityException se) {
0641:                    throw se;
0642:                } catch (Exception e) {
0643:                    throw new FolderNotFoundException("Folder " + folderPath
0644:                            + " not found.", e);
0645:                }
0646:            }
0647:
0648:            /* (non-Javadoc)
0649:             * @see org.apache.jetspeed.page.PageManager#getFolders(org.apache.jetspeed.om.folder.Folder)
0650:             */
0651:            public NodeSet getFolders(Folder folder) throws DocumentException {
0652:                FolderImpl folderImpl = (FolderImpl) folder;
0653:
0654:                // perform lookup of folder folders collection and cache in folder
0655:                try {
0656:                    // query for folders
0657:                    Criteria filter = new Criteria();
0658:                    filter.addEqualTo("parent", folderImpl.getId());
0659:                    QueryByCriteria query = QueryFactory.newQuery(
0660:                            FolderImpl.class, filter);
0661:                    Collection folders = getPersistenceBrokerTemplate()
0662:                            .getCollectionByQuery(query);
0663:
0664:                    // cache folders in folder
0665:                    folderImpl.accessFolders().clear();
0666:                    if (folders != null) {
0667:                        folderImpl.accessFolders().addAll(folders);
0668:                    }
0669:                    folderImpl.resetFolders(true);
0670:                } catch (Exception e) {
0671:                    // reset cache in folder
0672:                    folderImpl.resetFolders(false);
0673:                    throw new DocumentException(
0674:                            "Unable to access folders for folder "
0675:                                    + folder.getPath() + ".");
0676:                }
0677:
0678:                // folder folders cache populated, get folders from folder
0679:                // to provide packaging as filtered node set
0680:                return folder.getFolders();
0681:            }
0682:
0683:            /* (non-Javadoc)
0684:             * @see org.apache.jetspeed.page.PageManager#getFolder(org.apache.jetspeed.om.folder.Folder,java.lang.String)
0685:             */
0686:            public Folder getFolder(Folder folder, String name)
0687:                    throws FolderNotFoundException, DocumentException {
0688:                // perform lookup by path so that cache can be used
0689:                String folderPath = folder.getPath() + Folder.PATH_SEPARATOR
0690:                        + name;
0691:                try {
0692:                    return getFolder(folderPath);
0693:                } catch (FolderNotFoundException fnfe) {
0694:                    throw fnfe;
0695:                } catch (Exception e) {
0696:                    throw new FolderNotFoundException("Folder " + folderPath
0697:                            + " not found.", e);
0698:                }
0699:            }
0700:
0701:            /* (non-Javadoc)
0702:             * @see org.apache.jetspeed.page.PageManager#getPages(org.apache.jetspeed.om.folder.Folder)
0703:             */
0704:            public NodeSet getPages(Folder folder) throws NodeException {
0705:                FolderImpl folderImpl = (FolderImpl) folder;
0706:
0707:                // perform lookup of folder pages collection and cache in folder
0708:                try {
0709:                    // query for pages
0710:                    Criteria filter = new Criteria();
0711:                    filter.addEqualTo("parent", folderImpl.getId());
0712:                    QueryByCriteria query = QueryFactory.newQuery(
0713:                            PageImpl.class, filter);
0714:                    Collection pages = getPersistenceBrokerTemplate()
0715:                            .getCollectionByQuery(query);
0716:
0717:                    // cache pages in folder
0718:                    folderImpl.accessPages().clear();
0719:                    if (pages != null) {
0720:                        folderImpl.accessPages().addAll(pages);
0721:                    }
0722:                    folderImpl.resetPages(true);
0723:                } catch (Exception e) {
0724:                    // reset cache in folder
0725:                    folderImpl.resetPages(false);
0726:                    throw new NodeException(
0727:                            "Unable to access pages for folder "
0728:                                    + folder.getPath() + ".");
0729:                }
0730:
0731:                // folder pages cache populated, get pages from folder
0732:                // to provide packaging as filtered node set
0733:                return folder.getPages();
0734:            }
0735:
0736:            /* (non-Javadoc)
0737:             * @see org.apache.jetspeed.page.PageManager#getPage(org.apache.jetspeed.om.folder.Folder,java.lang.String)
0738:             */
0739:            public Page getPage(Folder folder, String name)
0740:                    throws PageNotFoundException, NodeException {
0741:                // perform lookup by path so that cache can be used
0742:                String pagePath = folder.getPath() + Folder.PATH_SEPARATOR
0743:                        + name;
0744:                try {
0745:                    return getPage(pagePath);
0746:                } catch (PageNotFoundException pnfe) {
0747:                    throw pnfe;
0748:                } catch (Exception e) {
0749:                    throw new PageNotFoundException("Page " + pagePath
0750:                            + " not found.", e);
0751:                }
0752:            }
0753:
0754:            /* (non-Javadoc)
0755:             * @see org.apache.jetspeed.page.PageManager#getLinks(org.apache.jetspeed.om.folder.Folder)
0756:             */
0757:            public NodeSet getLinks(Folder folder) throws NodeException {
0758:                FolderImpl folderImpl = (FolderImpl) folder;
0759:
0760:                // perform lookup of folder links collection and cache in folder
0761:                try {
0762:                    // query for links
0763:                    Criteria filter = new Criteria();
0764:                    filter.addEqualTo("parent", folderImpl.getId());
0765:                    QueryByCriteria query = QueryFactory.newQuery(
0766:                            LinkImpl.class, filter);
0767:                    Collection links = getPersistenceBrokerTemplate()
0768:                            .getCollectionByQuery(query);
0769:
0770:                    // cache links in folder
0771:                    folderImpl.accessLinks().clear();
0772:                    if (links != null) {
0773:                        folderImpl.accessLinks().addAll(links);
0774:                    }
0775:                    folderImpl.resetLinks(true);
0776:                } catch (Exception e) {
0777:                    // reset cache in folder
0778:                    folderImpl.resetLinks(false);
0779:                    throw new NodeException(
0780:                            "Unable to access links for folder "
0781:                                    + folder.getPath() + ".");
0782:                }
0783:
0784:                // folder links cache populated, get links from folder
0785:                // to provide packaging as filtered node set
0786:                return folder.getLinks();
0787:            }
0788:
0789:            /* (non-Javadoc)
0790:             * @see org.apache.jetspeed.page.PageManager#getLink(org.apache.jetspeed.om.folder.Folder,java.lang.String)
0791:             */
0792:            public Link getLink(Folder folder, String name)
0793:                    throws DocumentNotFoundException, NodeException {
0794:                // perform lookup by path so that cache can be used
0795:                String linkPath = folder.getPath() + Folder.PATH_SEPARATOR
0796:                        + name;
0797:                try {
0798:                    return getLink(linkPath);
0799:                } catch (DocumentNotFoundException dnfe) {
0800:                    throw dnfe;
0801:                } catch (Exception e) {
0802:                    throw new DocumentNotFoundException("Link " + linkPath
0803:                            + " not found.", e);
0804:                }
0805:            }
0806:
0807:            /* (non-Javadoc)
0808:             * @see org.apache.jetspeed.page.PageManager#getPageSecurity(org.apache.jetspeed.om.folder.Folder)
0809:             */
0810:            public PageSecurity getPageSecurity(Folder folder)
0811:                    throws DocumentNotFoundException, NodeException {
0812:                FolderImpl folderImpl = (FolderImpl) folder;
0813:
0814:                // perform lookup of page security document and cache
0815:                // in folder; limit lookup to root folder since page
0816:                // security document is currently supported only as a
0817:                // root folder singleton
0818:                if (folder.getPath().equals(Folder.PATH_SEPARATOR)) {
0819:                    try {
0820:                        // query for page security
0821:                        Criteria filter = new Criteria();
0822:                        filter.addEqualTo("parent", folderImpl.getId());
0823:                        QueryByCriteria query = QueryFactory.newQuery(
0824:                                PageSecurityImpl.class, filter);
0825:                        PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate()
0826:                                .getObjectByQuery(query);
0827:
0828:                        // cache page security in folder
0829:                        folderImpl.resetPageSecurity(
0830:                                (PageSecurityImpl) document, true);
0831:                    } catch (Exception e) {
0832:                        // reset page security in folder
0833:                        folderImpl.resetPageSecurity(null, true);
0834:                        throw new NodeException(
0835:                                "Unable to access page security for folder "
0836:                                        + folder.getPath() + ".");
0837:                    }
0838:                } else {
0839:                    // cache page security in folder
0840:                    folderImpl.resetPageSecurity(null, true);
0841:                }
0842:
0843:                // folder page security instance cache populated, get
0844:                // instance from folder to provide security checks
0845:                return folder.getPageSecurity();
0846:            }
0847:
0848:            /* (non-Javadoc)
0849:             * @see org.apache.jetspeed.page.PageManager#getAll(org.apache.jetspeed.om.folder.Folder)
0850:             */
0851:            public NodeSet getAll(Folder folder) throws DocumentException {
0852:                FolderImpl folderImpl = (FolderImpl) folder;
0853:
0854:                // perform lookup of folder nodes collection and cache in folder
0855:                try {
0856:                    // query for all nodes
0857:                    List all = DatabasePageManagerUtils.createList();
0858:                    Criteria filter = new Criteria();
0859:                    filter.addEqualTo("parent", folderImpl.getId());
0860:                    QueryByCriteria query = QueryFactory.newQuery(
0861:                            FolderImpl.class, filter);
0862:                    Collection folders = getPersistenceBrokerTemplate()
0863:                            .getCollectionByQuery(query);
0864:                    if (folders != null) {
0865:                        all.addAll(folders);
0866:                    }
0867:                    query = QueryFactory.newQuery(PageImpl.class, filter);
0868:                    Collection pages = getPersistenceBrokerTemplate()
0869:                            .getCollectionByQuery(query);
0870:                    if (pages != null) {
0871:                        all.addAll(pages);
0872:                    }
0873:                    query = QueryFactory.newQuery(LinkImpl.class, filter);
0874:                    Collection links = getPersistenceBrokerTemplate()
0875:                            .getCollectionByQuery(query);
0876:                    if (links != null) {
0877:                        all.addAll(links);
0878:                    }
0879:                    query = QueryFactory.newQuery(PageSecurityImpl.class,
0880:                            filter);
0881:                    PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate()
0882:                            .getObjectByQuery(query);
0883:                    if (document != null) {
0884:                        all.add(document);
0885:                    }
0886:
0887:                    // cache links in folder
0888:                    folderImpl.accessAll().clear();
0889:                    folderImpl.accessAll().addAll(all);
0890:                    folderImpl.resetAll(true);
0891:                } catch (Exception e) {
0892:                    // reset cache in folder
0893:                    folderImpl.resetAll(false);
0894:                    throw new DocumentException(
0895:                            "Unable to access all nodes for folder "
0896:                                    + folder.getPath() + ".");
0897:                }
0898:
0899:                // folder all nodes cache populated, get all from folder
0900:                // to provide packaging as filtered node set
0901:                return folder.getAll();
0902:            }
0903:
0904:            /* (non-Javadoc)
0905:             * @see org.apache.jetspeed.page.PageManager#updatePage(org.apache.jetspeed.om.page.Page)
0906:             */
0907:            public void updatePage(Page page) throws NodeException,
0908:                    PageNotUpdatedException {
0909:                try {
0910:                    // dereference page in case proxy is supplied
0911:                    if (page instanceof  ContentPageImpl) {
0912:                        page = ((ContentPageImpl) page).getPage();
0913:                    }
0914:                    page = (Page) ProxyHelper.getRealObject(page);
0915:
0916:                    // look up and set parent folder if necessary
0917:                    FolderImpl parent = (FolderImpl) page.getParent();
0918:                    if (parent == null) {
0919:                        // access folder by path
0920:                        String pagePath = page.getPath();
0921:                        String parentPath = pagePath.substring(0, pagePath
0922:                                .lastIndexOf(Folder.PATH_SEPARATOR));
0923:                        if (parentPath.length() == 0) {
0924:                            parentPath = Folder.PATH_SEPARATOR;
0925:                        }
0926:                        try {
0927:                            parent = (FolderImpl) getFolder(parentPath);
0928:                        } catch (FolderNotFoundException fnfe) {
0929:                            throw new PageNotUpdatedException(
0930:                                    "Missing parent folder: " + parentPath);
0931:                        }
0932:
0933:                        // check for edit access on parent folder; page
0934:                        // access not checked on create
0935:                        parent.checkAccess(JetspeedActions.EDIT);
0936:
0937:                        // update page and mark cache transaction
0938:                        page.setParent(parent);
0939:                        getPersistenceBrokerTemplate().store(page);
0940:                        DatabasePageManagerCache
0941:                                .addTransaction(new TransactionedOperation(page
0942:                                        .getPath(),
0943:                                        TransactionedOperation.ADD_OPERATION));
0944:
0945:                        // reset parent folder pages cache
0946:                        if (parent != null) {
0947:                            parent.resetPages(false);
0948:                        }
0949:
0950:                        // notify page manager listeners
0951:                        delegator.notifyNewNode(page);
0952:                    } else {
0953:                        // check for edit access on page and parent folder
0954:                        page.checkAccess(JetspeedActions.EDIT);
0955:
0956:                        // update page and mark cache transaction
0957:                        getPersistenceBrokerTemplate().store(page);
0958:                        DatabasePageManagerCache
0959:                                .addTransaction(new TransactionedOperation(page
0960:                                        .getPath(),
0961:                                        TransactionedOperation.UPDATE_OPERATION));
0962:
0963:                        // reset parent folder pages cache in case
0964:                        // parent is holding an out of date copy of
0965:                        // this page that was removed from the cache
0966:                        // before this one was accessed
0967:                        if (parent != null) {
0968:                            parent.resetPages(false);
0969:                        }
0970:
0971:                        // notify page manager listeners
0972:                        delegator.notifyUpdatedNode(page);
0973:                    }
0974:                } catch (PageNotUpdatedException pnue) {
0975:                    throw pnue;
0976:                } catch (SecurityException se) {
0977:                    throw se;
0978:                } catch (Exception e) {
0979:                    throw new PageNotUpdatedException("Page " + page.getPath()
0980:                            + " not updated.", e);
0981:                }
0982:            }
0983:
0984:            /* (non-Javadoc)
0985:             * @see org.apache.jetspeed.page.PageManager#removePage(org.apache.jetspeed.om.page.Page)
0986:             */
0987:            public void removePage(Page page) throws NodeException,
0988:                    PageNotRemovedException {
0989:                try {
0990:                    // dereference page in case proxy is supplied
0991:                    if (page instanceof  ContentPageImpl) {
0992:                        page = ((ContentPageImpl) page).getPage();
0993:                    }
0994:                    page = (Page) ProxyHelper.getRealObject(page);
0995:
0996:                    // check for edit access on page and parent folder
0997:                    page.checkAccess(JetspeedActions.EDIT);
0998:
0999:                    // look up and update parent folder if necessary
1000:                    if (page.getParent() != null) {
1001:                        FolderImpl parent = (FolderImpl) ProxyHelper
1002:                                .getRealObject(page.getParent());
1003:
1004:                        // delete page
1005:                        getPersistenceBrokerTemplate().delete(page);
1006:
1007:                        // reset parent folder pages cache
1008:                        if (parent != null) {
1009:                            parent.resetPages(false);
1010:                        }
1011:                    } else {
1012:                        // delete page
1013:                        getPersistenceBrokerTemplate().delete(page);
1014:                    }
1015:
1016:                    // notify page manager listeners
1017:                    delegator.notifyRemovedNode(page);
1018:                } catch (SecurityException se) {
1019:                    throw se;
1020:                } catch (Exception e) {
1021:                    throw new PageNotRemovedException("Page " + page.getPath()
1022:                            + " not removed.", e);
1023:                }
1024:            }
1025:
1026:            /* (non-Javadoc)
1027:             * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder)
1028:             */
1029:            public void updateFolder(Folder folder) throws NodeException,
1030:                    FolderNotUpdatedException {
1031:                // shallow update by default
1032:                updateFolder(folder, false);
1033:            }
1034:
1035:            /* (non-Javadoc)
1036:             * @see org.apache.jetspeed.page.PageManager#updateFolder(org.apache.jetspeed.om.folder.Folder,boolean)
1037:             */
1038:            public void updateFolder(Folder folder, boolean deep)
1039:                    throws NodeException, FolderNotUpdatedException {
1040:                try {
1041:                    // dereference folder in case proxy is supplied
1042:                    folder = (Folder) ProxyHelper.getRealObject(folder);
1043:
1044:                    // look up and set parent folder if required
1045:                    FolderImpl parent = (FolderImpl) folder.getParent();
1046:                    if ((parent == null)
1047:                            && !folder.getPath().equals(Folder.PATH_SEPARATOR)) {
1048:                        // access folder by path
1049:                        String folderPath = folder.getPath();
1050:                        String parentPath = folderPath.substring(0, folderPath
1051:                                .lastIndexOf(Folder.PATH_SEPARATOR));
1052:                        if (parentPath.length() == 0) {
1053:                            parentPath = Folder.PATH_SEPARATOR;
1054:                        }
1055:                        try {
1056:                            parent = (FolderImpl) getFolder(parentPath);
1057:                        } catch (FolderNotFoundException fnfe) {
1058:                            throw new FolderNotUpdatedException(
1059:                                    "Missing parent folder: " + parentPath);
1060:                        }
1061:
1062:                        // check for edit access on parent folder; folder
1063:                        // access not checked on create
1064:                        parent.checkAccess(JetspeedActions.EDIT);
1065:
1066:                        // update folder and mark cache transaction
1067:                        folder.setParent(parent);
1068:                        getPersistenceBrokerTemplate().store(folder);
1069:                        DatabasePageManagerCache
1070:                                .addTransaction(new TransactionedOperation(
1071:                                        folder.getPath(),
1072:                                        TransactionedOperation.ADD_OPERATION));
1073:
1074:                        // reset parent folder folders cache
1075:                        if (parent != null) {
1076:                            parent.resetFolders(false);
1077:                        }
1078:
1079:                        // notify page manager listeners
1080:                        delegator.notifyNewNode(folder);
1081:                    } else {
1082:                        // determine if folder is new by checking autoincrement id
1083:                        boolean newFolder = folder.getId().equals("0");
1084:
1085:                        // check for edit access on folder and parent folder
1086:                        // if not being initially created; access is not
1087:                        // checked on create
1088:                        if (!newFolder
1089:                                || !folder.getPath().equals(
1090:                                        Folder.PATH_SEPARATOR)) {
1091:                            folder.checkAccess(JetspeedActions.EDIT);
1092:                        }
1093:
1094:                        // create root folder or update folder and mark cache transaction
1095:                        getPersistenceBrokerTemplate().store(folder);
1096:                        if (newFolder && !folder.getId().equals("0")) {
1097:                            DatabasePageManagerCache
1098:                                    .addTransaction(new TransactionedOperation(
1099:                                            folder.getPath(),
1100:                                            TransactionedOperation.ADD_OPERATION));
1101:                        } else {
1102:                            DatabasePageManagerCache
1103:                                    .addTransaction(new TransactionedOperation(
1104:                                            folder.getPath(),
1105:                                            TransactionedOperation.UPDATE_OPERATION));
1106:                        }
1107:
1108:                        // reset parent folder folders cache in case
1109:                        // parent is holding an out of date copy of
1110:                        // this folder that was removed from the cache
1111:                        // before this one was accessed
1112:                        if (parent != null) {
1113:                            parent.resetFolders(false);
1114:                        }
1115:
1116:                        // notify page manager listeners
1117:                        if (newFolder && !folder.getId().equals("0")) {
1118:                            delegator.notifyNewNode(folder);
1119:                        } else {
1120:                            delegator.notifyUpdatedNode(folder);
1121:                        }
1122:                    }
1123:
1124:                    // update deep recursively if specified
1125:                    if (deep) {
1126:                        // update recursively, (breadth first)
1127:                        updateFolderNodes((FolderImpl) folder);
1128:                    }
1129:                } catch (FolderNotUpdatedException fnue) {
1130:                    throw fnue;
1131:                } catch (SecurityException se) {
1132:                    throw se;
1133:                } catch (Exception e) {
1134:                    throw new FolderNotUpdatedException("Folder "
1135:                            + folder.getPath() + " not updated.", e);
1136:                }
1137:            }
1138:
1139:            /**
1140:             * updateFolderNodes - recusively update all folder nodes
1141:             *
1142:             * @param folderImpl folder whose nodes are to be updated
1143:             * @param throws FolderNotUpdatedException
1144:             */
1145:            private void updateFolderNodes(FolderImpl folderImpl)
1146:                    throws FolderNotUpdatedException {
1147:                try {
1148:                    // construct general node query criteria
1149:                    Criteria filter = new Criteria();
1150:                    filter.addEqualTo("parent", folderImpl.getId());
1151:
1152:                    // update pages
1153:                    QueryByCriteria query = QueryFactory.newQuery(
1154:                            PageImpl.class, filter);
1155:                    Collection pages = getPersistenceBrokerTemplate()
1156:                            .getCollectionByQuery(query);
1157:                    if (pages != null) {
1158:                        Iterator pagesIter = pages.iterator();
1159:                        while (pagesIter.hasNext()) {
1160:                            updatePage((Page) pagesIter.next());
1161:                        }
1162:                    }
1163:
1164:                    // update links
1165:                    query = QueryFactory.newQuery(LinkImpl.class, filter);
1166:                    Collection links = getPersistenceBrokerTemplate()
1167:                            .getCollectionByQuery(query);
1168:                    if (links != null) {
1169:                        Iterator linksIter = links.iterator();
1170:                        while (linksIter.hasNext()) {
1171:                            updateLink((Link) linksIter.next());
1172:                        }
1173:                    }
1174:
1175:                    // update page security
1176:                    query = QueryFactory.newQuery(PageSecurityImpl.class,
1177:                            filter);
1178:                    PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate()
1179:                            .getObjectByQuery(query);
1180:                    if (document != null) {
1181:                        updatePageSecurity(document);
1182:                    }
1183:
1184:                    // update folders last: breadth first recursion
1185:                    query = QueryFactory.newQuery(FolderImpl.class, filter);
1186:                    Collection folders = getPersistenceBrokerTemplate()
1187:                            .getCollectionByQuery(query);
1188:                    if (folders != null) {
1189:                        Iterator foldersIter = folders.iterator();
1190:                        while (foldersIter.hasNext()) {
1191:                            updateFolder((Folder) foldersIter.next(), true);
1192:                        }
1193:                    }
1194:                } catch (FolderNotUpdatedException fnue) {
1195:                    throw fnue;
1196:                } catch (SecurityException se) {
1197:                    throw se;
1198:                } catch (Exception e) {
1199:                    throw new FolderNotUpdatedException("Folder "
1200:                            + folderImpl.getPath() + " not updated.", e);
1201:                }
1202:            }
1203:
1204:            /* (non-Javadoc)
1205:             * @see org.apache.jetspeed.page.PageManager#removeFolder(org.apache.jetspeed.om.folder.Folder)
1206:             */
1207:            public void removeFolder(Folder folder) throws NodeException,
1208:                    FolderNotRemovedException {
1209:                try {
1210:                    // dereference folder in case proxy is supplied
1211:                    folder = (Folder) ProxyHelper.getRealObject(folder);
1212:
1213:                    // check for edit access on folder and parent folder
1214:                    folder.checkAccess(JetspeedActions.EDIT);
1215:
1216:                    // reset folder nodes cache
1217:                    ((FolderImpl) folder).resetAll(false);
1218:
1219:                    // remove recursively, (depth first)
1220:                    removeFolderNodes((FolderImpl) folder);
1221:
1222:                    // look up and update parent folder if necessary
1223:                    if (folder.getParent() != null) {
1224:                        FolderImpl parent = (FolderImpl) ProxyHelper
1225:                                .getRealObject(folder.getParent());
1226:
1227:                        // delete folder
1228:                        getPersistenceBrokerTemplate().delete(folder);
1229:
1230:                        // reset parent folder folders cache
1231:                        if (parent != null) {
1232:                            parent.resetFolders(false);
1233:                        }
1234:                    } else {
1235:                        // delete folder: depth recursion
1236:                        getPersistenceBrokerTemplate().delete(folder);
1237:                    }
1238:
1239:                    // notify page manager listeners
1240:                    delegator.notifyRemovedNode((FolderImpl) folder);
1241:                } catch (SecurityException se) {
1242:                    throw se;
1243:                } catch (Exception e) {
1244:                    throw new FolderNotRemovedException("Folder "
1245:                            + folder.getPath() + " not removed.", e);
1246:                }
1247:            }
1248:
1249:            /**
1250:             * removeFolderNodes - recusively remove all folder nodes
1251:             *
1252:             * @param folderImpl folder whose nodes are to be removed
1253:             * @param throws FolderNotRemovedException
1254:             */
1255:            private void removeFolderNodes(FolderImpl folderImpl)
1256:                    throws FolderNotRemovedException {
1257:                try {
1258:                    // construct general node query criteria
1259:                    Criteria filter = new Criteria();
1260:                    filter.addEqualTo("parent", folderImpl.getId());
1261:
1262:                    // remove folders first: depth first recursion
1263:                    QueryByCriteria query = QueryFactory.newQuery(
1264:                            FolderImpl.class, filter);
1265:                    Collection folders = getPersistenceBrokerTemplate()
1266:                            .getCollectionByQuery(query);
1267:                    if (folders != null) {
1268:                        Iterator foldersIter = folders.iterator();
1269:                        while (foldersIter.hasNext()) {
1270:                            removeFolder((Folder) foldersIter.next());
1271:                        }
1272:                    }
1273:
1274:                    // remove pages
1275:                    query = QueryFactory.newQuery(PageImpl.class, filter);
1276:                    Collection pages = getPersistenceBrokerTemplate()
1277:                            .getCollectionByQuery(query);
1278:                    if (pages != null) {
1279:                        Iterator pagesIter = pages.iterator();
1280:                        while (pagesIter.hasNext()) {
1281:                            removePage((Page) pagesIter.next());
1282:                        }
1283:                    }
1284:
1285:                    // remove links
1286:                    query = QueryFactory.newQuery(LinkImpl.class, filter);
1287:                    Collection links = getPersistenceBrokerTemplate()
1288:                            .getCollectionByQuery(query);
1289:                    if (links != null) {
1290:                        Iterator linksIter = links.iterator();
1291:                        while (linksIter.hasNext()) {
1292:                            removeLink((Link) linksIter.next());
1293:                        }
1294:                    }
1295:
1296:                    // remove page security
1297:                    query = QueryFactory.newQuery(PageSecurityImpl.class,
1298:                            filter);
1299:                    PageSecurity document = (PageSecurity) getPersistenceBrokerTemplate()
1300:                            .getObjectByQuery(query);
1301:                    if (document != null) {
1302:                        removePageSecurity(document);
1303:                    }
1304:                } catch (FolderNotRemovedException fnre) {
1305:                    throw fnre;
1306:                } catch (SecurityException se) {
1307:                    throw se;
1308:                } catch (Exception e) {
1309:                    throw new FolderNotRemovedException("Folder "
1310:                            + folderImpl.getPath() + " not removed.", e);
1311:                }
1312:            }
1313:
1314:            /* (non-Javadoc)
1315:             * @see org.apache.jetspeed.page.PageManager#updateLink(org.apache.jetspeed.om.page.Link)
1316:             */
1317:            public void updateLink(Link link) throws NodeException,
1318:                    LinkNotUpdatedException {
1319:                try {
1320:                    // dereference link in case proxy is supplied
1321:                    link = (Link) ProxyHelper.getRealObject(link);
1322:
1323:                    // look up and set parent folder if necessary
1324:                    FolderImpl parent = (FolderImpl) link.getParent();
1325:                    if (parent == null) {
1326:                        // access folder by path
1327:                        String linkPath = link.getPath();
1328:                        String parentPath = linkPath.substring(0, linkPath
1329:                                .lastIndexOf(Folder.PATH_SEPARATOR));
1330:                        if (parentPath.length() == 0) {
1331:                            parentPath = Folder.PATH_SEPARATOR;
1332:                        }
1333:                        try {
1334:                            parent = (FolderImpl) getFolder(parentPath);
1335:                        } catch (FolderNotFoundException fnfe) {
1336:                            throw new FailedToUpdateDocumentException(
1337:                                    "Missing parent folder: " + parentPath);
1338:                        }
1339:
1340:                        // check for edit access on parent folder; link
1341:                        // access not checked on create
1342:                        parent.checkAccess(JetspeedActions.EDIT);
1343:
1344:                        // update link and mark cache transaction
1345:                        link.setParent(parent);
1346:                        getPersistenceBrokerTemplate().store(link);
1347:                        DatabasePageManagerCache
1348:                                .addTransaction(new TransactionedOperation(link
1349:                                        .getPath(),
1350:                                        TransactionedOperation.ADD_OPERATION));
1351:
1352:                        // reset parent folder links cache
1353:                        if (parent != null) {
1354:                            parent.resetLinks(false);
1355:                        }
1356:
1357:                        // notify page manager listeners
1358:                        delegator.notifyNewNode(link);
1359:                    } else {
1360:                        // check for edit access on link and parent folder
1361:                        link.checkAccess(JetspeedActions.EDIT);
1362:
1363:                        // update link and mark cache transaction
1364:                        getPersistenceBrokerTemplate().store(link);
1365:                        DatabasePageManagerCache
1366:                                .addTransaction(new TransactionedOperation(link
1367:                                        .getPath(),
1368:                                        TransactionedOperation.UPDATE_OPERATION));
1369:
1370:                        // reset parent folder links cache in case
1371:                        // parent is holding an out of date copy of
1372:                        // this link that was removed from the cache
1373:                        // before this one was accessed
1374:                        if (parent != null) {
1375:                            parent.resetLinks(false);
1376:                        }
1377:
1378:                        // notify page manager listeners
1379:                        delegator.notifyUpdatedNode(link);
1380:                    }
1381:                } catch (FailedToUpdateDocumentException fude) {
1382:                    throw fude;
1383:                } catch (SecurityException se) {
1384:                    throw se;
1385:                } catch (Exception e) {
1386:                    throw new FailedToUpdateDocumentException("Link "
1387:                            + link.getPath() + " not updated.", e);
1388:                }
1389:            }
1390:
1391:            /* (non-Javadoc)
1392:             * @see org.apache.jetspeed.page.PageManager#removeLink(org.apache.jetspeed.om.page.Link)
1393:             */
1394:            public void removeLink(Link link) throws NodeException,
1395:                    LinkNotRemovedException {
1396:                try {
1397:                    // dereference link in case proxy is supplied
1398:                    link = (Link) ProxyHelper.getRealObject(link);
1399:
1400:                    // check for edit access on link and parent folder
1401:                    link.checkAccess(JetspeedActions.EDIT);
1402:
1403:                    // look up and update parent folder if necessary
1404:                    if (link.getParent() != null) {
1405:                        FolderImpl parent = (FolderImpl) ProxyHelper
1406:                                .getRealObject(link.getParent());
1407:
1408:                        // delete link
1409:                        getPersistenceBrokerTemplate().delete(link);
1410:
1411:                        // reset parent folder links cache
1412:                        if (parent != null) {
1413:                            parent.resetLinks(false);
1414:                        }
1415:                    } else {
1416:                        // delete link
1417:                        getPersistenceBrokerTemplate().delete(link);
1418:                    }
1419:
1420:                    // notify page manager listeners
1421:                    delegator.notifyRemovedNode(link);
1422:                } catch (SecurityException se) {
1423:                    throw se;
1424:                } catch (Exception e) {
1425:                    throw new FailedToDeleteDocumentException("Link "
1426:                            + link.getPath() + " not removed.", e);
1427:                }
1428:            }
1429:
1430:            /* (non-Javadoc)
1431:             * @see org.apache.jetspeed.page.PageManager#updatePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
1432:             */
1433:            public void updatePageSecurity(PageSecurity pageSecurity)
1434:                    throws NodeException, FailedToUpdateDocumentException {
1435:                try {
1436:                    // dereference document in case proxy is supplied
1437:                    pageSecurity = (PageSecurity) ProxyHelper
1438:                            .getRealObject(pageSecurity);
1439:
1440:                    // look up and set parent folder if necessary
1441:                    FolderImpl parent = (FolderImpl) pageSecurity.getParent();
1442:                    if (parent == null) {
1443:                        // access folder by path
1444:                        String pageSecurityPath = pageSecurity.getPath();
1445:                        String parentPath = pageSecurityPath.substring(0,
1446:                                pageSecurityPath
1447:                                        .lastIndexOf(Folder.PATH_SEPARATOR));
1448:                        if (parentPath.length() == 0) {
1449:                            parentPath = Folder.PATH_SEPARATOR;
1450:                        }
1451:                        try {
1452:                            parent = (FolderImpl) getFolder(parentPath);
1453:                        } catch (FolderNotFoundException fnfe) {
1454:                            throw new FailedToUpdateDocumentException(
1455:                                    "Missing parent folder: " + parentPath);
1456:                        }
1457:
1458:                        // do not replace existing page security documents
1459:                        try {
1460:                            parent.getPageSecurity();
1461:                            throw new FailedToUpdateDocumentException(
1462:                                    "Parent folder page security exists: "
1463:                                            + parentPath);
1464:                        } catch (DocumentNotFoundException dnfe) {
1465:                            // check for edit access on parent folder; document
1466:                            // access not checked on create
1467:                            parent.checkAccess(JetspeedActions.EDIT);
1468:
1469:                            // update document and mark cache transaction
1470:                            pageSecurity.setParent(parent);
1471:                            getPersistenceBrokerTemplate().store(pageSecurity);
1472:                            DatabasePageManagerCache
1473:                                    .addTransaction(new TransactionedOperation(
1474:                                            pageSecurity.getPath(),
1475:                                            TransactionedOperation.ADD_OPERATION));
1476:
1477:                            // reset parent folder page security cache
1478:                            if (parent != null) {
1479:                                parent.resetPageSecurity(
1480:                                        (PageSecurityImpl) pageSecurity, true);
1481:                            }
1482:                        } catch (Exception e) {
1483:                            throw new FailedToUpdateDocumentException(
1484:                                    "Parent folder page security exists: "
1485:                                            + parentPath);
1486:                        }
1487:
1488:                        // notify page manager listeners
1489:                        delegator.notifyNewNode(pageSecurity);
1490:                    } else {
1491:                        // check for edit access on document and parent folder
1492:                        pageSecurity.checkAccess(JetspeedActions.EDIT);
1493:
1494:                        // update document and mark cache transaction
1495:                        getPersistenceBrokerTemplate().store(pageSecurity);
1496:                        DatabasePageManagerCache
1497:                                .addTransaction(new TransactionedOperation(
1498:                                        pageSecurity.getPath(),
1499:                                        TransactionedOperation.UPDATE_OPERATION));
1500:
1501:                        // reset parent folder page security cache in case
1502:                        // parent is holding an out of date copy of this
1503:                        // page security that was removed from the cache
1504:                        // before this one was accessed
1505:                        if (parent != null) {
1506:                            parent.resetPageSecurity(
1507:                                    (PageSecurityImpl) pageSecurity, true);
1508:                        }
1509:
1510:                        // notify page manager listeners
1511:                        delegator.notifyUpdatedNode(pageSecurity);
1512:                    }
1513:
1514:                    // reset all cached security constraints
1515:                    DatabasePageManagerCache.resetCachedSecurityConstraints();
1516:                } catch (FailedToUpdateDocumentException fude) {
1517:                    throw fude;
1518:                } catch (SecurityException se) {
1519:                    throw se;
1520:                } catch (Exception e) {
1521:                    throw new FailedToUpdateDocumentException("Document "
1522:                            + pageSecurity.getPath() + " not updated.", e);
1523:                }
1524:            }
1525:
1526:            /* (non-Javadoc)
1527:             * @see org.apache.jetspeed.page.PageManager#removePageSecurity(org.apache.jetspeed.om.page.PageSecurity)
1528:             */
1529:            public void removePageSecurity(PageSecurity pageSecurity)
1530:                    throws NodeException, FailedToDeleteDocumentException {
1531:                try {
1532:                    // dereference document in case proxy is supplied
1533:                    pageSecurity = (PageSecurity) ProxyHelper
1534:                            .getRealObject(pageSecurity);
1535:
1536:                    // check for edit access on document and parent folder
1537:                    pageSecurity.checkAccess(JetspeedActions.EDIT);
1538:
1539:                    // look up and update parent folder if necessary
1540:                    if (pageSecurity.getParent() != null) {
1541:                        FolderImpl parent = (FolderImpl) ProxyHelper
1542:                                .getRealObject(pageSecurity.getParent());
1543:
1544:                        // delete document
1545:                        getPersistenceBrokerTemplate().delete(pageSecurity);
1546:
1547:                        // reset parent folder page security cache
1548:                        if (parent != null) {
1549:                            parent.resetPageSecurity(null, true);
1550:                        }
1551:                    } else {
1552:                        // delete document
1553:                        getPersistenceBrokerTemplate().delete(pageSecurity);
1554:                    }
1555:
1556:                    // reset all cached security constraints
1557:                    DatabasePageManagerCache.resetCachedSecurityConstraints();
1558:
1559:                    // notify page manager listeners
1560:                    delegator.notifyRemovedNode(pageSecurity);
1561:                } catch (SecurityException se) {
1562:                    throw se;
1563:                } catch (Exception e) {
1564:                    throw new FailedToDeleteDocumentException("Document "
1565:                            + pageSecurity.getPath() + " not removed.", e);
1566:                }
1567:            }
1568:
1569:            /* (non-Javadoc)
1570:             * @see org.apache.jetspeed.page.PageManager#copyPage(org.apache.jetspeed.om.page.Page,java.lang.String)
1571:             */
1572:            public Page copyPage(Page source, String path)
1573:                    throws NodeException, PageNotUpdatedException {
1574:                return this .delegator.copyPage(source, path);
1575:            }
1576:
1577:            /* (non-Javadoc)
1578:             * @see org.apache.jetspeed.page.PageManager#copyLink(org.apache.jetspeed.om.page.Link,java.lang.String)
1579:             */
1580:            public Link copyLink(Link source, String path)
1581:                    throws NodeException, LinkNotUpdatedException {
1582:                return this .delegator.copyLink(source, path);
1583:            }
1584:
1585:            /* (non-Javadoc)
1586:             * @see org.apache.jetspeed.page.PageManager#copyFolder(org.apache.jetspeed.om.folder.Folder,java.lang.String)
1587:             */
1588:            public Folder copyFolder(Folder source, String path)
1589:                    throws NodeException, PageNotUpdatedException {
1590:                return this .delegator.copyFolder(source, path);
1591:            }
1592:
1593:            /* (non-Javadoc)
1594:             * @see org.apache.jetspeed.page.PageManager#copyFragment(org.apache.jetspeed.om.page.Fragment,java.lang.String)
1595:             */
1596:            public Fragment copyFragment(Fragment source, String name)
1597:                    throws NodeException, PageNotUpdatedException {
1598:                return this .delegator.copyFragment(source, name);
1599:            }
1600:
1601:            /* (non-Javadoc)
1602:             * @see org.apache.jetspeed.page.PageManager#copyPageSecurity(org.apache.jetspeed.om.page.PageSecurity)
1603:             */
1604:            public PageSecurity copyPageSecurity(PageSecurity source)
1605:                    throws NodeException {
1606:                return this .delegator.copyPageSecurity(source);
1607:            }
1608:
1609:            /* (non-Javadoc)
1610:             * @see org.apache.jetspeed.page.PageManager#getUserPage(java.lang.String,java.lang.String)
1611:             */
1612:            public Page getUserPage(String userName, String pageName)
1613:                    throws PageNotFoundException, NodeException {
1614:                return this .getPage(Folder.USER_FOLDER + userName
1615:                        + Folder.PATH_SEPARATOR + pageName);
1616:            }
1617:
1618:            /* (non-Javadoc)
1619:             * @see org.apache.jetspeed.page.PageManager#getUserFolder(java.lang.String)
1620:             */
1621:            public Folder getUserFolder(String userName)
1622:                    throws FolderNotFoundException, InvalidFolderException,
1623:                    NodeException {
1624:                return this .getFolder(Folder.USER_FOLDER + userName);
1625:            }
1626:
1627:            /* (non-Javadoc)
1628:             * @see org.apache.jetspeed.page.PageManager#folderExists(java.lang.String)
1629:             */
1630:            public boolean folderExists(String folderName) {
1631:                try {
1632:                    getFolder(folderName);
1633:                } catch (Exception e) {
1634:                    return false;
1635:                }
1636:                return true;
1637:            }
1638:
1639:            /* (non-Javadoc)
1640:             * @see org.apache.jetspeed.page.PageManager#pageExists(java.lang.String)
1641:             */
1642:            public boolean pageExists(String pageName) {
1643:                try {
1644:                    getPage(pageName);
1645:                } catch (Exception e) {
1646:                    return false;
1647:                }
1648:                return true;
1649:            }
1650:
1651:            /* (non-Javadoc)
1652:             * @see org.apache.jetspeed.page.PageManager#linkExists(java.lang.String)
1653:             */
1654:            public boolean linkExists(String linkName) {
1655:                try {
1656:                    getLink(linkName);
1657:                } catch (Exception e) {
1658:                    return false;
1659:                }
1660:                return true;
1661:            }
1662:
1663:            /* (non-Javadoc)
1664:             * @see org.apache.jetspeed.page.PageManager#userFolderExists(java.lang.String)
1665:             */
1666:            public boolean userFolderExists(String userName) {
1667:                try {
1668:                    getFolder(Folder.USER_FOLDER + userName);
1669:                } catch (Exception e) {
1670:                    return false;
1671:                }
1672:                return true;
1673:            }
1674:
1675:            /* (non-Javadoc)
1676:             * @see org.apache.jetspeed.page.PageManager#userPageExists(java.lang.String)
1677:             */
1678:            public boolean userPageExists(String userName, String pageName) {
1679:                try {
1680:                    getPage(Folder.USER_FOLDER + userName
1681:                            + Folder.PATH_SEPARATOR + pageName);
1682:                } catch (Exception e) {
1683:                    return false;
1684:                }
1685:                return true;
1686:            }
1687:
1688:            /* (non-Javadoc)
1689:             * @see org.apache.jetspeed.page.PageManager#createUserHomePagesFromRoles(java.security.auth.Subject)
1690:             */
1691:            public void createUserHomePagesFromRoles(Subject subject)
1692:                    throws NodeException {
1693:                PageManagerUtils.createUserHomePagesFromRoles(this , subject);
1694:            }
1695:
1696:            /* (non-Javadoc)
1697:             * @see org.apache.jetspeed.page.PageManager#deepCopyFolder(org.apache.jetspeed.om.folder.Folder,java.lang.String,java.lang.String)
1698:             */
1699:            public void deepCopyFolder(Folder srcFolder,
1700:                    String destinationPath, String owner) throws NodeException,
1701:                    PageNotUpdatedException {
1702:                PageManagerUtils.deepCopyFolder(this , srcFolder,
1703:                        destinationPath, owner);
1704:            }
1705:
1706:            /* (non-Javadoc)
1707:             * @see org.apache.jetspeed.page.PageManager#addPages(org.apache.jetspeed.om.page.Page[])
1708:             */
1709:            public int addPages(Page[] pages) throws NodeException {
1710:                if (pages.length > 0
1711:                        && pages[0].getPath().equals("/tx__test1.psml")) {
1712:                    // for tx testing
1713:                    System.out.println("Adding first page");
1714:                    this .updatePage(pages[0]);
1715:                    System.out.println("Adding second page");
1716:                    this .updatePage(pages[1]);
1717:                    System.out.println("About to throw ex");
1718:                    throw new NodeException("Its gonna blow captain!");
1719:                }
1720:                for (int ix = 0; ix < pages.length; ix++) {
1721:                    this.updatePage(pages[ix]);
1722:                }
1723:                return pages.length;
1724:            }
1725:
1726:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.