Package org.apache.tuscany.sca.contribution.resource

Examples of org.apache.tuscany.sca.contribution.resource.ResourceExport


     * @throws Exception
     */
    @Test
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        ResourceExport resourceExport = (ResourceExport)staxProcessor.read(reader, context);
        assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
    }
View Full Code Here


    /**
     * Process <export.resource uri=""/>
     */
    public ResourceExport read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException {
      ResourceExport resourceExport = this.factory.createResourceExport();
        QName element = null;

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

                        // Read <export.resource>
                        if (ResourceExport.TYPE.equals(element)) {
                            String uri = reader.getAttributeValue(null, URI);
                            if (uri == null) {
                              error(context.getMonitor(), "AttributeURIMissing", reader);
                                //throw new ContributionReadException("Attribute 'uri' is missing");
                            } else
                                resourceExport.setURI(uri);
                        }

                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        if (ResourceExport.TYPE.equals(reader.getName())) {
View Full Code Here

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

   
    /**
     * Process <export.resource uri=""/>
     */
    public ResourceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
      ResourceExport resourceExport = this.factory.createResourceExport();
        QName element = null;
       
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    element = reader.getName();
                   
                    // Read <export.resource>
                    if (EXPORT_RESOURCE.equals(element)) {
                        String uri = reader.getAttributeValue(null, URI);
                        if (uri == null) {
                            throw new ContributionReadException("Attribute 'uri' is missing");
                        }
                        resourceExport.setURI(uri);
                    }
                   
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    if (EXPORT_RESOURCE.equals(reader.getName())) {
View Full Code Here

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

        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
        factories.addFactory(new ResourceImportExportFactoryImpl());
        ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
        ResourceExport resourceExport = exportProcessor.read(reader);
       
        assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
    }
View Full Code Here

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

        ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
        factories.addFactory(new ResourceImportExportFactoryImpl());
        ResourceExportProcessor exportProcessor = new ResourceExportProcessor(factories);
        ResourceExport resourceExport = exportProcessor.read(reader);
       
        assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
    }
View Full Code Here

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

   
    /**
     * Process <export.resource uri=""/>
     */
    public ResourceExport read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
      ResourceExport resourceExport = this.factory.createResourceExport();
        QName element = null;
       
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    element = reader.getName();
                   
                    // Read <export.resource>
                    if (EXPORT_RESOURCE.equals(element)) {
                        String uri = reader.getAttributeValue(null, URI);
                        if (uri == null) {
                            throw new ContributionReadException("Attribute 'uri' is missing");
                        }
                        resourceExport.setURI(uri);
                    }
                   
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    if (EXPORT_RESOURCE.equals(reader.getName())) {
View Full Code Here

     * Test loading a valid export element from a contribution metadata stream
     * @throws Exception
     */
    public void testLoad() throws Exception {
        XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
        ResourceExport resourceExport = (ResourceExport)staxProcessor.read(reader);
        assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
    }
View Full Code Here

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

TOP

Related Classes of org.apache.tuscany.sca.contribution.resource.ResourceExport

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.