Package org.apache.tuscany.sca.assembly

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


    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        // Read the constrainingType document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {

                case START_ELEMENT:
                    name = reader.getName();
                   
                    // Read a <constrainingType>
                    if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                        constrainingType = assemblyFactory.createConstrainingType();
                        constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                        policyProcessor.readPolicies(constrainingType, reader);

                    } else if (Constants.SERVICE_QNAME.equals(name)) {
                       
                        // Read a <service>
                        abstractService = assemblyFactory.createAbstractService();
                        abstractContract = abstractService;
                        abstractService.setName(getString(reader, Constants.NAME));
                        constrainingType.getServices().add(abstractService);
                        policyProcessor.readPolicies(abstractService, reader);

                    } else if (Constants.REFERENCE_QNAME.equals(name)) {
                       
                        // Read a <reference>
                        abstractReference = assemblyFactory.createAbstractReference();
                        abstractContract = abstractReference;
                        abstractReference.setName(getString(reader, Constants.NAME));
                        readMultiplicity(abstractReference, reader);
                        constrainingType.getReferences().add(abstractReference);
                        policyProcessor.readPolicies(abstractReference, reader);

                    } else if (Constants.PROPERTY_QNAME.equals(name)) {
                       
                        // Read a <property>
                        abstractProperty = assemblyFactory.createAbstractProperty();
                        readAbstractProperty(abstractProperty, reader);
                       
                        // Read the property value
                        Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                        abstractProperty.setValue(value);
                       
                        constrainingType.getProperties().add(abstractProperty);
                        policyProcessor.readPolicies(abstractProperty, reader);
                       
                    } else if (OPERATION.equals(name)) {

                        // Read an <operation>
                        Operation operation = new OperationImpl();
                        operation.setName(getString(reader, NAME));
                        operation.setUnresolved(true);
                        policyProcessor.readPolicies(abstractContract, operation, reader);
                       
                    } else {

                        // Read an extension element
                        Object extension = extensionProcessor.read(reader);
                        if (extension instanceof InterfaceContract) {
                           
                            // <service><interface> and <reference><interface>
                            abstractContract.setInterfaceContract((InterfaceContract)extension);
                        } else {

                            // Add the extension element to the current element
                            if (abstractContract != null) {
                                abstractContract.getExtensions().add(extension);
                            } else {
                                constrainingType.getExtensions().add(extension);
                            }
                           
                        }
View Full Code Here


    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            policyProcessor.readPolicies(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            policyProcessor.readPolicies(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            policyProcessor.readPolicies(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                            abstractProperty.setValue(value);
                           
                            constrainingType.getProperties().add(abstractProperty);
                            policyProcessor.readPolicies(abstractProperty, reader);
                           
                        } else if (OPERATION_QNAME.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = new OperationImpl();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            policyProcessor.readPolicies(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {
   
                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            policyProcessor.readPolicies(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            policyProcessor.readPolicies(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            policyProcessor.readPolicies(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                            abstractProperty.setValue(value);
                           
                            constrainingType.getProperties().add(abstractProperty);
                            policyProcessor.readPolicies(abstractProperty, reader);
                           
                        } else if (OPERATION_QNAME.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = new OperationImpl();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            policyProcessor.readPolicies(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {
   
                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            policyProcessor.readPolicies(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            policyProcessor.readPolicies(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            policyProcessor.readPolicies(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                            abstractProperty.setValue(value);
                           
                            constrainingType.getProperties().add(abstractProperty);
                            policyProcessor.readPolicies(abstractProperty, reader);
                           
                        } else if (OPERATION_QNAME.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = new OperationImpl();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            policyProcessor.readPolicies(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {
   
                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        // Read the constrainingType document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {

                case START_ELEMENT:
                    name = reader.getName();
                   
                    // Read a <constrainingType>
                    if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                        constrainingType = assemblyFactory.createConstrainingType();
                        constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                        policyProcessor.readPolicies(constrainingType, reader);

                    } else if (Constants.SERVICE_QNAME.equals(name)) {
                       
                        // Read a <service>
                        abstractService = assemblyFactory.createAbstractService();
                        abstractContract = abstractService;
                        abstractService.setName(getString(reader, Constants.NAME));
                        constrainingType.getServices().add(abstractService);
                        policyProcessor.readPolicies(abstractService, reader);

                    } else if (Constants.REFERENCE_QNAME.equals(name)) {
                       
                        // Read a <reference>
                        abstractReference = assemblyFactory.createAbstractReference();
                        abstractContract = abstractReference;
                        abstractReference.setName(getString(reader, Constants.NAME));
                        readMultiplicity(abstractReference, reader);
                        constrainingType.getReferences().add(abstractReference);
                        policyProcessor.readPolicies(abstractReference, reader);

                    } else if (Constants.PROPERTY_QNAME.equals(name)) {
                       
                        // Read a <property>
                        abstractProperty = assemblyFactory.createAbstractProperty();
                        readAbstractProperty(abstractProperty, reader);
                       
                        // Read the property value
                        Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                        abstractProperty.setValue(value);
                       
                        constrainingType.getProperties().add(abstractProperty);
                        policyProcessor.readPolicies(abstractProperty, reader);
                       
                    } else if (OPERATION.equals(name)) {

                        // Read an <operation>
                        Operation operation = new OperationImpl();
                        operation.setName(getString(reader, NAME));
                        operation.setUnresolved(true);
                        policyProcessor.readPolicies(abstractContract, operation, reader);
                       
                    } else {

                        // Read an extension element
                        Object extension = extensionProcessor.read(reader);
                        if (extension instanceof InterfaceContract) {
                           
                            // <service><interface> and <reference><interface>
                            abstractContract.setInterfaceContract((InterfaceContract)extension);
                        } else {

                            // Add the extension element to the current element
                            if (abstractContract != null) {
                                abstractContract.getExtensions().add(extension);
                            } else {
                                constrainingType.getExtensions().add(extension);
                            }
                           
                        }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            policyProcessor.readPolicies(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            policyProcessor.readPolicies(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            policyProcessor.readPolicies(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                            abstractProperty.setValue(value);
                           
                            constrainingType.getProperties().add(abstractProperty);
                            policyProcessor.readPolicies(abstractProperty, reader);
                           
                        } else if (OPERATION_QNAME.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = new OperationImpl();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            policyProcessor.readPolicies(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {
   
                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            policyProcessor.readPolicies(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            policyProcessor.readPolicies(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            policyProcessor.readPolicies(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                            abstractProperty.setValue(value);
                           
                            constrainingType.getProperties().add(abstractProperty);
                            policyProcessor.readPolicies(abstractProperty, reader);
                           
                        } else if (OPERATION_QNAME.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = new OperationImpl();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            policyProcessor.readPolicies(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {
   
                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        // Read the constrainingType document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {

                case START_ELEMENT:
                    name = reader.getName();
                   
                    // Read a <constrainingType>
                    if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                        constrainingType = assemblyFactory.createConstrainingType();
                        constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                        policyProcessor.readPolicies(constrainingType, reader);

                    } else if (Constants.SERVICE_QNAME.equals(name)) {
                       
                        // Read a <service>
                        abstractService = assemblyFactory.createAbstractService();
                        abstractContract = abstractService;
                        abstractService.setName(getString(reader, Constants.NAME));
                        constrainingType.getServices().add(abstractService);
                        policyProcessor.readPolicies(abstractService, reader);

                    } else if (Constants.REFERENCE_QNAME.equals(name)) {
                       
                        // Read a <reference>
                        abstractReference = assemblyFactory.createAbstractReference();
                        abstractContract = abstractReference;
                        abstractReference.setName(getString(reader, Constants.NAME));
                        readMultiplicity(abstractReference, reader);
                        constrainingType.getReferences().add(abstractReference);
                        policyProcessor.readPolicies(abstractReference, reader);

                    } else if (Constants.PROPERTY_QNAME.equals(name)) {
                       
                        // Read a <property>
                        abstractProperty = assemblyFactory.createAbstractProperty();
                        readAbstractProperty(abstractProperty, reader);
                       
                        // Read the property value
                        Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
                        abstractProperty.setValue(value);
                       
                        constrainingType.getProperties().add(abstractProperty);
                        policyProcessor.readPolicies(abstractProperty, reader);
                       
                    } else if (OPERATION_QNAME.equals(name)) {

                        // Read an <operation>
                        Operation operation = new OperationImpl();
                        operation.setName(getString(reader, NAME));
                        operation.setUnresolved(true);
                        policyProcessor.readPolicies(abstractContract, operation, reader);
                       
                    } else {

                        // Read an extension element
                        Object extension = extensionProcessor.read(reader);
                        if (extension instanceof InterfaceContract) {
                           
                            // <service><interface> and <reference><interface>
                            abstractContract.setInterfaceContract((InterfaceContract)extension);
                        } else {

                            // Add the extension element to the current element
                            if (abstractContract != null) {
                                abstractContract.getExtensions().add(extension);
                            } else {
                                constrainingType.getExtensions().add(extension);
                            }
                           
                        }
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
           
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            readIntents(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            readIntents(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            readIntents(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                            constrainingType.getProperties().add(abstractProperty);
                            readIntents(abstractProperty, reader);
                           
                        } else if (OPERATION.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = assemblyFactory.createOperation();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            readIntents(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            }
                        }
                        break;
   
                    case END_ELEMENT:
View Full Code Here

    public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
        ConstrainingType constrainingType = null;
        AbstractService abstractService = null;
        AbstractReference abstractReference = null;
        AbstractProperty abstractProperty = null;
        AbstractContract abstractContract = null;
        QName name = null;
       
        try {
           
            // Read the constrainingType document
            while (reader.hasNext()) {
                int event = reader.getEventType();
                switch (event) {
   
                    case START_ELEMENT:
                        name = reader.getName();
                       
                        // Read a <constrainingType>
                        if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
                            constrainingType = assemblyFactory.createConstrainingType();
                            constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                            readIntents(constrainingType, reader);
   
                        } else if (Constants.SERVICE_QNAME.equals(name)) {
                           
                            // Read a <service>
                            abstractService = assemblyFactory.createAbstractService();
                            abstractContract = abstractService;
                            abstractService.setName(getString(reader, Constants.NAME));
                            constrainingType.getServices().add(abstractService);
                            readIntents(abstractService, reader);
   
                        } else if (Constants.REFERENCE_QNAME.equals(name)) {
                           
                            // Read a <reference>
                            abstractReference = assemblyFactory.createAbstractReference();
                            abstractContract = abstractReference;
                            abstractReference.setName(getString(reader, Constants.NAME));
                            readMultiplicity(abstractReference, reader);
                            constrainingType.getReferences().add(abstractReference);
                            readIntents(abstractReference, reader);
   
                        } else if (Constants.PROPERTY_QNAME.equals(name)) {
                           
                            // Read a <property>
                            abstractProperty = assemblyFactory.createAbstractProperty();
                            readAbstractProperty(abstractProperty, reader);
                            constrainingType.getProperties().add(abstractProperty);
                            readIntents(abstractProperty, reader);
                           
                        } else if (OPERATION.equals(name)) {
   
                            // Read an <operation>
                            Operation operation = assemblyFactory.createOperation();
                            operation.setName(getString(reader, NAME));
                            operation.setUnresolved(true);
                            readIntents(abstractContract, operation, reader);
                           
                        } else {
   
                            // Read an extension element
                            Object extension = extensionProcessor.read(reader);
                            if (extension instanceof InterfaceContract) {
                               
                                // <service><interface> and <reference><interface>
                                abstractContract.setInterfaceContract((InterfaceContract)extension);
                            } else {

                                // Add the extension element to the current element
                                if (abstractContract != null) {
                                    abstractContract.getExtensions().add(extension);
                                } else {
                                    constrainingType.getExtensions().add(extension);
                                }
                               
                            }
View Full Code Here

TOP

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

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.