public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); 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()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) { IOException ioException = new IOException(e.getMessage()); ioException.initCause(e); throw ioException; } } catch (ParserConfigurationException e) { IOException ioException = new IOException(e.getMessage()); ioException.initCause(e); throw ioException; } finally { monitor.done(); stream.close(); } }
public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); 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()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }
public void startElement(String name, Attributes attributes) { checkCancel(); if (PROPERTIES_ELEMENT.equals(name)) { if (propertiesHandler == null) { propertiesHandler = new PropertiesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (INSTALLABLE_UNITS_ELEMENT.equals(name)) { if (unitsHandler == null) { unitsHandler = new InstallableUnitsHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (REPOSITORY_REFERENCES_ELEMENT.equals(name)) { if (repositoryReferencesHandler == null) { repositoryReferencesHandler = new RepositoryReferencesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else { invalidElement(name, attributes); } }
public void startElement(String name, Attributes attributes) { checkCancel(); if (PROPERTIES_ELEMENT.equals(name)) { if (propertiesHandler == null) { propertiesHandler = new PropertiesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (INSTALLABLE_UNITS_ELEMENT.equals(name)) { if (unitsHandler == null) { unitsHandler = new InstallableUnitsHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (REPOSITORY_REFERENCES_ELEMENT.equals(name)) { if (repositoryReferencesHandler == null) { repositoryReferencesHandler = new RepositoryReferencesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else { invalidElement(name, attributes); } }
public void startElement(String name, Attributes attributes) { checkCancel(); if (PROPERTIES_ELEMENT.equals(name)) { if (propertiesHandler == null) { propertiesHandler = new PropertiesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (INSTALLABLE_UNITS_ELEMENT.equals(name)) { if (unitsHandler == null) { unitsHandler = new InstallableUnitsHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else if (REPOSITORY_REFERENCES_ELEMENT.equals(name)) { if (repositoryReferencesHandler == null) { repositoryReferencesHandler = new RepositoryReferencesHandler(this, attributes); } else { duplicateElement(this, name, attributes); } } else { invalidElement(name, attributes); } }
public synchronized void parse(InputStream stream, IProgressMonitor monitor) throws IOException { this.status = null; setProgressMonitor(monitor); monitor.beginTask(Messages.repo_loading, IProgressMonitor.UNKNOWN); 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()) { theRepository = repositoryHandler.getRepository(); } } catch (SAXException e) { if (!(e.getException() instanceof OperationCanceledException)) throw new IOException(e.getMessage()); } catch (ParserConfigurationException e) { throw new IOException(e.getMessage()); } finally { monitor.done(); stream.close(); } }
protected void handleRootAttributes(Attributes attributes) { String[] values = parseAttributes(attributes, required, optional); Version version = checkVersion(this.elementHandled, VERSION_ATTRIBUTE, values[2]); state.Name = values[0]; state.Type = values[1]; state.Version = version; state.Description = values[3]; state.Provider = values[4]; state.Location = null; }
protected void handleRootAttributes(Attributes attributes) { String[] values = parseAttributes(attributes, required, optional); Version version = checkVersion(this.elementHandled, VERSION_ATTRIBUTE, values[2]); state.Name = values[0]; state.Type = values[1]; state.Version = version; state.Description = values[3]; state.Provider = values[4]; state.Location = null; }
protected void handleRootAttributes(Attributes attributes) { String[] values = parseAttributes(attributes, required, optional); Version version = checkVersion(this.elementHandled, VERSION_ATTRIBUTE, values[2]); state.Name = values[0]; state.Type = values[1]; state.Version = version; state.Description = values[3]; state.Provider = values[4]; state.Location = null; }