Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.ConfigurationException


    public void initializeComponentFactory(ComponentTypeDescription desc, Element metadata) throws ConfigurationException {
        Element[] provides = metadata.getElements("provides");
        for (int i = 0; i < provides.length; i++) {
            String action = provides[i].getAttribute("action");
            if (action == null) {
                throw new ConfigurationException("Invalid composition service providing : no specified action");
            } else if (action.equalsIgnoreCase("implement")) {
                String spec = provides[i].getAttribute("specification");
                if (spec == null) {
                    throw new ConfigurationException("Malformed provides : the specification attribute is mandatory");
                } else {
                    desc.addProvidedServiceSpecification(spec);
                }
            } else if (action.equalsIgnoreCase("export")) {
                String spec = provides[i].getAttribute("specification");
                if (spec == null) {
                    throw new ConfigurationException("Malformed exports - Missing the specification attribute");
                } else {
                    desc.addProvidedServiceSpecification(spec);
                }
            } else {
                throw new ConfigurationException("Invalid composition service providing : unknown action " + action);
            }
        }
    }
View Full Code Here


                Filter fil = null;
                try {
                    fil = m_context.createFilter(filter);
                } catch (InvalidSyntaxException e) {
                    throw new ConfigurationException("An exporter filter is invalid " + filter + " : " + e.getMessage());
                }

                Comparator cmp = DependencyModel.getComparator(provides[i], m_context);
                int policy = DependencyModel.getPolicy(provides[i]);
                Class spec = DependencyModel.loadSpecification(specification, m_context);
View Full Code Here

                    m_trackers.add(tracker);
                } else if (srcs[0].equalsIgnoreCase("global")) {
                    SourceTracker tracker = new SourceTracker(srcs[1], global);
                    m_trackers.add(tracker);
                } else {
                    throw new ConfigurationException("Unknowns context scope : " + srcs[0]);
                }
            } else {
                throw new ConfigurationException("Malformed context source : " + sources[i]);
            }
        }
    }
View Full Code Here

            String fil = "(&(" + Constants.OBJECTCLASS + "=" + ContextSource.class.getName() + ")(" + SOURCE_NAME + "=" + name + "))";
            try {
                Filter filter = countext.createFilter(fil);
                m_tracker = new Tracker(countext, filter, this);
            } catch (InvalidSyntaxException e) {
                throw new ConfigurationException("A Context source filter is invalid " + fil + " : " + e.getMessage());
            }
        }
View Full Code Here

     * @see org.apache.felix.ipojo.ComponentFactory#check(org.apache.felix.ipojo.metadata.Element)
     */
    public void check(Element metadata) throws ConfigurationException {
        String name = metadata.getAttribute("name");
        if (name == null) {
            throw new ConfigurationException("A composite needs a name : " + metadata);
        }
    }
View Full Code Here

            Properties conf = null;
            try {
                conf = parseInstance(instances[i]);
            } catch (ParseException e) {
                error("An instance cannot be parsed correctly", e);
                throw new ConfigurationException("An instance cannot be parsed correctly : " + e.getMessage());
            }

          Properties instanceConfiguration = new Properties();
           instanceConfiguration.putAll(conf);
            instanceConfiguration.putAll(toAppend);
View Full Code Here

     * @throws ConfigurationException if the manipulation metadata cannot be found
     */
    public PojoMetadata(Element metadata) throws ConfigurationException {
        Element[] elems = metadata.getElements("manipulation", "");
        if (elems == null) {
            throw new ConfigurationException("The component " + metadata.getAttribute("classname") + " has no manipulation metadata");
        }
        Element manip = elems[0];
        m_super = manip.getAttribute("super");
        Element[] fields = manip.getElements("field");
        for (int i = 0; fields != null && i < fields.length; i++) {
View Full Code Here

            String extension = elems[i].getAttribute("extension");
            String onArrival = elems[i].getAttribute("onArrival");
            String onDeparture = elems[i].getAttribute("onDeparture");
           
            if (extension == null) {
                throw new ConfigurationException("The extender element requires an 'extender' attribute");
            }
            if (onArrival == null || onDeparture == null) {
                throw new ConfigurationException("The extender element requires the 'onArrival' and 'onDeparture' attributes");
            }
           
            ExtenderManager wbm = new ExtenderManager(this, extension, onArrival, onDeparture);
            m_managers.add(wbm);
        }
View Full Code Here

                String field = publisherMetadata.getField();
                FieldMetadata fieldMetadata = getPojoMetadata()
                        .getField(publisherMetadata.getField(),
                                Publisher.class.getName());
                if (fieldMetadata == null) {
                    throw new ConfigurationException(
                            "Field not found in the component : "
                                    + Publisher.class.getName() + " " + field);
                }

                // Check name and field are unique
                if (nameSet.contains(name)) {
                    throw new ConfigurationException(
                            "A publisher with the same name already exists : "
                                    + name);
                } else if (fieldSet.contains(field)) {
                    throw new ConfigurationException("The field " + field
                            + " is already associated to a publisher");
                }
                nameSet.add(name);
                fieldSet.add(field);
            }
View Full Code Here

                        subscriberMetadata.getCallback(),
                        new String[] { callbackType });
                String callbackSignature = subscriberMetadata.getCallback()
                        + "(" + callbackType + ")";
                if (methodMetadata == null) {
                    throw new ConfigurationException(
                            "Cannot find callback method " + callbackSignature);
                }

                // Warn if the same callback is used by several subscribers
                if (callbackSet.contains(callbackSignature)) {
                    warn("The callback method is already used by another subscriber : "
                            + callbackSignature);
                } else {
                    callbackSet.add(callbackSignature);
                }

                // Check name is unique
                if (nameSet.contains(name)) {
                    throw new ConfigurationException(
                            "A subscriber with the same name already exists : "
                                    + name);
                }
                nameSet.add(name);
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.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.