Package com.volantis.mcs.runtime.configuration

Examples of com.volantis.mcs.runtime.configuration.RemotePoliciesConfiguration


       
        TestXmlConfigurationBuilder configBuilder =
                new TestXmlConfigurationBuilder(doc);
        MarinerConfiguration config = configBuilder.buildConfiguration();
        assertNotNull(config);
        RemotePoliciesConfiguration policies = config.getRemotePolicies();
        assertNotNull(policies);
        assertEquals(connectionTimeout, policies.getConnectionTimeout());
        RemotePolicyCacheConfiguration cache = policies.getPolicyCache();
        Iterator quotas = policies.getQuotaIterator();

        if (cacheValue != null) {
            assertNotNull("RemotePolicyCacheConfiguration", cache);
            assertEquals(cacheValue.cachePolicies,
                    cache.getDefaultCacheThisPolicy());
View Full Code Here


        // use the commented code below to get around a bug to do with
        // reflection in the IBM JDK 1.4.1.
        VolantisInternals internals = new VolantisInternals(volantis);

        MarinerConfiguration marinerConfig = internals.getMarinerConfig();
        RemotePoliciesConfiguration configuration =
                marinerConfig.getRemotePolicies();
        RemotePolicyCacheConfiguration cacheConfiguration =
                configuration.getPolicyCache();

        // @todo this nicely demonstrates the bug re remote cache nesting
        // docs says the global and individual are at different nesting levels
        // and yet the tests pass with the same temporary for both, and with an
        // xml file that has them at the same level.
View Full Code Here

        // use the commented code below to get around a bug to do with
        // reflection in the IBM JDK 1.4.1.
        VolantisInternals internals = new VolantisInternals(volantis);

        MarinerConfiguration marinerConfig = internals.getMarinerConfig();
        RemotePoliciesConfiguration configuration =
                marinerConfig.getRemotePolicies();
        Iterator i = configuration.getQuotaIterator();
        Map quotaMap = new HashMap();
        while (i.hasNext()) {
            RemotePolicyQuotaConfiguration quota =
                    (RemotePolicyQuotaConfiguration) i.next();
            quotaMap.put(quota.getUrl(), quota);
View Full Code Here

        }
        return config;
    }

    private RemoteReadersFactory createRemoteReadersFactory() {
        RemotePoliciesConfiguration remotePolicies =
                marinerConfig.getRemotePolicies();
        int connectionTimeout = remotePolicies.getRealConnectionTimeout();

        Period timeout = Period.treatZeroAsIndefinitely(connectionTimeout);

        RemoteReadersFactory remoteReadersFactory =
                new RemoteReadersFactoryImpl(timeout,
View Full Code Here

     * for all policy types.</p>
     *
     * @return The constraints.
     */
    private CacheControlConstraints createRemoteCacheControlConstraints() {
        RemotePoliciesConfiguration remotePolicies =
                marinerConfig.getRemotePolicies();
        RemotePolicyCacheConfiguration policyCacheConfiguration =
                remotePolicies.getPolicyCache();

        if (policyCacheConfiguration == null) {
            policyCacheConfiguration = new RemotePolicyCacheConfiguration();
        }

View Full Code Here

        // can be built.
        if (localSize == 0) {
            localSize = 1;
        }

        RemotePoliciesConfiguration remotePolicies =
                marinerConfig.getRemotePolicies();
        RemotePolicyCacheConfiguration policyCacheConfiguration =
                remotePolicies.getPolicyCache();
        if (policyCacheConfiguration == null) {
            policyCacheConfiguration = new RemotePolicyCacheConfiguration();
        }

        int remoteSize;
        remoteSize = getInteger(policyCacheConfiguration.getMaxCacheSize(),
                DEFAULT_REMOTE_GROUP_SIZE);

        PolicyCacheBuilder builder = new PolicyCacheBuilder(
                localSize, remoteSize);

        CacheControlConstraints localConstraints = createLocalCacheConstraints(
                Boolean.TRUE, null);

        PolicyCachePartitionConstraints localPartitionConstraints =
                createPartitionConstraints(localSize, localConstraints);

        builder.setLocalPartitionConstraints(localPartitionConstraints);

        PolicyCachePartitionConstraints remotePartitionConstraints =
                createPartitionConstraints(remoteSize, remoteConstraints);

        builder.setRemotePartitionConstraints(remotePartitionConstraints);

        // Now build the policy specific groups to the local group.
        for (Iterator i = policyTypes.iterator(); i.hasNext();) {

            PolicyType policyType = (PolicyType) i.next();
            PolicyCacheConfiguration groupConfiguration =
                    getPolicyCacheConfiguration(policyType);
            int maxCount;
            if (groupConfiguration == null) {
                // Allow some entries in the group to ensure that when a policy
                // is marked as uncacheable that it is preserved.
                maxCount = 10;
            } else {
                maxCount = getInteger(groupConfiguration.getMaxEntries(),
                        Integer.MAX_VALUE);
                if (maxCount == -1) {
                    maxCount = Integer.MAX_VALUE;
                }
            }

            builder.addDefaultLocalPolicySpecificGroup(
                    policyType, maxCount);
        }

        Iterator i = remotePolicies.getQuotaIterator();
        while (i.hasNext()) {
            RemotePolicyQuotaConfiguration quota =
                    (RemotePolicyQuotaConfiguration) i.next();
            int percentage = quota.getPercentage().intValue();
            String url = quota.getUrl();
View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.configuration.RemotePoliciesConfiguration

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.