private static Component parseComponent()

in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/deployment/DescriptorFactory.java [249:303]


    private static Component parseComponent(Element child) {
        Component component = new Component();
        component.setType(child.getAttribute("type"));
        component.setComponentClassLoaderDelegation(getAttribute(child, "component-class-loader-delegation"));
        component.setBootstrapClassLoaderDelegation(getAttribute(child, "bootstrap-class-loader-delegation"));
        List<SharedLibraryList> sls = new ArrayList<SharedLibraryList>();
        DocumentFragment ext = null;
        for (Element e = DOMUtil.getFirstChildElement(child); e != null; e = DOMUtil.getNextSiblingElement(e)) {
            if ("identification".equals(e.getLocalName())) {
                component.setIdentification(readIdentification(e));
            } else if ("component-class-name".equals(e.getLocalName())) {
                component.setComponentClassName(getText(e));
                component.setDescription(getAttribute(e, "description"));
            } else if ("component-class-path".equals(e.getLocalName())) {
                ClassPath componentClassPath = new ClassPath();
                List<String> l = new ArrayList<String>();
                for (Element e2 = DOMUtil.getFirstChildElement(e); e2 != null; e2 = DOMUtil.getNextSiblingElement(e2)) {
                    if ("path-element".equals(e2.getLocalName())) {
                        l.add(getText(e2));
                    }
                }
                componentClassPath.setPathList(l);
                component.setComponentClassPath(componentClassPath);
            } else if ("bootstrap-class-name".equals(e.getLocalName())) {
                component.setBootstrapClassName(getText(e));
            } else if ("bootstrap-class-path".equals(e.getLocalName())) {
                ClassPath bootstrapClassPath = new ClassPath();
                List<String> l = new ArrayList<String>();
                for (Element e2 = DOMUtil.getFirstChildElement(e); e2 != null; e2 = DOMUtil.getNextSiblingElement(e2)) {
                    if ("path-element".equals(e2.getLocalName())) {
                        l.add(getText(e2));
                    }
                }
                bootstrapClassPath.setPathList(l);
                component.setBootstrapClassPath(bootstrapClassPath);
            } else if ("shared-library".equals(e.getLocalName())) {
                SharedLibraryList sl = new SharedLibraryList();
                sl.setName(getText(e));
                sl.setVersion(getAttribute(e, "version"));
                sls.add(sl);
            } else {
                if (ext == null) {
                    ext = child.getOwnerDocument().createDocumentFragment();
                }
                ext.appendChild(e);
            }
        }
        component.setSharedLibraries(sls.toArray(new SharedLibraryList[sls.size()]));
        if (ext != null) {
            InstallationDescriptorExtension descriptorExtension = new InstallationDescriptorExtension();
            descriptorExtension.setDescriptorExtension(ext);
            component.setDescriptorExtension(descriptorExtension);
        }
        return component;
    }