Package org.switchyard.config

Examples of org.switchyard.config.Configuration


        String name = config.getName();
        Descriptor desc = getDescriptor();
        if (name.equals(CompositeModel.COMPOSITE)) {
            return new V1CompositeModel(config, desc);
        } else if (name.equals(CompositeServiceModel.SERVICE)) {
            Configuration config_parent = config.getParent();
            if (config_parent != null) {
                if (config_parent.getName().equals(CompositeModel.COMPOSITE)) {
                    return new V1CompositeServiceModel(config, desc);
                } else if (config_parent.getName().equals(ComponentModel.COMPONENT)) {
                    return new V1ComponentServiceModel(config, desc);
                }
            }
        } else if (name.startsWith(BindingModel.BINDING)) {
            if (name.endsWith("." + SCABindingModel.SCA)) {
                return new V1SCABindingModel(config, desc);
            } else {
                return new V1BindingModel(config, desc);
            }
        } else if (name.equals(ComponentModel.COMPONENT)) {
            return new V1ComponentModel(config, desc);
        } else if (name.startsWith(ComponentImplementationModel.IMPLEMENTATION)) {
            if (name.equals(IMPLEMENTATION_BPEL)) {
                return new V1BPELComponentImplementationModel(config, getDescriptor());
            }
            return new V1ComponentImplementationModel(config, desc);
        } else if (name.startsWith(InterfaceModel.INTERFACE)) {
            Configuration config_parent = config.getParent();
            if (config_parent != null) {
                // only pick up standard SCA interface types
                if (name.endsWith(InterfaceModel.JAVA) || name.endsWith(InterfaceModel.WSDL)) {
                    return new V1InterfaceModel(config, desc);
                }
            }
        } else if (name.equals(ComponentReferenceModel.REFERENCE)) {
            Configuration config_parent = config.getParent();
            if (config_parent != null) {
                if (config_parent.getName().equals(CompositeModel.COMPOSITE)) {
                    return new V1CompositeReferenceModel(config, desc);
                } else if (config_parent.getName().equals(ComponentModel.COMPONENT)) {
                    return new V1ComponentReferenceModel(config, desc);
                }
            }
        } else if (name.equals(PropertyModel.PROPERTY)) {
            return new V1PropertyModel(config,desc);
View Full Code Here


     * Set the content of the requires attribute for a given config model.
     * @param model the model to set policy requirements on.
     * @param requirements the set of policy requirements.
     */
    public static void setRequirements(Model model, Set<QName> requirements) {
        Configuration config = model.getModelConfiguration();
        if (requirements == null || requirements.isEmpty()) {
            config.setAttribute(REQUIRES, null);
            return;
        }
        StringBuilder requires = new StringBuilder();
        for (QName req : requirements) {
            requires.append(" ");
            String ns = req.getNamespaceURI();
            if (XMLConstants.DEFAULT_NS_PREFIX.equals(ns)) {
                requires.append(req.getLocalPart());
            } else {
                String pfx = config.lookupPrefix(ns);
                if (pfx != null) {
                    requires.append(pfx + ":" + req.getLocalPart());
                } else {
                    // SCA cvc-datatype-valid.1.2.1 XSD doesn't allow for {namespaceURI}localPart format
                    //requires.append(req.toString());
                    requires.append(req.getLocalPart());
                }
            }
        }
        config.setAttribute(REQUIRES, requires.toString().trim());
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void setCompositePropertyResolver() {
        Configuration config = getModelConfiguration();
        Configuration parent = config.getParent();
        if (parent != null) {
            config.setPropertyResolver(CompoundPropertyResolver.compact(parent.getPropertyResolver(), this));
        } else {
            config.setPropertyResolver(CompoundPropertyResolver.compact(SystemAndTestPropertyResolver.INSTANCE, this));
        }
        for (ComponentModel component : _components) {
            component.setComponentPropertyResolver();
View Full Code Here

    public void setDomainPropertyResolver() {
        DomainModel domain = getDomain();
        if (domain != null) {
            PropertiesModel properties = domain.getProperties();
            if (properties != null) {
                Configuration config = getModelConfiguration();
                config.setPropertyResolver(CompoundPropertyResolver.compact(config.getPropertyResolver(), properties));
            }
        }
        if (_composite != null) {
            _composite.setCompositePropertyResolver();
        }
View Full Code Here

                        }
                    }
                }
            }
        }
        Configuration config = merged.getModelConfiguration();
        final String xmlns_x2 = XMLNS_ATTRIBUTE + ":" + XMLNS_ATTRIBUTE;
        if (config.hasAttribute(xmlns_x2)) {
            String xmlns = config.getAttribute(xmlns_x2);
            config.setAttribute(xmlns_x2, null);
            config.setAttribute(XMLNS_ATTRIBUTE, xmlns);
        }
        return new ScannerOutput<M>().setModel(merged);
    }
View Full Code Here

    public void execute() throws MojoExecutionException, MojoFailureException {
        parseVersion(_oldVersion, true);
        parseVersion(_newVersion, false);
        AtomicBoolean projectModified = new AtomicBoolean(false);
        try {
            Configuration project = new ConfigurationPuller(false).pull(_project_file);
            if (project != null) {
                setVersion(project.getFirstChild("version"), _newVersion_pom, projectModified);
                Configuration project_parent = project.getFirstChild("parent");
                if (project_parent != null) {
                    Configuration project_parent_groupId = project_parent.getFirstChild("groupId");
                    if (project_parent_groupId != null) {
                        String ppgid = Strings.trimToNull(project_parent_groupId.getValue());
                        if (ppgid != null && ppgid.startsWith("org.switchyard")) {
                            setVersion(project_parent.getFirstChild("version"), _newVersion_pom, projectModified);
                        }
                    }
                }
                Configuration project_properties = project.getFirstChild("properties");
                if (project_properties != null) {
                    setVersion(project_properties.getFirstChild("switchyard.version"), _newVersion_pom, projectModified);
                    setVersion(project_properties.getFirstChild("version.switchyard.runtime"), _newVersion_pom, projectModified);
                    setVersion(project_properties.getFirstChild("version.distro"), _newVersion_distro, projectModified);
                }
                if (projectModified.get()) {
                    getLog().info(_project_file.getAbsolutePath() + " modified. Writing...");
                    write(project, _project_file);
                } else {
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public final Model getModelParent() {
        if (_parent == null) {
            Configuration parent_config = _config.getParent();
            if (parent_config != null) {
                _parent = readModel(parent_config);
            }
        }
        return _parent;
View Full Code Here

     * Gets the first child model with the specified name.
     * @param name name of the child model
     * @return the first child model with the specified name
     */
    protected final Model getFirstChildModel(String name) {
        Configuration child_config = _config.getFirstChild(name);
        if (child_config != null) {
            return readModel(child_config);
        }
        return null;
    }
View Full Code Here

     * Gets the first child model with a specified name that starts with the specified prefix.
     * @param name the prefix to match against
     * @return the first child model with the specified prefix
     */
    protected final Model getFirstChildModelStartsWith(String name) {
        Configuration child_config = _config.getFirstChildStartsWith(name);
        if (child_config != null) {
            return readModel(child_config);
        }
        return null;
    }
View Full Code Here

     * @param child the child model to add
     * @return this model (useful for chaining)
     */
    protected final Model setChildModel(Model child) {
        if (child != null) {
            Configuration child_config = child.getModelConfiguration();
            _config.removeChildren(child_config.getQName());
            _config.addChild(child_config);
        }
        return this;
    }
View Full Code Here

TOP

Related Classes of org.switchyard.config.Configuration

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.