Package org.openmim.mn

Examples of org.openmim.mn.MessagingNetworkException


            //contactListLoginId2cli = null;
            synchronized (lastErrorLock)
            {
              if (lastError == null)
              {
                setLastError(new MessagingNetworkException(reasonMessage, reasonLogger, endUserReasonCode));
              }
            }
          }
          fireSessionStatusChangeMim_Uncond(newStatus_Mim, ctx, reasonLogger, reasonMessage, endUserReasonCode);
        }
View Full Code Here


  {
    checkShuttingdown();

    if (System.currentTimeMillis() >= stopTime)
    {
      throw new MessagingNetworkException(
        "msn server operation timed out: " + operationDetails,
        MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_SERVER_OR_PROTOCOL_ERROR,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_MESSAGING_OPERATION_TIMEOUT);
    }
  }
View Full Code Here

          //S: NAK TrID
          //S: ACK TrID
          //Acknowledgement mode is not currently implemented [by Microsoft].
          //
          //Object o = getThisTransaction();
          finish(new MessagingNetworkException("server reports: message delivery failed", MessagingNetworkException.CATEGORY_STILL_CONNECTED, MessagingNetworkException.ENDUSER_MESSAGING_SERVER_REPORTS_CANNOT_SEND_MESSAGE));
          /*
          synchronized(o)
          {
            o.notifyAll();
          }
View Full Code Here

    {
      Enumeration e = trid2trans.elements();
      while (e.hasMoreElements())
      {
        Transaction t = (Transaction) e.nextElement();
        t.finish(new MessagingNetworkException(msg, cat, endUserCode));
      }
      trid2trans.clear();
    }
  }
View Full Code Here

      {
        if (Defines.DEBUG && CAT.isEnabledFor(org.apache.log4j.Level.WARN)) CAT.warn("icq2k [" + srcLoginId + "] logout: session already logged out, request ignored");
        return;
      }
      session.setLastError(
        new MessagingNetworkException(
                            "logout requested by caller",
                            MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_LOGOUT_CALLER,
                            endUserReason)
      );
    }
View Full Code Here

      throw new AssertException("invalid call: login(..., MessagingNetwork.STATUS_OFFLINE)");
    MLang.EXPECT_IS_MIM_STATUS(statusMim, "statusMim");

    gal.addAop(true);
    AsyncOperationImpl aop = null;
    MessagingNetworkException mexmex = null;
    try
    {
      Session session = getResourceManager().getCreateSession(srcLoginId);
      //synchronized (session)
      {
View Full Code Here

    if ( password.indexOf(' ' ) != -1
      || password.indexOf('\t') != -1
      || password.indexOf('\r') != -1
      || password.indexOf('\n') != -1)
    {
      throw new MessagingNetworkException("MSN password cannot contain whitespace", MessagingNetworkException.CATEGORY_NOT_CATEGORIZED, MessagingNetworkException.ENDUSER_CANNOT_LOGIN_WRONG_PASSWORD);
    }

    long plannedAbortTime = System.currentTimeMillis() + 1000 * MSNMessagingNetwork.REQPARAM_SOCKET_TIMEOUT_SECONDS;
    if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug("connecting to DS "+host+":"+port);

    for (;;)
    {
      if (Thread.currentThread().isInterrupted()) throw new InterruptedException();
      ds = new DS(host, port, ctx);
      ses.add(ds);
      ses.setDS(ds);
      ses.setRunning(true);

      //7.1 Protocol Versioning
      //C: VER TrID dialect-name{ dialect-name...}
      //S: VER TrID dialect-name{ dialect-name...}
      //S: VER TrID{ dialect-name ... } 0{ dialect-name ... } //failure
      ds.start(new Transaction()
      {
        final String CMD1 = "VER";

        public void clientRequest(TransactionContext ctx)
        throws IOException, InterruptedException, MessagingNetworkException
        {
          post(CMD1, PROTOCOL_VERSIONS_STRING, ctx);
        }

        public void serverResponse(String cmd, String args, TransactionContext ctx, final Session ses, final PluginContext pctx)
        throws IOException, InterruptedException, MessagingNetworkException
        {
          StringTokenizer r = new StringTokenizer(args);
          if (!cmd.equals(CMD1)) throwProtocolViolated("cmd must be "+CMD1);
          while (r.hasMoreTokens())
          {
            String dialect = r.nextToken();
            if ("0".equals(dialect)) throwProtocolViolated("DS server reported version negotiation failure");
            //ignoring all dialect ids != "0"
          }
          finish();
        }
      }).waitFor(true, ses, pctx);

      ds.start(new Transaction()
      {
        //7.2 Server Policy Information
        //C: INF TrID
        //S: INF TrID SP{,SP...}
        final String CMD1 = "INF";

        public void clientRequest(TransactionContext ctx)
        throws IOException, InterruptedException, MessagingNetworkException
        {
          post(CMD1, "", ctx);
        }

        public void serverResponse(String cmd, String args, TransactionContext ctx, final Session ses, final PluginContext pctx)
        throws IOException, InterruptedException, MessagingNetworkException
        {
          StringTokenizer r = new StringTokenizer(args);
          if (!cmd.equals(CMD1)) throwProtocolViolated("cmd must be "+CMD1);
          r = new StringTokenizer(tok(r), ", \t");
          if (!r.hasMoreElements()) throwProtocolViolated("DS server did not report server security policy id; cannot proceed");
          boolean md5found = false;
          while (r.hasMoreElements())
          {
            String sp = r.nextToken(); //security package
            //"MD5" is used by the NS,
            //"CKI" by the SS.
            if ("MD5".equals(sp))
            {
              md5found = true;
              break;
            }
          }
          if (!md5found) throwProtocolViolated("DS server reported no known security packages; cannot proceed");
          finish();
        }
      }).waitFor(true, ses, pctx);

      if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug("sending login id");
      USRLoginTransaction usrt = new USRLoginTransaction(loginId);
      ds.start(usrt).waitFor(true, ses, pctx);

      r = usrt.stringTokenizer;
      if (usrt.isUSR) break;

      ds.close("changing NS server", MessagingNetworkException.CATEGORY_NOT_CATEGORIZED, MessagingNetworkException.ENDUSER_NO_ERROR);
      ds = null;

      if (System.currentTimeMillis() > plannedAbortTime)
        throw new MessagingNetworkException("login timed out", MessagingNetworkException.CATEGORY_NOT_CATEGORIZED, MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_MESSAGING_OPERATION_TIMEOUT);

      HostPort hp = parseReferral(r, "NS");
      host = hp.host;
      port = hp.port;

View Full Code Here

        if (Defines.DEBUG && CAT.isEnabledFor(org.apache.log4j.Level.ERROR)) CAT.error("cl item ignored", ex);
        continue;
      }

      if (ses.getLoginId().equals(dstLoginId))
        throw new MessagingNetworkException(
          "cannot login with yourself on a contact list",
          MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_SERVER_OR_PROTOCOL_ERROR,
          MessagingNetworkException.ENDUSER_CANNOT_LOGIN_WITH_YOURSELF_ON_CONTACT_LIST);

      if (!ses.contactListItemExists(dstLoginId))
View Full Code Here

                if (!"1".equals(total))
                {
                  sss.BYE(ses);
                  sss.close("we must leave the SSS when we are participant number >= 3", MessagingNetworkException.CATEGORY_STILL_CONNECTED, MessagingNetworkException.ENDUSER_TOO_MANY_PARTICIPANTS_IN_THE_ROOM_NOT_LOGGED_OFF);
                  ses.removeSSS(sss);
                  finish(new MessagingNetworkException("we must leave the SSS when we are participant number >= 3", MessagingNetworkException.CATEGORY_STILL_CONNECTED, MessagingNetworkException.ENDUSER_TOO_MANY_PARTICIPANTS_IN_THE_ROOM_NOT_LOGGED_OFF));
                  return;
                }
                state = 1;
                return;
              }
              //ANS 1 OK
              if (cmd.equals("ANS") && args.equals("OK"))
              {
                if (state == 0)
                {
                  sss.close("recipient went offline", MessagingNetworkException.CATEGORY_STILL_CONNECTED, MessagingNetworkException.ENDUSER_CANNOT_COMPLETE_REQUEST_RECIPIENT_IS_OFFLINE);
                  ses.removeSSS(sss);
                  finish(new MessagingNetworkException("recipient went offline", MessagingNetworkException.CATEGORY_STILL_CONNECTED, MessagingNetworkException.ENDUSER_CANNOT_COMPLETE_REQUEST_RECIPIENT_IS_OFFLINE));
                  return;
                }
                else
                {
                  //we'll wait for incoming messages there.
View Full Code Here

TOP

Related Classes of org.openmim.mn.MessagingNetworkException

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.