Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.SessionName


   public void subscriptionRemove(SubscriptionEvent subscriptionEvent) throws XmlBlasterException {
      if (this.topicSet == null && this.clientSet == null) return;

      SubscriptionInfo subscriptionInfo = subscriptionEvent.getSubscriptionInfo();
      SessionInfo sessionInfo = subscriptionInfo.getSessionInfo();
      SessionName sessionName = sessionInfo.getSessionName();
      String oid = subscriptionInfo.getKeyOid(); // is null for XPATH
      String url = subscriptionInfo.getKeyData().getUrl();

      // EXACT subscription recursion detection
      if (this.publishDestinationHelper != null && oid != null && oid.equals(this.publishDestinationHelper.getKeyOid())) {
         log.info("Ignoring unSubscribe event on topic '" + oid + "' from '" + sessionName.getRelativeName() + "' to avoid recursion");
         return;
      }

      // "/event/unSubscribe"
      String event = ContextNode.SEP + "event" + ContextNode.SEP + "unSubscribe";

      // "topic/hello/event/unSubscribe"
      String foundEvent = ContextNode.TOPIC_MARKER_TAG + ContextNode.SEP + oid + event;
      boolean found = true;
      if (this.topicSet != null) {
         if (!this.topicSet.contains(foundEvent)) {
            // "topic/*/event/unSubscribe"
            foundEvent = ContextNode.TOPIC_MARKER_TAG + ContextNode.SEP + "*" + event;
            if (!this.topicSet.contains(foundEvent)) {
               found = false;
            }
         }
      }
      if (!found) {
         if (this.clientSet == null) return;
         if (!this.clientSet.contains(foundEvent)) {
            // "client/joe/session/*/event/unSubscribe"
            foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + sessionName.getLoginName() + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*" + event;
            if (!this.clientSet.contains(foundEvent)) {
               // "client/*/session/*/event/unSubscribe"
               foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + "*" + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*" + event;
               if (!this.clientSet.contains(foundEvent)) {
                  return;
View Full Code Here


   }

   protected void callbackStateChange(DispatchManager dispatchManager, ConnectionStateEnum oldState, ConnectionStateEnum newState) {
      if (this.callbackSessionStateSet == null) return;

      SessionName sessionName = dispatchManager.getSessionName();

      /*
      // Not yet implemented:
      // "/event/callbackAlive" "/event/callbackPolling"
      //String event = ContextNode.SEP + "event" + ContextNode.SEP + (newState.equals(ConnectionStateEnum.ALIVE)?"callbackAlive":"callbackPolling");

      // "client/joe/session/1/event/callbackAlive", "client/joe/session/1/event/callbackPolling"
      String foundEvent = sessionName.getRelativeName() + event;
      if (!this.callbackSessionStateSet.contains(foundEvent)) {
         // "client/joe/session/* /event/callbackAlive"
         foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + sessionName.getLoginName() + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*" + event;
         if (!this.callbackSessionStateSet.contains(foundEvent)) {
            // "client/* /session/* /event/callbackAlive"
            foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + "*" + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*" + event;
            if (!this.callbackSessionStateSet.contains(foundEvent)) {
               return;
            }
         }
      }
      */

      try {
         //ConnectQosData cd = clientEvent.getSessionInfo().getConnectQos().getData();
         //dispatchManager.getSecurityInterceptor().getConnectQos();
         //dispatchManager.getDispatchConnectionsHandler().getCurrentDispatchConnection().getSessionInfoProtector().getConnectQos();
       //log.severe("Debug only: lookup " + sessionName.toString());
         CbDispatchConnection cbd = (CbDispatchConnection)dispatchManager.getDispatchConnectionsHandler().getCurrentDispatchConnection();
         if (cbd != null) {
            I_AdminSession is = cbd.getAdminSession();
            ConnectQosData cd = is.getConnectQos().getData();
            //ConnectQosData cd = clientEvent.getSessionInfo().getConnectQos().getData();
            // A client can on connect send a event/callbackState=false clientProperty to suppress the event fired
            if (cd.getClientProperty(ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "callbackState", true) == false) {
               if (log.isLoggable(Level.FINE))  log.fine("Found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "callbackState=true for "+sessionName.toString());
             return;
            }
           //else
           //    log.severe("Debug only: Not found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "callbackState");
        }
      }
      catch (Throwable e) {
        e.printStackTrace();
        log.warning("Accessing connectQos failed: " + e.toString());
      }
     
      // "/event/callbackState"
      String event = ContextNode.SEP + "event" + ContextNode.SEP + "callbackState";
      // "client/joe/session/1/event/callbackState"
      String foundEvent = sessionName.getRelativeName();
      if (!this.callbackSessionStateSet.contains(foundEvent)) {
         // "client/joe/session/*"
         foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + sessionName.getLoginName() + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*";
         if (!this.callbackSessionStateSet.contains(foundEvent)) {
            foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + "*" + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + sessionName.getPublicSessionId();
            // "client/*/session/1"
            if (!this.callbackSessionStateSet.contains(foundEvent)) {
               // "client/*/session/*"
               foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + "*" + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*";
               if (!this.callbackSessionStateSet.contains(foundEvent)) {
                  return;
               }
            }
         }
      }
      foundEvent += event;

      try {
         String summary = "Callback state has changed to "
             + newState.toString() + " for client "
             + sessionName.getAbsoluteName();
         String description = (oldState.equals(newState))?
               ("Callback has state changed"
               + " to "+ newState.toString() + " for client "
               + sessionName.getAbsoluteName())
               :
               ("Callback state has changed from " + oldState.toString()
               + " to "+ newState.toString() + " for client "
               + sessionName.getAbsoluteName());
         String eventType = foundEvent + " " + newState.toString();
         String errorCode = null;

         if (this.smtpDestinationHelper != null) {
            sendEmail(summary, description, eventType, null, sessionName, false);
View Full Code Here

   }

   // Cluster client connections "/event/connectionState"
   protected void connectionStateChange(I_XmlBlasterAccess connection, ConnectionStateEnum oldState,
         ConnectionStateEnum newState) {
      SessionName sessionName = connection.getSessionName();
      String foundEvent = "/event/connectionState";

      try {
         XmlBlasterAccess xb = (XmlBlasterAccess) connection;
         SessionName absoluteName = new SessionName(glob, xb.getContextNode().getSessionNameCompatible());
         String clname = absoluteName.getAbsoluteName();
         // connection.getServerNodeId().toString()+ "/" +
         // sessionName.getAbsoluteName();
         String summary = "Connection state has changed to " + newState.toString() + " for cluster client "
               + clname;
         String description = (oldState.equals(newState)) ? ("Connection has state changed" + " to "
View Full Code Here

      if (getSessions().length < 1) return -1;

      int countForwarded = 0;

      SessionName destination = entry.getReceiver();

      if (destination.isSession()) {
         // send to a specific session, it should never happen to have such messages in the subject queue ...
         String tmp = "Can't forward msg " + entry.getLogId() + " from " +
                      this.subjectQueue.getStorageId() + " size=" +
                      this.subjectQueue.getNumOfEntries() + " to unknown session '" +
                      entry.getReceiver().getAbsoluteName() + "'";
View Full Code Here

    */
   public final SessionInfo getSessionByPublicId(long publicSessionId) {
      if (publicSessionId == 0L) {
         return null;
      }
      SessionName sessionName = new SessionName(glob, subjectName, publicSessionId);
      synchronized (this.sessionMap) {
         return (SessionInfo)this.sessionMap.get(sessionName.getAbsoluteName());
      }
   }
View Full Code Here

               }
            }
         }
         String tmp = character.toString().trim(); // The address or XPath query string
         if (tmp.length() > 0) {
            this.destination.setDestination(new SessionName(glob, tmp)); // set address or XPath query string if it is before inner tags
            character.setLength(0);
         }
         return;
      }
View Full Code Here

      if( name.equalsIgnoreCase("destination") ) {
         inDestination = false;
         String tmp = character.toString().trim(); // The address or XPath query string
         if (tmp.length() > 0) {
            this.destination.setDestination(new SessionName(glob, tmp)); // set address or XPath query string if it is before the forceQueuing tag
            character.setLength(0);
         }
         msgQosData.addDestination(this.destination);
         return;
      }

      if(name.equalsIgnoreCase("sender")) {
//       this.inSender = false;
         msgQosData.setSender(new SessionName(glob, character.toString().trim()));
         // if (log.isLoggable(Level.FINE)) log.trace(ME, "Found message sender login name = " + msgQosData.getSender());
         character.setLength(0);
         return;
      }
View Full Code Here

         instanceId = instanceCounter;
         instanceCounter--;
      }
      // client has specified its own publicSessionId (> 0)
      this.sessionName = (sessionName.isPubSessionIdUser()) ? sessionName :
         new SessionName(glob, sessionName, getInstanceId());
   }
View Full Code Here

            // having no public sessionId we need to generate a unique
            // queue name
            storageId = new StorageId(glob, serverNodeId, relating, getId() + System.currentTimeMillis()
                  + Global.getCounter());
         } else {
            SessionName ses = getSessionName();
            if (ses != null)
               storageId = new StorageId(glob, serverNodeId, relating, ses);
            else
               storageId = new StorageId(glob, serverNodeId, relating, getId() + System.currentTimeMillis()
                     + Global.getCounter());
View Full Code Here

            }


            // We need to set a unique ID for this client so that global.getId() is unique
            // which is used e.g. in the JDBC plugin
            SessionName sn = getSessionName();
            if (sn != null) {
               if (sn.isPubSessionIdUser()) {
                  this.glob.setId(sn.toString());
               }
               else {
                  this.glob.setId(sn.toString() + System.currentTimeMillis()); // Not secure if two clients start simultaneously
               }
            }
            else {
               this.glob.setId(getLoginName() + System.currentTimeMillis()); // Not secure if two clients start simultaneously
            }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.SessionName

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.