Package org.fudgemsg.mapping

Examples of org.fudgemsg.mapping.FudgeDeserializer


    FudgeContext context = OpenGammaFudgeContext.getInstance();
    FudgeMsg message = context.createMessageReader(new ByteArrayInputStream(msg)).nextMessage();
    if (message == null) {
      return null;
    }
    FudgeDeserializer deser = new FudgeDeserializer(context);
    return deser.fudgeMsgToObject(type, message);
  }
View Full Code Here


      List<String> values = entry.getValue();
      for (String value : values) {
        decode(msg, key, value);
      }
    }
    FudgeDeserializer deser = new FudgeDeserializer(context);
    return deser.fudgeMsgToObject(type, msg);
  }
View Full Code Here

   */
  public static Tutorial1Security fromRawSecurity(final RawSecurity raw) {
    ArgumentChecker.isTrue(isInstance(raw), "raw");
    final FudgeContext context = OpenGammaFudgeContext.getInstance();
    final FudgeMsg fudgeMsg = context.deserialize(raw.getRawData()).getMessage();
    final FudgeDeserializer deserializer = new FudgeDeserializer(context);
    return new Tutorial1Security(raw, deserializer, fudgeMsg);
  }
View Full Code Here

        CurrencyPair.parse("GBP/USD"),
        CurrencyPair.parse("USD/CAD")));
    CurrencyPairsFudgeBuilder builder = new CurrencyPairsFudgeBuilder();
    MutableFudgeMsg msg = builder.buildMessage(new FudgeSerializer(FudgeContext.GLOBAL_DEFAULT), pairs1);
    AssertJUnit.assertNotNull(msg);
    CurrencyPairs pairs2 = builder.buildObject(new FudgeDeserializer(FudgeContext.GLOBAL_DEFAULT), msg);
    AssertJUnit.assertEquals(pairs1, pairs2);
  }
View Full Code Here

  private static final FudgeContext s_fudgeContext = OpenGammaFudgeContext.getInstance();

  protected <E> E fromJSON(Class<E> clazz, String json) {
    FudgeMsg fudgeMsg = toFudgeMsg(json);
    return new FudgeDeserializer(s_fudgeContext).fudgeMsgToObject(clazz, fudgeMsg);
  }
View Full Code Here

    FudgeMsgJSONReader fudgeJSONReader = new FudgeMsgJSONReader(getFudgeContext(), new StringReader(json));
   
    FudgeMsg fudgeMsg = fudgeJSONReader.readMessage();
    s_logger.debug("converted FudgeMsg: " + fudgeMsg);
   
    return new FudgeDeserializer(getFudgeContext()).fudgeMsgToObject(fudgeMsg);
   
  }
View Full Code Here

  public HistoricalTimeSeriesResolutionResult resolve(final ExternalIdBundle identifierBundle, final LocalDate identifierValidityDate,
      final String dataSource, final String dataProvider, final String dataField, final String resolutionKey) {
    ArgumentChecker.notNull(identifierBundle, "identifierBundle");
    ArgumentChecker.notNull(dataField, "dataField");
    try {
      final FudgeDeserializer fdc = new FudgeDeserializer(getFudgeContext());
      final UriBuilder uri = UriBuilder.fromUri(getBaseUri()).path("resolve");
      for (ExternalId id : identifierBundle) {
        uri.segment("id", id.toString());
      }
      if (identifierValidityDate != null) {
        uri.segment("identifierValidityDate", identifierValidityDate.toString());
      }
      if (dataSource != null) {
        uri.segment("dataSource", dataSource);
      }
      if (dataProvider != null) {
        uri.segment("dataProvider", dataProvider);
      }
      if (dataField != null) {
        uri.segment("dataField", dataField);
      }
      if (resolutionKey != null) {
        uri.segment("resolutionKey", resolutionKey);
      }
      final URI req = uri.build();
      final FudgeMsg response = accessRemote(req).get(FudgeMsg.class);
      final String adjustment = response.getString("adjustment");
      return new HistoricalTimeSeriesResolutionResult(
          fdc.fieldValueToObject(ManageableHistoricalTimeSeriesInfo.class, response.getByName("info")),
          (adjustment != null) ? new Adjuster(req, identifierBundle, adjustment) : null);
    } catch (UniformInterfaceException404NotFound e) {
      return null;
    }
  }
View Full Code Here

  /**
   * @param nextTick
   *
   */
  private void playNextTick() {
    FudgeDeserializer deserializer = new FudgeDeserializer(OpenGammaFudgeContext.getInstance());
    switch (_mode) {
      case ORIGINAL_LATENCY:
        BloombergTick currentTick = null;;
        try {
          FudgeMsg msg = _ticksQueue.take();
View Full Code Here

    FudgeSerializer serializationContext = new FudgeSerializer(s_fudgeContext);
    MutableFudgeMsg inputMsg = serializationContext.objectToFudgeMsg(inDefinition);
    FudgeMsg outputMsg = s_fudgeContext.deserialize(s_fudgeContext.toByteArray(inputMsg)).getMessage();
    assertNotNull(outputMsg);
   
    FudgeDeserializer deserializationContext = new FudgeDeserializer(s_fudgeContext);
    BloombergSecurityTypeDefinition outDefinition = deserializationContext.fudgeMsgToObject(BloombergSecurityTypeDefinition.class, outputMsg);
   
    assertEquals(inDefinition, outDefinition);
  }
View Full Code Here

  @Override
  public byte[] requestReceived(byte[] message) {
    FudgeMsgEnvelope requestEnvelope = _fudgeContext.deserialize(message);
    FudgeMsg requestFudgeMsg = requestEnvelope.getMessage();
    SecurityMasterRequestMessage secMasterRequest = SecurityMasterRequestMessage.fromFudgeMsg(new FudgeDeserializer(_fudgeContext), requestFudgeMsg);
    MessageType messageType = secMasterRequest.getMessageType();
    String secDes = secMasterRequest.getUniqueId() != null ? secMasterRequest.getUniqueId().getValue() : secMasterRequest.getSecKey().toString();
    s_logger.debug("Received {} request for {} ", new Object[] {secMasterRequest.getMessageType(), secDes });
    Security sec = null;
    SecurityMasterResponseMessage responseMessage = new SecurityMasterResponseMessage();
View Full Code Here

TOP

Related Classes of org.fudgemsg.mapping.FudgeDeserializer

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.