public List read()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/internal/eclipse/retrieve/StandaloneRetrieveSerializer.java [193:257]


    public List<StandaloneRetrieveSetup> read(InputStream in, IProject project)
            throws IOException {
        try {
            InputSource source = new InputSource(in);

            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder parser = factory.newDocumentBuilder();
            Document document = parser.parse(source);

            NodeList elements = document.getElementsByTagName(SETUP);

            List<StandaloneRetrieveSetup> setupList = new ArrayList<>();

            int count = elements.getLength();
            for (int i = 0; i != count; i++) {
                Node node = elements.item(i);

                StandaloneRetrieveSetup setup = new StandaloneRetrieveSetup();
                setup.setProject(project);

                NamedNodeMap attributes = node.getAttributes();
                setup.setName(getAttribute(attributes, SETUP_NAME));

                Node attr = attributes.getNamedItem(RESOLVE_IN_WORKSPACE);
                if (attr != null) {
                    setup.setResolveInWorkspace(Boolean.valueOf(attr.getNodeValue()));
                }

                NodeList children = node.getChildNodes();
                for (int j = 0; j < children.getLength(); j++) {
                    Node item = children.item(j);
                    switch (item.getNodeName()) {
                        case IVYSETTINGS:
                            SettingsSetup settingsSetup = readSettingsSetup(item);
                            setup.setSettingsSetup(settingsSetup);
                            setup.setSettingsProjectSpecific(true);
                            break;
                        case IVYXML:
                            String ivyXmlPath = readIvyXmlPath(item);
                            setup.setIvyXmlPath(ivyXmlPath);
                            break;
                        case RETRIEVE:
                            RetrieveSetup retrieveSetup = readRetrieveSetup(item);
                            setup.setRetrieveSetup(retrieveSetup);
                            break;
                    }
                }

                setupList.add(setup);
            }
            return setupList;
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e.getMessage(), e);
        } catch (SAXException e) {
            Throwable t = e.getCause();
            if (t instanceof IOException) {
                throw (IOException) t;
            }
            if (t == null) {
                t = e;
            }
            throw new IOException(t.getMessage(), t);
        }

    }