Package org.rhq.core.pluginapi.inventory

Examples of org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException


        Configuration pluginConfiguration = resourceContext.getPluginConfiguration();

        PropertySimple aptSourcesPathProperty = pluginConfiguration.getSimple("apt-sources-path");

        if (aptSourcesPathProperty == null) {
            throw new InvalidPluginConfigurationException(
                "Apt sources not found in the plugin configuration, cannot start resource component");
        }

        String aptSourcesPath = aptSourcesPathProperty.getStringValue();

        aptSourcesFile = new File(aptSourcesPath);

        if (!aptSourcesFile.exists()) {
            throw new InvalidPluginConfigurationException("Apt sources file not found at specified location: "
                + aptSourcesPath);
        }
    }
View Full Code Here


            .getStringValue();
        JBossInstallationInfo installInfo;
        try {
            installInfo = new JBossInstallationInfo(new File(jbossHomeDir));
        } catch (IOException e) {
            throw new InvalidPluginConfigurationException(e);
        }
        DiscoveredResourceDetails resourceDetails = createResourceDetails(discoveryContext, pluginConfig, processInfo,
            installInfo);
        return resourceDetails;
    }
View Full Code Here

    private void validatePluginConfiguration() {
        Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
        String principal = pluginConfig.getSimpleValue(TomcatServerComponent.PRINCIPAL_CONFIG_PROP, null);
        String credentials = pluginConfig.getSimpleValue(TomcatServerComponent.CREDENTIALS_CONFIG_PROP, null);
        if ((principal != null) && (credentials == null)) {
            throw new InvalidPluginConfigurationException("If the '" + TomcatServerComponent.PRINCIPAL_CONFIG_PROP
                + "' connection property is set, the '" + TomcatServerComponent.CREDENTIALS_CONFIG_PROP
                + "' connection property must also be set.");
        }

        if ((credentials != null) && (principal == null)) {
            throw new InvalidPluginConfigurationException("If the '" + TomcatServerComponent.CREDENTIALS_CONFIG_PROP
                + "' connection property is set, the '" + TomcatServerComponent.PRINCIPAL_CONFIG_PROP
                + "' connection property must also be set.");
        }
    }
View Full Code Here

            // Explicit checking for security exception (i.e. invalid credentials for connecting to JMX)
            if (e instanceof EmsConnectException) {
                Throwable cause = e.getCause();

                if (cause instanceof SecurityException) {
                    throw new InvalidPluginConfigurationException(
                        "Invalid JMX credentials specified for connecting to this server.", e);
                }
            }
        }
View Full Code Here

        Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
        configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(pluginConfig,
            ApplicationServerPluginConfigurationProperties.SERVER_HOME_DIR));

        if (!configPath.exists()) {
            throw new InvalidPluginConfigurationException("Configuration path '" + configPath + "' does not exist.");
        }
        return pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.SERVER_NAME,
            configPath.getName());
    }
View Full Code Here

        Configuration pluginConfig = serverComponent.getResourceContext().getPluginConfiguration();
        String javaHome = pluginConfig.getSimpleValue(ApplicationServerPluginConfigurationProperties.JAVA_HOME, null);
        if (javaHome != null) {
            File javaHomeDir = new File(javaHome);
            if (!javaHomeDir.isAbsolute()) {
                throw new InvalidPluginConfigurationException(
                    ApplicationServerPluginConfigurationProperties.JAVA_HOME
                        + " connection property ('"
                        + javaHomeDir
                        + "') is not an absolute path. Note, on Windows, absolute paths must start with the drive letter (e.g. C:).");
            }

            if (!javaHomeDir.exists()) {
                throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
                    + " connection property ('" + javaHomeDir + "') does not exist.");
            }

            if (!javaHomeDir.isDirectory()) {
                throw new InvalidPluginConfigurationException(ApplicationServerPluginConfigurationProperties.JAVA_HOME
                    + " connection property ('" + javaHomeDir + "') is not a directory.");
            }
        }
    }
View Full Code Here

            httpPost = initHttpPost(timeoutSec, jsonToSend);

            HttpResponse httpResponse = httpClient.execute(httpPost);
            StatusLine statusLine = httpResponse.getStatusLine();
            if (isAuthorizationFailureResponse(statusLine)) {
                throw new InvalidPluginConfigurationException(
                    createErrorMessageForAuthorizationFailureResponse(statusLine));
            }

            HttpEntity httpResponseEntity = httpResponse.getEntity();
            String responseBody = httpResponseEntity == null ? StringUtil.EMPTY_STRING : EntityUtils
View Full Code Here

                            + "the \"main\" Apache server in httpd.conf.");
                    } else {
                        configured = true;
                    }
                } catch (MalformedURLException e) {
                    throw new InvalidPluginConfigurationException("Value of '" + PLUGIN_CONFIG_PROP_URL
                        + "' connection property ('" + url + "') is not a valid URL.");
                }
            }

            bmxUrl = pluginConfig.getSimpleValue(PLUGIN_CONFIG_PROP_BMX_URL, null);
            if (bmxUrl != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Checking BMX url " + bmxUrl);
                }
                try {
                    URL uurl = new URL(bmxUrl);
                    if (uurl.getPort() == 0) {
                        LOG.error("The 'BMX Handler' connection property is invalid - 0 is not a valid port; please change the value to the "
                            + "port the Apache server is listening on.");
                    } else {
                        if (this.url == null) {
                            this.url = uurl;
                            configured = true;
                        }
                    }
                } catch (MalformedURLException e) {
                    throw new InvalidPluginConfigurationException("Value of '" + PLUGIN_CONFIG_PROP_BMX_URL
                        + "' connection property ('" + bmxUrl + "') is not a valid URL.");
                }
            }
            if (bmxUrl != null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Testing BMX connection on " + bmxUrl);
                }
                try {
                    /* Check the BMX URL and use it if available */
                    URL uurl = new URL(bmxUrl);
                    HttpURLConnection conn = (HttpURLConnection) uurl.openConnection();
                    conn.connect();
                    if (conn.getResponseCode() == 200) {
                        useBMX = true;
                        LOG.info("BMX will be used to check availability");
                    }
                    conn.disconnect();
                } catch (Exception ex) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("BMX connection fails on " + bmxUrl + " with " + ex);
                    }
                }
            }


            if (!configured) {
                throw new InvalidPluginConfigurationException(
                    "Neither SNMP, BMX nor an URL for checking availability has been configured");
            }

            File executablePath = getExecutablePath();
            try {
                this.binaryInfo = ApacheBinaryInfo.getInfo(executablePath.getPath(),
                    this.resourceContext.getSystemInformation());
            } catch (Exception e) {
                throw new InvalidPluginConfigurationException("'" + executablePath
                    + "' is not a valid Apache executable (" + e + ").");
            }

            this.operationsDelegate = new ApacheServerOperationsDelegate(this, pluginConfig,
                this.resourceContext.getSystemInformation());
View Full Code Here

        Configuration pluginConfig = context.getPluginConfiguration();

        this.configPath = resolvePathRelativeToHomeDir(getRequiredPropertyValue(pluginConfig,
            CONFIGURATION_PATH_CONFIG_PROP));
        if (!this.configPath.exists()) {
            throw new InvalidPluginConfigurationException("Configuration path '" + configPath + "' does not exist.");
        }
        this.configSet = pluginConfig.getSimpleValue(CONFIGURATION_SET_CONFIG_PROP, this.configPath.getName());

        // Until the bugs get worked out of the calls back into the PC's operation framework, use the implementation
        // that will simply make calls directly in the plugin.
        // controlFacade = new PluginContainerControlActionFacade(operationContext, this);
        ControlActionFacade controlFacade = new InPluginControlActionFacade(this);

        JBossASPaths jbossPaths = new JBossASPaths();
        jbossPaths.setHomeDir(getPluginConfiguration().getSimpleValue(JBOSS_HOME_DIR_CONFIG_PROP, null));
        jbossPaths.setServerDir(getPluginConfiguration().getSimpleValue(CONFIGURATION_PATH_CONFIG_PROP, null));

        JBPMWorkflowManager workflowManager = new JBPMWorkflowManager(contentContext, controlFacade, jbossPaths);

        this.contentFacetDelegate = new JBossASContentFacetDelegate(workflowManager, this.configPath);

        // Attempt to load the connection now. If we cannot, do not consider the start operation as failed. The only
        // exception to this rule is if the connection cannot be made due to a JMX security exception. In this case,
        // we treat it as an invalid plugin configuration and throw the appropriate exception (see the javadoc for
        // ResourceComponent)
        try {
            loadConnection();
        } catch (Exception e) {

            // Explicit checking for security exception (i.e. invalid credentials for connecting to JMX)
            if (e instanceof EmsConnectException) {
                Throwable cause = e.getCause();

                if (cause instanceof SecurityException) {
                    throw new InvalidPluginConfigurationException(
                        "Invalid JMX credentials specified for connecting to this server.", e);
                }
            }

        }
View Full Code Here

        validateJavaHomePathProperty();
        Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
        String principal = pluginConfig.getSimpleValue(JBossASServerComponent.PRINCIPAL_CONFIG_PROP, null);
        String credentials = pluginConfig.getSimpleValue(JBossASServerComponent.CREDENTIALS_CONFIG_PROP, null);
        if ((principal != null) && (credentials == null)) {
            throw new InvalidPluginConfigurationException("If the '" + JBossASServerComponent.PRINCIPAL_CONFIG_PROP
                + "' connection property is set, the '" + JBossASServerComponent.CREDENTIALS_CONFIG_PROP
                + "' connection property must also be set.");
        }

        if ((credentials != null) && (principal == null)) {
            throw new InvalidPluginConfigurationException("If the '" + JBossASServerComponent.CREDENTIALS_CONFIG_PROP
                + "' connection property is set, the '" + JBossASServerComponent.PRINCIPAL_CONFIG_PROP
                + "' connection property must also be set.");
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException

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.