Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.XmlBlasterException


   public void handleError(I_MsgErrorInfo msgErrorInfo) {
      if (msgErrorInfo == null) return;
      if (log.isLoggable(Level.FINER)) log.finer("Entering handleError for " + msgErrorInfo.getMsgQueueEntries().length + " messages");

      boolean shutdown = false;
      XmlBlasterException ex = msgErrorInfo.getXmlBlasterException();
      //user.security.authorization.notAuthorized
      //if (!ex.isCommunication()) { // verify if this makes sense!
      //if (ex.isInternal() || ex.isResource()) { // verify if this makes sense!
      if (ex.isInternal()) { // verify if this makes sense!
         shutdown = true;
      }

      String prefix = "";
      MsgQueueEntry[] entries = msgErrorInfo.getMsgQueueEntries();
      for (int i=0; i<entries.length; i++) {
         if (entries[i].getMethodName() == MethodName.CONNECT) {
            prefix = "Connection failed: ";
            shutdown = true;
         }
         else {
            log.warning(ME+": Default error handling: Message '" + entries[i].getEmbeddedType() + "' '" +
                       entries[i].getLogId() + "' is lost: " + msgErrorInfo.getXmlBlasterException().getMessage() +
                       ". You can add your own client side error handler with I_XmlBlasterAccess.setClientErrorHandler() if desired or intercept the message with xmlBlasterAccess.registerPostSendListener().");
         }
      }

      if (shutdown) {
         log.severe(prefix + msgErrorInfo.getXmlBlasterException().getMessage());
         if (msgErrorInfo.getDispatchManager() != null) {
            msgErrorInfo.getDispatchManager().toDead(msgErrorInfo.getXmlBlasterException());
            //if (xmlBlasterAccess.getQueue() != null)
            //   xmlBlasterAccess.getQueue().clear();
            msgErrorInfo.getDispatchManager().shutdown();
            return;
         }
      }
     
      log.severe(ex.getMessage());
      Thread.dumpStack();
      //if (xmlBlasterAccess.getQueue() != null)
      //   xmlBlasterAccess.getQueue().clear();
   }
View Full Code Here


      try {
         rem = Naming.lookup(addr);
      }
      catch (RemoteException e) {
         log.severe("Can't access callback address ='" + addr + "', no client rmi registry running");
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "Can't access callback address ='" + addr + "', no client rmi registry running", e);
      }
      catch (NotBoundException e) {
         log.severe("The given callback address ='" + addr + "' is not bound to rmi registry: " + e.toString());
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "The given callback address '" + addr + "' is not bound to rmi registry", e);
      }
      catch (MalformedURLException e) {
         log.severe("The given callback address ='" + addr + "' is invalid: " + e.toString());
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "The given callback address '" + addr + "' is invalid.", e);
      }
      catch (Throwable e) {
         log.severe("The given callback address ='" + addr + "' is invalid : " + e.toString());
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "The given callback address '" + addr + "' is invalid.", e);
      }

      if (rem instanceof org.xmlBlaster.protocol.rmi.I_XmlBlasterCallback) {
         cb = (I_XmlBlasterCallback)rem;
         log.info("Accessing client callback reference using given '" + addr + "' string");
      }
      else {
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "No callback to '" + addr + "' possible, class needs to implement interface I_XmlBlasterCallback.");
      }
   }
View Full Code Here

      }
   }

   private I_XmlBlasterCallback getCb() throws XmlBlasterException {
      if (cb == null)
         throw new XmlBlasterException(glob, ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME, "No callback to '" + callbackAddress.getRawAddress() + "' possible, no connection.");
      return cb;
   }
View Full Code Here

    * @exception Exceptions thrown from client are re thrown as ErrorCode.USER*
    */
   public final String[] sendUpdate(MsgUnitRaw[] msgArr) throws XmlBlasterException
   {
      if (msgArr == null || msgArr.length < 1)
         throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Illegal sendUpdate() argument");
      if (log.isLoggable(Level.FINE)) log.fine("xmlBlaster.update() to " + callbackAddress.getSecretSessionId());

      try {
         return getCb().update(callbackAddress.getSecretSessionId(), msgArr);
      } catch (RemoteException remote) {
         Throwable nested = remote.detail;
         if (nested != null && nested instanceof XmlBlasterException) {
            XmlBlasterException xmlBlasterException = (XmlBlasterException)nested;
            throw XmlBlasterException.tranformCallbackException(xmlBlasterException);
            /*
            // WE ONLY ACCEPT ErrorCode.USER... FROM CLIENTS !
            if (xmlBlasterException.isUser())
               throw xmlBlasterException;

            throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_ERROR, ME,
                   "RMI Callback of " + msgArr.length +
                   " messages to client [" + callbackAddress.getSecretSessionId() + "] failed.", xmlBlasterException);
            */
         }
         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME,
                     "RMI Callback of " + msgArr.length + " messages to client [" + callbackAddress.getSecretSessionId() + "] failed", remote);
      }
   }
View Full Code Here

    * @exception XmlBlasterException Is never from the client (oneway).
    */
   public void sendUpdateOneway(MsgUnitRaw[] msgArr) throws XmlBlasterException
   {
      if (msgArr == null || msgArr.length < 1)
         throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Illegal sendUpdateOneway() argument");

      if (log.isLoggable(Level.FINE)) log.fine("xmlBlaster.updateOneway() to " + callbackAddress.getSecretSessionId());

      try {
         getCb().updateOneway(callbackAddress.getSecretSessionId(), msgArr);
      } catch (Throwable e) {
         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME,
            "RMI oneway callback of message to client [" + callbackAddress.getSecretSessionId() + "] failed", e);
      }
   }
View Full Code Here

   public final String ping(String qos) throws XmlBlasterException
   {
      try {
         return getCb().ping(qos);
      } catch (Throwable e) {
         throw new XmlBlasterException(glob, ErrorCode.COMMUNICATION_NOCONNECTION, ME,
                     "RMI callback ping failed", e);
      }
   }
View Full Code Here

         try {
           rs.initialize(ll);
         } catch (IOException e) {
           //e.printStackTrace();
           if (log.isLoggable(Level.FINE)) log.fine("Initializing of remote console on port=" + port + " failed:" + e.toString());
           throw new XmlBlasterException(glob, ErrorCode.INTERNAL_UNKNOWN, ME, "Initializing of remote telnet console on port=" + port + " failed:" + e.toString());
         }
      }
   }
View Full Code Here

   public void connect(String loginName, String passwd) throws XmlBlasterException {
      if (log.isLoggable(Level.FINER)) log.finer("Entering login(loginName=" + loginName/* + ", qos=" + qos_literal */ + ")");

      if (loginName==null || passwd==null) {
         log.severe("login failed: please use no null arguments for login()");
         throw new XmlBlasterException(this.glob, ErrorCode.USER_ILLEGALARGUMENT, ME + ".connect", "login failed: please use 'connect loginName password'");
      }

      org.xmlBlaster.client.qos.ConnectQos clientConnectQos = new org.xmlBlaster.client.qos.ConnectQos(glob, loginName, passwd);
      clientConnectQos.setSessionTimeout(sessionTimeout);
      ConnectQosServer connectQos = new ConnectQosServer(glob, clientConnectQos.getData());
View Full Code Here

    * @return valid httpPushHandler for valid HTTP sessionId (never null)
    * @exception If sessionId not found.
    */
   public static void addHttpPushHandler(String sessionId, HttpPushHandler httpPushHandler) throws XmlBlasterException {
      if (sessionId == null) {
         throw new XmlBlasterException(ME+".NoSessionId", "Sorry, no valid session ID, are cookies disabled?");
      }
      synchronized(httpPushHandlers) {
         httpPushHandlers.put(sessionId, httpPushHandler);
      }
   }
View Full Code Here

    * @return valid httpPushHandler for valid HTTP sessionId (never null)
    * @exception If sessionId not found.
    */
   public static HttpPushHandler getHttpPushHandler(String sessionId) throws XmlBlasterException {
      if (sessionId == null) {
         throw new XmlBlasterException(ME+".NoSessionId", "Sorry, no valid session ID, are cookies disabled?");
      }
      synchronized(httpPushHandlers) {
         HttpPushHandler pc = (HttpPushHandler)httpPushHandlers.get(sessionId);
         if (pc != null)
            return pc;
      }
      throw new XmlBlasterException(ME, "Session not registered yet (sessionId="+sessionId+")");
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.XmlBlasterException

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.