Package org.apache.tuscany.sca.contribution.processor

Examples of org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor


        for (final BindingActivator bindingActivator : bindingActivators) {

            // Remove the binding SCDL processor from the runtime
            if (staxProcessors != null) {
                StAXArtifactProcessor processor =
                    staxProcessors.getProcessor(getBindingQName(bindingActivator.getBindingClass()));
                if (processor != null) {
                    staxProcessors.removeArtifactProcessor(processor);
                }
            }
View Full Code Here


    public void stop(ExtensionPointRegistry registry) {
        StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);

        for (final ImplementationActivator implementationActivator : implementationActivators) {
            if (staxProcessors != null) {
                StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
                if (processor != null) {
                    staxProcessors.removeArtifactProcessor(processor);
                }
            }
        }
View Full Code Here

        }

    }

    protected Binding createDelegatingBinding(QName bindingType) throws XMLStreamException, ContributionReadException {
        StAXArtifactProcessor processor = processors.getProcessor(bindingType);
        if (processor == null) {
            logger.warning("Mapped binding for binding.sca is not supported: " + bindingType);
        }

        StringBuffer xml = new StringBuffer();
        xml.append("<").append(bindingType.getLocalPart()).append(" xmlns:b=\"").append(bindingType.getNamespaceURI())
            .append("\"/>");

        StAXHelper staxHelper = StAXHelper.getInstance(registry);
        XMLStreamReader reader = staxHelper.createXMLStreamReader(new StringReader(xml.toString()));
        reader.nextTag();
        Binding binding = (Binding)processor.read(reader, new ProcessorContext(registry));

        return binding;
    }
View Full Code Here

        while (true) {
            int event = reader.getEventType();
            if (event == XMLStreamConstants.START_ELEMENT) {
                if ("policySet".equals(reader.getName().getLocalPart())) {
                    reader.nextTag();
                    StAXArtifactProcessor processor = processors.get(reader.getName());
                    Policy policy = (Policy)processor.read(reader);

                    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                    XMLStreamWriter writer = outputFactory.createXMLStreamWriter(outputStream);
                    processor.write(policy, writer);
                    writer.flush();
                    results.add(outputStream.toString());
                }
            }
            if (reader.hasNext()) {
View Full Code Here

        for (final BindingActivator bindingActivator : bindingActivators) {

            // Remove the binding SCDL processor from the runtime
            if (staxProcessors != null) {
                StAXArtifactProcessor processor =
                    staxProcessors.getProcessor(getBindingQName(bindingActivator.getBindingClass()));
                if (processor != null) {
                    staxProcessors.removeArtifactProcessor(processor);
                }
            }
View Full Code Here

    public void stop(ExtensionPointRegistry registry) {
        StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);

        for (final ImplementationActivator implementationActivator : implementationActivators) {
            if (staxProcessors != null) {
                StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
                if (processor != null) {
                    staxProcessors.removeArtifactProcessor(processor);
                }
            }
        }
View Full Code Here

    public void stop(ExtensionPointRegistry registry) {
        StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);

        for (final ImplementationActivator implementationActivator : implementationActivators) {
            if (staxProcessors != null) {
                StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
                if (processor != null) {
                    staxProcessors.removeArtifactProcessor(processor);
                }
            }
        }
View Full Code Here

        }

    }

    protected Binding createDelegatingBinding(QName bindingType) throws XMLStreamException, ContributionReadException {
        StAXArtifactProcessor processor = processors.getProcessor(bindingType);
        if (processor == null) {
            logger.warning("Mapped binding for binding.sca is not supported: " + bindingType);
        }

        StringBuffer xml = new StringBuffer();
        xml.append("<").append(bindingType.getLocalPart()).append(" xmlns:b=\"").append(bindingType.getNamespaceURI())
            .append("\"/>");

        StAXHelper staxHelper = StAXHelper.getInstance(registry);
        XMLStreamReader reader = staxHelper.createXMLStreamReader(new StringReader(xml.toString()));
        reader.nextTag();
        Binding binding = (Binding)processor.read(reader, new ProcessorContext(registry));

        return binding;
    }
View Full Code Here

        context = new ProcessorContext(extensionPoints);

        XMLInputFactory factory = XMLInputFactory.newInstance();
        StAXArtifactProcessorExtensionPoint staxProcessors =
            extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
        StAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, factory, null);

        processor = new ServiceDescriptionsProcessor(extensionPoints, staxProcessor);

        reader = factory.createXMLStreamReader(new StringReader(xml));
    }
View Full Code Here

        StAXAttributeProcessorExtensionPoint attributeExtensionPoint = registry.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
        StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint, inputFactory, outputFactory);
       
        BuilderExtensionPoint builderExtensionPoint = registry.getExtensionPoint(BuilderExtensionPoint.class);
       
        StAXArtifactProcessor processor = artifactExtensionPoint.getProcessor(Definitions.class);
       
        Object artifact = null;
       
        // Read the first definitions string
       
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(WS_POLICY1));
       
        artifact = processor.read(reader, new ProcessorContext());
        assertNotNull(artifact);
        Assert.assertTrue(artifact instanceof Definitions);
        Definitions definitions1 = (Definitions) artifact;

        // Read the second definitions string
       
        reader = inputFactory.createXMLStreamReader(new StringReader(WS_POLICY2));

        artifact = processor.read(reader, new ProcessorContext());
        assertNotNull(artifact);
        Assert.assertTrue(artifact instanceof Definitions);
        Definitions definitions2 = (Definitions) artifact; 
       
        // compare the policies using the policy builder
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor

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.