Package com.volantis.mcs.runtime.policies

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


     */
    private SelectedVariant selectVariant(String src) {

        PolicyReferenceResolver resolver = pageContext
                .getPolicyReferenceResolver();
        RuntimePolicyReference reference = null;

        reference = resolver.resolveUnquotedPolicyExpression(src, null);
        return pageContext.getAssetResolver()
                .selectBestVariant(reference, null);
    }
View Full Code Here


        return cssVersion;
    }

    // javadoc inherited
    public String resolveImage(PolicyReference reference) {
        RuntimePolicyReference runtimeReference =
                (RuntimePolicyReference) reference;

        String url = assetResolver.retrieveVariantURLAsString(runtimeReference, null);
        return assetResolver.rewriteURLWithPageURLRewriter(url, PageURLType.IMAGE);
    }
View Full Code Here

        } else if (selected.getVariant() != null) {
            return selected;
        }

        ActivatedVariablePolicy policy = selected.getPolicy();
        RuntimePolicyReference fallback = (RuntimePolicyReference)
                policy.getAlternatePolicy(PolicyType.IMAGE);
        if (fallback != null) {
            selected = assetResolver.selectBestVariant(fallback, null);
            if (selected == null) {
                return null;
View Full Code Here

    private static ScriptAssetReference loadAssetReference(String assetName,
           MarinerPageContext pageContext) throws MarinerContextException {
        loadProject(pageContext);
        final PolicyReferenceFactory factory = pageContext.getPolicyReferenceFactory();

        final RuntimePolicyReference reference = factory.createNormalizedReference(
                project, assetName, PolicyType.SCRIPT);
        return new DefaultComponentScriptAssetReference(
                reference, pageContext.getAssetResolver());

    }
View Full Code Here

        } else if (value instanceof StyleComponentURI) {
            StyleComponentURI styleComponentURI = (StyleComponentURI) value;

            // Resolve the identity against the project associated with the
            // value.
            RuntimePolicyReference reference =
                    resolver.resolvePolicyExpression(
                            styleComponentURI.getExpression());
            imageAssetReference = new DefaultComponentImageAssetReference(
                    reference, assetResolver);
        } else if (value instanceof StyleTranscodableURI) {
View Full Code Here

                // Get asset and policy resolvers, resolve component policy
                PolicyReferenceResolver referenceResolver = protocol.getMarinerPageContext().getPolicyReferenceResolver();
                AssetResolver assetResolver = protocol.getMarinerPageContext()
                        .getAssetResolver();
                RuntimePolicyReference policyReference = referenceResolver
                        .resolvePolicyExpression(((StyleComponentURI)labelContent).getExpression());

                // Create image asset from the policy and get fallback
                DefaultComponentImageAssetReference imageAsset = new DefaultComponentImageAssetReference(
                        policyReference, assetResolver);
                TextAssetReference textAsset = imageAsset.getTextFallback();

                // If e.g policy file is missing and as consequence textAsset == null,
                // throw suitable exception
                if (null == textAsset) {
                    throw new ProtocolException(exceptionLocalizer.format(
                            "missing-policy-failure", policyReference.getName()));
                }

                // Return text in plain encoding, or empty string
                textLabel = textAsset.getText(TextEncoding.PLAIN);
                if (null == textLabel) {
View Full Code Here

    private void renderImage(
            VolantisProtocol protocol, String policyURL, String alt)
            throws ProtocolException {

        // Get policy reference.
        RuntimePolicyReference reference;
        try {
            reference = WidgetHelper.loadImageReference(policyURL,
                    protocol.getMarinerPageContext());
        } catch (MarinerContextException e) {
            throw new ProtocolException(e);
View Full Code Here

           MarinerPageContext pageContext) throws MarinerContextException {
        loadProject(pageContext);
        final PolicyReferenceFactory factory = pageContext.getPolicyReferenceFactory();
       
       
        final RuntimePolicyReference reference = factory.createNormalizedReference(
                project, assetName, PolicyType.SCRIPT);
        return new DefaultComponentScriptAssetReference(
                reference, pageContext.getAssetResolver());
  
    }
View Full Code Here

        if (selection == null) {

            // Try fallback.
            PolicyType policyType = policy.getPolicyType();
            RuntimePolicyReference fallbackReference = (RuntimePolicyReference)
                    policy.getAlternatePolicy(policyType);
            if (fallbackReference != null) {
                PolicyFetcher fetcher = context.getPolicyFetcher();
                policy = (ActivatedVariablePolicy)
                        fetcher.fetchPolicy(fallbackReference);
View Full Code Here

                .returns(activatedPolicyMock);

        // =====================================================================
        //   Test Expectations
        // =====================================================================
        RuntimePolicyReference reference = new NormalizedPolicyReferenceImpl(
                projectMock, policyName, PolicyType.AUDIO);

        IMDPolicyFetcher fetcher = new IMDPolicyFetcher(fetcherMock,
                activatorMock, projectProviderMock);
View Full Code Here

TOP

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

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.