Examples of AssetResolver


Examples of com.volantis.mcs.dom2theme.AssetResolver

            ShorthandSet supportedShorthands) {

        propertyClearerChecker =
                new PropertyClearerCheckerImpl(detailsSet);

        AssetResolver assetResolver = context.getAssetResolver();

        supportedProperties = getSupportedProperties(detailsSet);

        resolvers = new PropertiesNormalizer[]{
            new BackgroundResolver(supportedProperties, assetResolver),
View Full Code Here

Examples of com.volantis.mcs.dom2theme.AssetResolver

        this.styleAttributeName = styleAttributeName;

        StyledDOMThemeExtractorFactory extractorFactory =
                StyledDOMThemeExtractorFactory.getDefaultInstance();

        final AssetResolver assetResolver = new AssetResolver() {

            // javadoc inherited
            public PolicyReference evaluateExpression(PolicyExpression expression) {
                return null;
            }
View Full Code Here

Examples of com.volantis.mcs.dom2theme.AssetResolver

     */
    protected String getTextFromStyleValue(
            Styles styles, final StyleProperty property,
            final EncodingCollection requiredEncodings) {

        AssetResolver assetResolver = getExtractorContext().getAssetResolver();
        StyleValue value = styles.getPropertyValues()
                .getStyleValue(property);

        String format;
        if (value == StyleKeywords.NONE) {
            // No validation.
            format = null;
        } else if (value instanceof StyleString) {
            StyleString string = (StyleString) value;
            format = string.getString();
        } else if (value instanceof StyleComponentURI) {
            StyleComponentURI uri = (StyleComponentURI) value;
            PolicyReference reference = assetResolver.evaluateExpression(
                    uri.getExpression());
            format = assetResolver.resolveText(reference, requiredEncodings);
        } else {
            throw new IllegalStateException(
                    "Unknown " +
                            property.getName() +
                            " value " + value);
View Full Code Here

Examples of com.volantis.mcs.dom2theme.AssetResolver

     *         null.
     */
    protected TextAssetReference getTextReferenceFromStyleValue(
            Styles styles, final StyleProperty property) {

        AssetResolver assetResolver = getExtractorContext().getAssetResolver();
        StyleValue value = styles.getPropertyValues()
                .getStyleValue(property);

        TextAssetReference reference;
        if (value == StyleKeywords.NONE) {
            // No validation.
            reference = null;
        } else if (value instanceof StyleString) {
            StyleString string = (StyleString) value;
            reference = new LiteralTextAssetReference(string.getString());
        } else if (value instanceof StyleComponentURI) {
            StyleComponentURI uri = (StyleComponentURI) value;
            reference = new DefaultComponentTextAssetReference(
                    (RuntimePolicyReference) assetResolver.evaluateExpression(
                            uri.getExpression()),
                    getMarinerPageContext().getAssetResolver());
        } else {
            throw new IllegalStateException(
                    "Unknown " +
View Full Code Here

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

        OutputBufferFactory outputBufferFactory
                = new TestDOMOutputBufferFactory();
        MenuItemRendererFactory itemRendererFactory
                = new TestMenuItemRendererFactory(outputBufferFactory);
        AssetResolver assetResolver = new AssetResolverMock("assetResolverMock",
                expectations);
        MenuSeparatorRendererFactory separatorRendererFactory
                = new TestMenuSeparatorRendererFactory();

        separatorRendererSelector
View Full Code Here

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

                                           Encoding encoding) {

        RuntimePolicyReference runtimePolicyReference =
                createPolicyReference(reference);

        final AssetResolver resolver = pageContext.getAssetResolver();
        SelectedVariant selected = resolver.selectBestVariant(
                runtimePolicyReference, getEncodingCollection(encoding));

        BestVariant best;
        if (selected == null) {
            best = null;
View Full Code Here

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

    public String retrieveAudioAssetURLAsString(String name, int encoding)
            throws RepositoryException {

        RuntimePolicyReference reference = createPolicyReference(name,
                PolicyType.AUDIO);
        final AssetResolver resolver = pageContext.getAssetResolver();
        return resolver.retrieveVariantURLAsString(reference,
                getEncodingCollection(EnumerationConverter.AUDIO_ENCODING,
                        encoding));
    }
View Full Code Here

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

        SelectedVariant selectedVariant = selectVariant(src);
        if(selectedVariant == null) {
          throw new XDIMEException("best selected variant not accessible");
        }

        AssetResolver assetResolver = pageContext.getAssetResolver();
               
        // The external link rendered for device independent resource will have
        // correct URL if used device support encoding from selected variant
        // otherwise returned variant will be null because selected variant is
        // filtered by PolicyVariantSelector#filter method       
        Variant variant = selectedVariant.getVariant();
        VariantType variantType = null;

        if(variant != null) {
            variantType = variant.getVariantType();
        }

        // for MTXT resource
        if (variantType == VariantType.TEXT) {
            PolicyReferenceResolver resolver = pageContext
                    .getPolicyReferenceResolver();
            TextAssetReference textReference = resolver
                    .resolveUnquotedTextExpression(src);

            final String text = textReference.getText(TextEncoding.PLAIN);
            if (text != null) {
                // We have found the text, so let's try and write it out to
                // attributes
                attributes.setTextContainer(text);
            } else {
                if (logger.isDebugEnabled()) {
                    logger.debug("No text exists for text asset  " + src);
                }
            }
            // remove src pointed at text component
            attributes.setSrc(null);

            // remove srcType which contains list of device independent mime
            // types
            attributes.setSrcType(null);
        }

        // retrieve url only for IMAGE, AUDIO and VIDEO resource so far
        String url = assetResolver.retrieveVariantURLAsString(selectedVariant);

        // get dimensions for image and video and save it to params into
        // attributes
        if (variantType == VariantType.IMAGE
                || variantType == VariantType.VIDEO) {

            PixelDimensionsMetaData dimMetaData =
                (PixelDimensionsMetaData) selectedVariant
                    .getVariant().getMetaData();
            // get the Map of parameters
            Map params = attributes.getParamMap();

            // save height and width in pixels unit to object's parameter map
            if (dimMetaData.getHeight() != 0) {
                params.put("height", StringConvertor.valueOf(dimMetaData
                        .getHeight()));
            }
            if (dimMetaData.getWidth() != 0) {
                params.put("width", StringConvertor.valueOf(dimMetaData
                        .getWidth()));
            }
        }

        // convert image if needed
        if (variantType == VariantType.IMAGE) {
            ImageMetaData imageMetaData = (ImageMetaData) selectedVariant
                    .getVariant().getMetaData();

            // image must be convert
            if (url != null
                    && imageMetaData.getConversionMode() ==
                        ImageConversionMode.ALWAYS_CONVERT) {
                url = assetResolver.rewriteURLWithPageURLRewriter(url,
                        PageURLType.IMAGE);

                attributes.setConvertibleImageAsset(true);               
            }
        }
View Full Code Here

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

                }
            } else if (labelContent instanceof StyleComponentURI) {

                // 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
View Full Code Here

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

        }

        // TODO: factor together with AbstractImageElement
        MarinerPageContext pageContext = protocol.getMarinerPageContext();

        AssetResolver resolver = pageContext.getAssetResolver();

        SelectedVariant selectedVariant =
                resolver.selectBestVariant(reference, null);

        String url = resolver.retrieveVariantURLAsString(selectedVariant);
        if (url == null) {
            return;
        }

        url = resolver.rewriteURLWithPageURLRewriter(url, PageURLType.IMAGE);

        ImageAttributes imageAttributes = new ImageAttributes();

        BaseLocation location = resolver.getBaseLocation(selectedVariant);
        imageAttributes.setLocalSrc(location == BaseLocation.DEVICE);

        Variant variant = selectedVariant.getVariant();
        ImageMetaData image = (ImageMetaData) variant.getMetaData();
        // Make a note of whether this image is a convertible
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.