com.googlecode.fascinator.common.JsonObject.toString()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中com.googlecode.fascinator.common.JsonObject.toString()方法的一些代码示例,展示了JsonObject.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonObject.toString()方法的具体详情如下:
包路径:com.googlecode.fascinator.common.JsonObject
类名称:JsonObject
方法名:toString

JsonObject.toString介绍

暂无

代码示例

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
 * Will return a JSON string description of an extending classes'
 * fields.
 *
 * @param property The class field to retrieve
 * @return The value of the property
 */
@Override
public final String describeMetadata() {
  // Grab the class name which is extending
  String class_name = this.getClass().getCanonicalName();
  try {
    Class<?> ref_class = Class.forName(class_name);
    Field field_list[] = ref_class.getDeclaredFields();
    response = new JsonObject();
    // Arbitrarily set recordId first, as its a private field
    // of GenericSchema inheriting classes can't access it.
    response.put("recordId", "String");
    for (int i = 0; i < field_list.length; i++) {
      response.put(field_list[i].getName(), field_list[i].getType().getSimpleName());
    }
    return response.toString();
  } catch (ClassNotFoundException ex) {
    log.error(ex.getMessage());
    return "Error retrieving user specification";
  }
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

/**
   * To put events to subscriber queue
   * 
   * @param oid Object id
   * @param eventType type of events happened
   * @param context where the event happened
   * @param jsonFile Configuration file
   */
  public void onEvent(Map<String, String> param) throws MessagingException {
    JsonObject json = new JsonObject();
    String username = param.get("username");
    if (username == null) {
      username = "guest";
    }
    Set<String> keys = param.keySet();
    Iterator<String> iter = keys.iterator();
    while (iter.hasNext()) {
      String key = iter.next();
      if ("username".equals(key)) {
        json.put("user", username);
      } else {
        json.put(key, param.get(key));
      }
    }
    queueMessage(SUBSCRIBER_QUEUE, json.toString());
  }
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-common

return response.toString();
} catch (ClassNotFoundException ex) {
  log.error("Error retrieving user specification", ex);

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

messaging.queueMessage(broker, target, message.toString());
} else {
  messaging.queueMessage(target, message.toString());

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

messaging.queueMessage(target, message.toString());
  return true;
} catch (Exception ex) {

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Send AMQ Message to schedule indicated object is ready for transformation
 * and indexing.
 *
 * @param oid The Object ID to send.
 * @param config Item configuration for this object.
 */
private void queueHarvest(String oid, JsonSimple config) {
  // NOTE: The oid is being updated in memory here
  // (including in the cache)
  // This OK so long as this process remains single threaded
  // and only keys that are overwritten EVERY time are used;
  // like 'oid'.
  log.info("Sending oid: " + oid + " to the harvest queue");
  JsonObject json;
  try {
    json = new JsonSimple(config.toString(false)).getJsonObject();
  } catch (IOException e) {
    json = config.getJsonObject();
  }
  json.put("oid", oid);
  try {
    messaging.queueMessage(toolChainEntry, json.toString());
  } catch (Exception ex) {
    log.error("Failed sending OID '{}' to the harvest message queue!",
        oid);
    log.error("Error stacktrace: ", ex);
  }
  log.info("Finished sending oid: " + oid + " to the harvest queue");
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Send the notification out on the broadcast topic
 * 
 * @param oid Object id
 * @param status Status of the object
 * @param message Message to be sent
 */
private void sendNotification(String oid, String status, String message)
    throws JMSException {
  JsonObject jsonMessage = new JsonObject();
  jsonMessage.put("id", oid);
  jsonMessage.put("idType", "object");
  jsonMessage.put("status", status);
  jsonMessage.put("message", message);
  TextMessage msg = session.createTextMessage(jsonMessage.toString());
  // producer.send(broadcast, msg);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

transformers.get(target).transform(object, config.toString());
  return true;
} catch (TransformerException ex) {

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

sendUpdate(msgJson.toString());
} catch (JMSException ex) {
  log.error("Failed messaging House Keeping!", ex);

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Send the notification out on the broadcast topic
 * 
 * @param oid Object Id
 * @param status Status of the object
 * @param message Message to be sent
 */
private void sendNotification(String oid, String status, String message)
    throws JMSException {
  JsonObject jsonMessage = new JsonObject();
  jsonMessage.put("id", oid);
  jsonMessage.put("idType", "object");
  jsonMessage.put("status", status);
  jsonMessage.put("message", message);
  TextMessage msg = session.createTextMessage(jsonMessage.toString());
  // producer.send(broadcast, msg);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Send the notification out on the broadcast topic
 *
 * @param oid Object id
 * @param status Status of the object
 * @param message Message to be sent
 */
private void sendNotification(String oid, String status, String message)
    throws JMSException {
  JsonObject jsonMessage = new JsonObject();
  jsonMessage.put("id", oid);
  jsonMessage.put("idType", "object");
  jsonMessage.put("status", status);
  jsonMessage.put("message", message);
  TextMessage msg = session.createTextMessage(jsonMessage.toString());
  // producer.send(broadcast, msg);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Send the notification out on the broadcast topic
 * 
 * @param oid Object id
 * @param status Status of the object
 * @param message Message to be sent
 */
@SuppressWarnings("unused")
private void sendNotification(String oid, String status, String message)
    throws JMSException {
  JsonObject jsonMessage = new JsonObject();
  jsonMessage.put("id", oid);
  jsonMessage.put("idType", "object");
  jsonMessage.put("status", status);
  jsonMessage.put("message", message);
  TextMessage msg = session.createTextMessage(jsonMessage.toString());
  // producer.send(broadcast, msg);
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * To delete object processing from queue
 *
 * @param oid Object id
 * @param jsonFile Configuration file
 * @throws MessagingException if the message could not be sent
 */
private void queueDelete(String oid, File jsonFile)
    throws MessagingException {
  try {
    JsonObject json = new JsonSimple(jsonFile).getJsonObject();
    json.put("oid", oid);
    json.put("deleted", "true");
    messaging.queueMessage(toolChainEntry, json.toString());
  } catch (IOException ioe) {
    log.error("Failed to parse message: {}", ioe.getMessage());
    throw new MessagingException(ioe);
  }
}

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * To queue object to be processed
 *
 * @param oid Object id
 * @param jsonFile Configuration file
 * @param commit To commit each request to Queue (true) or not (false)
 * @param queueName Name of the queue to route to
 * @throws MessagingException if the message could not be sent
 */
private void queueHarvest(String oid, File jsonFile, boolean commit,
    String queueName) throws MessagingException {
  try {
    JsonObject json = new JsonSimple(jsonFile).getJsonObject();
    json.put("oid", oid);
    if (commit) {
      json.put("commit", "true");
    }
    messaging.queueMessage(queueName, json.toString());
  } catch (IOException ioe) {
    log.error("Failed to parse message: {}", ioe.getMessage());
    throw new MessagingException(ioe);
  }
}

代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-indexer-solr

/**
 * Add a new document into the buffer, and check if submission is required
 * 
 * @param document : The Solr document to add to the buffer.
 */
private void addToBuffer(String index, String document) {
  JsonObject message = new JsonObject();
  message.put("event", "index");
  message.put("index", index);
  message.put("document", document);
  sendToIndex(message.toString());
}

代码示例来源:origin: com.googlecode.redbox-mint/redbox-vital-subscriber

message.put("oid", oid);
message.put("commit", "true");
messaging.queueMessage("indexer", message.toString());

代码示例来源:origin: com.googlecode.the-fascinator/fascinator-core

/**
 * Update the harvest file in storage if required
 *
 * @param file The harvest file to store
 * @return DigitalObject The storage object with the file
 * @throws StorageException If storage failed
 */
private DigitalObject updateHarvestFile(File file) throws StorageException {
  // Check the file in storage
  DigitalObject object = StorageUtils.checkHarvestFile(storage, file);
  // log.info("=== Check harvest file: '{}'=> '{}'", file.getName(),
  // object);
  if (object != null) {
    // If we got an object back its new or updated
    JsonObject message = new JsonObject();
    message.put("type", "harvest-update");
    message.put("oid", object.getId());
    try {
      messaging.queueMessage("houseKeeping", message.toString());
    } catch (MessagingException ex) {
      log.error("Error sending message: ", ex);
    }
  } else {
    // Otherwise grab the existing object
    String oid = StorageUtils.generateOid(file);
    object = StorageUtils.getDigitalObject(storage, oid);
    // log.info("=== Try again: '{}'=> '{}'", file.getName(), object);
  }
  return object;
}

代码示例来源:origin: com.googlecode.redbox-mint/redbox-web-service

IOUtils.toInputStream(recordMetadata.toString(), "utf-8"));

相关文章