Package org.fudgemsg.mapping

Examples of org.fudgemsg.mapping.FudgeSerializer


    getProvider().add(getName(), msg);
  }

  @Override
  public void addBlacklistRule(final FunctionBlacklistRule rule, final int timeToLive) {
    final FudgeSerializer fsc = new FudgeSerializer(getProvider().getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    msg.add(DataManageableFunctionBlacklistResource.TTL_FIELD, null, FudgeWireType.LONG, timeToLive);
    fsc.addToMessage(msg, DataManageableFunctionBlacklistResource.RULE_FIELD, null, rule);
    getProvider().add(getName(), msg);
  }
View Full Code Here


    getProvider().add(getName(), msg);
  }

  @Override
  public void addBlacklistRules(final Collection<FunctionBlacklistRule> rules) {
    final FudgeSerializer fsc = new FudgeSerializer(getProvider().getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    for (FunctionBlacklistRule rule : rules) {
      fsc.addToMessage(msg, DataManageableFunctionBlacklistResource.RULE_FIELD, null, rule);
    }
    getProvider().add(getName(), msg);
  }
View Full Code Here

    getProvider().add(getName(), msg);
  }

  @Override
  public void addBlacklistRules(final Collection<FunctionBlacklistRule> rules, final int timeToLive) {
    final FudgeSerializer fsc = new FudgeSerializer(getProvider().getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    msg.add(DataManageableFunctionBlacklistResource.TTL_FIELD, null, FudgeWireType.LONG, timeToLive);
    for (FunctionBlacklistRule rule : rules) {
      fsc.addToMessage(msg, DataManageableFunctionBlacklistResource.RULE_FIELD, null, rule);
    }
    getProvider().add(getName(), msg);
  }
View Full Code Here

    getProvider().add(getName(), msg);
  }

  @Override
  public void removeBlacklistRule(final FunctionBlacklistRule rule) {
    final FudgeSerializer fsc = new FudgeSerializer(getProvider().getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    fsc.addToMessage(msg, DataManageableFunctionBlacklistResource.RULE_FIELD, null, rule);
    getProvider().remove(getName(), msg);
  }
View Full Code Here

    getProvider().remove(getName(), msg);
  }

  @Override
  public void removeBlacklistRules(final Collection<FunctionBlacklistRule> rules) {
    final FudgeSerializer fsc = new FudgeSerializer(getProvider().getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    for (FunctionBlacklistRule rule : rules) {
      fsc.addToMessage(msg, DataManageableFunctionBlacklistResource.RULE_FIELD, null, rule);
    }
    getProvider().remove(getName(), msg);
  }
View Full Code Here

          response = new CacheMessage();
        }
      }
      if (response != null) {
        response.setCorrelationId(request.getCorrelationId());
        final FudgeSerializer sctx = new FudgeSerializer(context);
        final MutableFudgeMsg responseMsg = sctx.objectToFudgeMsg(response);
        // We have only one response type for each request, so don't really need the headers
        // FudgeSerializer.addClassHeader(responseMsg, response.getClass(), CacheMessage.class);
        getConnection().getFudgeMessageSender().send(responseMsg);
      }
    }
View Full Code Here

    return _statistics;
  }

  private void sendMessage(final RemoteCalcNodeMessage message) {
    final FudgeMessageSender sender = getConnection().getFudgeMessageSender();
    final FudgeSerializer serializer = new FudgeSerializer(sender.getFudgeContext());
    final FudgeMsg msg = FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(message), message.getClass(), RemoteCalcNodeMessage.class);
    s_logger.debug("Sending message ({} fields) to {}", msg.getNumFields(), _connection);
    sender.send(msg);
  }
View Full Code Here

  private FunctionBlacklistMaintainer getBlacklistUpdate() {
    return _blacklistUpdate;
  }

  protected void sendMessage(final RemoteCalcNodeMessage message) {
    final FudgeSerializer serializer = new FudgeSerializer(getFudgeMessageSender().getFudgeContext());
    getFudgeMessageSender().send(FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(message), message.getClass(), RemoteCalcNodeMessage.class));
  }
View Full Code Here

  }

  @GET
  @Path("mod/{mod}")
  public Response info(@PathParam("mod") final int mod) {
    final FudgeSerializer fsc = new FudgeSerializer(getFudgeContext());
    final MutableFudgeMsg info = fsc.newMessage();
    final int modificationCount = getUnderlying().getModificationCount();
    if (modificationCount != mod) {
      info.add(MODIFICATION_COUNT_FIELD, modificationCount);
      final MutableFudgeMsg rules = info.addSubMessage(RULES_FIELD, null);
      for (FunctionBlacklistRule rule : getUnderlying().getRules()) {
        fsc.addToMessage(rules, null, null, rule);
      }
    }
    return responseOk(info);
  }
View Full Code Here

  }

  @Override
  public void ruleAdded(final int modificationCount, final FunctionBlacklistRule rule, final ExecutorService defer) {
    final FudgeSerializer fsc = new FudgeSerializer(getFudgeContext());
    final MutableFudgeMsg msg = fsc.newMessage();
    msg.add(MODIFICATION_COUNT_FIELD, modificationCount);
    final MutableFudgeMsg rulesMessage = msg.addSubMessage(RULES_ADDED_FIELD, null);
    fsc.addToMessage(rulesMessage, null, null, rule);
    defer.submit(new Publish(msg));
  }
View Full Code Here

TOP

Related Classes of org.fudgemsg.mapping.FudgeSerializer

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.