Package com.volantis.mcs.runtime.repository.remote.xml

Examples of com.volantis.mcs.runtime.repository.remote.xml.RemoteReadersFactory


            // Create the policy cache.
            PolicyCache policyCache = createPolicyCache(
                    defaultRemoteCacheControlConstraints);

            RemoteReadersFactory remoteReadersFactory =
                    createRemoteReadersFactory();

            // Create the ProjectManager.
            ProjectLoader projectLoader = createProjectLoader();

            RepositoryContainer repositoryContainer =
                    new RepositoryContainer(jdbcRepository, xmlRepository);

            // Create the remote project specific constraints.
            CacheControlConstraintsMap defaultRemoteCacheControlConstraintsMap
                    = createRemoteCacheControlConstraintsMap(
                            defaultRemoteCacheControlConstraints);

            // Create the local project specific constraints.
            CacheControlConstraintsMap defaultLocalCacheControlConstraintsMap
                    = createLocalCacheControlConstraintsMap();

            PopulatableProjectManager projectManager =
                    new ProjectManagerImpl(projectLoader,
                            new RuntimeProjectConfiguratorImpl(
                                    defaultLocalCacheControlConstraintsMap,
                                    defaultRemoteCacheControlConstraintsMap,
                                    pathURLMapper, policyCache),
                            repositoryContainer,
                            remoteReadersFactory);

            // Create the activator.
            PolicyReferenceFactory referenceFactory =
                    new PolicyReferenceFactoryImpl(projectManager);

            PolicyActivator policyActivator =
                    initializeRepositoryObjectActivators(referenceFactory);

            // Create the retriever to use to retrieve activated policies from
            // any source.
            RuntimePolicyFactory runtimePolicyFactory =
                    RuntimePolicyFactory.getDefaultInstance();

            ActivatedPolicyRetriever activatedPolicyRetriever =
                    runtimePolicyFactory.createCachingRetriever(
                            policyActivator, projectManager, policyCache);

            policyFetcher = new PolicyFetcherImpl(activatedPolicyRetriever);

            // Initialize the projects

            projectManager.createPredefinedProjects(projects, configContext,
                    defaultLocalCacheControlConstraintsMap,
                    policyCache.getLocalDefaultGroup());
            RuntimeProject defaultProject = projectManager.getDefaultProject();

            // Determine the repository within which the default project
            // resides.
            LocalRepository defaultRepository;

            PolicySource defaultPolicySource = defaultProject.getPolicySource();
            if (defaultPolicySource instanceof JDBCPolicySource) {
                defaultRepository = jdbcRepository;
            } else if (defaultPolicySource instanceof XMLPolicySource) {
                defaultRepository = xmlRepository;
            } else {
                throw new IllegalStateException(
                        "Unknown policy source for the default project: " +
                        defaultPolicySource);
            }

            // Initialize repository managers;
            initializeDeprecatedManagers(defaultRepository, defaultProject,
                    policyCache);

            initializeDeviceManager(deviceRepository, deviceRepositoryLocation);

            // If we were asked to preload the default project policies...
            if (defaultProject.isPreloaded()) {
                // ... then preload the policy caches, syncronously.
                // In future we may wish to do this asyncronously.
                // NOTE: this will only load policies from the default
                // project! The accessor API does not currently allow us
                // to iterate over non-default projects.
                PolicyCachePreloader preloader =
                        new PolicyCachePreloader(defaultRepository,
                                defaultProject,
                                deviceRepositoryAccessor);

                preloader.run();
            }

            RemotePolicyBuildersReader policyBuildersReader =
                    remoteReadersFactory.createPolicyBuildersReader(
                            projectManager);

            this.remotePolicyPreloader = new RemotePolicyPreloader(
                    policyBuildersReader, policyActivator, policyCache);
            this.jdbcRepository = jdbcRepository;
View Full Code Here


                marinerConfig.getRemotePolicies();
        int connectionTimeout = remotePolicies.getRealConnectionTimeout();

        Period timeout = Period.treatZeroAsIndefinitely(connectionTimeout);

        RemoteReadersFactory remoteReadersFactory =
                new RemoteReadersFactoryImpl(timeout,
                        SystemClock.getDefaultInstance());
        return remoteReadersFactory;
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.repository.remote.xml.RemoteReadersFactory

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.