/*
(non-Javadoc)

@see
org.parallelj.launching.transport.tcp.command.AbstractTcpCommand#process
(org.apache.mina.core.session.IoSession, java.lang.String[])
541983
@Override
	public final String process(final IoSession session, final String... args) {
		RemoteProgram remoteProgram = null;
		// Get the corresponding remoteProgram
		try {
			remoteProgram = parseCommandLine(args);

			final Class<?> jobClass = (Class<?>) remoteProgram
					.getAdapterClass();
			final Launcher launcher = Launcher.getLauncher();

			final Launch<?> launch = launcher.newLaunch(jobClass);

			for (IOption ioption : this.getOptions()) {
				ioption.process(launch, remoteProgram);
			}

			final LaunchResult launchResult = launch.synchLaunch().getLaunchResult();
			String status = null;
			String userErrorCode = null;
			if (launchResult == null) {
				status = ProgramReturnCodes.NOTSTARTED.name();
			} else {
				status = String.valueOf(launchResult.getStatusCode());
				userErrorCode = String.valueOf(launchResult.getReturnCode());
			}

			return LaunchingMessageKind.ILAUNCH0003.getFormatedMessage(
					jobClass.getCanonicalName(), launch.getLaunchId(), status, userErrorCode);
		} catch (ParseException e) {
			return e.getMessage();
		} catch (ParserException e) {
			return e.getFormatedMessage();
		} catch (OptionException e) {
			return e.getFormatedMessage();
		} catch (LaunchException e) {
			return LaunchingMessageKind.ELAUNCH0008
					.format(remoteProgram != null ? remoteProgram
							.getAdapterClass() : "unknown",e);
		} catch (Exception e) {
			return LaunchingMessageKind.ELAUNCH0008
					.format(remoteProgram != null ? remoteProgram
							.getAdapterClass() : "unknown",e.getMessage(), e);
		}
	}
727965
@Override
	protected boolean processRun(DBGPCommand c) throws DBGPException
	{
		checkArgs(c, 1, false);

		if (status == DBGPStatus.BREAK || status == DBGPStatus.STOPPING)
		{
			if (breakContext != null)
			{
				breakContext.threadState.setBreaks(null, null, null);
				status = DBGPStatus.RUNNING;
				statusReason = DBGPReason.OK;
				return false; // run means continue
			} else
			{
				throw new DBGPException(DBGPErrorCode.NOT_AVAILABLE, c.toString());
			}
		}

		if (status == DBGPStatus.STARTING && expression == null)
		{
			status = DBGPStatus.RUNNING;
			statusReason = DBGPReason.OK;
			return false; // a run for a new thread, means continue
		}

		if (status != DBGPStatus.STARTING)
		{
			throw new DBGPException(DBGPErrorCode.NOT_AVAILABLE, c.toString());
		}

		if (c.data != null) // data is in "expression"
		{
			throw new DBGPException(DBGPErrorCode.INVALID_OPTIONS, c.toString());
		}

		if (remoteControl != null)
		{
			try
			{
				status = DBGPStatus.RUNNING;
				statusReason = DBGPReason.OK;
				final RemoteInterpreter remoteInterpreter = new RemoteInterpreter(interpreter, this);
				Thread remoteThread = new Thread(new Runnable()
				{

					public void run()
					{
						try
						{
							remoteControl.run(remoteInterpreter);
						} catch (Exception e)
						{
							status = DBGPStatus.STOPPED;
							statusReason = DBGPReason.ERROR;
							errorResponse(DBGPErrorCode.INTERNAL_ERROR, e.getMessage());
						}
					}
				});
				remoteThread.setName("RemoteControl runner");
				remoteThread.setDaemon(true);
				remoteThread.start();
				remoteInterpreter.processRemoteCalls();
				stdout("Remote control completed");
				statusResponse(DBGPStatus.STOPPED, DBGPReason.OK);
				run();

			} catch (Exception e)
			{
				status = DBGPStatus.STOPPED;
				statusReason = DBGPReason.ERROR;
				errorResponse(DBGPErrorCode.INTERNAL_ERROR, e.getMessage());
			}

			return false; // Do not continue after remote session
		} else
		{
			try
			{
				status = DBGPStatus.RUNNING;
				statusReason = DBGPReason.OK;
				if (!traceExpression)
				{
	    			long before = System.currentTimeMillis();
					if (expression.equals("###CONSOLE###"))
					{
						run();
					} else
					{
						theAnswer = interpreter.execute(expression, this);
					}
					stdout("\n" + expression + " = " + theAnswer.toString() + "\n");
	    			long after = System.currentTimeMillis();
	    			stdout("Executed in " + (double)(after-before)/1000 + " secs. ");
				} else
				{
					String[] parts = expression.split("\\s+");
					int testNo = 0;
					float reduction = 1.0F;
					TraceReductionType reductionType = TraceReductionType.NONE;
					long seed = 999;
					// Test`T1 4 {subset,reduction,seed}
					if (parts.length >= 2 && !parts[1].startsWith("{"))
					{
						try
						{
							testNo = Integer.parseInt(parts[1]);
						} catch (NumberFormatException e)
						{
							errorResponse(DBGPErrorCode.INTERNAL_ERROR, parts[0]
									+ " <name> [test number]");
							return true;
						}
					}
					if (parts.length >= 2
							&& parts[parts.length - 1].length() > 7
							&& parts[parts.length - 1].startsWith("{"))
					{
						try
						{
							String settings = parts[parts.length - 1];
							String[] tmp = settings.substring(1, settings.length() - 1).split(",");
							if (tmp.length == 3)
							{
								reduction = Float.parseFloat(tmp[0]);
								reductionType = TraceReductionType.valueOf(tmp[1]);
								seed = Long.parseLong(tmp[2]);
							}
						} catch (NumberFormatException e)
						{
							errorResponse(DBGPErrorCode.INTERNAL_ERROR, parts[0]
									+ " <name> [test number]");
							return true;
						}
					}

					String traceExpression1 = parts[0];

					interpreter.runtrace(traceExpression1, testNo, true, reduction, reductionType, seed);
					stdout("\n" + expression + " = " + "Trace completed\n");
				}

				statusResponse(DBGPStatus.STOPPED, DBGPReason.OK);

			} catch (ContextException e)
			{
				dyingThread(e);
			} catch (Exception e)
			{
				status = DBGPStatus.STOPPED;
				statusReason = DBGPReason.ERROR;
				errorResponse(DBGPErrorCode.EVALUATION_ERROR, e.getMessage());
			}

			return true;
		}
	}
1124934
@Override
    public void process(TestDeployment testDeployment, Archive<?> protocolArchive) {
        final TestClass testClass = this.testClass.get();
        final Archive<?> applicationArchive = testDeployment.getApplicationArchive();

        if (WarpCommons.isWarpTest(testClass.getJavaClass())) {
            if (!Validate.isArchiveOfType(WebArchive.class, protocolArchive)) {
                throw new IllegalArgumentException("Protocol archives of type " + protocolArchive.getClass()
                    + " not supported by Warp. Please use the Servlet 3.0 protocol.");
            }

            addWarpPackageToDeployment(protocolArchive.as(WebArchive.class));

            addWarpExtensionsDeployment(protocolArchive.as(WebArchive.class));

            removeTestClassFromDeployment(applicationArchive, testClass);
        }
    }
206477
public void processResponse(ResponseEvent arg0) {
    synchronized (listeners) {
      if (((ResponseEventExt) arg0).isRetransmission())
        retransmissions++;
      Iterator iter = listeners.iterator();
      while (iter.hasNext() == true) {
        SipListener listener = (SipListener) iter.next();
        listener.processResponse(arg0);
      }
    }
  }
1351882
@Override
    public void messageReceived(IoSession session, Object buf) {
        final IoSessionInputStream in = (IoSessionInputStream) session
                .getAttribute(KEY_IN);
        in.write((IoBuffer) buf);
    }
440014
@Override
    public synchronized void processConnect(WebSocketChannel channel, WSURI uri, String[] protocols) {
        LOG.entering(CLASS_NAME, "processConnect", new Object[] { uri, protocols });

        try {
            WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel;
            if (nativeChannel.getProxy() != null) {
                throw new IllegalStateException("Bridge proxy previously set");
            }
            
            Proxy proxy = BridgeUtil.createProxy(uri.getURI(), this);
            proxy.setPeer(channel);
            nativeChannel.setProxy(proxy);
            
            String[] params;
            if (protocols != null) {
                String s = "";
                for (int i=0; i<protocols.length; i++) {
                    if (i>0) {
                        s += ",";
                    }
                    s += protocols[i];
                }
                params = new String[] { "WEBSOCKET", uri.toString(), s, ""};
            } else {
                params = new String[] { "WEBSOCKET", uri.toString() };
            }
            proxy.processEvent(XoaEventKind.CREATE, params);
        }
        catch (Exception e) {
            LOG.log(Level.FINE, "While initializing WebSocket proxy: "+e.getMessage(), e);
            listener.connectionFailed(channel, e);
        }
    }
26467
@Override
    public void process(HttpServerRequest vertxRequest, ContainerRequest jerseyRequest, Handler<Void> done) {
        jerseyRequest.setProperty("custom.property", "Hello!");
        done.handle(null);
    }
59649
private void runSession() {
		if (!started) {
			logString("Thread Starting");
			completed = false;
			seqNum = getStartSeqNum();
			rtpStack.setNextZrtpSequenceNumber(getStartSeqNum());
			state = ZRTP_STATE_INACTIVE;
			initiator = false;
			hashMode = HashType.UNDEFINED;
			dhMode = KeyAgreementType.DH3K;
			sasMode = SasType.UNDEFINED;
			farEndZID = null;
			farEndH0 = null;
			farEndClientID = "";
			isLegacyClient = false;
			// farEndH1 = null;
			// farEndH2 = null;
			// farEndH3 = null;
			farEndZID = null;
			dhPart1Msg = null;
			dhPart2Msg = null;
			rxHelloMsg = txHelloMsg = commitMsg = null;
			msgConfirm1TX = msgConfirm2TX = null;
			msgConfirm1RX = msgConfirm2RX = null;
			msgErrorTX = null;

			try {
				// TODO: create after algorithm negotiation
				dhSuite.setAlgorithm(KeyAgreementType.DH3K);
				// Initialize the retransmission timer interval
				timerInterval = T1_INITIAL_INTERVAL;
				sendHello();
				started = true;
			} catch (Throwable e) {
				logError("Exception sending initial Hello message: "
						+ e.toString());
				e.printStackTrace();
				completed = true;
			}
			while (!completed) {
				synchronized (lock) {
					try {
						lock.wait();
					} catch (Throwable e) {
						logString("Thread Interrupted E:" + e);
					}
				}
				processQueuedMessages();
			}
			endSession();
			logString("Thread Ending");
		}
	}
1033693
@Override
  public final void process(final Map<String, Object> pAddParam,
    final IRequestData pRequestData) throws Exception {
    this.prcAccEntitiesPage.process(pAddParam, pRequestData);
    pRequestData.setAttribute("typeCodeSubaccMap",
      this.srvTypeCode.getTypeCodeMap());
  }
547276
public Object process(Object... params) throws APPErrorException {
        String command = (String) params[0];
        Object[] param = Arrays.copyOfRange(params, 1, params.length);
        Command comm = mCommands.get(command);
        if (null == comm) {
            throw new APPErrorException(mType + " 无法识别的命令；" + command);
        }
        return comm.excute(param);

    }
652459
void processAppCommand(final HttpServerExchange exchange, final RequestData requestData, final MCMPAction action) throws IOException {

        final String contextPath = requestData.getFirst(CONTEXT);
        final String jvmRoute = requestData.getFirst(JVMROUTE);
        final String aliases = requestData.getFirst(ALIAS);

        if (contextPath == null || jvmRoute == null || aliases == null) {
            processError(TYPESYNTAX, SMISFLD, exchange);
            return;
        }
        final List<String> virtualHosts = Arrays.asList(aliases.split(","));
        if (virtualHosts == null || virtualHosts.isEmpty()) {
            processError(TYPESYNTAX, SCONBAD, exchange);
            return;
        }

        String response = null;
        switch (action) {
            case ENABLE:
                if (!container.enableContext(contextPath, jvmRoute, virtualHosts)) {
                    processError(MCMPErrorCode.CANT_UPDATE_CONTEXT, exchange);
                    return;
                }
                break;
            case DISABLE:
                if (!container.disableContext(contextPath, jvmRoute, virtualHosts)) {
                    processError(MCMPErrorCode.CANT_UPDATE_CONTEXT, exchange);
                    return;
                }
                break;
            case STOP:
                int i = container.stopContext(contextPath, jvmRoute, virtualHosts);
                final StringBuilder builder = new StringBuilder();
                builder.append("Type=STOP-APP-RSP,JvmRoute=").append(jvmRoute);
                builder.append("Alias=").append(aliases);
                builder.append("Context=").append(contextPath);
                builder.append("Requests=").append(i);
                response = builder.toString();
                break;
            case REMOVE:
                if (!container.removeContext(contextPath, jvmRoute, virtualHosts)) {
                    processError(MCMPErrorCode.CANT_UPDATE_CONTEXT, exchange);
                    return;
                }
                break;
            default: {
                processError(TYPESYNTAX, SMISFLD, exchange);
                return;
            }
        }
        if (response != null) {
            sendResponse(exchange, response);
        } else {
            processOK(exchange);
        }
    }
1287874
@Override
    protected void process(@NotNull WireIn inWire,
                           @NotNull WireOut outWire,
                           @NotNull SessionDetailsProvider sd) {

        inWire.readDocument(m -> {
            long tid = inWire.read(() -> "tid").int64();
            outWire.writeDocument(true, meta -> meta.write(() -> "tid")
                    .int64(tid));

        }, d -> {
            outWire.writeDocument(false, data -> data.write(() -> "payloadResponse")
                    .text(inWire.read(() -> "payload").text()));
        });
    }
973774
public void processRequest(RequestEvent arg0) {
    LOG.trace("request received !");
    synchronized (listeners) {
      Iterator<SipListener> iter = listeners.iterator();
      while (iter.hasNext() == true) {
        SipListener listener = iter.next();
        LOG.trace("calling listener");
        listener.processRequest(arg0);
      }
    }
  }
592031
@Override
  public final void process(final Map<String, Object> pAddParam,
    final IRequestData pRequestData) throws Exception {
    this.srvEntitiesPage.retrievePage(pAddParam, pRequestData);
  }
238389
public final void process(Queue<String> argq, T state) {
    String[] args = argq.toArray(new String[argq.size()]);
    argq.clear();
    run(args, state);
  }
557336
public T process(String[] arguments, T bean) {
    return process(Arrays.asList(arguments), bean);
  }
173714
public void processThisMessage()
    {
        Utility.getLogger().info("On message called in receiving process");
        try {
            BaseMessage messageIn = this.getMessage();
            if (messageIn != null)
            {
                BaseMessage messageReply = this.createReplyMessage(messageIn);
                this.moveScreenParamsToMessage(messageReply);
                // Step 2 - Get the body part of the message
                this.getTransport().setupReplyMessage(messageReply, messageIn, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN);
            
                this.getTransport().processIncomingMessage(messageReply, null);
            }
        } catch(Exception ex) {
            ex.printStackTrace();
            Debug.print(ex, "Error in processing or replying to a message");
        }
    }