Package org.red5.server.api.service

Examples of org.red5.server.api.service.IServiceCall


          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = ScopeApplicationAdapter.getInstance()
              .getRoomScope(scopeName);
          ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
              currentScope);

          HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here


        String scopeName = "hibernate";
        if (rcl.getRoom_id() != null) {
          scopeName = rcl.getRoom_id().toString();
        }
        IScope currentScope = ScopeApplicationAdapter.getInstance()
            .getRoomScope(scopeName);
        ScopeApplicationAdapter.getInstance().roomLeaveByScope(rcl,
            currentScope);

        HashMap<Integer, String> messageObj = new HashMap<Integer, String>();
View Full Code Here

         }
         String scopeName = "hibernate";
         if (rcl.getRoom_id() != null) {
           scopeName = rcl.getRoom_id().toString();
         }
         IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         this.scopeApplicationAdapter.roomLeaveByScope(rcl, currentScope);
        
        
         HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
         messageObj.put(0, "kick");
View Full Code Here

          }
          String scopeName = "hibernate";
          if (rcl.getRoom_id() != null) {
            scopeName = rcl.getRoom_id().toString();
          }
          IScope currentScope = this.scopeApplicationAdapter.getRoomScope(scopeName);
         
          HashMap<Integer,String> messageObj = new HashMap<Integer,String>();
          messageObj.put(0, "kick");
         
          this.scopeApplicationAdapter.sendMessageById(messageObj, rcl.getStreamid(), currentScope);
View Full Code Here

    // ------------------------------------------------------------------------

    private void createPlayStream( IPendingServiceCallback callback ) {

        logger.debug( "create play stream" );
        IPendingServiceCallback wrapper = new CreatePlayStreamCallBack( callback );
        invoke( "createStream", null, wrapper );
    }
View Full Code Here

   * @param command Command event
   */
  protected void encodeCommand(IoBuffer out, ICommand command) {
    // TODO: tidy up here
    Output output = new org.red5.io.amf.Output(out);
    final IServiceCall call = command.getCall();
    final boolean isPending = (call.getStatus() == Call.STATUS_PENDING);
    log.debug("Call: {} pending: {}", call, isPending);
    if (!isPending) {
      log.debug("Call has been executed, send result");
      Serializer.serialize(output, call.isSuccess() ? "_result" : "_error");
    } else {
      log.debug("This is a pending call, send request");
      final String action = (call.getServiceName() == null) ? call.getServiceMethodName() : call.getServiceName() + '.' + call.getServiceMethodName();
      Serializer.serialize(output, action); // seems right
    }
    if (command instanceof Invoke) {
      Serializer.serialize(output, Integer.valueOf(command.getTransactionId()));
      Serializer.serialize(output, command.getConnectionParams());
    }
    if (call.getServiceName() == null && "connect".equals(call.getServiceMethodName())) {
      // response to initial connect, always use AMF0
      output = new org.red5.io.amf.Output(out);
    } else {
      if (Red5.getConnectionLocal().getEncoding() == Encoding.AMF3) {
        output = new org.red5.io.amf3.Output(out);
      } else {
        output = new org.red5.io.amf.Output(out);
      }
    }
    if (!isPending && (command instanceof Invoke)) {
      IPendingServiceCall pendingCall = (IPendingServiceCall) call;
      if (!call.isSuccess()) {
        log.debug("Call was not successful");
        StatusObject status = generateErrorResult(StatusCodes.NC_CALL_FAILED, call.getException());
        pendingCall.setResult(status);
      }
      Object res = pendingCall.getResult();
      log.debug("Writing result: {}", res);
      Serializer.serialize(output, res);
    } else {
      log.debug("Writing params");
      final Object[] args = call.getArguments();
      if (args != null) {
        for (Object element : args) {
          if (element instanceof ByteBuffer) {
            // a byte buffer indicates that serialization is already complete, send raw
            final ByteBuffer buf = (ByteBuffer) element;
View Full Code Here

   *            Connection
   * @param invoke
   *            Pending call result event context
   */
  protected void handlePendingCallResult(RTMPConnection conn, Invoke invoke) {
    final IServiceCall call = invoke.getCall();
    final IPendingServiceCall pendingCall = conn.retrievePendingCall(invoke.getTransactionId());
    if (pendingCall != null) {
      // The client sent a response to a previously made call.
      Object[] args = call.getArguments();
      if (args != null && args.length > 0) {
        // TODO: can a client return multiple results?
        pendingCall.setResult(args[0]);
      }
      Set<IPendingServiceCallback> callbacks = pendingCall.getCallbacks();
View Full Code Here

    notify(method, null);
  }

  /** {@inheritDoc} */
  public void notify(String method, Object[] params) {
    IServiceCall call = new Call(method, params);
    notify(call);
  }
View Full Code Here

public class RTMPTProtocolEncoder extends RTMPProtocolEncoder {

  @Override
  protected void encodeCommand(IoBuffer out, ICommand command) {
    // if we get an InsufficientBW message for the client, we'll reduce the base tolerance and set drop live to true
    final IServiceCall call = command.getCall();
    if ("onStatus".equals(call.getServiceMethodName()) && call.getArguments().length >= 1) {
      Object arg0 = call.getArguments()[0];
      if ("NetStream.Play.InsufficientBW".equals(((Status) arg0).getCode())) {
        long baseT = getBaseTolerance();
        try {
          // drop the tolerances by half but not less than 500
          setBaseTolerance(Math.max(baseT / 2, 500));
View Full Code Here

   * @param header      RTMP message header
   * @param message     RTMP message (event)
   * @return            Encoded message data
   */
  public IoBuffer encodeMessage(Header header, IRTMPEvent message) {
    IServiceCall call = null;
    switch (header.getDataType()) {
      case TYPE_CHUNK_SIZE:
        return encodeChunkSize((ChunkSize) message);
      case TYPE_INVOKE:
        log.trace("Invoke {}", message);
        call = ((Invoke) message).getCall();
        if (call != null) {
          log.debug("{}", call.toString());
          Object[] args = call.getArguments();
          if (args != null && args.length > 0) {
            Object a0 = args[0];
            if (a0 instanceof Status) {
              Status status = (Status) a0;
              //code: NetStream.Seek.Notify
View Full Code Here

TOP

Related Classes of org.red5.server.api.service.IServiceCall

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.