Package org.osgi.service.cm

Examples of org.osgi.service.cm.ConfigurationException


     */
    public void updated(Dictionary dictionary) throws ConfigurationException {
        if (dictionary != null) {
            String keyUsername = (String) dictionary.get(PROPERTY_KEY_USERNAME);
            if (keyUsername == null || "".equals(keyUsername.trim())) {
                throw new ConfigurationException(PROPERTY_KEY_USERNAME, "Missing property");
            }

            String keyPassword = (String) dictionary.get(PROPERTY_KEY_PASSWORD);
            if (keyPassword == null || "".equals(keyPassword.trim())) {
                throw new ConfigurationException(PROPERTY_KEY_PASSWORD, "Missing property");
            }

            String passwordHashType = (String) dictionary.get(PROPERTY_PASSWORD_HASHMETHOD);
            if (passwordHashType == null || "".equals(passwordHashType.trim())) {
                throw new ConfigurationException(PROPERTY_PASSWORD_HASHMETHOD, "Missing property");
            }
            if (!isValidHashMethod(passwordHashType)) {
                throw new ConfigurationException(PROPERTY_PASSWORD_HASHMETHOD, "Invalid hash method!");
            }

            m_keyUsername = keyUsername;
            m_keyPassword = keyPassword;
            m_passwordHashMethod = passwordHashType;
View Full Code Here


    public void updated(Dictionary dict) throws ConfigurationException {
        if (dict != null) {
            String customer = (String) dict.get(KEY_REPOSITORY_CUSTOMER);
            if (customer == null) {
                throw new ConfigurationException(KEY_REPOSITORY_CUSTOMER, "Property missing.");
            }
            String name = (String) dict.get(KEY_REPOSITORY_NAME);
            if (name == null) {
                throw new ConfigurationException(KEY_REPOSITORY_NAME, "Property missing.");
            }

            String fileRoot = FILE_ROOT + File.separator + customer + File.separator + name + File.separator;

            File local = getFile(fileRoot + "local");
View Full Code Here

     */
    public void updated(Dictionary dictionary) throws ConfigurationException {
        if (dictionary != null) {
            String keyUsername = (String) dictionary.get(PROPERTY_KEY_USERNAME);
            if (keyUsername == null || "".equals(keyUsername.trim())) {
                throw new ConfigurationException(PROPERTY_KEY_USERNAME, "Missing property");
            }

            String keyPassword = (String) dictionary.get(PROPERTY_KEY_PASSWORD);
            if (keyPassword == null || "".equals(keyPassword.trim())) {
                throw new ConfigurationException(PROPERTY_KEY_PASSWORD, "Missing property");
            }

            m_keyUsername = keyUsername;
            m_keyPassword = keyPassword;
        }
View Full Code Here

     */
    private static void checkMandatoryProperties(final Dictionary<Object, Object> config, final String... mandatoryKeys)
        throws ConfigurationException {
        for (String key : mandatoryKeys) {
            if (config.get(key) == null) {
                throw new ConfigurationException(key, "Missing configuration property: " + key);
            }
        }
    }
View Full Code Here

     * @return the executable name, never <code>null</code>.
     * @throws ConfigurationException in case the given value was <code>null</code> or empty.
     */
    private static String parseExecutableName(final String value) throws ConfigurationException {
        if (value == null || value.trim().isEmpty()) {
            throw new ConfigurationException(EXECUTABLE_NAME, "Invalid executable name!");
        }
        return value;
    }
View Full Code Here

    private static int parseExitValue(String value) throws ConfigurationException {
        try {
            return Integer.parseInt(value);
        }
        catch (NumberFormatException exception) {
            throw new ConfigurationException(NORMAL_EXIT_VALUE, "Invalid exit value!");
        }
    }
View Full Code Here

        try {
            FrameworkUtil.createFilter(value);
            return value;
        }
        catch (InvalidSyntaxException exception) {
            throw new ConfigurationException(PROCESS_STREAM_LISTENER_FILTER, "Invalid filter syntax! Reason: "
                + exception.getMessage());
        }
    }
View Full Code Here

        catch (NumberFormatException exception) {
            // Ignore, will be picked up below...
        }

        if (instanceCount < MINIMAL_INSTANCE_COUNT) {
            throw new ConfigurationException(INSTANCE_COUNT, "Invalid instance count!");
        }
        return instanceCount;
    }
View Full Code Here

        if (dictionary != null) {
            URL aceHost;
            try {
                String aceHostString = (String) dictionary.get(KEY_ACE_HOST);
                if (aceHostString == null) {
                    throw new ConfigurationException(KEY_ACE_HOST, "Missing property");
                }
                aceHost = new URL(aceHostString);
            }
            catch (MalformedURLException e) {
                throw new ConfigurationException(KEY_ACE_HOST, "Is not a valid URL", e);
            }

            URL obrUrl;
            try {
                String obrUrlString = (String) dictionary.get(KEY_OBR_URL);
                if (obrUrlString == null) {
                    throw new ConfigurationException(KEY_OBR_URL, "Missing property");
                }
                obrUrl = new URL(obrUrlString);
            }
            catch (MalformedURLException e) {
                throw new ConfigurationException(KEY_OBR_URL, "Is not a valid URL", e);
            }

            String useAuthString = (String) dictionary.get(KEY_USE_AUTHENTICATION);
            if (useAuthString == null || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
            }
            boolean useAuth = Boolean.parseBoolean(useAuthString);

            String userNameString = (String) dictionary.get(KEY_USER_NAME);
            if ((userNameString == null) && !useAuth) {
                throw new ConfigurationException(KEY_USER_NAME, "Missing value; authentication is disabled!");
            }

            m_useAuth = useAuth;
            m_userName = userNameString;
            m_aceHost = aceHost;
View Full Code Here

    public void updated(Dictionary settings) throws ConfigurationException {
        if (settings != null) {
            for (ConfigItem item : ConfigItem.values()) {
                String value = (String) settings.get(item.toString());
                if ((value == null) || value.equals("")) {
                    throw new ConfigurationException(item.toString(), item.getErrorText());
                }
            }
            // store configuration
            m_settings = settings;
        }
View Full Code Here

TOP

Related Classes of org.osgi.service.cm.ConfigurationException

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.