Package org.rhq.common.jbossas.client.controller

Examples of org.rhq.common.jbossas.client.controller.WebJBossASClient


                // Not only do we want to make sure we can connect, but we also want to wait for the subsystems to initialize.
                // Let's wait for one of the subsystems to exist; once we know this is up, the rest are probably ready too.
                ModelControllerClient mcc = null;
                try {
                    mcc = createModelControllerClient();
                    if (!(new WebJBossASClient(mcc).isWebSubsystem())) {
                        throw new IllegalStateException(
                            "The server does not appear to be fully started yet (the web subsystem did not start)");
                    }

                    return retVal;
View Full Code Here


        // ...but we want a secure SSL connector, too.
        // This is the name of the secure connector we want to create.
        final String sslConnectorName = "https";

        WebJBossASClient client = new WebJBossASClient(mcc);

        // because some of the connector attributes do not (yet) support expressions, let's remove any existing
        // connector we may have created before and create it again with our current attribute values.
        client.removeConnector(sslConnectorName);

        LOG.info("Creating https connector...");
        ConnectorConfiguration connector = buildSecureConnectorConfiguration(configDirStr, serverProperties);

        // verify that we have a truststore file - if user is relying on our self-signed certs, we'll have to create one for them
        String truststoreFileString = connector.getSslConfiguration().getCaCertificateFile();
        truststoreFileString = resolveExpression(mcc, truststoreFileString);
        if (truststoreFileString == null) {
            LOG.warn("Missing a valid truststore location - you must specify a valid truststore location!");
        } else {
            File truststoreFile = new File(truststoreFileString);
            if (!truststoreFile.exists()) {
                // user didn't provide a truststore file, copy the keystore and use it as the truststore; tell the user about this
                String keystoreFileString = connector.getSslConfiguration().getCertificateKeyFile();
                keystoreFileString = resolveExpression(mcc, keystoreFileString);
                File keystoreFile = new File(keystoreFileString);
                if (!keystoreFile.isFile()) {
                    LOG.warn("Missing both keystore [" + keystoreFile + "] and truststore [" + truststoreFile + "]");
                } else {
                    LOG.warn("Missing the truststore [" + truststoreFile + "] - will copy the keystore ["
                        + keystoreFile + "] and make the copy the truststore.");
                    try {
                        FileUtil.copyFile(keystoreFile, truststoreFile);
                    } catch (Exception e) {
                        LOG.error("Failed to copy keystore to make truststore - a truststore still does not exist", e);
                    }
                }
            }
        }

        if (needProtocolWorkaround) {
            connector.setProtocol("org.apache.coyote.http11.Http11Protocol");
        }

        client.addConnector("https", connector);
        LOG.info("https connector created.");

        if (client.isConnector(connectorName)) {
            client.changeConnector(connectorName, "max-connections",
                buildExpression("rhq.server.startup.web.max-connections", serverProperties, true));
            client.changeConnector(connectorName, "redirect-port",
                buildExpression("rhq.server.socket.binding.port.https", serverProperties, true));

            if (needProtocolWorkaround) {
                client.changeConnector(connectorName, "protocol", "org.apache.coyote.http11.Http11Protocol");
            }
        } else {
            LOG.warn("There doesn't appear to be a http connector configured already - this is strange.");
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.common.jbossas.client.controller.WebJBossASClient

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.