public synchronized void parse(InputStream stream) throws IOException { this.status = null; try { // TODO: currently not caching the parser since we make no assumptions // or restrictions on concurrent parsing getParser(); RepositoryHandler repositoryHandler = new RepositoryHandler(); xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler)); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { theState = repositoryHandler.getRepository(); } } catch (SAXException e) { throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { stream.close(); } }
public synchronized void parse(InputStream stream) throws IOException { this.status = null; try { // TODO: currently not caching the parser since we make no assumptions // or restrictions on concurrent parsing getParser(); RepositoryHandler repositoryHandler = new RepositoryHandler(); xmlReader.setContentHandler(new RepositoryDocHandler(REPOSITORY_ELEMENT, repositoryHandler)); xmlReader.parse(new InputSource(stream)); if (isValidXML()) { theState = repositoryHandler.getRepository(); } } catch (SAXException e) { throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { stream.close(); } }
protected void finished() { if (isValidXML()) { state = new CompositeRepositoryState(); state.setName(attrValues[0]); state.setType(attrValues[1]); state.setVersion(attrValues[2]); state.setDescription(attrValues[3]); state.setProvider(attrValues[4]); state.setProperties((propertiesHandler == null ? new OrderedProperties(0) // : propertiesHandler.getProperties())); state.setChildren((childrenHandler == null ? new URI[0] // : childrenHandler.getChildren())); } } }
protected void finished() { if (isValidXML()) { state = new CompositeRepositoryState(); state.setName(attrValues[0]); state.setType(attrValues[1]); state.setVersion(attrValues[2]); state.setDescription(attrValues[3]); state.setProvider(attrValues[4]); state.setProperties((propertiesHandler == null ? new OrderedProperties(0) // : propertiesHandler.getProperties())); state.setChildren((childrenHandler == null ? new URI[0] // : childrenHandler.getChildren())); } } }