Package org.apache.tuscany.sca.implementation.osgi

Examples of org.apache.tuscany.sca.implementation.osgi.SCAConfig


            return null;
        }
        ExtenderConfiguration extender = new ExtenderConfiguration();
        for (URL url : scaConfigs) {
            try {
                SCAConfig scaConfig = deployer.loadXMLDocument(url, deployer.createMonitor());
                extender.scaConfigs.add(scaConfig);
            } catch (Exception e) {
                logger.log(Level.SEVERE, e.getMessage(), e);
                throw new ServiceRuntimeException(e);
            }
View Full Code Here


    }

    public SCAConfig read(XMLStreamReader reader, ProcessorContext context) throws XMLStreamException,
        ContributionReadException {
        int event = reader.getEventType();
        SCAConfig definitions = factory.createSCAConfig();
        String targetNamespace = null;
        while (true) {
            switch (event) {
                case XMLStreamConstants.START_ELEMENT:
                    QName name = reader.getName();
                    if (SCA_CONFIG_QNAME.equals(name)) {
                        targetNamespace = reader.getAttributeValue(null, "targetNamespace");
                        definitions.setTargetNamespace(targetNamespace);
                    } else {
                        Object extension = processor.read(reader, context);
                        if (extension != null) {
                            if (extension instanceof Intent) {
                                Intent intent = (Intent)extension;
                                intent.setName(new QName(targetNamespace, intent.getName().getLocalPart()));
                                definitions.getIntents().add(intent);
                                for (Intent i : intent.getQualifiedIntents()) {
                                    i.setName(new QName(targetNamespace, i.getName().getLocalPart()));
                                }
                            } else if (extension instanceof PolicySet) {
                                PolicySet policySet = (PolicySet)extension;
                                policySet.setName(new QName(targetNamespace, policySet.getName().getLocalPart()));
                                definitions.getPolicySets().add(policySet);
                            } else if (extension instanceof Binding) {
                                Binding binding = (Binding)extension;
                                definitions.getBindings().add(binding);
                            }
                        }
                    }
                    break;
                case XMLStreamConstants.END_ELEMENT:
View Full Code Here

    }
   
    public String instrospectSCAConfig(ServiceReference reference, Map<String, Object> props, ComponentService service){
       
        ServiceDescriptionsFactory serviceDescriptionFactory = registry.getExtensionPoint(ServiceDescriptionsFactory.class);
        SCAConfig scaConfig = serviceDescriptionFactory.createSCAConfig();
       
        // add the binding configurations
        List<Binding> bindings = scaConfig.getBindings();
        bindings.addAll(service.getBindings());
       
        // add the intent configurations
        List<Intent> intents = scaConfig.getIntents();
        intents.addAll(service.getRequiredIntents());
       
        // add the policy set configurations
        List<PolicySet> policySets = scaConfig.getPolicySets();
        policySets.addAll(service.getPolicySets());
       
        // set up the target namespace
        // TODO - there is a bug in the spec which only allow bindings from one
        //        namsepace to be included in sca-config element. Here we just
        //        the first bindings namespace
        Map<String, Object> properties = getProperties(reference, props);
        String[] bindingNames = getStringArray(properties.get(SCA_BINDINGS));
        if (bindingNames.length > 0){
            QName firstBindingQName = getQName(bindingNames[0]);
            scaConfig.setTargetNamespace(firstBindingQName.getNamespaceURI());
        }       
       
        // write the sca config out to XML
        String scaConfigXMLString = "";
       
View Full Code Here

    }
   
    public String instrospectSCAConfig(ServiceReference reference, Map<String, Object> props, ComponentService service){
       
        ServiceDescriptionsFactory serviceDescriptionFactory = registry.getExtensionPoint(ServiceDescriptionsFactory.class);
        SCAConfig scaConfig = serviceDescriptionFactory.createSCAConfig();
       
        // add the binding configurations
        List<Binding> bindings = scaConfig.getBindings();
        bindings.addAll(service.getBindings());
       
        // add the intent configurations
        List<Intent> intents = scaConfig.getIntents();
        intents.addAll(service.getRequiredIntents());
       
        // add the policy set configurations
        List<PolicySet> policySets = scaConfig.getPolicySets();
        policySets.addAll(service.getPolicySets());
       
        // set up the target namespace
        // TODO - there is a bug in the spec which only allow bindings from one
        //        namsepace to be included in sca-config element. Here we just
        //        the first bindings namespace
        Map<String, Object> properties = getProperties(reference, props);
        String[] bindingNames = getStringArray(properties.get(SCA_BINDINGS));
        if (bindingNames.length > 0){
            QName firstBindingQName = getQName(bindingNames[0]);
            scaConfig.setTargetNamespace(firstBindingQName.getNamespaceURI());
        }       
       
        // write the sca config out to XML
        String scaConfigXMLString = "";
       
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.implementation.osgi.SCAConfig

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.