Package com.volantis.mcs.runtime.policies

Examples of com.volantis.mcs.runtime.policies.ActivatedPolicy


        Object key = cache.getKey(project, name);

        CacheablePolicyProvider provider = new CacheablePolicyProvider(
                delegate, project, name, cache);
        ActivatedPolicy policy = (ActivatedPolicy)
                cache.retrieve(key, provider);

        return policy;
    }
View Full Code Here


    // Javadoc inherited.
    public ActivatedPolicy retrievePolicy(RuntimeProject logicalProject,
                                          String name)
            throws RepositoryException {

        ActivatedPolicy policy = null;

        RuntimeProject actualProject = logicalProject;

        // Only fallback if the name is project relative.
        boolean supportFallback = name.startsWith("/");
View Full Code Here

    // Javadoc inherited.
    public ProviderResult retrieve(
            SystemClock clock, Object key, CacheEntry entry) {

        CacheControl cacheControl;
        ActivatedPolicy policy;
        Throwable throwable = null;
        try {
            policy = retriever.retrievePolicy(project, name);

            // todo need to be able to handle the case where the policy could
            // todo not be retrieved but the project for the policy was found
            // todo and is not the same as the supplied one. i.e. when a
            // todo request is made to a remote repository which finds the
            // todo project for the policy but not the policy. The reason we
            // todo need to do that is because we need to use the actual
            // todo project for the policy to get default cache control stuff.

            if (policy == null) {
                cacheControl = cache.getDefaultCacheControl(project, key);
            } else {
                // Determine whether the policy is cacheable.
                cacheControl = policy.getCacheControl();
            }

        } catch (Throwable e) {
            // Catch all exceptions so that they will trigger the retry
            // mechanism if configured.
            if (logger.isErrorEnabled()) {
                logger.error(e);
            }

            cacheControl = cache.getDefaultCacheControl(project, key);
            policy = null;

            // Remember the throwable so that it can be returned back to the
            // cache which will place the entry into the error state.
            throwable = e;
        }

        // If this is cacheable then update the state, either the one
        // associated with the entry, or a newly created one if the entry has
        // not been supplied, or does not have one. The latter will only occur
        // if this is the first time that a policy is being retrieved for the
        // entry.
        //
        // If this is not cacheable then there is no point in updating the
        // state as while it will be stored in the entry it will not be used.
        // Therefore, in that case return null so that state based on an
        // uncacheable policy is not stored in the entry.

        final boolean cacheable = cacheControl.getCacheThisPolicy();
        CachedPolicyState state = null;
        if (cacheable) {

            ActivatedPolicy expiredPolicy = null;

            // Attempt to get the state from the entry if it has been provided.
            // If it has not been specified then the policy must previously
            // have been uncacheable.
            if (entry != null) {
View Full Code Here

     * @param expiredPolicy The policy
     */
    public ActivatedPolicy retrieveFailed(
            SystemClock clock, ActivatedPolicy expiredPolicy) {

        ActivatedPolicy policy = null;

        // If retry is supported then check to see whether another retry is
        // allowed.
        if (retryFailedRetrieval && retryCount < maxRetryCount) {

View Full Code Here

                        (PolicyBuilder) iterator.next();

                // Complete post-load initialization ("activation") for the
                // object. This call will do nothing if there are no
                // activators
                final ActivatedPolicy policy = policyActivator.activate(
                        project, policyBuilder, project);

                SingleRetriever retriever = new SingleRetriever(policy);
                String name = policy.getName();
                CacheablePolicyProvider provider = new CacheablePolicyProvider(
                        retriever, project, name, policyCache);
                policyCache.retrieve(name, provider);
            }
        }
View Full Code Here

    // Javadoc inherited.
    public ActivatedPolicy fetchPolicy(RuntimePolicyReference reference) {

        // Look in the page repository first.
        String name = reference.getName();
        ActivatedPolicy policy = getActivatedInlinePolicy(name);

        // If the policy was not found, either because it was not there or was
        // not searched for then delegate to the normal fetcher.
        if (policy == null) {
            policy = delegate.fetchPolicy(reference);
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Adding to the map: " + name + " builder " + builder);
        }

        RuntimeProject currentProject = projectProvider.getCurrentProject();
        ActivatedPolicy activatedPolicy = (ActivatedPolicy)
                activator.activate(currentProject, builder, currentProject);

        repository.put(name, activatedPolicy);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.policies.ActivatedPolicy

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.