All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.petals.binding.soap.SoapBootstrap Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2007-2012 EBM WebSourcing, 2012-2023 Linagora
 * 
 * This program/library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This program/library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program/library; If not, see http://www.gnu.org/licenses/
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.binding.soap;

import static org.ow2.petals.binding.soap.SoapConstants.Axis2.AXIS2_XML;
import static org.ow2.petals.binding.soap.SoapConstants.Axis2.MODULES_PATH;
import static org.ow2.petals.binding.soap.SoapConstants.Axis2.MODULE_ARCHIVE_EXTENSION;
import static org.ow2.petals.binding.soap.SoapConstants.Axis2.SERVICES_PATH;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.Collection;

import javax.jbi.JBIException;
import javax.management.InvalidAttributeValueException;

import org.apache.commons.io.FileUtils;
import org.ow2.petals.component.framework.DefaultBootstrap;
import org.ow2.petals.component.framework.exception.NegativeValueException;

/**
 * The bootstrap class. Copy all the configuration files in the good directories.
 * @author Christophe HAMERLING - EBM WebSourcing
 */
public class SoapBootstrap extends DefaultBootstrap {

    public static final String ATTR_NAME_HTTP_HOST = "httpHost";

    public static final String ATTR_NAME_HTTP_PORT = "httpPort";

    public static final String ATTR_NAME_HTTP_ACCEPTORS = "httpAcceptors";

    public static final String ATTR_NAME_HTTP_BACKLOG_SIZE = "httpBacklogSize";

    public static final String ATTR_NAME_HTTPS_ENABLED = "httpsEnabled";

    public static final String ATTR_NAME_HTTPS_PORT = "httpsPort";

    public static final String ATTR_NAME_HTTPS_ACCEPTORS = "httpsAcceptors";

    public static final String ATTR_NAME_HTTPS_BACKLOG_SIZE = "httpsBacklogSize";

    public static final String ATTR_NAME_HTTPS_KEYSTORE_TYPE = "httpsKeystoreType";

    public static final String ATTR_NAME_HTTPS_KEYSTORE_FILE = "httpsKeystoreFile";

    public static final String ATTR_NAME_HTTPS_KEYSTORE_PWD = "httpsKeystorePassword";

    public static final String ATTR_NAME_HTTPS_KEY_PWD = "httpsKeyPassword";

    public static final String ATTR_NAME_MAX_HTTP_CONNECTIONS_PER_HOST = "maxHttpConnectionsPerHost";

    protected SoapBootstrapOperations bootstrapOperations;

    /**
     * Add a module to the Axis2 engine. This method is used by the
     * configuration MBean.
     * 
     * @param url
     * @return
     * @throws JBIException
     */
    public String addModule(final String url) throws Exception {
        return this.bootstrapOperations.addModule(url);
    }

    /**
     * Copy the needed configuration files to the Axis2 directories. Do not copy
     * them if the files are already present (the install phase has already been
     * done and we are now in the uninstall phase).
     * 
     */
    protected void copyConfigurationFiles() throws JBIException {

        final File installRootFile = new File(getInstallContext().getInstallRoot());

        /* copy required files from install directory */
        final File axis2File = new File(installRootFile, AXIS2_XML);

        // copy axis2.xml file
        if (axis2File.exists()) {
            final String workspaceRootDir = installContext.getContext().getWorkspaceRoot();
            final File destFile = new File(workspaceRootDir, axis2File.getName());
            if (!destFile.exists()) {
                try {
                    FileUtils.copyFile(axis2File, destFile);
                } catch (final IOException e) {
                    throw new JBIException(
                            "Can not copy the axis2 configuration file, axis2 can not be used", e);
                }
            }
        } else {
            throw new JBIException("the axis2 configuration file do not exist at '+ "
                    + axis2File.getAbsolutePath() + "', axis2 can not be used");
        }

        // copy modules from component root path
        final String workspaceRootDir = getInstallContext().getContext().getWorkspaceRoot();
        final File modules = new File(workspaceRootDir, MODULES_PATH);
        final File[] moduleFiles = installRootFile.listFiles(new FileFilter() {
            @Override
            public boolean accept(final File pathname) {
                return pathname.getName().endsWith("." + MODULE_ARCHIVE_EXTENSION);
            }
        });
        for (final File file : moduleFiles) {
            final File destFile = new File(modules, file.getName());
            if (!destFile.exists()) {
                try {
                    FileUtils.copyFile(file, destFile);
                } catch (final IOException e) {
                    getLogger().warning(
                            "The module '" + file.getName()
                                    + "' cannot been copied to modules directory");
                }
            }
        }
    }

    /**
     * Create the directories that will be used by axis
     */
    protected void createWorkDirectories() {
        final String workspaceRootDir = installContext.getContext().getWorkspaceRoot();
        final File modules = new File(workspaceRootDir, MODULES_PATH);
        final File services = new File(workspaceRootDir, SERVICES_PATH);
        if (!modules.exists()) {
            if (!modules.mkdirs()) {
                getLogger().warning(
                        "Cannot create modules directory at '" + modules.getAbsolutePath() + "'");
            }
        }
        if (!services.exists()) {
            if (!services.mkdirs()) {
                getLogger().warning(
                        "Cannot create services directory at '" + services.getAbsolutePath() + "'");
            }
        }
    }

    @Override
    protected void doInit() throws JBIException {
        super.doInit();
        createWorkDirectories();
        copyConfigurationFiles();

        if (bootstrapOperations == null) {
            bootstrapOperations = new SoapBootstrapOperations(installContext);
        }
    }

    @Override
    public Collection getMBeanAttributesNames() {
        final Collection attributes = super.getMBeanAttributesNames();
        
        attributes.add(ATTR_NAME_HTTP_PORT);
        attributes.add(ATTR_NAME_HTTP_HOST);
        attributes.add("httpServicesList");
        attributes.add("httpServicesContext");
        attributes.add("httpServicesMapping");
        attributes.add("httpThreadPoolSizeMin");
        attributes.add("httpThreadPoolSizeMax");
        attributes.add(ATTR_NAME_HTTP_ACCEPTORS);
        attributes.add(ATTR_NAME_HTTP_BACKLOG_SIZE);
        attributes.add(ATTR_NAME_HTTPS_ENABLED);
        attributes.add(ATTR_NAME_HTTPS_PORT);
        attributes.add(ATTR_NAME_HTTPS_ACCEPTORS);
        attributes.add(ATTR_NAME_HTTPS_BACKLOG_SIZE);
        attributes.add(ATTR_NAME_HTTPS_KEYSTORE_TYPE);
        attributes.add(ATTR_NAME_HTTPS_KEYSTORE_FILE);
        attributes.add(ATTR_NAME_HTTPS_KEYSTORE_PWD);
        attributes.add(ATTR_NAME_HTTPS_KEY_PWD);
        attributes.add("httpsTruststoreType");
        attributes.add("httpsTruststoreFile");
        attributes.add("httpsTruststorePassword");
        attributes.add("httpsClientAuthenticationEnabled");
        attributes.add("javaNamingFactoryInitial");
        attributes.add("javaNamingProviderURL");
        attributes.add("jmsConnectionFactoryJNDIName");
        attributes.add("publicStacktracesEnabled");
        attributes.add(ATTR_NAME_MAX_HTTP_CONNECTIONS_PER_HOST);

        return attributes;
    }

    /**
     * Get the number of acceptors for HTTP
     * 
     * @return the number of acceptors for HTTP
     */
    public int getHttpAcceptors() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTP_ACCEPTORS,
                SoapConstants.HttpServer.DEFAULT_HTTP_ACCEPTORS);
    }

    /**
     * Get the HTTP backlog size
     * 
     * @return the HTTP backlog size
     */
    public int getHttpBacklogSize() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTP_BACKLOG_SIZE,
                SoapConstants.HttpServer.DEFAULT_HTTP_BACKLOG_SIZE);
    }

    /**
     * Get the HTTP host name
     * 
     * @return the HTTP host name
     */
    public String getHttpHost() {
        return this.getParam(SoapConstants.HttpServer.HTTP_HOSTNAME);
    }

    /**
     * Get the HTTP port
     * 
     * @return the HTTP port
     */
    public int getHttpPort() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTP_PORT, SoapConstants.HttpServer.DEFAULT_HTTP_PORT);
    }

    /**
     * Get the HTTP service context
     * 
     * @return the HTTP service context
     */
    public String getHttpServicesContext() {
        return this.getParam(SoapConstants.HttpServer.HTTP_SERVICES_CONTEXT);
    }

    /**
     * Return if the service list is available
     * 
     * @return true if the service list is available, otherwise false
     */
    public boolean getHttpServicesList() {
        return this.getParamAsBoolean(SoapConstants.HttpServer.HTTP_SERVICES_LIST,
                SoapConstants.HttpServer.DEFAULT_HTTP_SERVICES_LIST);
    }

    /**
     * Get the HTTP service mapping
     * 
     * @return the HTTP service mapping
     */
    public String getHttpServicesMapping() {
        return this.getParam(SoapConstants.HttpServer.HTTP_SERVICES_MAPPING);
    }

    /**
     * Get the HTTP thread pool maximum size
     * 
     * @return the HTTP thread pool maximum size
     */
    public int getHttpThreadPoolSizeMax() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX,
                SoapConstants.HttpServer.DEFAULT_HTTP_THREAD_POOL_SIZE_MAX);
    }

    /**
     * Get the HTTP thread pool minimum size
     * 
     * @return the HTTP thread pool minimum size
     */
    public int getHttpThreadPoolSizeMin() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN,
                SoapConstants.HttpServer.DEFAULT_HTTP_THREAD_POOL_SIZE_MIN);
    }

    /**
     * Get the Java initial factory naming
     * 
     * @return the Java initial factory naming
     */
    public String getJavaNamingFactoryInitial() {
        return this.getParam(SoapConstants.JmsTransportLayer.JNDI_INITIAL_FACTORY);
    }

    /**
     * Get the Java URL provider naming
     * 
     * @return the Java URL provider naming
     */
    public String getJavaNamingProviderURL() {
        return this.getParam(SoapConstants.JmsTransportLayer.JNDI_PROVIDER_URL);
    }

    /**
     * Get the JMS connection factory JNDI name
     * 
     * @return the JMS connection factory JNDI name
     */
    public String getJMSConnectionFactoryJNDIName() {
        return this.getParam(SoapConstants.JmsTransportLayer.CONFAC_JNDINAME);
    }

    /**
     * Return if HTTPS is enabled
     * 
     * @return true if HTTPS is enabled, otherwise false
     */
    public boolean isHttpsEnabled() {
        return this.getParamAsBoolean(SoapConstants.HttpServer.HTTPS_ENABLED,
                SoapConstants.HttpServer.DEFAULT_HTTPS_ENABLED);
    }

    /**
     * Get the keystore type (JKS / PKCS12)
     * 
     * @return the keystore type (JKS / PKCS12)
     */
    public String getHttpsKeystoreType() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_TYPE);
    }
    
    /**
     * Get HTTPS port.
     * 
     * @return the HTTPS port
     */
    public int getHttpsPort() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTPS_PORT, SoapConstants.HttpServer.DEFAULT_HTTPS_PORT);
    }

    /**
     * Get the number of acceptors for HTTPS
     * 
     * @return the number of acceptors for HTTPS
     */
    public int getHttpsAcceptors() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTPS_ACCEPTORS,
                SoapConstants.HttpServer.DEFAULT_HTTPS_ACCEPTORS);
    }

    /**
     * Get the HTTPS backlog size
     * 
     * @return the HTTPS backlog size
     */
    public int getHttpsBacklogSize() {
        return this.getParamAsInteger(SoapConstants.HttpServer.HTTPS_BACKLOG_SIZE,
                SoapConstants.HttpServer.DEFAULT_HTTPS_BACKLOG_SIZE);
    }
    
    /**
     * Get the keystore file path
     * 
     * @return the keystore file path
     */
    public String getHttpsKeystoreFile() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_FILE);
    }

    /**
     * Get the keystore password
     * 
     * @return the keystore password
     */
    public String getHttpsKeystorePassword() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_PASSWORD_PARAM);
    }

    /**
     * Get the key password
     * 
     * @return the key password
     */
    public String getHttpsKeyPassword() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_KEY_PASSWORD_PARAM);
    }
    
    /**
     * Get the truststore type (JKS / PKCS12)
     * 
     * @return the truststore type (JKS / PKCS12)
     */
    public String getHttpsTruststoreType() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_TYPE);
    }

    /**
     * Get the truststore file path
     * 
     * @return the truststore file path
     */
    public String getHttpsTruststoreFile() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_FILE);
    }

    /**
     * Get the truststore password
     * 
     * @return the truststore password
     */
    public String getHttpsTruststorePassword() {
        return this.getParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_PASSWORD_PARAM);
    }

    /**
     * Return if the client authentication is required at SSL level.
     * 
     * @return true if the client authentication is required at SSL level,
     *         otherwise false
     */
    public boolean isHttpsClientAuthenticationEnabled() {
        return this.getParamAsBoolean(SoapConstants.HttpServer.HTTPS_CLIENT_AUTH_ENABLED,
                SoapConstants.HttpServer.DEFAULT_HTTPS_CLIENT_AUTH_ENABLED);
    }
    
    public boolean isPublicStacktracesEnabled() {
        return this.getParamAsBoolean(SoapConstants.HttpServer.PUBLIC_STACKTRACES_ENABLED,
                SoapConstants.HttpServer.DEFAULT_PUBLIC_STACKTRACES_ENABLED);
    }

    @Override
    public Collection getMBeanOperationsNames() {
        final Collection methods = super.getMBeanOperationsNames();

        // expose addModule for management
        methods.add("addModule");

        return methods;
    }

    /**
     * Set number of acceptors for HTTP
     * 
     * @param httpAcceptors
     *            the number of acceptors for HTTP
     */
    public void setHttpAcceptors(final int httpAcceptors) {
        this.setParam(SoapConstants.HttpServer.HTTP_ACCEPTORS, Integer.toString(httpAcceptors));
    }

    /**
     * Set the HTTP backlog size
     * 
     * @param backlogSize
     *            the HTTP backlog size to set
     */
    public void setHttpBacklogSize(final int backlogSize) {
        this.setParam(SoapConstants.HttpServer.HTTP_BACKLOG_SIZE, Integer.toString(backlogSize));
    }

    /**
     * Set the HTTP host name
     * 
     * @param httpHostName
     *            the HTTP host name
     */
    public void setHttpHost(final String httpHostName) {
        this.setParam(SoapConstants.HttpServer.HTTP_HOSTNAME, httpHostName);
    }

    /**
     * Set the HTTP port
     * 
     * @param httpPort
     *            the HTTP port
     * @throws NegativeValueException
     *             The given value is not a strict positive value
     */
    public void setHttpPort(final int httpPort) throws NegativeValueException {
        this.setParamAsPositiveInteger(SoapConstants.HttpServer.HTTP_PORT, httpPort);
    }

    /**
     * Set HTTP service context
     * 
     * @param httpServicesContext the HTTP service context
     */
    public void setHttpServicesContext(final String httpServicesContext) {
        this.setParam(SoapConstants.HttpServer.HTTP_SERVICES_CONTEXT, httpServicesContext);
    }

    /**
     * Define if the service list is available
     * 
     * @param httpServicesList true if the service list is available, otherwise false
     */
    public void setHttpServicesList(final boolean httpServicesList) {
        this.setParam(SoapConstants.HttpServer.HTTP_SERVICES_LIST, Boolean.toString(httpServicesList));
    }

    /**
     * Set the HTTP service mapping
     * 
     * @param httpServicesMapping the HTTP service mapping
     */
    public void setHttpServicesMapping(final String httpServicesMapping) {
        this.setParam(SoapConstants.HttpServer.HTTP_SERVICES_MAPPING, httpServicesMapping);
    }

    /**
     * Set the HTTP thread pool maximum size
     * 
     * @param httpThreadPoolSizeMax
     *            the HTTP thread pool maximum size
     * @throws InvalidAttributeValueException
     *             The value to set is invalid
     */
    public void setHttpThreadPoolSizeMax(final int httpThreadPoolSizeMax)
            throws InvalidAttributeValueException {
        if (httpThreadPoolSizeMax > 0) {
            final String httThreadPoolSizeMinStr = this.getParam(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN);
            if (httpThreadPoolSizeMax >= Integer.parseInt(httThreadPoolSizeMinStr)) {
                this.setParam(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX,
                        Integer.toString(httpThreadPoolSizeMax));
            } else {
                throw new InvalidAttributeValueException("Invalid value for attribute '"
                        + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX
                        + "': The value must be upper or equals to the value of '"
                        + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN + "'");
            }

        } else {
            throw new InvalidAttributeValueException("Invalid value for attribute '"
                    + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX
                    + "': The value must be upper or equals to 1.");
        }
    }

    /**
     * Set the HTTP thread pool minimum size
     * 
     * @param httpThreadPoolSizeMin
     *            the HTTP thread pool minimum size
     * @throws InvalidAttributeValueException
     *             The value to set is invalid
     */
    public void setHttpThreadPoolSizeMin(final int httpThreadPoolSizeMin)
            throws InvalidAttributeValueException {
        if (httpThreadPoolSizeMin > 0) {
            final String httThreadPoolSizeMaxStr = this.getParam(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX);
            if (httpThreadPoolSizeMin <= Integer.parseInt(httThreadPoolSizeMaxStr)) {
                this.setParam(SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN,
                        Integer.toString(httpThreadPoolSizeMin));
            } else {
                throw new InvalidAttributeValueException("Invalid value for attribute '"
                        + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN
                        + "': The value must be lower or equals to the value of '"
                        + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MAX + "'");
            }
        } else {
            throw new InvalidAttributeValueException("Invalid value for attribute '"
                    + SoapConstants.HttpServer.HTTP_THREAD_POOL_SIZE_MIN
                    + "': The value must be upper or equals to 1.");
        }
    }

    /**
     * Set the Java initial factory naming
     * 
     * @param javaNamingFactoryInitial the Java initial factory naming
     */
    public void setJavaNamingFactoryInitial(final String javaNamingFactoryInitial) {
        this.setParam(SoapConstants.JmsTransportLayer.JNDI_INITIAL_FACTORY, javaNamingFactoryInitial);
    }

    /**
     * Set the Java URL provider naming
     * 
     * @param javaNamingProviderURL the Java URL provider naming
     */
    public void setJavaNamingProviderURL(final String javaNamingProviderURL) {
        this.setParam(SoapConstants.JmsTransportLayer.JNDI_PROVIDER_URL, javaNamingProviderURL);
    }

    /**
     * Set the JMS connection factory JNDI name
     * 
     * @param jmsConnectionFactoryJNDIName the JMS connection factory JNDI name
     */
    public void setJMSConnectionFactoryJNDIName(final String jmsConnectionFactoryJNDIName) {
        this.setParam(SoapConstants.JmsTransportLayer.CONFAC_JNDINAME, jmsConnectionFactoryJNDIName);
    }
    
    /**
     * Define if HTTPS is enabled
     * 
     * @param isHttpsEnabled a flag set to true if HTTPS is enabled, otherwise false
     */
    public void setHttpsEnabled(boolean isHttpsEnabled) {
        this.setParam(SoapConstants.HttpServer.HTTPS_ENABLED, Boolean.toString(isHttpsEnabled));
    }

    /**
     * Set the HTTPS port
     * 
     * @param httpsPort the HTTPS port
     */
    public void setHttpsPort(final int httpsPort) {
        this.setParam(SoapConstants.HttpServer.HTTPS_PORT, Integer.toString(httpsPort));
    }

    /**
     * Set number of acceptors for HTTPS
     * 
     * @param httpsAcceptors
     *            the number of acceptors for HTTPS
     */
    public void setHttpsAcceptors(final int httpsAcceptors) {
        this.setParam(SoapConstants.HttpServer.HTTPS_ACCEPTORS, Integer.toString(httpsAcceptors));
    }

    /**
     * Set the HTTPS backlog size
     * 
     * @param backlogSize
     *            the HTTPS backlog size to set
     */
    public void setHttpsBacklogSize(final int backlogSize) {
        this.setParam(SoapConstants.HttpServer.HTTPS_BACKLOG_SIZE, Integer.toString(backlogSize));
    }
    
    /**
     * Set the type of the keystore (JKS / PKCS12)
     * 
     * @param httpsKeystoreType the type of the keystore (JKS / PKCS12)
     */
    public void setHttpsKeystoreType(String httpsKeystoreType) {
        this.setParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_TYPE, httpsKeystoreType);
    }
    
    /**
     * Set the keystore absolute file path
     * 
     * @param httpsKeytoreFile the keystore absolute file path
     */
    public void setHttpsKeystoreFile(String httpsKeytoreFile) {
        this.setParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_FILE, httpsKeytoreFile);
    }

    /**
     * Set the keystore password
     * 
     * @param httpsKeytorePassword the keystore password
     */
    public void setHttpsKeystorePassword(String httpsKeytorePassword) {
        this.setParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_PASSWORD_PARAM, httpsKeytorePassword);
    }

    /**
     * Set the key password
     * 
     * @param httpsKeytoreKeyPassword the key password
     */
    public void setHttpsKeyPassword(String httpsKeytoreKeyPassword) {
        this.setParam(SoapConstants.HttpServer.HTTPS_KEYSTORE_KEY_PASSWORD_PARAM, httpsKeytoreKeyPassword);
    }
    
    /**
     * Set the type of the truststore (JKS / PKCS12)
     * 
     * @param httpsTruststoreType the type of the truststore (JKS / PKCS12)
     */
    public void setHttpsTruststoreType(String httpsTruststoreType) {
        this.setParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_TYPE, httpsTruststoreType);
    }    
    
    /**
     * Set the truststore absolute file path
     * 
     * @param httpsTruststoreFile the truststore absolute file path
     */
    public void setHttpsTruststoreFile(String httpsTruststoreFile) {
        this.setParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_FILE, httpsTruststoreFile);
    }

    /**
     * Set the truststore password
     * 
     * @param httpsTruststorePassword the truststore password
     */
    public void setHttpsTruststorePassword(String httpsTruststorePassword) {
        this.setParam(SoapConstants.HttpServer.HTTPS_TRUSTSTORE_PASSWORD_PARAM, httpsTruststorePassword);
    }

    /**
     * Define if the client authentication is required at SSL level
     * 
     * @param isHttpsClientAuthenticationEnabled
     *            a flag set to true if the client authentication is required at
     *            SSL level, otherwise false
     */
    public void setHttpsClientAuthenticationEnabled(boolean isHttpsClientAuthenticationEnabled) {
        this.setParam(SoapConstants.HttpServer.HTTPS_CLIENT_AUTH_ENABLED,
                Boolean.toString(isHttpsClientAuthenticationEnabled));
    }   

    public void setPublicStacktracesEnabled(final boolean publicStacktracesEnabled) {
        this.setParam(SoapConstants.HttpServer.PUBLIC_STACKTRACES_ENABLED, Boolean.toString(publicStacktracesEnabled));
    }

    /**
     * Set the max number of connections per HTTP host
     * 
     * @param maxHttpConnectionsPerHost
     *            the max number of connections per HTTP host
     * @throws NegativeValueException
     *             The given value is a negative value
     */
    public void setMaxHttpConnectionsPerHost(final int maxHttpConnectionsPerHost) throws NegativeValueException {
        this.setParamAsPositiveInteger(SoapConstants.WsClients.MAX_HTTP_CONNECTIONS_PER_HOST,
                maxHttpConnectionsPerHost);
    }

    /**
     * Get the max number of connections per HTTP host
     * 
     * @return the max number of connections per HTTP host
     */
    public int getMaxHttpConnectionsPerHost() {
        return this.getParamAsInteger(SoapConstants.WsClients.MAX_HTTP_CONNECTIONS_PER_HOST,
                this.getJbiComponentConfiguration().getComponent().getProcessorMaxPoolSize().getValue());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy