// Path: switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/ExtraJaxbClassesModel.java
// public interface ExtraJaxbClassesModel extends Model {
// 
//     /** The "extraJaxbClasses" name. */
//     public static final String EXTRA_JAXB_CLASSES = "extraJaxbClasses";
// 
//     /** Gets the child extraJaxbClass models.
//      * 
//      * @return the child extraJaxbClass models */
//     public List<ExtraJaxbClassModel> getExtraJaxbClasses();
// 
//     /** Adds a child extraJaxbClass model.
//      * 
//      * @param extraJaxbClass the child extraJaxbClass model
//      * @return this ExtraJaxbClassesModel (useful for chaining) */
//     public ExtraJaxbClassesModel addExtraJaxbClass(ExtraJaxbClassModel extraJaxbClass);
// 
// }
// 
// Path: switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/RemoteModel.java
// public interface RemoteModel extends Model {
// 
//     /** Gets the deploymentId attribute.
//      * 
//      * @return the deploymentId attribute */
//     public String getDeploymentId();
// 
//     /** Sets the deploymentId attribute.
//      * 
//      * @param deploymentId the deploymentId attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setDeploymentId(String deploymentId);
// 
//     /** Gets the userName attribute.
//      * 
//      * @return the userName attribute */
//     public String getUserName();
// 
//     /** Sets the userName attribute.
//      * 
//      * @param userName the userName attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setUserName(String userName);
// 
//     /** Gets the password attribute.
//      * 
//      * @return the password attribute */
//     public String getPassword();
// 
//     /** Sets the password attribute.
//      * 
//      * @param password the password attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setPassword(String password);
// 
//     /** Gets the timeout attribute.
//      * 
//      * @return the timeout attribute */
//     public Integer getTimeout();
// 
//     /** Sets the timeout attribute.
//      * 
//      * @param timeout the timeout attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setTimeout(Integer timeout);
// 
//     /** Gets the child extraJaxbClasses model.
//      * 
//      * @return the child extraJaxbClasses model */
//     public ExtraJaxbClassesModel getExtraJaxbClasses();
// 
//     /** Sets the child extraJaxbClasses model.
//      * 
//      * @param extraJaxbClasses the child extraJaxbClasses model
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setExtraJaxbClasses(ExtraJaxbClassesModel extraJaxbClasses);
// 
// }


import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedHashSet;
import java.util.Properties;
import java.util.Set;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.remote.client.api.RemoteJmsRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRestRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRuntimeEngineBuilder;
import org.kie.services.client.api.RemoteRuntimeEngineFactory;
import org.kie.services.client.api.command.RemoteConfiguration;
import org.kie.services.client.api.command.RemoteRuntimeEngine;
import org.switchyard.common.type.reflect.Access;
import org.switchyard.common.type.reflect.FieldAccess;
import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassModel;
import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassesModel;
import org.switchyard.component.common.knowledge.config.model.RemoteJmsModel;
import org.switchyard.component.common.knowledge.config.model.RemoteModel;
import org.switchyard.component.common.knowledge.config.model.RemoteRestModel;
        if (truststoreLocation != null) {
            builder.addTruststoreLocation(truststoreLocation);
        }
        return ctx;
    }

    @SuppressWarnings("deprecation")
    private void configRemoteRest(RemoteRestRuntimeEngineBuilder builder, RemoteRestModel model) {
        configRemote(builder, model);
        try {
            builder.addUrl(new URL(model.getUrl()));
        } catch (MalformedURLException mue) {
            throw new RuntimeException(mue);
        }
    }

    private void configRemote(RemoteRuntimeEngineBuilder<?, ?> builder, RemoteModel model) {
        builder.addDeploymentId(model.getDeploymentId());
        String userName = model.getUserName();
        if (userName != null) {
            builder.addUserName(userName);
        }
        String password = model.getPassword();
        if (password != null) {
            builder.addPassword(password);
        }
        Integer timeout = model.getTimeout();
        if (timeout != null) {
            builder.addTimeout(timeout.intValue());
        }
// Path: switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/ExtraJaxbClassesModel.java
// public interface ExtraJaxbClassesModel extends Model {
// 
//     /** The "extraJaxbClasses" name. */
//     public static final String EXTRA_JAXB_CLASSES = "extraJaxbClasses";
// 
//     /** Gets the child extraJaxbClass models.
//      * 
//      * @return the child extraJaxbClass models */
//     public List<ExtraJaxbClassModel> getExtraJaxbClasses();
// 
//     /** Adds a child extraJaxbClass model.
//      * 
//      * @param extraJaxbClass the child extraJaxbClass model
//      * @return this ExtraJaxbClassesModel (useful for chaining) */
//     public ExtraJaxbClassesModel addExtraJaxbClass(ExtraJaxbClassModel extraJaxbClass);
// 
// }
// 
// Path: switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/RemoteModel.java
// public interface RemoteModel extends Model {
// 
//     /** Gets the deploymentId attribute.
//      * 
//      * @return the deploymentId attribute */
//     public String getDeploymentId();
// 
//     /** Sets the deploymentId attribute.
//      * 
//      * @param deploymentId the deploymentId attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setDeploymentId(String deploymentId);
// 
//     /** Gets the userName attribute.
//      * 
//      * @return the userName attribute */
//     public String getUserName();
// 
//     /** Sets the userName attribute.
//      * 
//      * @param userName the userName attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setUserName(String userName);
// 
//     /** Gets the password attribute.
//      * 
//      * @return the password attribute */
//     public String getPassword();
// 
//     /** Sets the password attribute.
//      * 
//      * @param password the password attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setPassword(String password);
// 
//     /** Gets the timeout attribute.
//      * 
//      * @return the timeout attribute */
//     public Integer getTimeout();
// 
//     /** Sets the timeout attribute.
//      * 
//      * @param timeout the timeout attribute
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setTimeout(Integer timeout);
// 
//     /** Gets the child extraJaxbClasses model.
//      * 
//      * @return the child extraJaxbClasses model */
//     public ExtraJaxbClassesModel getExtraJaxbClasses();
// 
//     /** Sets the child extraJaxbClasses model.
//      * 
//      * @param extraJaxbClasses the child extraJaxbClasses model
//      * @return this RemoteModel (useful for chaining) */
//     public RemoteModel setExtraJaxbClasses(ExtraJaxbClassesModel extraJaxbClasses);
// 
// }


// Path: switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/RemoteConfigurationBuilder.java
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedHashSet;
import java.util.Properties;
import java.util.Set;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.remote.client.api.RemoteJmsRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRestRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRuntimeEngineBuilder;
import org.kie.services.client.api.RemoteRuntimeEngineFactory;
import org.kie.services.client.api.command.RemoteConfiguration;
import org.kie.services.client.api.command.RemoteRuntimeEngine;
import org.switchyard.common.type.reflect.Access;
import org.switchyard.common.type.reflect.FieldAccess;
import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassModel;
import org.switchyard.component.common.knowledge.config.model.ExtraJaxbClassesModel;
import org.switchyard.component.common.knowledge.config.model.RemoteJmsModel;
import org.switchyard.component.common.knowledge.config.model.RemoteModel;
import org.switchyard.component.common.knowledge.config.model.RemoteRestModel;

        if (truststoreLocation != null) {
            builder.addTruststoreLocation(truststoreLocation);
        }
        return ctx;
    }

    @SuppressWarnings("deprecation")
    private void configRemoteRest(RemoteRestRuntimeEngineBuilder builder, RemoteRestModel model) {
        configRemote(builder, model);
        try {
            builder.addUrl(new URL(model.getUrl()));
        } catch (MalformedURLException mue) {
            throw new RuntimeException(mue);
        }
    }

    private void configRemote(RemoteRuntimeEngineBuilder<?, ?> builder, RemoteModel model) {
        builder.addDeploymentId(model.getDeploymentId());
        String userName = model.getUserName();
        if (userName != null) {
            builder.addUserName(userName);
        }
        String password = model.getPassword();
        if (password != null) {
            builder.addPassword(password);
        }
        Integer timeout = model.getTimeout();
        if (timeout != null) {
            builder.addTimeout(timeout.intValue());
        }
        ExtraJaxbClassesModel extraJaxbClasses = model.getExtraJaxbClasses();