@Override protected void doDestroy() { if (connection != null) { try { connection.close(); } catch (SQLException e) { getMonitor().debug("Failed to close PostgreSQL Connection", e); // Do nothing } connection = null; } }
@Override protected void doDestroy() { if (connection != null) { try { connection.close(); } catch (SQLException e) { getMonitor().debug("Failed to close PostgreSQL Connection", e); // Do nothing } connection = null; } }
@Override protected void doClose() throws IOException { if (br != null) { try { br.close(); } catch (IOException ioe) { getMonitor().debug("An error occurred when closing the BufferedReader", ioe); } br = null; } } }
protected MongoClient createMongoClient(ServerAddress sa, Optional<MongoCredential> credentials) { if (!credentials.isPresent()) { getMonitor().debug("Connecting to Mongo without authentication"); return new MongoClient(sa); } else { getMonitor() .debug( "Connecting to Mongo with authentication as user '{}'", credentials.get().getUserName()); return new MongoClient(sa, Arrays.asList(credentials.get())); } }
protected MongoClient createMongoClient(ServerAddress sa, Optional<MongoCredential> credentials) { if (!credentials.isPresent()) { getMonitor().debug("Connecting to Mongo without authentication"); return new MongoClient(sa); } else { getMonitor() .debug( "Connecting to Mongo with authentication as user '{}'", credentials.get().getUserName()); return new MongoClient(sa, Arrays.asList(credentials.get())); } }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from ActiveMQ"); try { session.close(); connection.close(); } catch (JMSException e) { getMonitor().error("Could not close connection to ActiveMQ", e); } }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from ActiveMQ"); try { session.close(); connection.close(); } catch (JMSException e) { getMonitor().error("Could not close connection to ActiveMQ", e); } }
@Override protected void doClose() throws IOException { if (br != null) { try { br.close(); } catch (IOException ioe) { getMonitor().debug("An error occurred when closing the BufferedReader", ioe); } br = null; } if (extractor != null) { extractor.destroy(); extractor = null; } } }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from Mongo"); m.close(); db = null; m = null; }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from Mongo"); m.close(); db = null; m = null; }
private void connectToMongo( String host, int port, String database, String username, String password) throws BaleenException { try { // Connect to Mongo ServerAddress sa = new ServerAddress(host, port); Optional<MongoCredential> cred = createCredentials(username, password, database); m = createMongoClient(sa, cred); getMonitor().debug("Getting Mongo Database '{}'", db); db = m.getDatabase(database); } catch (Exception e) { throw new BaleenException("Unable to connect to Mongo", e); } }
private void connectToMongo( String host, int port, String database, String username, String password) throws BaleenException { try { // Connect to Mongo ServerAddress sa = new ServerAddress(host, port); Optional<MongoCredential> cred = createCredentials(username, password, database); m = createMongoClient(sa, cred); getMonitor().debug("Getting Mongo Database '{}'", db); db = m.getDatabase(database); } catch (Exception e) { throw new BaleenException("Unable to connect to Mongo", e); } }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from RabbitMQ"); try { connection.close(); } catch (final Exception e) { getMonitor().error("Could not close connection to RabbitMQ", e); } } }
@Override protected void doDestroy() { getMonitor().debug("Disconnecting from RabbitMQ"); try { connection.close(); } catch (final Exception e) { getMonitor().error("Could not close connection to RabbitMQ", e); } } }
private Optional<Vertex> traversal(JCas jCas, GraphTraversalSource traversal) { EntityRelationConverter converter = new EntityRelationConverter(monitor, options.getStopFeatures(), fields, false); loadMentions(jCas, traversal, converter); if (options.isOutputRelations()) { loadRelations(jCas, traversal, converter); } else { monitor.debug("DocumentGraph relations ommitted"); } if (options.isOutputEvents()) { loadEvents(jCas, traversal, converter); } else { monitor.debug("DocumentGraph events ommitted"); } return loadDocument(jCas, traversal); }
private Optional<Vertex> traversal(JCas jCas, GraphTraversalSource traversal) { EntityRelationConverter converter = new EntityRelationConverter(monitor, options.getStopFeatures(), fields, false); loadMentions(jCas, traversal, converter); if (options.isOutputRelations()) { loadRelations(jCas, traversal, converter); } else { monitor.debug("DocumentGraph relations ommitted"); } if (options.isOutputEvents()) { loadEvents(jCas, traversal, converter); } else { monitor.debug("DocumentGraph events ommitted"); } return loadDocument(jCas, traversal); }
private void tryExpunge() throws MessagingException { try { inboxFolder.expunge(); } catch (MethodNotSupportedException mnse) { getMonitor() .debug( "Expunge method not supported (e.g. POP3) - closing and reopening folder - {}", mnse.getMessage()); inboxFolder.close(true); reopenConnection(); } }
private void tryExpunge() throws MessagingException { try { inboxFolder.expunge(); } catch (MethodNotSupportedException mnse) { getMonitor() .debug( "Expunge method not supported (e.g. POP3) - closing and reopening folder - {}", mnse.getMessage()); inboxFolder.close(true); reopenConnection(); } }
/** * Load the data form the jCas into the given graph. * * @param jCas to load the data from * @param graph to load the data into */ public void load(JCas jCas, Graph graph) { GraphTraversalSource traversal = graph.traversal(); Optional<Vertex> document = traversal(jCas, traversal); if (options.isOutputContent()) { loadDocumentContent(jCas, graph, document); } if (options.isOutputMeta()) { loadGraphMetadata(jCas, graph, document); } else { monitor.debug("DocumentGraph metadata skiped"); } }
@Test public void testLogger() { UimaMonitor monitor = new UimaMonitor(PIPELINE, this.getClass()); monitor.trace("test"); monitor.debug("test"); monitor.info("test"); monitor.warn("test"); monitor.error("test"); } }