Package org.apache.jetspeed.page.document.impl

Examples of org.apache.jetspeed.page.document.impl.NodeImpl


    {
        // construct page element attributes from path
        path = NodeImpl.getCanonicalNodePath(path);

        // optimized retrieval from cache by path if available
        NodeImpl cachedNode = DatabasePageManagerCache.cacheLookup(path);
        if (fragmentsElementType.isInstance(cachedNode))
        {
            // check for view access on page element
            cachedNode.checkAccess(JetspeedActions.VIEW);

            return (BaseFragmentsElement)cachedNode;
        }

        // retrieve page element from database
View Full Code Here


    {
        // construct link attributes from path
        path = NodeImpl.getCanonicalNodePath(path);

        // optimized retrieval from cache by path if available
        NodeImpl cachedNode = DatabasePageManagerCache.cacheLookup(path);
        if (cachedNode instanceof Link)
        {
            // check for view access on link
            cachedNode.checkAccess(JetspeedActions.VIEW);

            return (Link)cachedNode;
        }

        // retrieve link from database
View Full Code Here

    {
        // construct document attributes from path
        String path = Folder.PATH_SEPARATOR + PageSecurity.DOCUMENT_TYPE;

        // optimized retrieval from cache by path if available
        NodeImpl cachedNode = DatabasePageManagerCache.cacheLookup(path);
        if (cachedNode instanceof PageSecurity)
        {
            // check for view access on document
            cachedNode.checkAccess(JetspeedActions.VIEW);

            return (PageSecurity)cachedNode;
        }

        // retrieve document from database
View Full Code Here

    {
        // construct folder attributes from path
        folderPath = NodeImpl.getCanonicalNodePath(folderPath);

        // optimized retrieval from cache by path if available
        NodeImpl cachedNode = DatabasePageManagerCache.cacheLookup(folderPath);
        if (cachedNode instanceof Folder)
        {
            // check for view access on folder
            cachedNode.checkAccess(JetspeedActions.VIEW);

            return (Folder)cachedNode;
        }

        // retrieve folder from database
View Full Code Here

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementAdded(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementAdded(JetspeedCache cache, boolean local, Object key, Object element)
            {
                NodeImpl node = (NodeImpl)element;
                // infuse node with page manager configuration
                // or the page manager itself and add to the
                // paths cache
                node.setConstraintsEnabled(constraintsEnabled);
                node.setPermissionsEnabled(permissionsEnabled);
                node.setPageManager(databasePageManager);
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementChanged(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementChanged(JetspeedCache cache, boolean local, Object key, Object element)
            {
                notifyElementAdded(cache, local, key, element);
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementEvicted(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementEvicted(JetspeedCache cache, boolean local, Object key, Object element)
            {
                notifyElementRemoved(cache, local, key, element);
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementExpired(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementExpired(JetspeedCache cache, boolean local, Object key, Object element)
            {
                notifyElementRemoved(cache, local, key, element);
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementRemoved(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementRemoved(JetspeedCache cache, boolean local, Object key, Object element)
            {
                NodeImpl node = (NodeImpl)element;
                // reset internal FolderImpl caches
                if (node instanceof FolderImpl)
                {
                    ((FolderImpl)node).resetAll(false);
                }
            }
        }, true);
       
        // setup remote path cache listener
        pathCache.addEventListener(new JetspeedCacheEventListener()
        {
            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementAdded(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementAdded(JetspeedCache cache, boolean local, Object key, Object element)
            {
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementChanged(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementChanged(JetspeedCache cache, boolean local, Object key, Object element)
            {
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementEvicted(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementEvicted(JetspeedCache cache, boolean local, Object key, Object element)
            {
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementExpired(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementExpired(JetspeedCache cache, boolean local, Object key, Object element)
            {
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementRemoved(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementRemoved(JetspeedCache cache, boolean local, Object key, Object element)
            {
                DatabasePageManagerCacheObject cacheObject = (DatabasePageManagerCacheObject)element;
                // remove cache object from local caches
                Identity oid = ((cacheObject != null) ? cacheObject.getId() : null);
                String path = ((cacheObject != null) ? cacheObject.getPath() : (String)key);
                if ((oid != null) || (path != null))
                {
                    synchronized (DatabasePageManagerCache.class)
                    {
                        if (oid != null)
                        {
                            // get object cached by oid
                            NodeImpl node = (NodeImpl)cacheLookup(oid);
                            // reset internal FolderImpl caches
                            if (node instanceof FolderImpl)
                            {
                                ((FolderImpl)node).resetAll(false);
                            }
                            // notify page manager of update
                            DatabasePageManagerCache.pageManager.notifyUpdatedNode(node);
                            // remove from cache
                            DatabasePageManagerCache.oidCache.removeQuiet(oid);
                        }
                        if (path != null)
                        {
                            // lookup parent object cached by path and oid
                            int pathLastSeparatorIndex = path.lastIndexOf(Folder.PATH_SEPARATOR);
                            String parentPath = ((pathLastSeparatorIndex > 0) ? path.substring(0, pathLastSeparatorIndex) : Folder.PATH_SEPARATOR);
                            NodeImpl parentNode = cacheLookup(parentPath);
                            // reset internal FolderImpl caches in case element removed
                            if (parentNode instanceof FolderImpl)
                            {
                                ((FolderImpl)parentNode).resetAll(false);
                            }
View Full Code Here

     */
    public synchronized static void cacheAdd(Identity oid, Object obj)
    {
        if (obj instanceof NodeImpl)
        {
            NodeImpl node = (NodeImpl)obj;
            String path = node.getPath();

            // add node to caches; note that removes force notification
            // of update to distributed caches
            oidCache.remove(oid);
            boolean removed = pathCache.remove(path);
View Full Code Here

    public synchronized static void cacheRemove(Identity oid)
    {
        // remove from cache by oid
        if (oid != null)
        {
            NodeImpl node = (NodeImpl)cacheLookup(oid);
            if (node != null)
            {
                String path = node.getPath();
                // remove from caches; note that removes are
                // propagated to distributed caches
                oidCache.remove(oid);
                boolean removed = pathCache.remove(path);
                // if a remove was not successful from the path cache,
View Full Code Here

    {
        // reset cached objects
        Iterator resetIter = oidCache.getKeys().iterator();
        while (resetIter.hasNext())
        {
            NodeImpl node = (NodeImpl)cacheLookup((Identity)resetIter.next());
            node.resetCachedSecurityConstraints();
        }
    }
View Full Code Here

        dump.append("--------------------------"+EOL);
        Iterator dumpIter = oidCache.getKeys().iterator();
        while (dumpIter.hasNext())
        {
            Identity oid = (Identity)dumpIter.next();
            NodeImpl node = (NodeImpl)cacheLookup(oid);
            dump.append("node="+node.getPath()+", oid="+oid+EOL);
        }
        dump.append("--------------------------");
        log.debug("DatabasePageManagerCache dump:"+EOL+dump.toString());
    }   
View Full Code Here

    {
        // construct page attributes from path
        path = NodeImpl.getCanonicalNodePath(path);

        // optimized retrieval from cache by path if available
        NodeImpl cachedNode = DatabasePageManagerCache.cacheLookup(path);
        if (cachedNode instanceof Page)
        {
            // check for view access on page
            cachedNode.checkAccess(JetspeedActions.VIEW);

            return (Page)cachedNode;
        }

        // retrieve page from database
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.page.document.impl.NodeImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.