Package org.milyn.cdr

Examples of org.milyn.cdr.SmooksResourceConfiguration


        }
    }

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        Stack<SmooksResourceConfiguration> resourceStack = ExtensionContext.getExtensionContext(executionContext).getResourceStack();
        SmooksResourceConfiguration currentConfig;
        SmooksResourceConfiguration parentConfig;
        String value;

        String actualMapTo = mapTo;

        //If no mapTo is set then the mapFrom value becomes the mapTo value
View Full Code Here


    @ConfigParam(defaultVal = AnnotationConstants.NULL_STRING)
    private String defaultValue;

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        SmooksResourceConfiguration config;
        String value = DomUtils.getAllText(element, false);
        String mapToPropertyName = mapTo;

        if(mapToPropertyName == null) {
            if(mapToSpecifier == null) {
View Full Code Here

        return defaultConditionEvaluator;
    }

  public SmooksResourceConfiguration getResourceByName(String name) {
    for(int i = resourceStack.size() - 1; i >= 0; i--) {
      SmooksResourceConfiguration config = resourceStack.get(i);
      String resourceName = config.getResource();
      if(name.equals(resourceName)) {
        return config;
      }
    }
View Full Code Here

    @ConfigParam(defaultVal = AnnotationConstants.NULL_STRING)
    private String defaultValue;

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        SmooksResourceConfiguration config;
        String value = DomUtils.getAttributeValue(element, attribute);

        String actualMapTo = mapTo;

        if(actualMapTo == null && mapToSpecifier != null) {
View Full Code Here

    @ConfigParam
    private String value;

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        SmooksResourceConfiguration config;

        try {
            config = ExtensionContext.getExtensionContext(executionContext).getResourceStack().peek();
        } catch (EmptyStackException e) {
            throw new SmooksException("No SmooksResourceConfiguration available in ExtensionContext stack.  Unable to set SmooksResourceConfiguration property '" + setOn + "' with static value.");
View Full Code Here

    @ConfigParam(defaultVal = "false")
    private boolean isTemplate;

    public void visitBefore(Element element, ExecutionContext executionContext) throws SmooksException {
        SmooksResourceConfiguration config = new SmooksResourceConfiguration();
        ExtensionContext extensionContext = ExtensionContext.getExtensionContext(executionContext);

        config.setExtendedConfigNS(element.getNamespaceURI());
        config.setResource(resource);

        // Set the defaults...
        if(extensionContext.getDefaultSelector() != null) {
            config.setSelector(extensionContext.getDefaultSelector());
        }
        config.setSelectorNamespaceURI(extensionContext.getDefaultNamespace());

        String targetProfile = DomUtils.getAttributeValue(element, PARAMETER_TARGET_PROFILE);
        if(targetProfile == null) {
          targetProfile = extensionContext.getDefaultProfile();
        }
        config.setTargetProfile(targetProfile);
        config.setConditionEvaluator(extensionContext.getDefaultConditionEvaluator());

        if(isTemplate) {
          extensionContext.addResourceTemplate(config);
        } else {
          extensionContext.addResource(config);
View Full Code Here

    public static SmooksResourceConfiguration getSAXParserConfiguration(ContentDeliveryConfig deliveryConfig) {
        if (deliveryConfig == null) {
            throw new IllegalArgumentException("null 'deliveryConfig' arg in method call.");
        }

        SmooksResourceConfiguration saxDriverConfig = null;
        List<SmooksResourceConfiguration> saxConfigs = deliveryConfig.getSmooksResourceConfigurations(ORG_XML_SAX_DRIVER);

        if (saxConfigs != null && !saxConfigs.isEmpty()) {
            saxDriverConfig = saxConfigs.get(0);
        }
View Full Code Here

        if(elementSUs != null) {
            int numSUs = elementSUs.size();

            for(int i = 0; i < numSUs; i++) {
                ContentHandlerConfigMap configMap = elementSUs.get(i);
                SmooksResourceConfiguration config = configMap.getResourceConfig();

                // Make sure the serialization unit is targeted at this element.
                if(!config.isTargetedAtElement(element, executionContext)) {
                    continue;
                }

                // Register the targeting event...
                if(eventListener != null) {
View Full Code Here

    public SmooksResourceConfiguration addVisitor(Visitor visitor, String targetSelector, String targetSelectorNS, boolean configure) {
        AssertArgument.isNotNull(visitor, "visitor");
        AssertArgument.isNotNull(targetSelector, "targetSelector");

        SmooksResourceConfiguration resourceConfig;
        if (visitor instanceof SmooksResourceConfigurationFactory) {
            resourceConfig = ((SmooksResourceConfigurationFactory)visitor).createConfiguration();
            resourceConfig.setResource(visitor.getClass().getName());
            resourceConfig.setSelector(targetSelector);
        } else {
            resourceConfig = new SmooksResourceConfiguration(targetSelector, visitor.getClass().getName());
        }

        resourceConfig.setSelectorNamespaceURI(targetSelectorNS);
        addVisitor(visitor, resourceConfig, configure);

        return resourceConfig;
    }
View Full Code Here

        Map<String, List<ContentHandlerConfigMap<? extends SAXVisitor>>> table = saxVisitorMap.getTable();
        Collection<List<ContentHandlerConfigMap<? extends SAXVisitor>>> contentHandlerMaps = table.values();

        for(List<ContentHandlerConfigMap<? extends SAXVisitor>> contentHandlerMapList : contentHandlerMaps) {
            for(ContentHandlerConfigMap<? extends SAXVisitor> contentHandlerMap : contentHandlerMapList) {
                SmooksResourceConfiguration resourceConfig = contentHandlerMap.getResourceConfig();
                SelectorStep selectorStep = resourceConfig.getSelectorStep();

                if(selectorStep.accessesText()) {
                    throw new SmooksConfigurationException("Unsupported selector '" + selectorStep.getXPathExpression() + "' on resource '" + resourceConfig + "'.  The 'text()' XPath token is only supported on SAX Visitor implementations that implement the " + SAXVisitAfter.class.getName() + " interface only.  Class '" + resourceConfig.getResource() + "' implements other SAX Visitor interfaces.");
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.milyn.cdr.SmooksResourceConfiguration

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.