Package com.betfair.cougar.core.api.exception

Examples of com.betfair.cougar.core.api.exception.CougarServiceException


    }

    public ExecutionResult(Object result) {
        if (result instanceof CougarApplicationException) {
            this.resultType = ResultType.Fault;
            fault = new CougarServiceException(ServerFaultCode.ServiceCheckedException, "", (CougarApplicationException)result);
        } else if (result instanceof CougarException) {
            this.resultType = ResultType.Fault;
            fault = (CougarException)result;
        } else if (result instanceof Subscription) {
            this.resultType = ResultType.Subscription;
View Full Code Here


    public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) {
        if (key.getType() == OperationKey.Type.Request) {
            GeoLocationDetails geoDetails = ctx.getLocation();
            if (geoDetails == null) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "Geo location details were not provided"));
            } else if (banList.contains(geoDetails.getResolvedAddresses().get(0))) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "The IP Address [" + geoDetails.getRemoteAddr() + "] is not permitted to access to this service"));
            }
        }
        return new InterceptorResult(InterceptorState.CONTINUE);
    }
View Full Code Here

  }

    @KPITimedEvent(value = "Baseline.service.testNamedCougarException", catchFailures = true)
    @Override
    public SimpleResponse testNamedCougarException(RequestContext ctx, String errorCodeName, TimeConstraints timeConstraints) {
        throw new CougarServiceException(ServerFaultCode.valueOf(errorCodeName), "Test throwing an exception with error code: "+errorCodeName);
    }
View Full Code Here

        else if (protocol == TestConnectedObjectsProtocolEnum.SOCKET) {
            client = socketSyncClient;
        }
        else {
            // implement other protocols when we have the transports
            throw new CougarServiceException(ServerFaultCode.FrameworkError, "Unsupported protocol: "+protocol);
        }

        return ConnectedObjectTestingUtils.testConnectedObjects(ctx, client, protocol);
    }
View Full Code Here

  }

    @KPITimedEvent(value = "Baseline.service.testNamedCougarException", catchFailures = true)
    @Override
    public SimpleResponse testNamedCougarException(RequestContext ctx, String errorCodeName, TimeConstraints timeConstraints) {
        throw new CougarServiceException(ServerFaultCode.valueOf(errorCodeName), "Test throwing an exception with error code: "+errorCodeName);
    }
View Full Code Here

        else if (protocol == TestConnectedObjectsProtocolEnum.SOCKET) {
            client = socketSyncClient;
        }
        else {
            // implement other protocols when we have the transports
            throw new CougarServiceException(ServerFaultCode.FrameworkError, "Unsupported protocol: "+protocol);
        }

        return ConnectedObjectTestingUtils.testConnectedObjects(ctx, client, protocol);
    }
View Full Code Here

    public InterceptorResult invoke(ExecutionContext ctx, OperationKey key, Object[] args) {
        if (key.getType() == OperationKey.Type.Request) {
            GeoLocationDetails geoDetails = ctx.getLocation();
            if (geoDetails == null) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "Geo location details were not provided"));
            } else if (banList.contains(geoDetails.getResolvedAddresses().get(0))) {
                return new InterceptorResult(InterceptorState.FORCE_ON_EXCEPTION,
                        new CougarServiceException(ServerFaultCode.SecurityException, "The IP Address [" + geoDetails.getRemoteAddr() + "] is not permitted to access to this service"));
            }
        }
        return new InterceptorResult(InterceptorState.CONTINUE);
    }
View Full Code Here

        ServerFaultCode code = (ServerFaultCode)in.readObject();
        FaultDetail faultDetail = (FaultDetail) in.readObject();
        if (faultDetail != null) {
                  if (faultDetail.getCause() != null) {
                      if (faultDetail.getCause() instanceof CougarApplicationException) {
                          return new InvocationResponseImpl(null, new CougarServiceException(code, faultDetail.getDetailMessage(), (CougarApplicationException)faultDetail.getCause()));
                      } else {
                          return new InvocationResponseImpl(null, new CougarServiceException(code, faultDetail.getDetailMessage(), faultDetail.getCause()));
                      }
                  }
                  else {
                        FaultCode faultCode = code == ServerFaultCode.ServiceCheckedException ? FaultCode.Server : code.getResponseCode().getFaultCode();
                      return new InvocationResponseImpl(null, new CougarServiceException(code, faultCode + " fault received from remote server: "+code,
                                new CougarServiceException(code, faultDetail.getDetailMessage())
                        ));
                  }
        }
              else {
            return new InvocationResponseImpl(null, new CougarServiceException(code, "No detailed message available"));
              }
      }
    }
    catch (ClassNotFoundException e) {
      throw new TranscriptionException(e);
View Full Code Here

                   observer,
                   timeConstraints);

        if (!observer.await(timeConstraints)) {
            // todo: we should really make this a client exception
            throw new CougarServiceException(ServerFaultCode.Timeout, "Operation echoCougarPropertyValue timed out!");
        }

        final ExecutionResult er = observer.getExecutionResult();
        switch (er.getResultType()) {
            case Success:
View Full Code Here

                   observer,
                   timeConstraints);

        if (!observer.await(timeConstraints)) {
            // todo: we should really make this a client exception
            throw new CougarServiceException(ServerFaultCode.Timeout, "Operation mandatoryCollectionElementTest timed out!");
        }

        final ExecutionResult er = observer.getExecutionResult();
        switch (er.getResultType()) {
            case Success:
View Full Code Here

TOP

Related Classes of com.betfair.cougar.core.api.exception.CougarServiceException

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.