Package org.coweb.oe

Examples of org.coweb.oe.ContextVector


  public void localSync(String topic, Object value,
      String type, int position) {

    /* Construct op, send it, then process it in the op engine. */
    String jsonValue = JSON.toString(value);
    ContextVector cv = null;
    Operation op = null;
    if (null != type) {
      try {
        op = this.engine.createOp(true, topic, jsonValue, type,
            position, -1, null, -1);
        cv = op.getContextVector();
      } catch (OperationEngineException e) {
        log.warning("Bad type: " + type + ", using null type instead.");
        type = null;
      }
    }

    Map<String, Object> message = new HashMap<String, Object>();
    message.put("topic", topic);
    message.put("value", jsonValue);
    message.put("type", type);
    message.put("position", position);
    if (null != cv) {
      int[] sites = cv.getSites();
      if (null != sites) {
        Integer[] Sites = new Integer[sites.length];
        for (int i = 0; i < sites.length; ++i)
          Sites[i] = sites[i];
        message.put("context", Sites);
View Full Code Here


    public void run() {
      if(!shouldSync || engine == null)
        return;
     
      try {
        ContextVector cv = engine.copyContextVector();
        /* Must convert to Integer[] from int[], because the receiver of this
           message expects Integer[]. */
        int cnt = 0;
        int[] sites = cv.getSites();
        Integer[] arr = new Integer[sites.length];
        for (int i: sites) {
          arr[cnt] = i;
          ++cnt;
        }
View Full Code Here

TOP

Related Classes of org.coweb.oe.ContextVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.