List of usage examples for io.vertx.core.json JsonObject getBinary
public byte[] getBinary(String key)
From source file:com.glencoesoftware.omero.ms.core.RedisCacheVerticle.java
License:Open Source License
/** * Set a key in the cache./* w w w.j a v a 2 s . c o m*/ */ private void set(Message<JsonObject> message) { if (connection == null) { log.debug("Cache not enabled"); message.reply(null); return; } JsonObject data = message.body(); String key = data.getString("key"); byte[] value = data.getBinary("value"); if (key == null) { message.reply(null); return; } log.debug("Setting cache key: {}", key); RedisAsyncCommands<byte[], byte[]> commands = connection.async(); final StopWatch t0 = new Slf4JStopWatch("set"); // Binary retrieval, get(String) includes a UTF-8 step RedisFuture<String> future = commands.set(key.getBytes(), value); future.whenComplete((v, t) -> { try { if (t != null) { log.error("Exception while setting cache value", t); message.fail(500, t.getMessage()); return; } if (!"OK".equals(v)) { message.fail(500, "Non OK reply: " + v); return; } message.reply(null); } finally { t0.stop(); } }); }
From source file:com.hpe.sw.cms.verticle.ApiVerticle.java
License:Apache License
/** * Handler to handle GET /images/:id request. Response is the image scan files (with/without enrich). * * @return//from w w w .ja va 2s.com */ private Handler<RoutingContext> downloadHandler() { return routingContext -> { String category = routingContext.request().getParam("fileCategory"); JsonObject params = new JsonObject(); if (routingContext.request().getParam("id") != null) { params.put(Image.IMAGE_ID, routingContext.request().getParam("id")); } else { params.put(Image.HOST, routingContext.request().getParam(Image.HOST)); params.put(Image.NAME, routingContext.request().getParam(Image.NAME)); params.put(Image.TAG, routingContext.request().getParam(Image.TAG)); } vertx.eventBus().send(Events.DOWNLOAD_FILE.name(), params, event -> { if (event.succeeded() && event.result() != null) { Message msg = event.result(); JsonObject file = (JsonObject) msg.body(); routingContext.response().setChunked(true); if (file == null) { routingContext.response().setStatusCode(404).end("There is no image found."); return; } if ("enrich".equals(category) && file.getBinary(Image.ENRICHED_FILE) != null) { String fileName = file.getString(Image.HOST) + "___" + file.getString(Image.NAME) + "___" + file.getString(Image.IMAGE_ID) + ".xsf"; routingContext.response().putHeader("Content-Disposition", "attachment; filename = " + fileName); Buffer buffer = Buffer.buffer(file.getBinary(Image.ENRICHED_FILE)); routingContext.response().end(buffer); } else if ("enrich_xml".equals(category) && file.getBinary(Image.SCANNED_FILE) != null) { routingContext.response().end(decompressGzip(file.getBinary(Image.ENRICHED_FILE))); } else if ("scan".equals(category) && file.getBinary(Image.SCANNED_FILE) != null) { String fileName = file.getString(Image.HOST) + "___" + file.getString(Image.NAME) + "___" + file.getString(Image.IMAGE_ID) + ".xsf"; routingContext.response().putHeader("Content-Disposition", "attachment; filename = " + fileName); Buffer buffer = Buffer.buffer(file.getBinary(Image.SCANNED_FILE)); routingContext.response().end(buffer); } else if ("scan_xml".equals(category) && file.getBinary(Image.SCANNED_FILE) != null) { routingContext.response().end(decompressGzip(file.getBinary(Image.SCANNED_FILE))); } } else if (event.result() == null) { routingContext.response().setStatusCode(404).end("There is no image found."); } else { routingContext.response().setStatusCode(500).end("Server has error."); } }); }; }
From source file:com.hpe.sw.cms.verticle.MongoStoreVerticle.java
License:Apache License
@Override public void start() throws Exception { super.start(); client = MongoClient.createShared(vertx, config().getJsonObject("mongo")); vertx.eventBus().consumer(Events.GET_IMAGES.name(), msg -> { JsonObject param = (JsonObject) msg.body(); JsonObject query = new JsonObject(); if (param != null && param.getString("timestamp") != null) { Long timestamp = Long.parseLong(param.getString("timestamp")); query.put(Image.TIMESTAMP, new JsonObject().put("$gte", timestamp)); } else if (param != null && param.getString("imageid") != null) { query.put(Image.IMAGE_ID, param.getString(Image.IMAGE_ID)); }/* w w w . j av a 2 s . co m*/ if (!query.containsKey(Image.IMAGE_ID) && (param == null || param.getString("include") == null || !"all".equals(param.getString("include")))) { query.put(Image.IMAGE_ID, new JsonObject().put("$exists", true)); } JsonArray images = new JsonArray(); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); for (JsonObject dbImage : result) { images.add(Image.cloneImage(dbImage)); } msg.reply(images); } }); }); vertx.eventBus().consumer(Events.DOWNLOAD_FILE.name(), msg -> { JsonObject query = (JsonObject) msg.body(); LOG.debug("DOWNLOAD_FILE query is " + query); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); LOG.debug("DOWNLOAD_FILE result is " + result.size()); if (result.size() > 0) { msg.reply(result.get(0)); } else { msg.reply(null); } } }); }); vertx.eventBus().consumer(Events.IMAGES_UPDATED.name(), msg -> { JsonArray updates = new JsonArray(); JsonObject query = new JsonObject(); query.put(Image.IS_SCANNED, false); int fetchSize = Integer.valueOf(String.valueOf(msg.body())); FindOptions options = new FindOptions(); JsonObject sort = new JsonObject(); sort.put(Image.TIMESTAMP, -1); options.setLimit(fetchSize).setSort(sort); client.findWithOptions("images", query, options, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); for (JsonObject update : result) { updates.add(update); LOG.debug("get image from DB :" + Image.getImageKey(update)); } LOG.debug("IMAGES_UPDATED reply updates size " + updates.size()); msg.reply(updates); } }); }); vertx.eventBus().consumer(Events.SCANFILE_UPLOADED.name(), msg -> { JsonObject upFile = (JsonObject) msg.body(); JsonObject query = new JsonObject(); query.put(Image.HOST, upFile.getString(Image.HOST)).put(Image.NAME, upFile.getString(Image.NAME)) .put(Image.TAG, upFile.getString(Image.TAG)); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); if (result.size() == 0) { LOG.error("no mapped image in DB for " + Image.getImageKey(upFile)); return; } for (JsonObject dbImage : result) { if (upFile.getBoolean("isScanFailed")) { //Failed in scanning. LOG.info("store failed scan to DB " + Image.getImageKey(upFile)); dbImage.put(Image.IS_SCANNED, true); dbImage.put(Image.IS_SCANNED_FAILED, true); } else { //successfully in scanning. LOG.info("store scanfile to DB " + Image.getImageKey(upFile)); dbImage.put(Image.IS_SCANNED, true); dbImage.put(Image.IS_SCANNED_FAILED, false); dbImage.put(Image.IMAGE_ID, upFile.getString(Image.IMAGE_ID)); dbImage.put(Image.SCANNED_FILE, upFile.getBinary(Image.SCANNED_FILE)); } client.save("images", dbImage, h -> { if (h.succeeded()) { LOG.info("SCANFILE_UPLOADED:Image " + Image.getImageKey(dbImage) + " updated !"); } else { h.cause().printStackTrace(); } }); } } }); }); vertx.eventBus().consumer(Events.ENRICHFILE_UPLOADED.name(), msg -> { JsonArray upFiles = (JsonArray) msg.body(); for (Object upFileObj : upFiles) { JsonObject upFile = (JsonObject) upFileObj; if (upFile.getBinary("enrichedFile") == null) { LOG.info("enrichedFile is emptry for " + upFile.getString("imageid")); continue; } LOG.info("store enrichfile to DB " + upFile.getString("imageid")); JsonObject query = new JsonObject(); query.put(Image.IMAGE_ID, upFile.getString(Image.IMAGE_ID)); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); for (JsonObject dbImage : result) { dbImage.put(Image.IS_ENRICHED, true); dbImage.put(Image.ENRICHED_FILE, upFile.getBinary(Image.ENRICHED_FILE)); client.save("images", dbImage, h -> { if (h.succeeded()) { LOG.info("ENRICHFILE_UPLOADED:Image " + Image.getImageKey(dbImage) + " updated !"); } else { h.cause().printStackTrace(); } }); } } }); } }); vertx.eventBus().consumer(Events.IMAGE_TO_ENRICH.name(), msg -> { JsonObject query = new JsonObject(); query.put(Image.IS_SCANNED, true).put(Image.IS_SCANNED_FAILED, false).put(Image.IS_ENRICHED, false); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); msg.reply(new JsonArray(result)); } }); }); vertx.eventBus().consumer(Events.NEW_IMAGE.name(), msg -> { //to store events in JsonObject obj = (JsonObject) msg.body(); JsonObject query = new JsonObject(); query.put(Image.HOST, obj.getString(Image.HOST)).put(Image.NAME, obj.getString(Image.NAME)) .put(Image.TAG, obj.getString(Image.TAG)); client.find("images", query, res -> { if (res.succeeded()) { List<JsonObject> result = res.result(); if (result.isEmpty()) { //inserted client.insert("images", obj, h -> { if (h.succeeded()) { LOG.info("IMAGES_COMMING :Image " + Image.getImageKey(obj) + " inserted !"); } else { h.cause().printStackTrace(); } }); } else if (result.size() == 1) { JsonObject toUpdate = result.get(0); if (!obj.getString(Image.SIGN).equals(toUpdate.getString(Image.SIGN))) { toUpdate.put(Image.TIMESTAMP, obj.getLong(Image.TIMESTAMP)) .put(Image.SIGN, obj.getString(Image.SIGN)) .put(Image.IS_SCANNED, obj.getBoolean(Image.IS_SCANNED)) .put(Image.IS_ENRICHED, obj.getBoolean(Image.IS_ENRICHED)); //saved client.save("images", toUpdate, h -> { if (h.succeeded()) { LOG.info("IMAGES_COMMING :Image " + Image.getImageKey(obj) + " updated !"); } else { h.cause().printStackTrace(); } }); } else { LOG.info("IMAGES_COMMING :Image " + Image.getImageKey(obj) + " has the same sign with the coming image, so will not update to DB !"); } } else { throw new RuntimeException( "IMAGES_COMMING :Found " + result.size() + " image for " + Image.getImageKey(obj)); } } }); }); }
From source file:com.hpe.sw.cms.verticle.RecognizerVerticle.java
License:Apache License
@Override public void start() throws Exception { super.start(); getVertx().setPeriodic(config().getLong("recognizer.interval", INTERVAL), h -> { getVertx().eventBus().send(Events.IMAGE_TO_ENRICH.name(), null, event -> { Message msg = event.result(); if (msg != null) { String enrichPath = Constant.PROJECT_PATH + "xmlenricher/runtime/xmlenricher/Scans/incoming/"; JsonArray scanfiles = (JsonArray) msg.body(); for (Object obj : scanfiles) { FileOutputStream fop = null; try { JsonObject image = (JsonObject) obj; String filePath = enrichPath + image.getString("imageid") + ".xsf"; File file = new File(filePath); if (!file.exists()) { file.createNewFile(); }/*from www . j a v a2s .c o m*/ fop = new FileOutputStream(file); IOUtils.write(image.getBinary("scannedFile"), fop); fop.flush(); fop.close(); } catch (Exception e) { LOG.error("Error in writing scan file", e); } finally { if (fop != null) { try { fop.close(); } catch (IOException e) { e.printStackTrace(); } } } } } }); }); //check whether there are new enriched files getVertx().setPeriodic(config().getLong("recognizer.interval", INTERVAL), h -> { String enrichPath = Constant.PROJECT_PATH + "xmlenricher/runtime/xmlenricher/Scans/processedcore/"; File fileDir = new File(enrichPath); File[] fileList = fileDir.listFiles(XSF_FILTER); JsonArray enrichedFiles = new JsonArray(); for (File file : fileList) { if (file.isFile()) { String imageid = file.getName().split("\\.")[0]; try { JsonObject enrichedFile = new JsonObject(); enrichedFile.put("imageid", imageid); enrichedFile.put("enrichedFile", FileUtils.readFileToByteArray(file)); enrichedFiles.add(enrichedFile); file.delete(); //TODO: do a batch delete after all enrichedFiles are collected } catch (IOException e) { e.printStackTrace(); } } } if (enrichedFiles.size() > 0) { getVertx().eventBus().publish(Events.ENRICHFILE_UPLOADED.name(), enrichedFiles); } }); }
From source file:com.hubrick.vertx.kafka.producer.model.ByteKafkaMessage.java
License:Apache License
public ByteKafkaMessage(JsonObject jsonObject) { super(jsonObject.getString(PART_KEY)); this.payload = jsonObject.getBinary(PAYLOAD) != null ? Buffer.buffer(jsonObject.getBinary(PAYLOAD)) : null; }
From source file:enmasse.kafka.bridge.converter.JsonMessageConverter.java
License:Apache License
@Override public Message toAmqpMessage(String amqpAddress, ConsumerRecord<String, byte[]> record) { Message message = Proton.message();//from www . j a v a 2s .c o m message.setAddress(amqpAddress); // get the root JSON JsonObject json = new JsonObject(new String(record.value())); // get AMQP properties from the JSON JsonObject jsonProperties = json.getJsonObject(JsonMessageConverter.PROPERTIES); if (jsonProperties != null) { for (Entry<String, Object> entry : jsonProperties) { if (entry.getValue() != null) { if (entry.getKey().equals(JsonMessageConverter.MESSAGE_ID)) { message.setMessageId(entry.getValue()); } else if (entry.getKey().equals(JsonMessageConverter.TO)) { message.setAddress(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.SUBJECT)) { message.setSubject(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.REPLY_TO)) { message.setReplyTo(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.CORRELATION_ID)) { message.setCorrelationId(entry.getValue()); } } } } // get AMQP application properties from the JSON JsonObject jsonApplicationProperties = json.getJsonObject(JsonMessageConverter.APPLICATION_PROPERTIES); if (jsonApplicationProperties != null) { Map<Symbol, Object> applicationPropertiesMap = new HashMap<>(); for (Entry<String, Object> entry : jsonApplicationProperties) { applicationPropertiesMap.put(Symbol.valueOf(entry.getKey()), entry.getValue()); } ApplicationProperties applicationProperties = new ApplicationProperties(applicationPropertiesMap); message.setApplicationProperties(applicationProperties); } // put message annotations about partition, offset and key (if not null) Map<Symbol, Object> messageAnnotationsMap = new HashMap<>(); messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_PARTITION_ANNOTATION), record.partition()); messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_OFFSET_ANNOTATION), record.offset()); if (record.key() != null) messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_KEY_ANNOTATION), record.key()); messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_TOPIC_ANNOTATION), record.topic()); // get AMQP message annotations from the JSON JsonObject jsonMessageAnnotations = json.getJsonObject(JsonMessageConverter.MESSAGE_ANNOTATIONS); if (jsonMessageAnnotations != null) { for (Entry<String, Object> entry : jsonMessageAnnotations) { messageAnnotationsMap.put(Symbol.valueOf(entry.getKey()), entry.getValue()); } } MessageAnnotations messageAnnotations = new MessageAnnotations(messageAnnotationsMap); message.setMessageAnnotations(messageAnnotations); // get the AMQP message body from the JSON JsonObject jsonBody = json.getJsonObject(JsonMessageConverter.BODY); if (jsonBody != null) { // type attribtute for following sectin : AMQP value or raw data/binary String type = jsonBody.getString(JsonMessageConverter.SECTION_TYPE); if (type.equals(JsonMessageConverter.SECTION_AMQP_VALUE_TYPE)) { // section is an AMQP value Object jsonSection = jsonBody.getValue(JsonMessageConverter.SECTION); // encoded as String if (jsonSection instanceof String) { message.setBody(new AmqpValue(jsonSection)); // encoded as an array/List } else if (jsonSection instanceof JsonArray) { JsonArray jsonArray = (JsonArray) jsonSection; message.setBody(new AmqpValue(jsonArray.getList())); // encoded as a Map } else if (jsonSection instanceof JsonObject) { JsonObject jsonObject = (JsonObject) jsonSection; message.setBody(new AmqpValue(jsonObject.getMap())); } } else if (type.equals(JsonMessageConverter.SECTION_DATA_TYPE)) { // section is a raw binary data // get the section from the JSON (it's base64 encoded) byte[] value = jsonBody.getBinary(JsonMessageConverter.SECTION); message.setBody(new Data(new Binary(Base64.getDecoder().decode(value)))); } } return message; }
From source file:io.rhiot.kafka.bridge.JsonMessageConverter.java
License:Apache License
@Override public Message toAmqpMessage(String amqpAddress, ConsumerRecord<String, byte[]> record) { Message message = Proton.message();/* w w w . ja v a 2 s . c om*/ message.setAddress(amqpAddress); // get the root JSON JsonObject json = new JsonObject(new String(record.value())); // get AMQP properties from the JSON JsonObject jsonProperties = json.getJsonObject(JsonMessageConverter.PROPERTIES); if (jsonProperties != null) { for (Entry<String, Object> entry : jsonProperties) { if (entry.getValue() != null) { if (entry.getKey().equals(JsonMessageConverter.MESSAGE_ID)) { message.setMessageId(entry.getValue()); } else if (entry.getKey().equals(JsonMessageConverter.TO)) { message.setAddress(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.SUBJECT)) { message.setSubject(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.REPLY_TO)) { message.setReplyTo(entry.getValue().toString()); } else if (entry.getKey().equals(JsonMessageConverter.CORRELATION_ID)) { message.setCorrelationId(entry.getValue()); } } } } // get AMQP application properties from the JSON JsonObject jsonApplicationProperties = json.getJsonObject(JsonMessageConverter.APPLICATION_PROPERTIES); if (jsonApplicationProperties != null) { Map<Symbol, Object> applicationPropertiesMap = new HashMap<>(); for (Entry<String, Object> entry : jsonApplicationProperties) { applicationPropertiesMap.put(Symbol.valueOf(entry.getKey()), entry.getValue()); } ApplicationProperties applicationProperties = new ApplicationProperties(applicationPropertiesMap); message.setApplicationProperties(applicationProperties); } // put message annotations about partition, offset and key (if not null) Map<Symbol, Object> messageAnnotationsMap = new HashMap<>(); messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_PARTITION_ANNOTATION), record.partition()); messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_OFFSET_ANNOTATION), record.offset()); if (record.key() != null) messageAnnotationsMap.put(Symbol.valueOf(Bridge.AMQP_KEY_ANNOTATION), record.key()); // get AMQP message annotations from the JSON JsonObject jsonMessageAnnotations = json.getJsonObject(JsonMessageConverter.MESSAGE_ANNOTATIONS); if (jsonMessageAnnotations != null) { for (Entry<String, Object> entry : jsonMessageAnnotations) { messageAnnotationsMap.put(Symbol.valueOf(entry.getKey()), entry.getValue()); } } MessageAnnotations messageAnnotations = new MessageAnnotations(messageAnnotationsMap); message.setMessageAnnotations(messageAnnotations); // get the AMQP message body from the JSON JsonObject jsonBody = json.getJsonObject(JsonMessageConverter.BODY); if (jsonBody != null) { // type attribtute for following sectin : AMQP value or raw data/binary String type = jsonBody.getString(JsonMessageConverter.SECTION_TYPE); if (type.equals(JsonMessageConverter.SECTION_AMQP_VALUE_TYPE)) { // section is an AMQP value Object jsonSection = jsonBody.getValue(JsonMessageConverter.SECTION); // encoded as String if (jsonSection instanceof String) { message.setBody(new AmqpValue(jsonSection)); // encoded as an array/List } else if (jsonSection instanceof JsonArray) { JsonArray jsonArray = (JsonArray) jsonSection; message.setBody(new AmqpValue(jsonArray.getList())); // encoded as a Map } else if (jsonSection instanceof JsonObject) { JsonObject jsonObject = (JsonObject) jsonSection; message.setBody(new AmqpValue(jsonObject.getMap())); } } else if (type.equals(JsonMessageConverter.SECTION_DATA_TYPE)) { // section is a raw binary data // get the section from the JSON (it's base64 encoded) byte[] value = jsonBody.getBinary(JsonMessageConverter.SECTION); message.setBody(new Data(new Binary(Base64.getDecoder().decode(value)))); } } return message; }
From source file:org.eclipse.hono.authentication.impl.BaseAuthenticationService.java
License:Open Source License
private void processMessage(final Message<JsonObject> message) { final JsonObject body = message.body(); final String mechanism = body.getString(FIELD_MECHANISM); if (!isSupported(mechanism)) { replyWithError(message, ERROR_CODE_UNSUPPORTED_MECHANISM, "unsupported SASL mechanism"); } else {/*from w w w . ja v a 2 s .c om*/ final byte[] response = body.getBinary(FIELD_RESPONSE); LOG.debug("received authentication request [mechanism: {}, response: {}]", mechanism, response != null ? "*****" : "empty"); validateResponse(mechanism, response, validation -> { if (validation.succeeded()) { replyWithAuthorizationId(message, validation.result()); } else { replyWithError(message, ERROR_CODE_AUTHENTICATION_FAILED, validation.cause().getMessage()); } }); } }
From source file:org.entcore.directory.controllers.StructureController.java
License:Open Source License
private void massMailTypePdf(final HttpServerRequest request, final String templatePath, final String baseUrl, final String filename, final JsonArray users) { final JsonObject templateProps = new JsonObject().put("users", users); vertx.fileSystem().readFile(templatePath + "massmail.pdf.xhtml", new Handler<AsyncResult<Buffer>>() { @Override// w w w. j a v a 2 s .c o m public void handle(AsyncResult<Buffer> result) { if (!result.succeeded()) { badRequest(request); return; } StringReader reader = new StringReader(result.result().toString("UTF-8")); processTemplate(request, templateProps, "massmail.pdf.xhtml", reader, new Handler<Writer>() { public void handle(Writer writer) { String processedTemplate = ((StringWriter) writer).getBuffer().toString(); if (processedTemplate == null) { badRequest(request); return; } JsonObject actionObject = new JsonObject(); actionObject.put("content", processedTemplate.getBytes()).put("baseUrl", baseUrl); eb.send(node + "entcore.pdf.generator", actionObject, new DeliveryOptions().setSendTimeout(600000l), handlerToAsyncHandler(new Handler<Message<JsonObject>>() { public void handle(Message<JsonObject> reply) { JsonObject pdfResponse = reply.body(); if (!"ok".equals(pdfResponse.getString("status"))) { badRequest(request, pdfResponse.getString("message")); return; } byte[] pdf = pdfResponse.getBinary("content"); request.response().putHeader("Content-Type", "application/pdf"); request.response().putHeader("Content-Disposition", "attachment; filename=" + filename + ".pdf"); request.response().end(Buffer.buffer(pdf)); } })); } }); } }); }
From source file:org.sfs.filesystem.volume.DigestBlob.java
License:Apache License
public DigestBlob(JsonObject jsonObject) { super(jsonObject); digests = new HashMap<>(); JsonArray jsonArray = jsonObject.getJsonArray("X-Computed-Digests"); if (jsonArray != null) { for (Object o : jsonArray) { JsonObject jsonDigest = (JsonObject) o; String digestName = jsonDigest.getString("name"); byte[] value = jsonDigest.getBinary("value"); Optional<MessageDigestFactory> oMessageDigestFactory = fromValueIfExists(digestName); if (oMessageDigestFactory.isPresent()) { MessageDigestFactory messageDigestFactory = oMessageDigestFactory.get(); withDigest(messageDigestFactory, value); }//from w w w .j ava 2 s .c om } } }