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

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


    {
        // 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(SecuredResource.VIEW_ACTION);

            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(SecuredResource.VIEW_ACTION);

            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(SecuredResource.VIEW_ACTION);

            return (Folder)cachedNode;
        }

        // retrieve folder from database
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

    {
        // 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(final JetspeedCache cache, final boolean local, final Object key, final Object element)
            {
                final 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);
                if (node instanceof FolderImpl)
                {
                    ((FolderImpl)node).setPageManager(pageManager);
                }
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementChanged(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementChanged(final JetspeedCache cache, final boolean local, final Object key, final Object element)
            {
                final 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);
                if (node instanceof FolderImpl)
                {
                    ((FolderImpl)node).setPageManager(pageManager);
                }
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementEvicted(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementEvicted(final JetspeedCache cache, final boolean local, final Object key, final Object element)
            {
                final NodeImpl node = (NodeImpl)element;
                // reset internal FolderImpl caches
                if (node instanceof FolderImpl)
                {
                    ((FolderImpl)node).resetAll(false);
                }
            }

            /* (non-Javadoc)
             * @see org.apache.jetspeed.cache.JetspeedCacheEventListener#notifyElementExpired(org.apache.jetspeed.cache.JetspeedCache, boolean, java.lang.Object, java.lang.Object)
             */
            public void notifyElementExpired(final JetspeedCache cache, final boolean local, final Object key, final Object element)
            {
                final NodeImpl node = (NodeImpl)element;
                // reset internal FolderImpl caches
                if (node instanceof FolderImpl)
                {
                    ((FolderImpl)node).resetAll(false);
                }
            }

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

            // add node to caches; note that removes force notification
            // of update to distributed caches
            oidCache.remove(oid);
            final CacheElement element = oidCache.createElement(oid, node);
View Full Code Here

    public synchronized static void cacheRemove(final Identity oid)
    {
        // remove from cache by oid
        if (oid != null)
        {
            final NodeImpl node = (NodeImpl)cacheLookup(oid);
            if (node != null)
            {
                final String nodePath = node.getPath();
                // remove from caches; note that removes are
                // propagated to distributed caches
                oidCache.remove(oid);
                final boolean removed = pathCache.remove(nodePath);
                // if a remove was not successful from the path cache,
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.