public void inicializa() throws Exception { try { log.info("Inicializa el cliente MongoDB"); String host = ApplicationConfiguration.getInstance().getProperty("mongo.host"); if (StringUtils.isEmpty(host)) { throw new DocumentException("No está configurado el host"); } String property = ApplicationConfiguration.getInstance().getProperty("mongo.port"); if (StringUtils.isEmpty(property)) { throw new DocumentException("No está configurado el puerto"); } int port = Integer.parseInt(property); String dbName = ApplicationConfiguration.getInstance().getProperty("mongo.data.base"); if (StringUtils.isEmpty(dbName)) { throw new DocumentException("No está configurada la base de datos"); } mongoClient = new MongoClient(host, port); dataBase = mongoClient.getDB(dbName); } catch (Exception e) { log.error("Error al iniciar el cliente: " + e.getMessage()); e.printStackTrace(); throw new DocumentException(e.getMessage()); } }
private ProcessOutputMessage() { String property = ApplicationConfiguration.getInstance().getProperty("pathProcessOutputMessageConfiguration"); parserProcessMessage = new ParserProcessMessage(property); property = ApplicationConfiguration.getInstance() .getProperty("pathConfigureOutputMessageConfiguration"); configuratorHandler = new ConfiguratorHandler(property); }