Package org.switchyard.config.model.composite

Examples of org.switchyard.config.model.composite.CompositeModel


    public void testTargetNamespace() throws Exception {
        SwitchYardModel switchyard = _puller.pull(COMPLETE_XML, getClass());
        Assert.assertEquals("m1app", switchyard.getName());
        Assert.assertEquals(new QName("m1app"), switchyard.getQName());
        final String tns = "urn:m1app:example:1.0";
        CompositeModel composite = switchyard.getComposite();
        Assert.assertEquals("m1app", composite.getName());
        Assert.assertEquals(new QName(tns, "m1app"), composite.getQName());
        CompositeServiceModel compositeService = composite.getServices().iterator().next();
        Assert.assertEquals("M1AppService", compositeService.getName());
        Assert.assertEquals(new QName(tns, "M1AppService"), compositeService.getQName());
        ComponentModel component = composite.getComponents().iterator().next();
        Assert.assertEquals("SimpleService", component.getName());
        Assert.assertEquals(new QName(tns, "SimpleService"), component.getQName());
        ComponentServiceModel componentService = component.getServices().iterator().next();
        Assert.assertEquals("SimpleService", componentService.getName());
        Assert.assertEquals(new QName(tns, "SimpleService"), componentService.getQName());
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public List<ComponentReferenceModel> getComponentReferences() {
        List<ComponentReferenceModel> list = new ArrayList<ComponentReferenceModel>();
        CompositeModel composite = getComposite();
        if (composite != null) {
            String[] promotes = Strings.splitTrimToNullArray(getPromote(), " ");
            for (String promote : promotes) {
                String[] names =  Strings.splitTrimToNullArray(promote, "/");
                int namesCount = names.length;
                if (namesCount > 0) {
                    String componentName = names[0];
                    String componentReferenceName = (namesCount == 2) ? names[1] : null;
                    boolean componentMissing = true;
                    componentLoop: for (ComponentModel component : composite.getComponents()) {
                        if (componentName.equals(component.getName())) {
                            List<ComponentReferenceModel> componentReferences = component.getReferences();
                            if (namesCount == 1) {
                                if (componentReferences.size() > 0) {
                                    ComponentReferenceModel componentReference = componentReferences.iterator().next();
View Full Code Here

     * types in the application.
     * @return list of activator type names
     */
    public List<String> getActivationTypes() {
        HashSet<String> types = new HashSet<String>();
        CompositeModel composite = getConfig().getComposite();
        if (composite != null) {
            // reference bindings
            for (CompositeReferenceModel reference : composite.getReferences()) {
                for (BindingModel binding : reference.getBindings()) {
                    types.add(binding.getType());
                }
            }
            // service bindings
            for (CompositeServiceModel service : composite.getServices()) {
                for (BindingModel binding : service.getBindings()) {
                    types.add(binding.getType());
                }
            }
            // implementations
            for (ComponentModel component : composite.getComponents()) {
                if (component.getImplementation() != null) {
                    types.add(component.getImplementation().getType());
                }
            }
        }
View Full Code Here

    }

    private void deployReferenceBindings() {
        _log.debug("Deploying reference bindings for deployment " + getName());
        // activate bindings for each service
        CompositeModel composite = getConfig().getComposite();
        if (composite == null) {
            return;
        }
        for (CompositeReferenceModel reference : composite.getReferences()) {
            int bindingCount = 0;
            for (BindingModel binding : reference.getBindings()) {
                QName refQName = reference.getQName();
                ++bindingCount;
                if (binding.getName() == null) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public ComponentServiceModel getComponentService() {
        CompositeModel composite = getComposite();
        if (composite != null) {
            String[] promotes = Strings.splitTrimToNullArray(getPromote(), " ");
            switch (promotes.length) {
                case 0:
                    break;
                case 1:
                    String[] names =  Strings.splitTrimToNullArray(promotes[0], "/");
                    int namesCount = names.length;
                    if (namesCount > 0) {
                        String componentName = names[0];
                        String componentServiceName = (namesCount == 2) ? names[1] : null;
                        for (ComponentModel component : composite.getComponents()) {
                            if (componentName.equals(component.getName())) {
                                List<ComponentServiceModel> componentServices = component.getServices();
                                if (namesCount == 1) {
                                    if (componentServices.size() > 0) {
                                        ComponentServiceModel componentService = componentServices.iterator().next();
View Full Code Here

     * @return the QName
     */
    public QName createQName(String localPart) {
        final String tns;
        if (_configModel != null) {
            CompositeModel composite = _configModel.getComposite();
            tns = composite != null ? composite.getTargetNamespace() : _configModel.getTargetNamespace();
        } else {
            tns = null;
        }
        return XMLHelper.createQName(tns, localPart);
    }
View Full Code Here

TOP

Related Classes of org.switchyard.config.model.composite.CompositeModel

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.