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

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


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


        System.out.println("--------------------------");       
        final Iterator dumpIter = oidCache.getKeys().iterator();
        while (dumpIter.hasNext())
        {
            final Identity oid = (Identity)dumpIter.next();
            final NodeImpl node = (NodeImpl)cacheLookup(oid);
            System.out.println("node="+node.getPath()+", oid="+oid);
        }
        System.out.println("--------------------------");
    }   
View Full Code Here

    {
        // 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;
                pathToOidMap.put(node.getPath(), (Identity)key);
                // 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;
                pathToOidMap.remove(node.getPath());
                // set stale flag since this object will now be orphaned
                // and should be be refetched from the page manager
                node.setStale(true);
                // 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 = cacheLookup(oid, false);
                            // 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.remove(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, false);
                            // reset internal FolderImpl caches in case element removed
                            if (parentNode instanceof FolderImpl)
                            {
                                ((FolderImpl)parentNode).resetAll(false);
                            }
View Full Code Here

        {
            // return valid object cached by oid
            CacheElement element = oidCache.get(oid);
            if (element != null)
            {
                NodeImpl node = (NodeImpl)element.getContent();

                // if cache access is considered an application
                // read hit, ping elements in oid and path caches
                // related to retrieved node to prevent them from
                // being LRU reaped from the cache and limit
                // cache churn, heap bloat, and graph calving
                if (cacheRead)
                {
                    // ping node path cache element
                    String path = node.getPath();
                    pathCache.get(path);
                    // iterate up cached parent folder hierarchy
                    Integer parentIdentity = node.getParentIdentity();
                    while (parentIdentity != null)
                    {
                        // access parent node by oid from cache and ping
                        // parent oid cache element in the process
                        Identity parentOid = new Identity(FolderImpl.class, FolderImpl.class, new Object[]{new Integer(parentIdentity)});
                        CacheElement parentElement = oidCache.get(parentOid);
                        if (parentElement != null)
                        {
                            // ping parent node path cache element
                            NodeImpl parentNode = (NodeImpl)parentElement.getContent();
                            String parentPath = parentNode.getPath();
                            pathCache.get(parentPath);
                            // get parent identity if available
                            parentIdentity = parentNode.getParentIdentity();
                        }
                        else
                        {
                            // parent folder no longer in cache, will reload in
                            // cache when parent folder is subsequently accessed
View Full Code Here

    public synchronized static void cacheRemove(Identity oid)
    {
        // remove from cache by oid
        if (oid != null)
        {
            NodeImpl node = cacheLookup(oid, false);
            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 = cacheLookup((Identity)resetIter.next(), false);
            if (node != null)
            {
              node.resetCachedSecurityConstraints();
            }
        }
    }
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.