Examples of FudgeMsgEnvelope


Examples of org.fudgemsg.FudgeMsgEnvelope

  @Path("debugInfo")
  public FudgeMsgEnvelope getDebugInfo() {
    final MutableFudgeMsg message = OpenGammaFudgeContext.getInstance().newMessage();
    message.add("fudgeContext", OpenGammaFudgeContext.getInstance().toString());
    message.add("securitySource", getSecuritySource().toString());
    return new FudgeMsgEnvelope(message);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

      if (nChecks > 20) {
        fail("Didn't receive messages in 2 seconds");
      }
    }
   
    FudgeMsgEnvelope envelope = null;
    envelope = collectingReceiver.getMessages().get(0);
    assertNotNull(envelope);
    assertNotNull(envelope.getMessage());
    Long firstTimestamp = envelope.getMessage().getLong("TheTime");
    assertNotNull(firstTimestamp);
    assertEquals(1, envelope.getMessage().getNumFields());

    envelope = collectingReceiver.getMessages().get(1);
    assertNotNull(envelope);
    assertNotNull(envelope.getMessage());
    Long secondTimestamp = envelope.getMessage().getLong("TheTime");
    assertNotNull(firstTimestamp);
    assertEquals(1, envelope.getMessage().getNumFields());
   
    assertTrue(secondTimestamp > firstTimestamp);
   
    sender.stop();
    requestDispatcher.stop();
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

    // set the uniqueId (needs to go in Fudge message)
    final UniqueId uniqueId = createUniqueId(docOid, docId);
    exchange.setUniqueId(uniqueId);
    document.setUniqueId(uniqueId);
    // the arguments for inserting into the exchange table
    FudgeMsgEnvelope env = FUDGE_CONTEXT.toFudgeMsg(exchange);
    byte[] bytes = FUDGE_CONTEXT.toByteArray(env.getMessage());
    final DbMapSqlParameterSource docArgs = new DbMapSqlParameterSource()
      .addValue("doc_id", docId)
      .addValue("doc_oid", docOid)
      .addTimestamp("ver_from_instant", document.getVersionFromInstant())
      .addTimestampNullFuture("ver_to_instant", document.getVersionToInstant())
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

  @Test
  public void build() {

    when(_provider.getTrace(_resource.getProperties())).thenReturn(_sampleResult);

    FudgeMsgEnvelope result = _resource.build();

    verify(_provider).getTrace(_resource.getProperties());
    assertNotNull(result);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

      Inner wrapper = (Inner) in.readObject();
      byte[] bytes = wrapper._data;
      if (bytes == null) {
        _fieldData = null;
      } else {
        FudgeMsgEnvelope envelope = OpenGammaFudgeContext.getInstance().deserialize(bytes);
        _fieldData = envelope.getMessage();
      }
    }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

  @Override
  public void addJSON(Appendable buffer) {
    StringWriter stringWriter = new StringWriter();
    FudgeStreamWriter fudgeWriter = new FudgeJSONStreamWriter(_fudgeContext, stringWriter);
    FudgeMsgEnvelope msg = _fudgeContext.toFudgeMsg(_value);
    fudgeWriter.writeFields(msg.getMessage());
    fudgeWriter.flush();
    fudgeWriter.close();
    try {
      buffer.append(stringWriter.toString());
    } catch (IOException ex) {
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

   * @param taxonomyId  identifier of the taxonomy to use. If the taxonomy is recognized by the {@link FudgeContext} it will be used to reduce field names to ordinals where possible.
   * @param version  schema version
   * @param processingDirectives  processing directive flags
   */
  public void writeMessage(final FudgeMsg message, final int taxonomyId, final int version, final int processingDirectives) {
    writeMessageEnvelope(new FudgeMsgEnvelope(message, version, processingDirectives), taxonomyId);
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

   
  }

  protected String createXML(ConfigDocument doc) {
    // get xml and pretty print it
    FudgeMsgEnvelope msg = getFudgeContext().toFudgeMsg(doc.getConfig().getValue());
    s_logger.debug("config doc {} converted to fudge {}", doc.getUniqueId(), msg);
    StringWriter buf = new StringWriter(1024)
    @SuppressWarnings("resource")
    FudgeMsgWriter writer = new FudgeMsgWriter(new FudgeXMLStreamWriter(getFudgeContext(), buf));
    writer.writeMessageEnvelope(msg);
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

      FinancialSecurity financialSec = (FinancialSecurity) security;
      financialSec.accept(new SecurityTemplateModelObjectBuilder(out, data().getSecurityMaster(), data().getOrganizationMaster()));
    } else {
      if (security.getSecurityType().equals(SecurityEntryData.EXTERNAL_SENSITIVITIES_SECURITY_TYPE)) {
        RawSecurity rawSecurity = (RawSecurity) security;
        FudgeMsgEnvelope msg = OpenGammaFudgeContext.getInstance().deserialize(rawSecurity.getRawData());
        SecurityEntryData securityEntryData = OpenGammaFudgeContext.getInstance().fromFudgeMsg(SecurityEntryData.class, msg.getMessage());

        out.put("securityEntryData", securityEntryData);
        RawSecurity underlyingRawSecurity = (RawSecurity) getSecurity(securityEntryData.getFactorSetId(), data().getSecurityMaster());
        if (underlyingRawSecurity != null) {
          FudgeMsgEnvelope factorIdMsg = OpenGammaFudgeContext.getInstance().deserialize(underlyingRawSecurity.getRawData());
          @SuppressWarnings("unchecked")
          List<FactorExposureData> factorExposureDataList = OpenGammaFudgeContext.getInstance().fromFudgeMsg(List.class, factorIdMsg.getMessage());
          s_logger.error(factorExposureDataList.toString());
          List<FactorExposure> factorExposuresList = convertToFactorExposure(factorExposureDataList);
          out.put("factorExposuresList", factorExposuresList);
        } else {
          s_logger.error("Couldn't find security");
        }

      }
      if (security.getSecurityType().equals(FactorExposureData.EXTERNAL_SENSITIVITIES_RISK_FACTORS_SECURITY_TYPE)) {
        RawSecurity rawSecurity = (RawSecurity) security;
        FudgeMsgEnvelope msg = OpenGammaFudgeContext.getInstance().deserialize(rawSecurity.getRawData());
        @SuppressWarnings("unchecked")
        List<FactorExposureData> factorExposureDataList = OpenGammaFudgeContext.getInstance().fromFudgeMsg(List.class, msg.getMessage());
        List<FactorExposure> factorExposuresList = convertToFactorExposure(factorExposureDataList);
        out.put("factorExposuresList", factorExposuresList);
      }
    }
  }
View Full Code Here

Examples of org.fudgemsg.FudgeMsgEnvelope

   * Reads the next message, discarding the envelope.
   *
   * @return the message read without the envelope
   */
  public FudgeMsg readMessage() {
    final FudgeMsgEnvelope msgEnv = readMessageEnvelope();
    if (msgEnv == null) {
      return null;
    }
    return msgEnv.getMessage();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.