private void updateModel () { BufferedReader r = null; try { r = requester.requestURL(getUrl() + MODEL_URL, ContentType.XML); ModelParser m = new InterMineModelParser(); model = m.process(r); } catch (ModelParserException e) { LOG.error("Error reading remote model", e); } finally { if (r != null) { try { r.close(); } catch (IOException e) { LOG.error("Error closing connection", e); } } } }
/** * Merges the additions from an additions file into an existing model. * @param mergedModel The existing model. * @param newAdditionsFile a file name containing genomic additions. * @return The existing model with the additions merged in. * @throws FileNotFoundException when the newAdditionsFile can't be found in the classpath * @throws ModelParserException if there was a problem generating required additional * class descriptors for the * classes in the additions file * @throws ModelMergerException if there was a problem merging the existing model and the new * additions * */ private static Model processFile(Model mergedModel, String newAdditionsFile, ModelParser parser) throws FileNotFoundException, ModelParserException, ModelMergerException { InputStream is = ModelFileMerger.class.getClassLoader() .getResourceAsStream(newAdditionsFile); if (is == null) { throw new FileNotFoundException("Could not find additions file " + newAdditionsFile + " in the classpath"); } Set<ClassDescriptor> additionClds = parser.generateClassDescriptors(new InputStreamReader(is), mergedModel.getPackageName()); return ModelMerger.mergeModel(mergedModel, additionClds); } }
private void updateModel () { BufferedReader r = null; try { r = requester.requestURL(getUrl() + MODEL_URL, ContentType.XML); ModelParser m = new InterMineModelParser(); model = m.process(r); } catch (ModelParserException e) { LOG.error("Error reading remote model", e); } finally { if (r != null) { try { r.close(); } catch (IOException e) { LOG.error("Error closing connection", e); } } } }
/** * Merges the additions from an additions file into an existing model. * @param mergedModel The existing model. * @param newAdditionsFile a file name containing genomic additions. * @return The existing model with the additions merged in. * @throws FileNotFoundException when the newAdditionsFile can't be found in the classpath * @throws ModelParserException if there was a problem generating required additional * class descriptors for the * classes in the additions file * @throws ModelMergerException if there was a problem merging the existing model and the new * additions * */ private static Model processFile(Model mergedModel, String newAdditionsFile, ModelParser parser) throws FileNotFoundException, ModelParserException, ModelMergerException { InputStream is = ModelFileMerger.class.getClassLoader() .getResourceAsStream(newAdditionsFile); if (is == null) { throw new FileNotFoundException("Could not find additions file " + newAdditionsFile + " in the classpath"); } Set<ClassDescriptor> additionClds = parser.generateClassDescriptors(new InputStreamReader(is), mergedModel.getPackageName()); return ModelMerger.mergeModel(mergedModel, additionClds); } }
try { FileReader reader = new FileReader(inputModelFile); mergedModel = parser.process(reader); reader.close(); } catch (Exception e) {
try { FileReader reader = new FileReader(inputModelFile); mergedModel = parser.process(reader); reader.close(); } catch (Exception e) {