Esempio n. 1
0
    } // stuff()

    /*
    ****************************************************************************
    * stuff()
    ****************************************************************************
    */ /**
    * Adds a descriptors associated with a subsegment to the cache.
    * @param oAuth - The Authority containing a subsegment whose descriptor is
    * provided
    * @param oDescriptor - The descriptor of the subsegment
    * @param nDepth - The index of the subsegment in oAuth
    */
    synchronized void stuff(
        XRIAuthority oAuth, XRD oDescriptor, int nDepth)
    {
        // get the community node
        CacheNode oCommunityNode = moRootNode.mkdir(oAuth.getRootAuthority());

        // if necessary, create a node for this authority path
        CacheNode oNode = oCommunityNode.mkdir(oAuth, 0, nDepth);

        // set the correct descriptor for the node
        oNode.moCacheValue = new CachedValue(oDescriptor, nDepth);

        trim();

    } // stuff()
Esempio n. 2
0
    } // find()

    /*
    ****************************************************************************
    * findNode()
    ****************************************************************************
    */ /**
    *
    */
    private CacheNode findNode(
        XRIAuthority oAuth, bool bPartial, bool bCompleteChain,
        Vector oCachedDescriptors)
    {
        // get the Node for the community root
        CacheNode oCommunityNode = moRootNode.find(oAuth.getRootAuthority());
        if (oCommunityNode == null)
        {
            return null;
        }

        // if the found node doesn't have a cached value, potentially bail
        if (
            (oCommunityNode.moCacheValue == null) ||
            (oCommunityNode.moCacheValue.getDescriptor() == null))
        {
            if (bCompleteChain)
            {
                return null;
            }
        }
        else if (oCachedDescriptors != null)
        {
            oCachedDescriptors.add(oCommunityNode.moCacheValue.getDescriptor());
        }

        // find the deepest node that fits the bill
        CacheResult oDeepestNode =
            oCommunityNode.find(oAuth, 0, bCompleteChain, oCachedDescriptors);

        // return the node we found if we got everything, or we are in partial mode
        if (bPartial || (oDeepestNode.mnNumFound == oAuth.getNumSubSegments()))
        {
            return oDeepestNode.moLastCacheNode;
        }
        else
        {
            return null;
        }

    } // findNode()