Package org.xmlBlaster.util.xbformat

Examples of org.xmlBlaster.util.xbformat.MsgInfo


   {
      if (!running)
         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME, "ping() invocation ignored, we are shutdown.");
      try {
         String cbSessionId = "";
         MsgInfo parser = new MsgInfo(glob, MsgInfo.INVOKE_BYTE, MethodName.PING, cbSessionId, progressListener, getMsgInfoParserClassName());
         parser.addMessage(qos);
         Object response = requestAndBlockForReply(parser, SocketExecutor.WAIT_ON_RESPONSE, SocketUrl.SOCKET_TCP);
         if (log.isLoggable(Level.FINE)) log.fine("Got ping response " + ((response == null) ? "null" : response.toString()));
         return (String)response; // return the QoS
      } catch (Throwable e) {
         boolean weAreOnServerSide = getXmlBlasterCore() != null; //// TODO !!!!!!!!!!!
View Full Code Here


            MsgInfo[] msgInfoArr = MsgInfo.parse(glob, progressListener, iStream, getMsgInfoParserClassName(), this.pluginInfo);
            if (msgInfoArr.length < 1) {
               log.warning(toString() + ": Got unexpected empty data from SOCKET, closing connection now");
               break;
            }
            final MsgInfo receiver = msgInfoArr[0];
           
            //if (MethodName.CONNECT.equals(receiver.getMethodName()))
            //   log.info("Test: Got connectQos");

            if (log.isLoggable(Level.FINEST)) log.finest("Receiving message >" + receiver.toLiteral() + "<\n" + receiver.dump());

            if (this.acceptRemoteLoginAsTunnel
                  && receiver.isInvoke()
                  && !MethodName.UPDATE.equals(receiver.getMethodName())
                  && !MethodName.UPDATE_ONEWAY.equals(receiver.getMethodName())
                  && !MethodName.EXCEPTION.equals(receiver.getMethodName())
                  && !MethodName.PING.equals(receiver.getMethodName())) {
              
               //getSocketExecutor().getXmlBlasterCore().
               if (MethodName.CONNECT == receiver.getMethodName()) {
                  // TODO: crypt.importMessage(receiver.getQos()); see also ClientDispatchConnection.java:440
                  Socket socket = this.sock;
                  if (socket == null) return; // Is possible when EOF arrived inbetween
                  ConnectQosServer conQos = new ConnectQosServer(glob, receiver.getQos());
                  if (conQos.getSecurityQos() == null)
                     throw new XmlBlasterException(glob, ErrorCode.USER_SECURITY_AUTHENTICATION_ILLEGALARGUMENT, ME, "connect() without securityQos");
                  conQos.getSecurityQos().setClientIp (socket.getInetAddress().getHostAddress());
                  conQos.setAddressServer(getAddressServer());
                  Object callbackSocketDriver = new CallbackSocketDriver(conQos.getSessionName().getLoginName(), this);
                  conQos.getAddressServer().setCallbackDriver(callbackSocketDriver);
                  conQos.getData().getCurrentCallbackAddress().setCallbackDriver(callbackSocketDriver);
                  ConnectReturnQosServer retQos = getAuthenticateCore().connect(conQos);
                  this.secretSessionId = retQos.getSecretSessionId();
                  receiver.setSecretSessionId(retQos.getSecretSessionId()); // executeResponse needs it
                  executeResponse(receiver, retQos.toXml(), SocketUrl.SOCKET_TCP);
               }
               else if (MethodName.DISCONNECT == receiver.getMethodName()) {
                  executeResponse(receiver, Constants.RET_OK, SocketUrl.SOCKET_TCP);   // ACK the disconnect to the client and then proceed to the server core
                  // Note: the disconnect will call over the CbInfo our shutdown as well
                  // setting sessionId = null prevents that our shutdown calls disconnect() again.
                  getAuthenticateCore().disconnect(getAddressServer(), receiver.getSecretSessionId(), receiver.getQos());
                  shutdown();
               }
               else {
                  if (log.isLoggable(Level.FINE)) log.fine("Received tunneled message, forwarding now to xmlBlaster core: " + receiver.getMethodNameStr());
                  boolean processed = receiveReply(receiver, SocketUrl.SOCKET_TCP);    // Parse the message and invoke actions in same thread
                  if (!processed)
                     log.warning("Received message is not processed: " + receiver.toLiteral());
               }
            }
            else if (this.acceptRemoteLoginAsTunnel
                  && receiver.isResponse()
                  && MethodName.UPDATE.equals(receiver.getMethodName())
                  && MethodName.UPDATE_ONEWAY.equals(receiver.getMethodName()) // ONEWAY have no response, just do be complete
            ) {
               log.severe("UPDATE RESPONSE IS NOT YET IMPLEMENTED");              
               boolean processed = receiveReply(receiver, SocketUrl.SOCKET_TCP);    // Parse the message and invoke actions in same thread
               if (!processed)
                  log.warning("Received message is not processed: " + receiver.toLiteral());
            }
            else {
               // Normal client operation
               if (receiver.isInvoke() && multiThreaded) {
                  // Parse the message and invoke callback to client code in a separate thread
                  // to avoid dead lock when client does a e.g. publish() during this update()
                  WorkerThread t = new WorkerThread(glob, this, receiver);
                  // -dispatch/callback/plugin/socket/invokerThreadPrio 5
                  t.setPriority(this.callbackAddress.getEnv("invokerThreadPrio", Thread.NORM_PRIORITY).getValue());
                  t.start();
               }
               else {
                  boolean processed = receiveReply(receiver, SocketUrl.SOCKET_TCP);    // Parse the message and invoke actions in same thread
                  if (!processed)
                     log.warning("Received message is not processed: " + receiver.toLiteral());
               }
               if (MethodName.DISCONNECT == receiver.getMethodName() && receiver.isResponse()) {
                  if (log.isLoggable(Level.FINE)) log.fine("Terminating socket callback thread because of disconnect response");
                  threadRunning = false;
               }
            }
         }
View Full Code Here

      MsgUnitRaw[] msgArr = { new MsgUnitRaw(key, (byte[])null, qos) };
      return getLiteral(msgArr, methodName, MsgInfo.INVOKE_BYTE);
   }

   private String getLiteral(MsgUnitRaw[] msgArr, MethodName methodName, byte typeByte) throws XmlBlasterException {
      MsgInfo msgInfo = new MsgInfo(this.glob, typeByte, methodName, secretSessionId, progressListener);
      msgInfo.addMessage(msgArr);
      msgInfo.createRequestId(null);
      return parser.toLiteral(msgInfo);
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.xbformat.MsgInfo

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.