Package org.apache.tuscany.sca.assembly

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


        Composite include = null;
        Component component = null;
        Property property = null;
        ComponentService componentService = null;
        ComponentReference componentReference = null;
        ComponentProperty componentProperty = null;
        CompositeService compositeService = null;
        CompositeReference compositeReference = null;
        Contract contract = null;
        Wire wire = null;
        Callback callback = null;
        QName name = null;

        // Read the composite document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    name = reader.getName();

                    if (COMPOSITE_QNAME.equals(name)) {

                        // Read a <composite>
                        composite = assemblyFactory.createComposite();
                        composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                        if(isSet(reader, AUTOWIRE)) {
                            composite.setAutowire(getBoolean(reader, AUTOWIRE));
                        }
                        composite.setLocal(getBoolean(reader, LOCAL));
                        composite.setConstrainingType(readConstrainingType(reader));
                        policyProcessor.readPolicies(composite, reader);

                    } else if (INCLUDE_QNAME.equals(name)) {

                        // Read an <include>
                        include = assemblyFactory.createComposite();
                        include.setName(getQName(reader, "name"));
                        include.setUnresolved(true);
                        composite.getIncludes().add(include);

                    } else if (SERVICE_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><service>
                            componentService = assemblyFactory.createComponentService();
                            contract = componentService;
                            componentService.setName(getString(reader, NAME));
                            component.getServices().add(componentService);
                            policyProcessor.readPolicies(contract, reader);
                        } else {

                            // Read a <composite><service>
                            compositeService = assemblyFactory.createCompositeService();
                            contract = compositeService;
                            compositeService.setName(getString(reader, NAME));

                            String promoted = getString(reader, PROMOTE);
                            String promotedComponentName;
                            String promotedServiceName;
                            int s = promoted.indexOf('/');
                            if (s == -1) {
                                promotedComponentName = promoted;
                                promotedServiceName = null;
                            } else {
                                promotedComponentName = promoted.substring(0, s);
                                promotedServiceName = promoted.substring(s + 1);
                            }

                            Component promotedComponent = assemblyFactory.createComponent();
                            promotedComponent.setUnresolved(true);
                            promotedComponent.setName(promotedComponentName);
                            compositeService.setPromotedComponent(promotedComponent);

                            ComponentService promotedService = assemblyFactory.createComponentService();
                            promotedService.setUnresolved(true);
                            promotedService.setName(promotedServiceName);
                            compositeService.setPromotedService(promotedService);

                            composite.getServices().add(compositeService);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (REFERENCE_QNAME.equals(name)) {
                        if (component != null) {
                            // Read a <component><reference>
                            componentReference = assemblyFactory.createComponentReference();
                            contract = componentReference;
                            componentReference.setName(getString(reader, NAME));
                            readMultiplicity(componentReference, reader);
                            if (isSet(reader, AUTOWIRE)) {
                                componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
                            }
                            readTargets(componentReference, reader);
                            componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            component.getReferences().add(componentReference);
                            policyProcessor.readPolicies(contract, reader);
                        } else {
                            // Read a <composite><reference>
                            compositeReference = assemblyFactory.createCompositeReference();
                            contract = compositeReference;
                            compositeReference.setName(getString(reader, NAME));
                            readMultiplicity(compositeReference, reader);
                            readTargets(compositeReference, reader);
                            String promote = reader.getAttributeValue(null, Constants.PROMOTE);
                            if (promote != null) {
                                for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
                                    ComponentReference promotedReference =
                                        assemblyFactory.createComponentReference();
                                    promotedReference.setUnresolved(true);
                                    promotedReference.setName(tokens.nextToken());
                                    compositeReference.getPromotedReferences().add(promotedReference);
                                }
                            }
                            compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            composite.getReferences().add(compositeReference);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (PROPERTY_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><property>
                            componentProperty = assemblyFactory.createComponentProperty();
                            property = componentProperty;
                            componentProperty.setSource(getString(reader, SOURCE));
                            componentProperty.setFile(getString(reader, FILE));
                            policyProcessor.readPolicies(property, reader);
                            readAbstractProperty(componentProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
View Full Code Here


     * @param composite
     */
    private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
        // Resolve properties
        Map<String, Property> compositeProperties = new HashMap<String, Property>();
        ComponentProperty componentProperty = null;
        for (Property p : composite.getProperties()) {
            componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
            if (componentProperty != null) {
                compositeProperties.put(p.getName(), componentProperty);
            } else {
View Full Code Here

        // Create component properties for all properties
        if (component.getImplementation() != null) {
            for (Property property : component.getImplementation().getProperties()) {
                if (!componentProperties.containsKey(property.getName())) {
                    ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
                    componentProperty.setName(property.getName());
                    componentProperty.setMany(property.isMany());
                    componentProperty.setXSDElement(property.getXSDElement());
                    componentProperty.setXSDType(property.getXSDType());
                    componentProperty.setProperty(property);
                    component.getProperties().add(componentProperty);
                }
            }
        }

        // Reconcile component properties and their properties
        for (ComponentProperty componentProperty : component.getProperties()) {
            Property property = componentProperty.getProperty();
            if (property != null) {

                // Check that a component property does not override the
                // mustSupply attribute
                if (!property.isMustSupply() && componentProperty.isMustSupply()) {
                    warning("PropertyMustSupplyIncompatible", component, component.getName(), componentProperty.getName());
                }

                // Default to the mustSupply attribute specified on the property
                if (!componentProperty.isMustSupply())
                    componentProperty.setMustSupply(property.isMustSupply());

                // Default to the value specified on the property
                if (componentProperty.getValue() == null) {
                    componentProperty.setValue(property.getValue());
                }
               
                // Override the property value for the composite
                if(component.getImplementation() instanceof Composite) {
                    property.setValue(componentProperty.getValue());
                }

                // Check that a value is supplied
                if (componentProperty.getValue() == null && property.isMustSupply()) {
                    warning("PropertyMustSupplyNull", component, component.getName(), componentProperty.getName());
                }

                // Check that a a component property does not override the
                // many attribute
                if (!property.isMany() && componentProperty.isMany()) {

                    warning("PropertyOverrideManyAttribute", component, component.getName(), componentProperty.getName());
                }

                // Default to the many attribute defined on the property
                componentProperty.setMany(property.isMany());

                // Default to the type and element defined on the property
                if (componentProperty.getXSDType() == null) {
                    componentProperty.setXSDType(property.getXSDType());
                }
                if (componentProperty.getXSDElement() == null) {
                    componentProperty.setXSDElement(property.getXSDElement());
                }

                // Check that a type or element are specified
                if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
                    warning("NoTypeForComponentProperty", component, component.getName(), componentProperty.getName());
                }
            }
        }
    }
View Full Code Here

     * @param composite
     */
    private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
        // Resolve properties
        Map<String, Property> compositeProperties = new HashMap<String, Property>();
        ComponentProperty componentProperty = null;
        for (Property p : composite.getProperties()) {
            componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
            if (componentProperty != null) {
                compositeProperties.put(p.getName(), componentProperty);
            } else {
View Full Code Here

        Composite include = null;
        Component component = null;
        Property property = null;
        ComponentService componentService = null;
        ComponentReference componentReference = null;
        ComponentProperty componentProperty = null;
        CompositeService compositeService = null;
        CompositeReference compositeReference = null;
        Contract contract = null;
        Wire wire = null;
        Callback callback = null;
        QName name = null;

        // Read the composite document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    name = reader.getName();

                    if (COMPOSITE_QNAME.equals(name)) {

                        // Read a <composite>
                        composite = assemblyFactory.createComposite();
                       
                        composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));

                        if(!isSet(reader, TARGET_NAMESPACE)){
                            // spec says that a composite must have a namespace
                            warning("NoCompositeNamespace", composite, composite.getName().toString());  
                        }
                       
                        if(isSet(reader, AUTOWIRE)) {
                            composite.setAutowire(getBoolean(reader, AUTOWIRE));
                        }
                        composite.setLocal(getBoolean(reader, LOCAL));
                        composite.setConstrainingType(readConstrainingType(reader));
                        policyProcessor.readPolicies(composite, reader);

                    } else if (INCLUDE_QNAME.equals(name)) {

                        // Read an <include>
                        include = assemblyFactory.createComposite();
                        include.setName(getQName(reader, NAME));
                        include.setURI(getString(reader, URI));
                        include.setUnresolved(true);
                        composite.getIncludes().add(include);

                    } else if (SERVICE_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><service>
                            componentService = assemblyFactory.createComponentService();
                            contract = componentService;
                            componentService.setName(getString(reader, NAME));
                            component.getServices().add(componentService);
                            policyProcessor.readPolicies(contract, reader);
                        } else {

                            // Read a <composite><service>
                            compositeService = assemblyFactory.createCompositeService();
                            contract = compositeService;
                            compositeService.setName(getString(reader, NAME));

                            String promoted = getString(reader, PROMOTE);
                            if (promoted != null) {
                                String promotedComponentName;
                                String promotedServiceName;
                                int s = promoted.indexOf('/');
                                if (s == -1) {
                                    promotedComponentName = promoted;
                                    promotedServiceName = null;
                                } else {
                                    promotedComponentName = promoted.substring(0, s);
                                    promotedServiceName = promoted.substring(s + 1);
                                }
   
                                Component promotedComponent = assemblyFactory.createComponent();
                                promotedComponent.setUnresolved(true);
                                promotedComponent.setName(promotedComponentName);
                                compositeService.setPromotedComponent(promotedComponent);
   
                                ComponentService promotedService = assemblyFactory.createComponentService();
                                promotedService.setUnresolved(true);
                                promotedService.setName(promotedServiceName);
                                compositeService.setPromotedService(promotedService);
                            }

                            composite.getServices().add(compositeService);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (REFERENCE_QNAME.equals(name)) {
                        if (component != null) {
                            // Read a <component><reference>
                            componentReference = assemblyFactory.createComponentReference();
                            contract = componentReference;
                            componentReference.setName(getString(reader, NAME));
                            readMultiplicity(componentReference, reader);
                            if (isSet(reader, AUTOWIRE)) {
                                componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
                            }
                            readTargets(componentReference, reader);
                            componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            component.getReferences().add(componentReference);
                            policyProcessor.readPolicies(contract, reader);
                        } else {
                            // Read a <composite><reference>
                            compositeReference = assemblyFactory.createCompositeReference();
                            contract = compositeReference;
                            compositeReference.setName(getString(reader, NAME));
                            readMultiplicity(compositeReference, reader);
                            readTargets(compositeReference, reader);
                            String promote = reader.getAttributeValue(null, Constants.PROMOTE);
                            if (promote != null) {
                                for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
                                    ComponentReference promotedReference =
                                        assemblyFactory.createComponentReference();
                                    promotedReference.setUnresolved(true);
                                    promotedReference.setName(tokens.nextToken());
                                    compositeReference.getPromotedReferences().add(promotedReference);
                                }
                            }
                            compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            composite.getReferences().add(compositeReference);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (PROPERTY_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><property>
                            componentProperty = assemblyFactory.createComponentProperty();
                            property = componentProperty;
                            String source = getString(reader, SOURCE);
                            if(source!=null) {
                                source = source.trim();
                            }
                            componentProperty.setSource(source);
                            if (source != null) {
                                // $<name>/...
                                if (source.charAt(0) == '$') {
                                    int index = source.indexOf('/');
                                    if (index == -1) {
                                        // Tolerating $prop
                                        source = source + "/";
                                        index = source.length() - 1;
                                    }
                                    source = source.substring(index + 1);
                                    if ("".equals(source)) {
                                        source = ".";
                                    }
                                }
                                XPath xpath = xPathFactory.newXPath();
                                xpath.setNamespaceContext(reader.getNamespaceContext());
                                try {
                                    componentProperty.setSourceXPathExpression(xpath.compile(source));
                                } catch (XPathExpressionException e) {
                                  ContributionReadException ce = new ContributionReadException(e);
                                  error("ContributionReadException", xpath, ce);
                                    //throw ce;
                                }
                            }
                            componentProperty.setFile(getString(reader, FILE));
                            policyProcessor.readPolicies(property, reader);
                            readAbstractProperty(componentProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
View Full Code Here

        Composite include = null;
        Component component = null;
        Property property = null;
        ComponentService componentService = null;
        ComponentReference componentReference = null;
        ComponentProperty componentProperty = null;
        CompositeService compositeService = null;
        CompositeReference compositeReference = null;
        Contract contract = null;
        Wire wire = null;
        Callback callback = null;
        QName name = null;

        // Read the component scdl

        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
            case START_ELEMENT:
                QName itemName = reader.getName();
                if (!itemName.getNamespaceURI().equals(SCA10_NS))
                    name = new QName(SCA10_NS, itemName.getLocalPart());
                else
                    name = itemName;

                if (SERVICE_QNAME.equals(name)) {
                    if (component != null) {

                        // Read a <component><service>
                        componentService = assemblyFactory
                                .createComponentService();
                        contract = componentService;
                        componentService.setName(getString(reader, NAME));
                        component.getServices().add(componentService);
                        policyProcessor.readPolicies(contract, reader);
                    }

                } else if (REFERENCE_QNAME.equals(name)) {
                    if (component != null) {
                        // Read a <component><reference>
                        componentReference = assemblyFactory
                                .createComponentReference();
                        contract = componentReference;
                        componentReference.setName(getString(reader, NAME));
                        readMultiplicity(componentReference, reader);
                        if (isSet(reader, AUTOWIRE)) {
                            componentReference.setAutowire(getBoolean(reader,
                                    AUTOWIRE));
                        }
                        readTargets(componentReference, reader);
                        componentReference.setWiredByImpl(getBoolean(reader,
                                WIRED_BY_IMPL));
                        component.getReferences().add(componentReference);
                        policyProcessor.readPolicies(contract, reader);
                    }

                } else if (PROPERTY_QNAME.equals(name)) {
                    if (component != null) {

                        // Read a <component><property>
                        componentProperty = assemblyFactory
                                .createComponentProperty();
                        property = componentProperty;
                        componentProperty.setSource(getString(reader, SOURCE));
                        componentProperty.setFile(getString(reader, FILE));
                        policyProcessor.readPolicies(property, reader);
                        readAbstractProperty(componentProperty, reader);

                        // Read the property value
                        Document value = readPropertyValue(property
View Full Code Here

        c.setConstrainingType(constraint);

        Implementation i = new TestImplementation(factory);
        c.setImplementation(i);

        ComponentProperty p = factory.createComponentProperty();
        p.setName("currency");
        p.setValue("USD");
        p.setMustSupply(true);
        p.setXSDType(new QName("", ""));
        p.setProperty(i.getProperties().get(0));
        c.getProperties().add(p);

        ComponentReference ref1 = factory.createComponentReference();
        ref1.setName("accountDataService");
        ref1.setMultiplicity(Multiplicity.ONE_ONE);
View Full Code Here

        // Create component properties for all properties
        if (component.getImplementation() != null) {
            for (Property property : component.getImplementation().getProperties()) {
                if (!componentProperties.containsKey(property.getName())) {
                    ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
                    componentProperty.setName(property.getName());
                    componentProperty.setMany(property.isMany());
                    componentProperty.setXSDElement(property.getXSDElement());
                    componentProperty.setXSDType(property.getXSDType());
                    componentProperty.setProperty(property);
                    component.getProperties().add(componentProperty);
                }
            }
        }

        // Reconcile component properties and their properties
        for (ComponentProperty componentProperty : component.getProperties()) {
            Property property = componentProperty.getProperty();
            if (property != null) {

                // Check that a component property does not override the
                // mustSupply attribute
                if (!property.isMustSupply() && componentProperty.isMustSupply()) {
                    warning("Component property mustSupply attribute incompatible with property: " + component
                                .getName()
                                + "/"
                                + componentProperty.getName(),
                            component);
                }

                // Default to the mustSupply attribute specified on the property
                if (!componentProperty.isMustSupply())
                    componentProperty.setMustSupply(property.isMustSupply());

                // Default to the value specified on the property
                if (componentProperty.getValue() == null) {
                    componentProperty.setValue(property.getValue());
                }
               
                // Override the property value for the composite
                if(component.getImplementation() instanceof Composite) {
                    property.setValue(componentProperty.getValue());
                }

                // Check that a value is supplied
                if (componentProperty.getValue() == null && property.isMustSupply()) {
                    warning("No value configured on a mustSupply property: " + component.getName()
                        + "/"
                        + componentProperty.getName(), component);
                }

                // Check that a a component property does not override the
                // many attribute
                if (!property.isMany() && componentProperty.isMany()) {
                    warning("Component property many attribute incompatible with property: " + component
                                .getName()
                                + "/"
                                + componentProperty.getName(),
                            component);
                }

                // Default to the many attribute defined on the property
                componentProperty.setMany(property.isMany());

                // Default to the type and element defined on the property
                if (componentProperty.getXSDType() == null) {
                    componentProperty.setXSDType(property.getXSDType());
                }
                if (componentProperty.getXSDElement() == null) {
                    componentProperty.setXSDElement(property.getXSDElement());
                }

                // Check that a type or element are specified
                if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
                    warning("No type specified on component property: " + component.getName()
                        + "/"
                        + componentProperty.getName(), component);
                }
            }
        }
    }
View Full Code Here

     * @param composite
     */
    private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
        // Resolve properties
        Map<String, Property> compositeProperties = new HashMap<String, Property>();
        ComponentProperty componentProperty = null;
        for (Property p : composite.getProperties()) {
            componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
            if (componentProperty != null) {
                compositeProperties.put(p.getName(), componentProperty);
            } else {
View Full Code Here

        Composite include = null;
        Component component = null;
        Property property = null;
        ComponentService componentService = null;
        ComponentReference componentReference = null;
        ComponentProperty componentProperty = null;
        CompositeService compositeService = null;
        CompositeReference compositeReference = null;
        Contract contract = null;
        Wire wire = null;
        Callback callback = null;
        QName name = null;

        // Read the composite document
        while (reader.hasNext()) {
            int event = reader.getEventType();
            switch (event) {
                case START_ELEMENT:
                    name = reader.getName();

                    if (COMPOSITE_QNAME.equals(name)) {

                        // Read a <composite>
                        composite = assemblyFactory.createComposite();
                        composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
                        if(isSet(reader, AUTOWIRE)) {
                            composite.setAutowire(getBoolean(reader, AUTOWIRE));
                        }
                        composite.setLocal(getBoolean(reader, LOCAL));
                        composite.setConstrainingType(readConstrainingType(reader));
                        policyProcessor.readPolicies(composite, reader);

                    } else if (INCLUDE_QNAME.equals(name)) {

                        // Read an <include>
                        include = assemblyFactory.createComposite();
                        include.setName(getQName(reader, NAME));
                        include.setURI(getString(reader, URI));
                        include.setUnresolved(true);
                        composite.getIncludes().add(include);

                    } else if (SERVICE_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><service>
                            componentService = assemblyFactory.createComponentService();
                            contract = componentService;
                            componentService.setName(getString(reader, NAME));
                            component.getServices().add(componentService);
                            policyProcessor.readPolicies(contract, reader);
                        } else {

                            // Read a <composite><service>
                            compositeService = assemblyFactory.createCompositeService();
                            contract = compositeService;
                            compositeService.setName(getString(reader, NAME));

                            String promoted = getString(reader, PROMOTE);
                            String promotedComponentName;
                            String promotedServiceName;
                            int s = promoted.indexOf('/');
                            if (s == -1) {
                                promotedComponentName = promoted;
                                promotedServiceName = null;
                            } else {
                                promotedComponentName = promoted.substring(0, s);
                                promotedServiceName = promoted.substring(s + 1);
                            }

                            Component promotedComponent = assemblyFactory.createComponent();
                            promotedComponent.setUnresolved(true);
                            promotedComponent.setName(promotedComponentName);
                            compositeService.setPromotedComponent(promotedComponent);

                            ComponentService promotedService = assemblyFactory.createComponentService();
                            promotedService.setUnresolved(true);
                            promotedService.setName(promotedServiceName);
                            compositeService.setPromotedService(promotedService);

                            composite.getServices().add(compositeService);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (REFERENCE_QNAME.equals(name)) {
                        if (component != null) {
                            // Read a <component><reference>
                            componentReference = assemblyFactory.createComponentReference();
                            contract = componentReference;
                            componentReference.setName(getString(reader, NAME));
                            readMultiplicity(componentReference, reader);
                            if (isSet(reader, AUTOWIRE)) {
                                componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
                            }
                            readTargets(componentReference, reader);
                            componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            component.getReferences().add(componentReference);
                            policyProcessor.readPolicies(contract, reader);
                        } else {
                            // Read a <composite><reference>
                            compositeReference = assemblyFactory.createCompositeReference();
                            contract = compositeReference;
                            compositeReference.setName(getString(reader, NAME));
                            readMultiplicity(compositeReference, reader);
                            readTargets(compositeReference, reader);
                            String promote = reader.getAttributeValue(null, Constants.PROMOTE);
                            if (promote != null) {
                                for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
                                    ComponentReference promotedReference =
                                        assemblyFactory.createComponentReference();
                                    promotedReference.setUnresolved(true);
                                    promotedReference.setName(tokens.nextToken());
                                    compositeReference.getPromotedReferences().add(promotedReference);
                                }
                            }
                            compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
                            composite.getReferences().add(compositeReference);
                            policyProcessor.readPolicies(contract, reader);
                        }

                    } else if (PROPERTY_QNAME.equals(name)) {
                        if (component != null) {

                            // Read a <component><property>
                            componentProperty = assemblyFactory.createComponentProperty();
                            property = componentProperty;
                            String source = getString(reader, SOURCE);
                            if(source!=null) {
                                source = source.trim();
                            }
                            componentProperty.setSource(source);
                            if (source != null) {
                                // $<name>/...
                                if (source.charAt(0) == '$') {
                                    int index = source.indexOf('/');
                                    if (index == -1) {
                                        // Tolerating $prop
                                        source = source + "/";
                                        index = source.length() - 1;
                                    }
                                    source = source.substring(index + 1);
                                    if ("".equals(source)) {
                                        source = ".";
                                    }
                                }
                                XPath xpath = xPathFactory.newXPath();
                                xpath.setNamespaceContext(reader.getNamespaceContext());
                                try {
                                    componentProperty.setSourceXPathExpression(xpath.compile(source));
                                } catch (XPathExpressionException e) {
                                    throw new ContributionReadException(e);
                                }
                            }
                            componentProperty.setFile(getString(reader, FILE));
                            policyProcessor.readPolicies(property, reader);
                            readAbstractProperty(componentProperty, reader);
                           
                            // Read the property value
                            Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
View Full Code Here

TOP

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

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.