Examples of AssetResolver


Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

                    policy.getName()
                    + " on device " + pageContext.getDeviceName());
        }

        String imageURL = null;
        AssetResolver resolver = pageContext.getAssetResolver();
        RuntimePolicyReference fallback = (RuntimePolicyReference)
                policy.getAlternatePolicy(PolicyType.IMAGE);
        if (fallback != null) {
            imageURL = resolver.retrieveVariantURLAsString(fallback, null);
        }

        if (imageURL == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("No altImage for component \"" + policy.getName());
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

            logger.debug("Trying altText for dynvis asset named \"" +
                    policy.getName() + " on device " +
                    pageContext.getDeviceName());
        }

        AssetResolver resolver = pageContext.getAssetResolver();

        TextAssetReference altText = new LiteralTextAssetReference(altAttr);
        altText = new FallbackComponentTextAssetReference(resolver, policy,
                altText);
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

                // Resolve the expression to a reference.
                RuntimePolicyReference reference =
                        resolver.resolveUnquotedPolicyExpression(
                                imageComponentName, PolicyType.IMAGE);

                AssetResolver assetResolver = pageContext.getAssetResolver();

                SelectedVariant selected =
                        assetResolver.selectBestVariant(reference, null);

                // Try and find the best image asset with the specified name.
                if (selected != null) {
                    ImageAsset imageAsset =
                            (ImageAsset) selected.getOldObject();
                    if (imageAsset == null) {
                        // No image asset which matches could be found so use the
                        // alt text, if any.

                        // And then try and write out the alt or fallback text,
                        // if we can
                        AltTextAttributes altTextAttrs =
                                new AltTextAttributes(attributes);
                        altTextAttrs.setStyles(pattributes.getStyles());
                        altText = new FallbackComponentTextAssetReference(
                                assetResolver, selected.getPolicy(), altText);
                        altTextAttrs.setAltText(altText);

                        if (protocol.writeAltText(altTextAttrs)) {
                            return SKIP_ELEMENT_BODY;
                        }

                    } else {
                        String[] srcArray = pageContext.
                                retrieveImageAssetURLAsString(imageAsset);
                        url = srcArray[0];

                        AssetGroup assetGroup =
                                assetResolver.getAssetGroup(imageAsset);
                        if (assetGroup != null) {
                            pattributes.setLocalSrc(AssetGroup.ON_DEVICE ==
                                    assetGroup.getLocationType());
                        } else {
                            pattributes.setLocalSrc(false);
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

        String url = getAttribute(XDIMEAttribute.HREF, attributes);

        // Do the actual processing, if the 'href' attribute is specified.
        if (url != null) {
            // Prepare the asset resolver and page URI rewriter for later use.
            AssetResolver assetResolver = getProtocol(context).getMarinerPageContext()
                    .getAssetResolver();
            PageURIRewriter uriRewriter = getProtocol(context).getMarinerPageContext()
                    .getPageURIRewriter();

            if (!uriRewriter.willPossiblyRewrite(PageURLType.ANCHOR)) {
                // If the URL is not to be rewritten using page URI rewriter
                // for which the current state of the page context is important,
                // simply create a LinkAssetReference in standard way.
                // The URL will be rewritten by PageURLRewriter when the
                // getUrl() method gets called.
                linkAssetReference = new LiteralLinkAssetReference(url, assetResolver,
                        PageURLType.ANCHOR);

            } else {
                // If the URL possibly is to be rewritten using page URI
                // rewriter, rewrite the URL in-place, since at the moment the
                // getUrl() method would be invoked, the page context would
                // change and the page URI rewriter would return different
                // result than expected.
                url = assetResolver.rewriteURLWithPageURLRewriter(url, PageURLType.ANCHOR);

                try {
                    url = uriRewriter.rewrite(new URI(url), PageURLType.ANCHOR).toString();
                } catch (URISyntaxException e) {
                    throw new XDIMEException("Invalid URI: " + url, e);
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

        AudioAttributes attributes =
                (AudioAttributes) blockAttributes;

        // Nothing to do if the source cannot be generated.
        AssetResolver resolver = pageContext.getAssetResolver();
        String src = resolver.computeURLAsString(selected);
        if (src == null) {
            return;
        }

        aAttributes.setId(attributes.getId());
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

            // Resolve the expression to a reference.
            RuntimePolicyReference reference =
                    resolver.resolveUnquotedPolicyExpression(
                            audioComponentName, PolicyType.AUDIO);

            AssetResolver assetResolver = pageContext.getAssetResolver();

            // Only supports AMR encoding at the moment.
            SelectedVariant selected = assetResolver.selectBestVariant(
                    reference, ENCODING_COLLECTION);
            if (selected != null) {
                usePolicy(pageContext, selected, attributes);
            }
        }
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

        // Get asset and policy resolvers, resolve component policy
        TabsContext context = getCurrentContext();
        PolicyReferenceResolver referenceResolver = context.getPageContext()
                .getPolicyReferenceResolver();
        AssetResolver assetResolver = context.getPageContext()
                .getAssetResolver();
        RuntimePolicyReference policyReference = referenceResolver
                .resolvePolicyExpression(component.getExpression());

        // Create image asset from the policy and get fallback
View Full Code Here

Examples of com.volantis.mcs.protocols.assets.implementation.AssetResolver

                        context.getPolicyReferenceResolver();

                RuntimePolicyReference reference =
                        resolver.resolvePolicyExpression(expression);

                AssetResolver assetResolver = context.getAssetResolver();
                ImageAssetReference image =
                        new DefaultComponentImageAssetReference(reference,
                                assetResolver);
                String url = image.getURL();
                if (url != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.