Package org.osgi.service.cm

Examples of org.osgi.service.cm.ConfigurationException


        String value = (String) properties.get(property);
        if (value != null) {
            try {
                return Boolean.parseBoolean(value);
            } catch (Exception e) {
                throw new ConfigurationException(property, NLS.MESSAGES.getMessage("prop.value.not.boolean", property, value), e);
            }
        }
        return dflt;
    }
View Full Code Here


        if (recipe != null) {
            try {
                parseScheduleRecipe(recipe);
            }
            catch (NumberFormatException nfe) {
                throw new ConfigurationException(m_name, "Could not parse scheduling recipe for task", nfe);
            }
        }
    }
View Full Code Here

    public void updated(Dictionary properties) throws ConfigurationException {
        if (properties != null) {
            m_interval = (String) properties.get("interval");
            if (m_interval == null) {
                throw new ConfigurationException("interval", "must be specified");
            }
            System.out.println("Task.updated: properties=" + properties);
        }
    }
View Full Code Here

            }
            else if (t.getCause() instanceof ConfigurationException) {
                throw (ConfigurationException) t.getCause();
            }
            else {
                throw new ConfigurationException(null, "Could not create service for ManagedServiceFactory Pid " + pid, t);
            }
        }
    }
View Full Code Here

                    // the callback threw an OSGi ConfigurationException: just re-throw it.
                    throw (ConfigurationException) e.getTargetException();
                }
                else {
                    // wrap the callback exception into a ConfigurationException.
                    throw new ConfigurationException(null, "Service " + ds + " with " + this.toString() + " could not be updated", e.getTargetException());
                }
            }
            catch (NoSuchMethodException e) {
                // if the method does not exist, ignore it
            }
            catch (Throwable t) {
                // wrap any other exception as a ConfigurationException.
                throw new ConfigurationException(null, "Service " + ds + " with " + this.toString() + " could not be updated", t);
            }
        }
    }
View Full Code Here

    private static String getProp(Dictionary props, String key) throws ConfigurationException {
        String val = getProp(props, key, null);
        if (val != null) {
            return val;
        } else {
            throw new ConfigurationException(key, "The property " + key + " requires a value");
        }
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public synchronized void updated(Dictionary dict) throws ConfigurationException {
        if (dict != null) {
            String path = (String) dict.get(OBRFileStoreConstants.FILE_LOCATION_KEY);
            if (path == null) {
                throw new ConfigurationException(OBRFileStoreConstants.FILE_LOCATION_KEY, "Missing property");
            }
            File dir = new File(path);
            if (!dir.equals(m_dir)) {
                if (!dir.exists()) {
                    dir.mkdirs();
                }
                else if (!dir.isDirectory()) {
                    throw new ConfigurationException(OBRFileStoreConstants.FILE_LOCATION_KEY, "Is not a directory: " + dir);
                }
                m_dir = dir;
                m_foundFiles.clear();
            }
        }
View Full Code Here

    public void updated(Dictionary dictionary) throws ConfigurationException {
        if (dictionary != null) {
            String id = (String) dictionary.get(IdentificationConstants.IDENTIFICATION_TARGETID_KEY);
            if ((id == null) || (id.length() == 0)) {
                // illegal config
                throw new ConfigurationException(IdentificationConstants.IDENTIFICATION_TARGETID_KEY, "Illegal target ID supplied");
            }
            // legal config, set configuration
            setID(id);
        }
    }
View Full Code Here

        if (properties != null) {
            URL server;
            try {
                server = new URL(getConfigProperty(properties, SERVER));
            } catch (MalformedURLException e) {
                throw new ConfigurationException(SERVER, getConfigProperty(properties, SERVER) + " is not a valid URL.", e);
            }
            String amiId = getConfigProperty(properties, AMI_ID);
            String amiOwnerId = getConfigProperty(properties, AMI_OWNER_ID, "");
            String location = getConfigProperty(properties, LOCATION);
            String hardwareId = getConfigProperty(properties, HARDWARE_ID, InstanceType.C1_MEDIUM);
View Full Code Here

    private String getConfigProperty(@SuppressWarnings("rawtypes") Dictionary settings, String id, String defaultValue) throws ConfigurationException {
        String result = (String) settings.get(id);
        if (result == null) {
            if (defaultValue == null) {
                throw new ConfigurationException(id, "key missing");
            } else {
                return defaultValue;
            }
        }
        return result;
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.