Package com.volantis.mcs.runtime.configuration.project

Examples of com.volantis.mcs.runtime.configuration.project.AssetsConfiguration


     * @return the new AssetsConfiguration
     */
    private AssetsConfiguration initialiseAssetConfiguration(
            AssetsAttributes attrs) {
        // Create a new AssetsConfiguration and add all the asset types to it.
        final AssetsConfiguration config = new AssetsConfiguration();
        config.setAudioAssets(new AssetConfiguration());
        config.setDynamicVisualAssets(new AssetConfiguration());
        config.setImageAssets(new AssetConfiguration());
        config.setScriptAssets(new AssetConfiguration());
        config.setTextAssets(new AssetConfiguration());

        // Copy the base URL.
        config.setBaseUrl(attrs.getBaseUrl());

        // Create a List of the asset configurations to simplify processing.
        final List assetConfigsList = new ArrayList(5);
        assetConfigsList.add(config.getAudioAssets());
        assetConfigsList.add(config.getDynamicVisualAssets());
        assetConfigsList.add(config.getImageAssets());
        assetConfigsList.add(config.getScriptAssets());
        assetConfigsList.add(config.getTextAssets());

        // Process each asset configuration, inserting a leading slash if
        // necessary.
        for (Iterator it = assetConfigsList.iterator(); it.hasNext();) {
            AssetConfiguration assetConfig = (AssetConfiguration) it.next();
View Full Code Here


        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        parent = findParent(pageContext, elementName);

        AssetsConfiguration assetsConfiguration = parent.getAssetsConfiguration();
        String generatedResourceBaseDir = null;
        GeneratedResourcesConfiguration generatedResourcesConfiguration =
                parent.getGeneratedResourcesConfiguration();
        if (generatedResourcesConfiguration != null) {
            generatedResourceBaseDir =
                    generatedResourcesConfiguration.getBaseDir();
        }
        policySource = parent.getPolicySource();
        CacheControlConstraintsMap cacheControlConstraintsMap =
                pageContext.getVolantisBean().getProjectManager().getDefaultProject().getCacheControlConstraintsMap();
        DynamicProjectKey key = new DynamicProjectKey(policySource,
                assetsConfiguration, generatedResourceBaseDir, cacheControlConstraintsMap);

        project = pageContext.getVolantisBean().getDynamicProject(key);
        if (logger.isDebugEnabled()) {
            logger.debug("Setting project to : PolicySource [" +
                ((policySource != null) ? policySource.toString() : "null") +
                "," +
                ((assetsConfiguration != null)
       ? assetsConfiguration.getBaseUrl() : "null") +
                "," +         
                ((generatedResourcesConfiguration != null)
       ? generatedResourcesConfiguration.getBaseDir()
       : "null") +
                "]");
View Full Code Here

        result = element.elementEnd(requestContextMock, null);
        assertEquals("Unexpected result from elementEnd.",
                MCSIConstants.CONTINUE_PROCESSING, result);

        AssetsConfiguration assetsConfiguration =
                parent.getAssetsConfiguration();
        String baseUrl= assetsConfiguration.getBaseUrl();
        assertEquals("BaseUrl has unexpected value",baseUrl,BASE_URL);

        // Finally, check that the asset URL prefixes are as expected: there is
        // a leading slash on each.
        assertEquals("Audio asset prefix URL should be /",
                "/",
                assetsConfiguration.getAudioAssets().getPrefixUrl());
        assertEquals("Dynamic visual asset prefix URL should be /",
                "/",
                assetsConfiguration.getDynamicVisualAssets().getPrefixUrl());
        assertEquals("Image asset prefix URL should be /",
                "/",
                assetsConfiguration.getImageAssets().getPrefixUrl());
        assertEquals("Script asset prefix URL should be /",
                "/",
                assetsConfiguration.getScriptAssets().getPrefixUrl());
        assertEquals("Text asset prefix URL should be /",
                "/",
                assetsConfiguration.getTextAssets().getPrefixUrl());
    }
View Full Code Here

        pageContextMock.expects.pushMCSIElement(element);
        pageContextMock.expects.popMCSIElement().returns(element);

        // Set the AssetsConfiguration
        AssetsConfiguration assetsConfiguration = new AssetsConfiguration();
        assetsConfiguration.setBaseUrl(BASE_URL);
        parent.setAssetsConfiguration(assetsConfiguration);

        // Set the PolicySource
        parent.setPolicySource(policySourceMock);
View Full Code Here

            assertTrue(policies instanceof XmlPoliciesConfiguration);
            XmlPoliciesConfiguration xmlPolicies =
                    (XmlPoliciesConfiguration) policies;
            assertEquals("", "an xml dir", xmlPolicies.getDirectory());

            AssetsConfiguration assets = project.getAssets();
            assertNotNull(assets);
            AssetConfiguration audioAssets = assets.getAudioAssets();
            assertNotNull(audioAssets);
            assertEquals("", "a/prefix/url", audioAssets.getPrefixUrl());

            GeneratedResourcesConfiguration resources =
                    project.getGeneratedResources();
            assertNotNull(resources);
            assertEquals("", "default-resources", resources.getBaseDir());
        }

        // Test the single named project which was present.
        {
            RuntimeProjectConfiguration project = (RuntimeProjectConfiguration)
                    projects.getNamedProjects().values().iterator().next();
            assertNotNull(project);
            assertEquals("", "a/project", project.getName());

            AbstractPoliciesConfiguration policies = project.getPolicies();
            assertNotNull(policies);
            assertTrue(policies instanceof JdbcPoliciesConfiguration);
            JdbcPoliciesConfiguration jdbcPolicies =
                    (JdbcPoliciesConfiguration) policies;
            assertEquals("", "a jdbc policy", jdbcPolicies.getName());

            AssetsConfiguration assets = project.getAssets();
            assertNotNull(assets);
            AssetConfiguration dynvisAssets = assets.getDynamicVisualAssets();
            assertNotNull(dynvisAssets);
            assertEquals("", "another/prefix/url", dynvisAssets.getPrefixUrl());

            GeneratedResourcesConfiguration resources =
                    project.getGeneratedResources();
View Full Code Here

        ProjectThemes projectThemes =
                configuration.getProjectThemes();
        builder.setProjectThemes(projectThemes);

        AssetsConfiguration assets = configuration.getAssets();
        if (assets == null) {
            assets = new AssetsConfiguration();
            assets.setBaseUrl(".");
        }

        // If this is local then get the external location as relative to the
        // servlet context. Otherwise the external location is the same as the
        // location.
        String externalLocation;
        if (remote) {
            externalLocation = policyRootAsString;
        } else {
            externalLocation = pathURLMapper.mapInternalURLToExternalPath(
                    policyRootAsString);

            if (logger.isDebugEnabled()) {
                logger.debug("Mapped project location URL " +
                        policyRootAsString + " to external path " +
                        externalLocation);
            }
        }

        // Resolve the asset's base URL against the external location of the
        // project file.
        String assetsBase = assets.getBaseUrl();
        MarinerURL assetsBaseURL = new MarinerURL(externalLocation, assetsBase);
        assetsBase = assetsBaseURL.getExternalForm();

        // This method is only used for portable projects.
        builder.setPortable(true);

        assets.setBaseUrl(assetsBase);

        builder.setAssetsConfiguration(assets);

        builder.setGeneratedResourceBaseDir(assets.getBaseUrl());
    }
View Full Code Here

     * @param baseURL The baseURL to use in the AssetsConfiguration.
     * @return An initialised instance of AssetsConfiguration.
     */
    private AssetsConfiguration createConfig(String baseURL) {
        // Base variables
        AssetsConfiguration assetConfig = new AssetsConfiguration();
        AssetConfiguration asset;

        // Setting the prefixes
        asset = new AssetConfiguration();
        asset.setPrefixUrl(audioPrefixString);
        assetConfig.setAudioAssets(asset);
        asset = new AssetConfiguration();
        asset.setPrefixUrl(dynamicVisualPrefixString);
        assetConfig.setDynamicVisualAssets(asset);
        asset = new AssetConfiguration();
        asset.setPrefixUrl(imagePrefixString);
        assetConfig.setImageAssets(asset);
        asset = new AssetConfiguration();
        asset.setPrefixUrl(scriptPrefixString);
        assetConfig.setScriptAssets(asset);
        asset = new AssetConfiguration();
        asset.setPrefixUrl(textPrefixString);
        assetConfig.setTextAssets(asset);

        // Setting the base URL
        assetConfig.setBaseUrl(baseURL);

        return assetConfig;
    }
View Full Code Here

        // =====================================================================
        final SeparateCacheControlConstraintsMap cacheControlConstraintsMap =
                new SeparateCacheControlConstraintsMap();
        DynamicProjectKey key1 = new DynamicProjectKey(
                policySourceMock,
                new AssetsConfiguration(), "", cacheControlConstraintsMap);
        DynamicProjectKey key2 = new DynamicProjectKey(
                policySourceMock,
                new AssetsConfiguration(), "", cacheControlConstraintsMap);
        assertEquals(key1, key2);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.runtime.configuration.project.AssetsConfiguration

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.