Package org.apache.tuscany.sca.assembly

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


            resolver.addModel(composite, context);

            staxProcessor.resolve(composite, resolver, new ProcessorContext());

            SCABinding referenceSCABinding =
                (SCABinding)composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
            SCABinding serviceSCABinding =
                (SCABinding)composite.getComponents().get(1).getServices().get(0).getBindings().get(0);

            Assert.assertNotNull(referenceSCABinding);
            Assert.assertNotNull(serviceSCABinding);
        } catch (Exception ex) {
View Full Code Here


     * @param contract
     * @param definitions
     */
    protected void createSCABinding(Contract contract, Definitions definitions) {

        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        scaBinding.setName(contract.getName());

        if (definitions != null) {
            for (ExtensionType attachPointType : definitions.getBindingTypes()) {
                if (attachPointType.getType().equals(BINDING_SCA_QNAME)) {
                    ((PolicySubject)scaBinding).setExtensionType(attachPointType);
View Full Code Here

     * @param contract
     * @param definitions
     */
    protected void createSCABinding(Contract contract, Definitions definitions) {

        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        scaBinding.setName(contract.getName());

        if (definitions != null) {
            for (ExtensionType attachPointType : definitions.getBindingTypes()) {
                if (attachPointType.getType().equals(BINDING_SCA_QNAME)) {
                    ((PolicySubject)scaBinding).setExtensionType(attachPointType);
View Full Code Here

            resolver.addModel(composite, context);

            staxProcessor.resolve(composite, resolver, new ProcessorContext());

            SCABinding referenceSCABinding =
                (SCABinding)composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
            SCABinding serviceSCABinding =
                (SCABinding)composite.getComponents().get(1).getServices().get(0).getBindings().get(0);

            Assert.assertNotNull(referenceSCABinding);
            Assert.assertNotNull(serviceSCABinding);
        } catch (Exception ex) {
View Full Code Here

        InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        ComponentType componentType = (ComponentType)staxProcessor.read(reader, context);
        assertNotNull(componentType);
       
        SCABinding referenceSCABinding = (SCABinding) componentType.getReferences().get(0).getBindings().get(0);
        assertNotNull(referenceSCABinding);
       
        SCABinding serviceSCABinding   = (SCABinding) componentType.getServices().get(0).getBindings().get(0);
        assertNotNull(serviceSCABinding);    

        //new PrintUtil(System.out).print(componentType);
    }
View Full Code Here

        InputStream is = getClass().getResourceAsStream("/Calculator.composite");
        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
        Composite composite = (Composite)staxProcessor.read(reader, context);
        assertNotNull(composite);

        SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
        SCABinding serviceSCABinding   = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
       
        Assert.assertNotNull(referenceSCABinding);
        Assert.assertNotNull(serviceSCABinding);       
    }
View Full Code Here

                if (serviceName == null || serviceName.equals(componentService.getName())) {

                    CompositeService compositeService = (CompositeService)componentService.getService();
                    if (compositeService != null) {
                        promotedService = compositeService.getPromotedService();
                        SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
                        if (scaBinding != null) {
                            Component promotedComponent = scaBinding.getComponent();
                            if (serviceName != null) {
                                serviceName = "$promoted$." + serviceName;
                            }
                            componentContext = (ComponentContext)promotedComponent;
                        }
View Full Code Here

                if (serviceName == null || serviceName.equals(componentService.getName())) {

                    CompositeService compositeService = (CompositeService)componentService.getService();
                    if (compositeService != null) {
                        promotedService = compositeService.getPromotedService();
                        SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
                        if (scaBinding != null) {
                            Component promotedComponent = scaBinding.getComponent();
                            if (serviceName != null) {
                                serviceName = "$promoted$." + serviceName;
                            }
                            componentContext = (ComponentContext)promotedComponent;
                        }
View Full Code Here

            // TODO: For non-SCA binding, how do we deal with targets? For now, assuming targets only apply to SCABinding
            return;
        }
        for (ComponentService service : reference.getTargets()) {
            Component target = null;
            SCABinding scaBinding = service.getBinding(SCABinding.class);
            if (scaBinding != null) {
                target = scaBinding.getComponent();
            }

            // FIXME: [rfeng] Ignore unresolved services
            if (service.isUnresolved()) {
                continue;
View Full Code Here

 
  public String getBeanName() {
    //TODO handle multiplicity
    ComponentService componentService = reference.getTargets().get(0);
    if (!componentService.isUnresolved()) {
      SCABinding binding = componentService.getBinding(SCABinding.class);
                        return binding.getComponent().getURI();
    } else {
      return null;
    }
  }
View Full Code Here

TOP

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

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.