Package org.apache.tuscany.sca.contribution.namespace

Examples of org.apache.tuscany.sca.contribution.namespace.NamespaceExport


     * @throws Exception
     */
    @Test
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader);
        assertEquals("http://foo", namespaceExport.getNamespace());
        assertEquals(1, namespaceExport.getAttributeExtensions().size());
        assertEquals(1, namespaceExport.getExtensions().size());
    }
View Full Code Here


    /**
     * Process <export namespace=""/>
     */
    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException {
        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
        QName element = null;

        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();

                        // Read <export>
                        if (EXPORT.equals(element)) {
                            String ns = reader.getAttributeValue(null, NAMESPACE);
                            if (ns == null) {
                              error("AttributeNameSpaceMissing", reader);
                                //throw new ContributionReadException("Attribute 'namespace' is missing");
                            } else {
                                namespaceExport.setNamespace(ns);
                            }
                            readExtendedAttributes(reader, namespaceExport, attributeProcessor, extensionFactory);
                        } else {
                            readExtendedElement(reader, namespaceExport, extensionProcessor);
                        }
View Full Code Here

   
    /**
     * Process <export namespace=""/>
     */
    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException {
        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
        QName element = null;
       
        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();
                       
                        // Read <export>
                        if (EXPORT.equals(element)) {
                            String ns = reader.getAttributeValue(null, NAMESPACE);
                            if (ns == null) {
                              error("AttributeNameSpaceMissing", reader);
                                //throw new ContributionReadException("Attribute 'namespace' is missing");
                            } else
                                namespaceExport.setNamespace(ns);
                        }
                       
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        if (EXPORT.equals(reader.getName())) {
View Full Code Here

     * @throws Exception
     */
    @Test
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader, context);
        assertEquals("http://foo", namespaceExport.getNamespace());
        assertEquals(1, namespaceExport.getAttributeExtensions().size());
        assertEquals(1, namespaceExport.getExtensions().size());
    }
View Full Code Here

                    if (targetContribution != null) {
                   
                        // Find a matching contribution export
                        for (Export export: targetContribution.getExports()) {
                            if (export instanceof NamespaceExport) {
                                NamespaceExport namespaceExport = (NamespaceExport)export;
                                if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
                                    namespaceImport.setModelResolver(namespaceExport.getModelResolver());
                                   
                                    List<Contribution> exportingContributions = new ArrayList<Contribution>();
                                    exportingContributions.add(namespaceExport.getContribution());
                                    import_.setExportContributions(exportingContributions);
                                   
                                    initialized = true;
                                    break;
                                }
View Full Code Here

                    if (targetContribution != null) {
                   
                        // Find a matching contribution export
                        for (Export export: targetContribution.getExports()) {
                            if (export instanceof NamespaceExport) {
                                NamespaceExport namespaceExport = (NamespaceExport)export;
                                if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
                                    namespaceImport.setModelResolver(namespaceExport.getModelResolver());
                                    initialized = true;
                                    break;
                                }
                            }
                        }
View Full Code Here

   
    /**
     * Process <export namespace=""/>
     */
    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
        QName element = null;
       
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    element = reader.getName();
                   
                    // Read <export>
                    if (EXPORT.equals(element)) {
                        String ns = reader.getAttributeValue(null, NAMESPACE);
                        if (ns == null) {
                            throw new ContributionReadException("Attribute 'namespace' is missing");
                        }
                        namespaceExport.setNamespace(ns);
                    }
                   
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    if (EXPORT.equals(reader.getName())) {
View Full Code Here

        XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));

        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
        factories.addFactory(new NamespaceImportExportFactoryImpl());
        NamespaceExportProcessor exportProcessor = new NamespaceExportProcessor(factories);
        NamespaceExport namespaceExport = exportProcessor.read(reader);
       
        assertEquals("http://foo", namespaceExport.getNamespace());
    }
View Full Code Here

    /**
     * Process <export namespace=""/>
     */
    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException {
        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
        QName element = null;

        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();

                        // Read <export>
                        if (EXPORT.equals(element)) {
                            String ns = reader.getAttributeValue(null, NAMESPACE);
                            if (ns == null) {
                              error("AttributeNameSpaceMissing", reader);
                                //throw new ContributionReadException("Attribute 'namespace' is missing");
                            } else {
                                namespaceExport.setNamespace(ns);
                            }
                            readExtendedAttributes(reader, namespaceExport, attributeProcessor, extensionFactory);
                        } else {
                            readExtendedElement(reader, namespaceExport, extensionProcessor);
                        }
View Full Code Here

    /**
     * Process <export namespace=""/>
     */
    public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException {
        NamespaceExport namespaceExport = this.factory.createNamespaceExport();
        QName element = null;

        try {
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
                    case START_ELEMENT:
                        element = reader.getName();

                        // Read <export>
                        if (EXPORT.equals(element)) {
                            String ns = reader.getAttributeValue(null, NAMESPACE);
                            if (ns == null) {
                              error("AttributeNameSpaceMissing", reader);
                                //throw new ContributionReadException("Attribute 'namespace' is missing");
                            } else {
                                namespaceExport.setNamespace(ns);
                            }
                            readExtendedAttributes(reader, namespaceExport, attributeProcessor, extensionFactory);
                        } else {
                            readExtendedElement(reader, namespaceExport, extensionProcessor);
                        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.contribution.namespace.NamespaceExport

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.