Package com.betfair.baseline.v2

Examples of com.betfair.baseline.v2.BaselineSyncClientImpl


    public IdentChain testIdentityChain(RequestContext ctx, TimeConstraints timeConstraints) throws SimpleException {
        ctx.setRequestLogExtension(new BaselineLogExtension(null, null, null));
        if (ctx.getIdentity() == null) {
            return null;
        }
        IdentChain result = new IdentChain();
        result.setIdentities(new ArrayList<Ident>());
        for (Identity i: ctx.getIdentity().getIdentities()) {
            Ident ident = new Ident();
            ident.setPrincipal(i.getPrincipal().getName());
            ident.setCredentialName(i.getCredential().getName());
            ident.setCredentialValue((String)i.getCredential().getValue());
            result.getIdentities().add(ident);
        }
        return result;
    }
View Full Code Here


    @KPITimedEvent(value = "Baseline.service.testLargeGet", catchFailures = true)
    @Override
    public LargeRequest testLargeGet(RequestContext ctx, Integer size, TimeConstraints timeConstraints) throws SimpleException {
        ctx.trace("Starting large get for array of size %d", size);
        ctx.setRequestLogExtension(new BaselineLogExtension(size, null, null));
        LargeRequest result = new LargeRequest();
        result.setObjects(new ArrayList<ComplexObject>());
        result.setSize(size);
        result.setOddOrEven(size % 2 == 0 ? LargeRequestOddOrEvenEnum.EVEN : LargeRequestOddOrEvenEnum.ODD);
        for (int i = 0; i < size; i++) {
            ComplexObject o = new ComplexObject();
            o.setName("name " + i);
            o.setValue1(i);
            o.setValue2(i + 1);
            result.getObjects().add(o);
        }
        return result;
    }
View Full Code Here

    public void emitLogMessage(RequestContext ctx, String logString, String logLevel, Long timeStamp, TimeConstraints timeConstraints) throws SimpleException {
        // Set the request log extension using the operation params
      ctx.setRequestLogExtension(new BaselineLogExtension(logString, null, null));
      // Construct an instance of the event to be emitted
      LogMessage lm = new LogMessage();
        LogMessageContainer body = new LogMessageContainer();
        lm.setBody(body);
        // Add the neccessary parameters
      body.setLogString(logString);
      body.setLogLevel(logLevel);
      body.setTimeStamp(timeStamp);
      try {
            // Create a new global execution observer variable for each event and call OnResult() passing the event instance just created
          logMessageObserver.onResult(new ExecutionResult(lm));
      } catch (Throwable ex) {
          LOGGER.log(Level.SEVERE, "An exception occurred emitting the inputted message event:", ex);
View Full Code Here

  public MandatoryParamsOperationResponseObject mandatoryParamsOperation(RequestContext ctx, String headerParam,
      String queryParam, MandatoryParamsRequest message, TimeConstraints timeConstraints) throws SimpleException {

    ctx.setRequestLogExtension(new BaselineLogExtension(message, null, null));

    MandatoryParamsOperationResponseObject returnObject = new MandatoryParamsOperationResponseObject();

    returnObject.setHeaderParameter(headerParam);
    returnObject.setQueryParameter(queryParam);
    returnObject.setBodyParameter1(message.getBodyParameter1());
    if (message.getBodyParameter2() != null) {
      returnObject.setBodyParameter2(message.getBodyParameter2());
    }

    return returnObject;

  }
View Full Code Here

    @KPITimedEvent(value = "Baseline.service.testLargeMapGet", catchFailures = true)
    @Override
    public MapDataType testLargeMapGet(RequestContext ctx, Integer size, TimeConstraints timeConstraints) throws SimpleException {
        ctx.setRequestLogExtension(new BaselineLogExtension(size, null, null));
        MapDataType result = new MapDataType();
        result.setCache(new HashMap<Integer, ComplexObject>());
        result.setSomeMap(new HashMap<String, ComplexObject>());
        for (int i = 0; i < size; i++) {
            ComplexObject o = new ComplexObject();
            o.setName("name " + i);
            o.setValue1(i);
            o.setValue2(i + 1);
            result.getCache().put(i, o);
            result.getSomeMap().put(String.valueOf(i), o);
        }

        return result;
    }
View Full Code Here

    for (Date key : requestMap.keySet()) {
      responseMap.put(key, requestMap.get(key));
    }

    MapDateTimeKeyOperationResponseObject responseObject = new MapDateTimeKeyOperationResponseObject();
    responseObject.setResponseMap(responseMap);

    return responseObject;
  }
View Full Code Here

        ctx.trace("Starting simple get for matched bet between accounts [ " + bet.getAccount1() + ", " + bet.getAccount2() + "]");

        ctx.setRequestLogExtension(new BaselineLogExtension(bet, null, null));

        MatchedBet matchedBet = new MatchedBet();
        MatchedBetContainer body = new MatchedBetContainer();
        matchedBet.setBody(body);
        body.setMatchedBet(bet);
        body.setMarket(market);

        try {
            matchedBetObserver.onResult(new ExecutionResult(matchedBet));
        } catch (Throwable ex) {
          LOGGER.log(Level.SEVERE, "An exception occurred emitting the matched bet event:", ex);
View Full Code Here

    @KPITimedEvent(value = "Baseline.service.testNoParams", catchFailures = true)
    @Override
    public NoParamsResponse testNoParams(RequestContext ctx, TimeConstraints timeConstraints) throws SimpleException {
        ctx.setRequestLogExtension(new BaselineLogExtension(null, null, null));
        NoParamsResponse response = new NoParamsResponse();
        response.setStatus("hello");
        response.setVersion("1.0.0");
        return response;
    }
View Full Code Here

  public NonMandatoryParamsOperationResponseObject nonMandatoryParamsOperation(RequestContext ctx, String headerParam,
      String queryParam, NonMandatoryParamsRequest message, TimeConstraints timeConstraints) throws SimpleException {

    ctx.setRequestLogExtension(new BaselineLogExtension(message, null, null));

    NonMandatoryParamsOperationResponseObject returnObject = new NonMandatoryParamsOperationResponseObject();

    /*
     *
     * Path paramters must always be passed regardless of mandatory flag in IDL so assume passed
     */
    if (headerParam != null) {
      returnObject.setHeaderParameter(headerParam);
    }
    else {
      returnObject.setHeaderParameter(null);
    }
    if (queryParam != null) {
      returnObject.setQueryParameter(queryParam);
    }
    if ((message != null) && (message.getBodyParameter1() != null)) {
      returnObject.setBodyParameter1(message.getBodyParameter1());
    }
    if ((message != null) && (message.getBodyParameter2() != null)) {
      returnObject.setBodyParameter2(message.getBodyParameter2());
    }

    return returnObject;
  }
View Full Code Here

      queryParamsBuff.append(entry);
    }
    String queryParamEntries = queryParamsBuff.toString();
    queryParamEntries = queryParamEntries.substring(0, queryParamEntries.length() - 1);

    NonMandatoryParamsOperationResponseObject responseObject = new NonMandatoryParamsOperationResponseObject();
    responseObject.setHeaderParameter(headerParamEntries);
    responseObject.setQueryParameter(queryParamEntries);

    return responseObject;
  }
View Full Code Here

TOP

Related Classes of com.betfair.baseline.v2.BaselineSyncClientImpl

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.