Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.Extension


        for (int a = 0; a < reader.getAttributeCount(); a++) {
            QName attributeName = reader.getAttributeName(a);
            if (attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
                if (!elementName.getNamespaceURI().equals(attributeName.getNamespaceURI())) {
                    Object attributeValue = extensionAttributeProcessor.read(attributeName, reader, context);
                    Extension attributeExtension;
                    if (attributeValue instanceof Extension) {
                        attributeExtension = (Extension)attributeValue;
                    } else {
                        attributeExtension = extensionFactory.createExtension();
                        attributeExtension.setQName(attributeName);
                        attributeExtension.setValue(attributeValue);
                        attributeExtension.setAttribute(true);
                    }
                    extensible.getAttributeExtensions().add(attributeExtension);
                }
            }
        }
View Full Code Here


        return Extension.class;
    }

    public Extension read(QName attributeName, XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        String attributeValue = reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
        Extension ext = assemblyFactory.createExtension();
        ext.setQName(attributeName);
        ext.setAttribute(true);
        ext.setValue(attributeValue);
        return ext;
    }
View Full Code Here

        for (int a = 0; a < reader.getAttributeCount(); a++) {
            QName attributeName = reader.getAttributeName(a);
            if (attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
                if (!elementName.getNamespaceURI().equals(attributeName.getNamespaceURI())) {
                    Object attributeValue = extensionAttributeProcessor.read(attributeName, reader, context);
                    Extension attributeExtension;
                    if (attributeValue instanceof Extension) {
                        attributeExtension = (Extension)attributeValue;
                    } else {
                        attributeExtension = extensionFactory.createExtension();
                        attributeExtension.setQName(attributeName);
                        attributeExtension.setValue(attributeValue);
                        attributeExtension.setAttribute(true);
                    }
                    extensible.getAttributeExtensions().add(attributeExtension);
                }
            }
        }
View Full Code Here

      assertEquals("Calculator", c.getName().getLocalPart());
      assertEquals(1, c.getComponents().size());
      Component component = c.getComponents().get(0);
      assertEquals("AddServiceComponent", component.getName());
      assertEquals(1, component.getAttributeExtensions().size());
      Extension extension = component.getAttributeExtensions().get(0);
      assertEquals("customAttribute", extension.getQName().getLocalPart());
      assertEquals("http://test", extension.getQName().getNamespaceURI());
      assertEquals("customValue", extension.getValue());
    }
View Full Code Here

        return Extension.class;
    }

    public Extension read(QName attributeName, XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        String attributeValue = reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
        Extension ext = assemblyFactory.createExtension();
        ext.setQName(attributeName);
        ext.setAttribute(true);
        ext.setValue(attributeValue);
        return ext;
    }
View Full Code Here

     * @throws XMLStreamException
     */
    public Extension read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        QName name = reader.getName();
        String xml = helper.saveAsString(reader);
        Extension ext = assemblyFactory.createExtension();
        ext.setQName(name);
        ext.setValue(xml);
       
        return ext;
    }
View Full Code Here

    private void verifyExtendedElementComposite(Composite composite) throws XMLStreamException {

    assertEquals("RecursiveExtendedElement", composite.getName().getLocalPart());
    assertEquals(1, composite.getExtensions().size());
    Extension ext1 = (Extension) composite.getExtensions().get(0);
    assertEquals("unknownElement", ext1.getQName().getLocalPart());
    assertEquals("http://docs.oasis-open.org/ns/opencsa/sca/200912", ext1.getQName().getNamespaceURI());
 
    XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader((String)ext1.getValue()));       
    reader.next();
    assertEquals("unknownElement", reader.getLocalName());
    reader.next();
    assertEquals("subUnknownElement1", reader.getLocalName());
    assertEquals(1, reader.getAttributeCount());
View Full Code Here

      Component component = composite.getComponents().get(0);
      assertEquals("unknownImpl", component.getName());
      assertEquals(1, component.getServices().size());
      assertEquals("service", component.getServices().get(0).getName());
      assertEquals(1, component.getExtensions().size());
      Extension ext = (Extension) component.getExtensions().get(0);
      assertEquals("http://docs.oasis-open.org/ns/opencsa/sca/200912", ext.getQName().getNamespaceURI());
      assertEquals("implementation.unknown", ext.getQName().getLocalPart());
   
  }
View Full Code Here

      assertEquals("Calculator", c.getName().getLocalPart());
      assertEquals(1, c.getComponents().size());
      Component component = c.getComponents().get(0);
      assertEquals("AddServiceComponent", component.getName());
      assertEquals(1, component.getAttributeExtensions().size());
      Extension extension = component.getAttributeExtensions().get(0);
      assertEquals("customAttribute", extension.getQName().getLocalPart());
      assertEquals("http://test", extension.getQName().getNamespaceURI());
      assertEquals("customValue", extension.getValue());
    }
View Full Code Here

        for (int a = 0; a < reader.getAttributeCount(); a++) {
            QName attributeName = reader.getAttributeName(a);
            if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
                if( ! elementName.getNamespaceURI().equals(attributeName.getNamespaceURI()) ) {
                    Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
                    Extension attributeExtension;
                    if (attributeValue instanceof Extension) {
                        attributeExtension = (Extension) attributeValue;
                    } else {
                        attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
                    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.Extension

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.