Examples of PendingCall


Examples of org.red5.server.service.PendingCall

  public void sendStatus(Status status) {
    if (connection != null) {
      final boolean andReturn = !status.getCode().equals(StatusCodes.NS_DATA_START);
      final Invoke event = new Invoke();
      if (andReturn) {
        final PendingCall call = new PendingCall(null, CALL_ON_STATUS, new Object[] { status });
        if (status.getCode().equals(StatusCodes.NS_PLAY_START)) {
          IScope scope = connection.getScope();
          if (scope.getContext().getApplicationContext().containsBean(IRtmpSampleAccess.BEAN_NAME)) {
            IRtmpSampleAccess sampleAccess = (IRtmpSampleAccess) scope.getContext().getApplicationContext().getBean(IRtmpSampleAccess.BEAN_NAME);
            boolean videoAccess = sampleAccess.isVideoAllowed(scope);
View Full Code Here

Examples of org.red5.server.service.PendingCall

          //if the conversion fails and the endpoint is not a ServiceAdapter
          //just drop the object directly into an array
          args = new Object[]{msg.body};
        }
       
        IPendingServiceCall call = new PendingCall(operation, args);
        try {
          if (!serviceInvoker.invoke(call, endpoint)) {
            if (call.getException() != null) {
              // Use regular exception handling
              Throwable err = call.getException();
              return returnError(msg, "Server.Invoke.Error", err.getMessage(), err);
            }
            return returnError(msg, "Server.Invoke.Error", "Can't invoke method.", "");
          }
        } catch (Throwable err) {
          log.error("Error while invoking method.", err);
          return returnError(msg, "Server.Invoke.Error", err.getMessage(), err);
        }
   
        //we got a valid result from the method call.
        result.body = call.getResult();
    }
   
    return result;
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

//    resp.getWriter().write(message);
//    resp.flushBuffer();
   
    // create and send a rejected status
    Status status = new Status(StatusCodes.NC_CONNECT_REJECTED, Status.ERROR, message);
    PendingCall call = new PendingCall(null, "onStatus", new Object[] { status });
    Invoke event = new Invoke();
    event.setCall(call);
    Header header = new Header();
    Packet packet = new Packet(header, event);
    header.setDataType(event.getDataType());
View Full Code Here

Examples of org.red5.server.service.PendingCall

    invoke(method, null, callback);
  }

  /** {@inheritDoc} */
  public void invoke(String method, Object[] params, IPendingServiceCallback callback) {
    IPendingServiceCall call = new PendingCall(method, params);
    if (callback != null) {
      call.registerCallback(callback);
    }
    invoke(call);
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

      String serviceMethod = (dotIndex == -1) ? action : action.substring(dotIndex + 1, action.length());
      // pull off the prefixes since java doesn't allow this on a method name
      if (serviceMethod.startsWith("@") || serviceMethod.startsWith("|")) {
        serviceMethod = serviceMethod.substring(1);
      }
      PendingCall call = new PendingCall(serviceName, serviceMethod, params);
      invoke.setCall(call);
      return invoke;
    } else {
      //TODO replace this with something better as time permits
      throw new RuntimeException("Action was null");
View Full Code Here

Examples of org.red5.server.service.PendingCall

    }
    final int dotIndex = action.lastIndexOf('.');
    String serviceName = (dotIndex == -1) ? null : action.substring(0, dotIndex);
    String serviceMethod = (dotIndex == -1) ? action : action.substring(dotIndex + 1, action.length());
    log.debug("Service name: {} method: {}", serviceName, serviceMethod);
    PendingCall call = new PendingCall(serviceName, serviceMethod, params);
    msg.setCall(call);
    return msg;
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

  @Test
  public void simpletest() {
    if (context.hasBean("echoService")) {
        EchoService service = (EchoService) context.getBean("echoService");
        IPendingServiceCall call = new PendingCall("echoService", "echoString",
            new Object[] { "My String" });
        context.getServiceInvoker().invoke(call, service);
        assertTrue("result null", call.getResult() != null);
    } else {
      System.out.println("No echo service found");
      assertTrue(false);
    }
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

  @Override
  public void invoke(String name, Object[] params, IPendingServiceCallback callback) {
    if ("echo".equals(name)) {
      echo(params);
    }   
    IPendingServiceCall call = new PendingCall(null, name, params);
    call.setResult(Boolean.TRUE);
    callback.resultReceived(call);
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

  }

  /** {@inheritDoc} */
  public void invoke(String method, Object[] params,
      IPendingServiceCallback callback) {
    IPendingServiceCall call = new PendingCall(method, params);
    if (callback != null) {
      call.registerCallback(callback);
    }
    invoke(call);
  }
View Full Code Here

Examples of org.red5.server.service.PendingCall

    params.put("fpad", false);
    params.put("audioCodecs",(double)615);
    params.put("videoCodecs",(double)76);
    params.put("pageUrl","http://localhost/test.html");
    params.put("objectEncoding",(double)0);
    PendingCall pendingCall=new PendingCall("connect");
    Invoke invoke=new Invoke(pendingCall);
    invoke.setConnectionParams(params);
    invoke.setInvokeId(1);
    channel.write(invoke);
  }
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.