public void processRecords(List<String> records) throws MalformedURLException, ProtocolException, IOException { HttpURLConnection urlConn = null; String request = istexApiUrl; System.out.println(records.size()); for (String id : records) { request = istexApiUrl + "/" + id + "/fulltext/tei"; URL url = new URL(request); urlConn = (HttpURLConnection) url.openConnection(); System.out.println(" id :" + id); if (urlConn != null) { urlConn.setDoInput(true); urlConn.setRequestMethod("GET"); InputStream in = urlConn.getInputStream(); String xml = Utilities.convertStreamToString(in); mm.insertExternalTeiDocument(in, id, "istex", MongoCollectionsInterface.ISTEX_TEIS, date); in.close(); } } }
public IstexHarvester() { this.mm = MongoFileManager.getInstance(false); }