Package org.rhq.core.pluginapi.inventory

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


        Configuration pc = this.resourceContext.getPluginConfiguration();
        PropertySimple prop;

        prop = pc.getSimple(AgentLauncherScriptDiscoveryComponent.PLUGINCONFIG_PATHNAME);
        if (prop == null) {
            throw new InvalidPluginConfigurationException("Missing path to launcher script");
        }
        if (prop.getStringValue() == null) {
            throw new InvalidPluginConfigurationException("Launcher script pathname property value is null");
        }

        launcherScript = new File(prop.getStringValue());
        if (!launcherScript.exists()) {
            throw new InvalidPluginConfigurationException("Launcher Script [" + launcherScript + "] does not exist");
        }

        log.debug("Starting agent launcher script component: " + launcherScript);
        return;
    }
View Full Code Here


        Configuration conf = context.getPluginConfiguration();

        String engineName = conf.getSimpleValue("language",null);
        if (engineName==null)
            throw new InvalidPluginConfigurationException("No (valid) language given ");

        ScriptEngineManager seMgr = new ScriptEngineManager();
        engine = seMgr.getEngineByName(engineName);

        String scriptName = conf.getSimpleValue("scriptName", null);
        if (scriptName ==null)
            throw new InvalidPluginConfigurationException("No (valid) script name given");

        File dataDir = context.getDataDirectory();
        File scriptFile = new File(dataDir.getAbsolutePath() + "/"+ scriptName); // TODO find a better directory for this.
        if (!scriptFile.exists())
            throw new InvalidPluginConfigurationException("Script does not exist at " + scriptFile.getAbsolutePath());

        try {
            FileReader fr = new FileReader(scriptFile);
            try {
                Reader reader = new BufferedReader(fr);
                try {
                    StringWriter writer = new StringWriter();
                    try {
                        int tmp;
                        while ((tmp=reader.read())!=-1) {
                            writer.write(tmp);
                        }
                        reader.close();
                        theScript = writer.toString();
                    } finally {
                        writer.close();
                    }
                } finally {
                    reader.close();
                }
            } finally {
                fr.close();
            }

            engine.eval(theScript);
        }
        catch (ScriptException se) {
            throw new InvalidPluginConfigurationException(se.getMessage());
        }
    }
View Full Code Here

                                                      ResourceDiscoveryContext discoveryContext)
            throws InvalidPluginConfigurationException {

        String type = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE).getStringValue();
        if (type.equals(PARENT_TYPE)) {
            throw new InvalidPluginConfigurationException("'" + PARENT_TYPE + "' is not a valid type for a manually added JVM.");
        }

        String connectorAddress = pluginConfig.getSimpleValue(CONNECTOR_ADDRESS_CONFIG_PROPERTY, null);
        if (connectorAddress == null) {
            throw new InvalidPluginConfigurationException("A connector address must be specified when manually adding a JVM.");
        }

        ConnectionProvider connectionProvider;
        EmsConnection connection;
        try {
            connectionProvider = ConnectionProviderFactory.createConnectionProvider(pluginConfig, null,
                discoveryContext.getParentResourceContext().getTemporaryDirectory());
            connection = connectionProvider.connect();
            connection.loadSynchronous(false);
        } catch (Exception e) {
            if (e.getCause() instanceof SecurityException) {
                throw new InvalidPluginConfigurationException("Failed to authenticate to JVM with connector address ["
                        + connectorAddress + "] - principal and/or credentials connection properties are not set correctly.");
            }
            throw new RuntimeException("Failed to connect to JVM with connector address [" + connectorAddress + "].", e);
        }
View Full Code Here

    public static Connection buildConnection(Configuration configuration) throws SQLException {
        String driverClass = configuration.getSimple(DRIVER_CLASS_PROPERTY).getStringValue();
        try {
            Class.forName(driverClass);
        } catch (ClassNotFoundException e) {
            throw new InvalidPluginConfigurationException("Specified JDBC driver class (" + driverClass
                + ") not found.");
        }

        String url = buildUrl(configuration);
        if (LOG.isDebugEnabled()) {
View Full Code Here

    private ResourceContext<PostgresDatabaseComponent> resourceContext;

    public void start(ResourceContext<PostgresDatabaseComponent> context) {
        if (!context.getResourceKey().contains(SCHEMA_SEPARATOR)) {
            throw new InvalidPluginConfigurationException("Resource key in old format (missing schema name)");
        }
        if (isBlank(getSchemaNameFromContext(context))) {
            throw new InvalidPluginConfigurationException("schemaName is not defined");
        }
        if (isBlank(getTableNameFromContext(context))) {
            throw new InvalidPluginConfigurationException("tableName is not defined");
        }
        try {
            if (!tableExists(context)) {
                throw new InvalidPluginConfigurationException("table does not exist");
            }
        } catch (SQLException e) {
            throw new InvalidPluginConfigurationException("Exception while checking table existence", e);
        }
        this.resourceContext = context;
    }
View Full Code Here

        String hostname = serverPluginConfig.getHostname();
        Integer port = serverPluginConfig.getPort();
        String user = serverPluginConfig.getUser();

        if (hostname == null || port == null) {
            throw new InvalidPluginConfigurationException("Hostname and port must both be set.");
        }

        ProductInfo productInfo = new ProductInfo(ASConnectionParams.createFrom(serverPluginConfig)).getFromRemote();
        JBossProductType productType = productInfo.getProductType();

        if (productType == null) {
            throw new InvalidPluginConfigurationException("Can not connect to [" + hostname + ":" + port
                + "] as user [" + user + "]. Did you provide the correct credentials?");
        }

        HostPort hostPort = new HostPort(false);
        HostPort managementHostPort = new HostPort(false);
View Full Code Here

    private <T> T getServerAttribute(ASConnection connection, String attributeName) {
        Operation op = new ReadAttribute(null, attributeName);
        Result res = connection.execute(op);
        if (!res.isSuccess()) {
            throw new InvalidPluginConfigurationException("Could not connect to remote server ["
                + res.getFailureDescription() + "]. Did you enable management?");
        }
        @SuppressWarnings("unchecked")
        T result = (T) res.getResult();
        return result;
View Full Code Here

        //        String collectionTZ = getResponseTimeCollectionTimeZone();
        String logFormat = getResponseTimeLogFormat();
        ResponseTimeConfiguration responseTimeConfiguration = getResponseTimeConfiguration();

        if (logFormat == null) {
            throw new InvalidPluginConfigurationException("The 'responseTimeLogFormat' property must be specified.");
        }

        responseTimeDelegate = new IISResponseTimeDelegate(logDirectory, logFormat, responseTimeConfiguration
        /*,collectionTZ.equals("true")*/);
    }
View Full Code Here

        return new File(hostsFilePath);
    }

    public static void validateHostFileExists(File hostsFile) throws InvalidPluginConfigurationException {
        if (!hostsFile.exists()) {
            throw new InvalidPluginConfigurationException("Location specified by '" + HostsComponent.INCLUDE_GLOBS_PROP
                    + "' connection property does not exist.");
        }
        if (hostsFile.isDirectory()) {
            throw new InvalidPluginConfigurationException("Location specified by '" + HostsComponent.INCLUDE_GLOBS_PROP
                    + "' connection property is a directory, not a regular file.");
        }
    }
View Full Code Here

    public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
                                                      ResourceDiscoveryContext<DirectoryComponent> context) throws InvalidPluginConfigurationException {

        String path = pluginConfiguration.getSimpleValue("path");
        if (path==null || path.isEmpty()) {
            throw new InvalidPluginConfigurationException("Path must not be empty");
        }
        if (path.equals("/")) {
            throw new InvalidPluginConfigurationException("/ is forbidden");
        }

        DiscoveredResourceDetails result = new DiscoveredResourceDetails(
            context.getResourceType(),
            path,
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.