Package org.apache.felix.ipojo.parser

Examples of org.apache.felix.ipojo.parser.ParseException


            dict.put("instance.name", name);
        }

        String comp = instance.getAttribute("component");
        if (comp == null) {
            throw new ParseException("An instance does not have the 'component' attribute");
        } else {
            dict.put("component", comp);
        }

        Element[] props = instance.getElements("property");
View Full Code Here


     */
    public static void parseProperty(Element prop, Dictionary dict) throws ParseException {
        // Check that the property has a name
        String name = prop.getAttribute("name");
        String value = prop.getAttribute("value");
        if (name == null) { throw new ParseException("A property does not have the 'name' attribute"); }
        // Final case : the property element has a 'value' attribute
        if (value == null) {
            // Recursive case
            // Check if there is 'property' element
            Element[] subProps = prop.getElements("property");
            if (subProps == null) { throw new ParseException("A complex property must have at least one 'property' sub-element"); }
            Dictionary dict2 = new Properties();
            for (int i = 0; i < subProps.length; i++) {
                parseProperty(subProps[i], dict2);
                dict.put(prop.getAttribute("name"), dict2);
            }
View Full Code Here

            dict.put("name", name);
        }

        String comp = instance.getAttribute("component");
        if (comp == null) {
            throw new ParseException("An instance does not have the 'component' attribute");
        } else {
            dict.put("component", comp);
        }

        Element[] props = instance.getElements("property");
View Full Code Here

     */
    public static void parseProperty(Element prop, Dictionary dict) throws ParseException {
        // Check that the property has a name
        String name = prop.getAttribute("name");
        String value = prop.getAttribute("value");
        if (name == null) { throw new ParseException("A property does not have the 'name' attribute"); }
        // Final case : the property element has a 'value' attribute
        if (value == null) {
            // Recursive case
            // Check if there is 'property' element
            Element[] subProps = prop.getElements("property");
            if (subProps == null) { throw new ParseException("A complex property must have at least one 'property' sub-element"); }
            Dictionary dict2 = new Properties();
            for (int i = 0; i < subProps.length; i++) {
                parseProperty(subProps[i], dict2);
                dict.put(prop.getAttribute("name"), dict2);
            }
View Full Code Here

        Dictionary bundleHeaders = factory.getBundleContext().getBundle().getHeaders();
        String ipojoHeader = ( String ) bundleHeaders.get( ADSConstants.IPOJO_HEADER );

        if ( ipojoHeader == null )
        {
            throw new ParseException( "Null ipojo header returned for factory: " + factory.getName() );
        }

        ManifestMetadataParser parser = new ManifestMetadataParser();
        parser.parseHeader( ipojoHeader );

        Element[] componentMetas = parser.getComponentsMetadata();

        for ( Element componentMeta : componentMetas )
        {
            String compName = componentMeta.getAttribute( "name" );
            if ( compName.equals( factory.getName() ) )
            {
                Element[] adsElements = componentMeta.getElements(
                    ADSConstants.ADS_COMPONENT_HANDLER_NAME,
                    ADSConstants.ADS_COMPONENT_HANDLER_NS );

                if ( adsElements == null || adsElements.length == 0 )
                {
                    throw new ParseException( "ADSComponent element couldn't be found for factory: "
                        + factory.getName() );
                }

                return adsElements[0].getAttribute( "componentType" );
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.parser.ParseException

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.