Package org.rhq.core.pluginapi.inventory

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


    static InetAddress createComponentConfiguration(Configuration pluginConfig)
        throws InvalidPluginConfigurationException {
        String addressString = pluginConfig.getSimpleValue(ConfigKeys.ADDRESS, EMPTY_STRING);
        if (isBlank(addressString)) {
            throw new InvalidPluginConfigurationException("Address is not defined");
        }
        try {
            return InetAddress.getByName(addressString);
        } catch (UnknownHostException uhe) {
            throw new InvalidPluginConfigurationException(uhe);
        }
    }
View Full Code Here


            if (availOutputRegexProp != null && availOutputRegexProp.getStringValue() != null) {
                availOutputRegex = Pattern.compile(availOutputRegexProp.getStringValue());
            }
        } catch (Exception e) {
            throw new InvalidPluginConfigurationException("Cannot get avail plugin config. Cause: " + e);
        }

        // first, make sure the executable actually exists
        File executableFile = new File(executable);
        if (!executableFile.exists()) {
View Full Code Here

        String executable;
        String workingDir = null;
        Map<String, String> envvars = null;

        if (executableProp == null) {
            throw new InvalidPluginConfigurationException("Missing required plugin config: " + PLUGINCONFIG_EXECUTABLE);
        } else {
            executable = executableProp.getStringValue();
            if (executable == null || executable.length() == 0) {
                throw new InvalidPluginConfigurationException("Bad plugin config: " + PLUGINCONFIG_EXECUTABLE);
            }
        }

        if (workingDirProp != null) {
            workingDir = workingDirProp.getStringValue();
            if (workingDir != null && workingDir.length() == 0) {
                workingDir = null; // empty string is as good as unsetting it (i.e. making it null)
            }
        }

        if (envvarsProp != null) {
            try {
                // we want envvars to be null if there are no envvars defined, so the agent env is passed
                // but if there are 1 or more envvars in our config, then we define our envvars list
                List<Property> listOfMaps = envvarsProp.getList();
                if (listOfMaps.size() > 0) {
                    envvars = new HashMap<String, String>();
                    for (Property envvarMap : listOfMaps) {
                        PropertySimple name = (PropertySimple) ((PropertyMap) envvarMap).get(PLUGINCONFIG_ENVVAR_NAME);
                        PropertySimple value = (PropertySimple) ((PropertyMap) envvarMap)
                            .get(PLUGINCONFIG_ENVVAR_VALUE);
                        envvars.put(name.getStringValue(), value.getStringValue());
                    }
                }
            } catch (Exception e) {
                throw new InvalidPluginConfigurationException("Bad plugin config: " + PLUGINCONFIG_ENVVARS
                    + ". Cause: " + e);
            }
        }

        ProcessExecution processExecution = new ProcessExecution(executable);
View Full Code Here

        // Restart the server ResourceComponent so it picks up the changes we just made to the plugin config.
        InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
        inventoryManager.deactivateResource(getServerResource());
        ResourceContainer serverContainer = inventoryManager.getResourceContainer(getServerResource());
        InvalidPluginConfigurationException ipce = null;
        try {
            inventoryManager.activateResource(getServerResource(), serverContainer, true);
        } catch (InvalidPluginConfigurationException e) {
            ipce = e;
        }
View Full Code Here

    public void start(ResourceContext<PostgresServerComponent<?>> resourceContext) {
        this.resourceContext = resourceContext;
        try {
            pgRoleOid = Long.parseLong(resourceContext.getResourceKey().substring(OID_PREFIX.length()));
        } catch (Exception e) {
            throw new InvalidPluginConfigurationException("Invalid resource key [" + resourceContext.getResourceKey()
                + "]");
        }
    }
View Full Code Here

            : scriptPath;
    }

    private void validatePath(File path) {
        if (!path.isAbsolute()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' is not absolute.");
        }
        if (!path.exists()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' does not exist.");
        }
        if (path.isDirectory()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' is a directory, not a file.");
        }
    }
View Full Code Here

    }

    @Override
    public void start(ResourceContext<TomcatServerComponent<?>> context) {
        if (UNKNOWN.equals(context.getPluginConfiguration().getSimple(PLUGIN_CONFIG_HANDLER).getStringValue())) {
          throw new InvalidPluginConfigurationException(
              "The connector is not listening for requests on the configured port. This is most likely due to the configured port being in use at Tomcat startup. In some cases (AJP connectors) Tomcat will assign an open port. This happens most often when there are multiple Tomcat servers running on the same platform. Check your Tomcat configuration for conflicts: "
                    + context.getResourceKey());
        }

        super.start(context);
View Full Code Here

        }
    }

    private void validatePath(File path) {
        if (!path.isAbsolute()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' is not absolute.");
        }
        if (!path.exists()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' does not exist.");
        }
        if (path.isDirectory()) {
            throw new InvalidPluginConfigurationException("Path '" + path + "' is a directory, not a file.");
        }
    }
View Full Code Here

        Configuration conf = context.getPluginConfiguration();
        String tmp = conf.getSimpleValue("ones", "1");
        int wantedOnes = Integer.parseInt(tmp);
        if (wantedOnes < 1)
            throw new InvalidPluginConfigurationException("Ones must be > 0");
        tmp = conf.getSimpleValue("zeros", "1");
        int wantedZeros = Integer.parseInt(tmp);
        if (wantedZeros < 1)
            throw new InvalidPluginConfigurationException("Zeros must be > 0");

        wanted[0] = wantedZeros;
        wanted[1] = wantedOnes;

        tmp = conf.getSimpleValue("delay", "0");
View Full Code Here

        Configuration pluginConfiguration = resourceContext.getPluginConfiguration();

        PropertySimple grubPathProperty = pluginConfiguration.getSimple("grub-conf-path");

        if (grubPathProperty == null) {
            throw new InvalidPluginConfigurationException(
                "GRUB configuration file path not found in the plugin configuration, cannot start resource component");
        }

        String grubPath = grubPathProperty.getStringValue();

        grubFile = new File(grubPath);

        if (!grubFile.exists()) {
            throw new InvalidPluginConfigurationException("GRUB configuration file not found at specified location: "
                + grubPath);
        }
    }
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.