Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.SessionName


    * eventType == client/* /session/* /event/remoteProperties
    * Enforced by I_RemotePropertiesListener
    */
   public void update(SessionInfo sessionInfo, Map remoteProperties) {
      log.fine("Received new remote properties from client " + sessionInfo.getId());
      SessionName sessionName = sessionInfo.getSessionName();
      String relativeName = sessionName.getRelativeName();

      String event = ContextNode.SEP + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "remoteProperties";
      String foundEvent = relativeName + event;  // "client/joe/session/1/event/remoteProperties"
      if (!this.clientSet.contains(foundEvent)) {
         // "client/joe/session/*/event/remoteProperties"
         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/remoteProperties"
            foundEvent = ContextNode.SUBJECT_MARKER_TAG + ContextNode.SEP + "*" + ContextNode.SEP + ContextNode.SESSION_MARKER_TAG + ContextNode.SEP + "*" + event;
            if (!this.clientSet.contains(foundEvent)) {
               return;
            }
         }
      }

      try {
         String summary = "Remote properties change for client " + sessionName.getAbsoluteName();
         String description = summary;
         ClientProperty[] cp = sessionInfo.getRemotePropertyArr();
         for (int i=0; i<cp.length; i++)
            description += "\n   " + cp[i].toXml("", "remoteProperty").trim();
         String eventType = foundEvent;
View Full Code Here


         ContextNode contextNode = this.engineGlob.getContextNode();
         int rl = this.engineGlob.getRunlevelManager().getCurrentRunlevel();
         String summary = "Heartbeat event from " + contextNode.getAbsoluteName() + ", runlevel=" + RunlevelManager.toRunlevelStr(rl) + " (" + rl + ")";
         String errorCode = null;
         String description = "Heartbeat event from " + contextNode.getAbsoluteName() + ", runlevel=" + RunlevelManager.toRunlevelStr(rl) + " (" + rl + ")";
         SessionName sessionName = null;

         if (this.smtpDestinationHelper != null) {
            // Ignores contentTemplate and forces the XML as last argument
            sendEmail(summary, description, eventType, null, sessionName, false);
         }
View Full Code Here

      ClusterManager clusterManager = g.getClusterManagerNoEx();
      if (clusterManager != null && clusterManager.isReady()) {
         ClusterNode[] nodes = clusterManager.getClusterNodes();
         for (int ic = 0; ic < nodes.length; ic++) {
            ClusterNode node = nodes[ic];
            SessionName destination = node.getRemoteSessionName();
            if (destination == null)
               continue;
            buf.append("\n  ").append("<connection clusterId='").appendEscaped(destination.getNodeIdStr()).append(
                  "' id='").appendEscaped(destination.getLoginName()).append("'>");
            buf.append("\n   ").append("<session id='").append(destination.getPublicSessionId()).append("'>");
            buf.append("\n    ").append("<state>").append(node.getConnectionStateStr()).append("</state>");
            I_Queue clientQueue = node.getConnectionQueue();
            if (clientQueue != null) {
               buf.append("\n    <queue relating='" + Constants.RELATING_CLIENT + "'"); // "connection"
               buf.append(" numOfEntries='").append(clientQueue.getNumOfEntries()).append("'");
View Full Code Here

         String eventType, String errorCode, boolean forceSending) {
      if (this.jmxDestinationHelper == null) return;
      if (!this.isActive) return;

      try {
         SessionName sessionName = null;
         //String message = eventType + ": " + summary; // Shows up under 'Message' in jconsole
         String message =this.jmxDestinationHelper.getMessage(summary, description,
               eventType, errorCode, sessionName);
         String attributeName = eventType;
         String oldValue = ""; // TODO what to put here?
View Full Code Here

   public void sessionAdded(ClientEvent clientEvent) throws XmlBlasterException {

      if (this.pendingCallbackSessionInfoSet != null) {
         synchronized (this.pendingCallbackSessionInfoSet) {
            try {
               SessionName currSessionName = clientEvent.getSessionInfo().getSessionName();
               String name = currSessionName.getAbsoluteName();
               boolean found = this.pendingCallbackSessionInfoSet.remove(name);
               if (!found) { // wild card entries remain
                  found = this.pendingCallbackSessionInfoSet.contains(currSessionName.getRelativeSubjectIdWildcard());
                  if (!found) {
                     found = this.pendingCallbackSessionInfoSet.contains(currSessionName.getRelativePubSessionIdWildcard());
                  }
                  if (!found) {
                     found = this.pendingCallbackSessionInfoSet.contains(currSessionName.getRelativeWildcard());
                  }
               }
               if (found) {
                  SessionName sessionName = new SessionName(this.engineGlob, name);
                  SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
                  DispatchManager mgr = null;
                  if (sessionInfo != null)
                     mgr = sessionInfo.getDispatchManager();
                  if (mgr != null) {
                     mgr.addConnectionStatusListener(this, true); // true: fire initial event
                     // done already:
                     //if (this.callbackSessionStateSet == null) this.callbackSessionStateSet = new TreeSet();
                     //this.callbackSessionStateSet.add(sessionName.getRelativeName());
                  }
                  else
                     System.err.println("EventPlugin.sessionAdded: Unexpected missing of " + name);
               }
            } catch (Throwable e) {
               e.printStackTrace();
            }
         }
      }

      if (this.clientSet == null) return;

      SessionInfo sessionInfo = clientEvent.getSessionInfo();
      SessionName sessionName = sessionInfo.getSessionName();

      try {
         ConnectQosData cd = sessionInfo.getConnectQos().getData();
         // A client can on connect send a event/connect=false clientProperty to suppress the event fired
         if (cd.getClientProperty(ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect", true) == false) {
            if (log.isLoggable(Level.FINE)) log.fine("Found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect=true for "+sessionName.toString());
          return;
         }
      }
      catch (Throwable e) {
        e.printStackTrace();
        log.warning("Accessing connectQos failed: " + e.toString());
      }
     
      String relativeName = sessionName.getRelativeName();

      String event = ContextNode.SEP + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "connect";
      String foundEvent = relativeName + event;  // "client/joe/session/1/event/connect"
      if (!this.clientSet.contains(foundEvent)) {
         // "client/joe/session/*/event/connect"
         foundEvent = sessionName.getRelativePubSessionIdWildcard() + event;
         if (!this.clientSet.contains(foundEvent)) {
            // "client/*/session/1/event/connect"
            foundEvent = sessionName.getRelativeSubjectIdWildcard() + event;
            if (!this.clientSet.contains(foundEvent)) {
               // "client/*/session/*/event/connect"
               foundEvent = sessionName.getRelativeWildcard() + event;
               if (!this.clientSet.contains(foundEvent)) {
                  return;
               }
            }
         }
      }

      try {
         //PublishKey(glob, Constants.EVENT_OID_LOGIN/*"__sys__Login"*/, "text/plain");
         // Key '__sys__UserList' for login/logout event
         // PublishKey(glob, Constants.EVENT_OID_USERLIST/*"__sys__UserList"*/, "text/plain");
         String summary = "Login of client " + sessionName.getAbsoluteName();
         String description = sessionInfo.toXml();
         String eventType = foundEvent;
         String errorCode = null;

         if (this.smtpDestinationHelper != null) {
View Full Code Here

               boolean isNew = this.pendingCallbackSessionInfoSet.add(name);
               if (!isNew)
                  System.err.println("EventPlugin.sessionPreRemoved: Unexpected occurrence of " + name);

               // Remove the listener for now
               SessionName sessionName = new SessionName(this.engineGlob, name);
               SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
               DispatchManager mgr = null;
               if (sessionInfo != null)
                  mgr = sessionInfo.getDispatchManager();
               if (mgr != null) {
View Full Code Here

      // PublishKey(glob, Constants.EVENT_OID_USERLIST/*"__sys__UserList"*/, "text/plain");

      if (this.clientSet == null) return;

      SessionInfo sessionInfo = clientEvent.getSessionInfo();
      SessionName sessionName = sessionInfo.getSessionName();
     
      try {
         ConnectQosData cd = sessionInfo.getConnectQos().getData();
         // A client can on connect send a event/disconnect=false clientProperty to suppress the event fired
         if (cd.getClientProperty(ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "disconnect", true) == false) {
            if (log.isLoggable(Level.FINE))  log.fine("Found " + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "disconnect=true for "+sessionName.toString());
          return;
         }
      }
      catch (Throwable e) {
        e.printStackTrace();
        log.warning("Accessing connectQos failed: " + e.toString());
      }
     
      String relativeName = sessionName.getRelativeName();

      String event = ContextNode.SEP + ContextNode.EVENT_MARKER_TAG + ContextNode.SEP + "disconnect";
      String foundEvent = relativeName + event;  // "client/joe/session/1/event/disconnect"
      if (!this.clientSet.contains(foundEvent)) {
         // "client/joe/session/*/event/disconnect"
         foundEvent = sessionName.getRelativePubSessionIdWildcard() + event;
         if (!this.clientSet.contains(foundEvent)) {
            // "client/*/session/1/event/disconnect"
            foundEvent = sessionName.getRelativeSubjectIdWildcard() + event;
            if (!this.clientSet.contains(foundEvent)) {
               // "client/*/session/*/event/disconnect"
               foundEvent = sessionName.getRelativeWildcard() + event;
               if (!this.clientSet.contains(foundEvent)) {
                  return;
               }
            }
         }
      }

      try {
         String summary = "Logout of client " + sessionName.getAbsoluteName();
         String description = summary;
         String eventType = foundEvent;
         String errorCode = null;

         if (this.smtpDestinationHelper != null) {
View Full Code Here

    */
   private void completeDestinations() throws XmlBlasterException  {
      if (getNumDestinations() > 0) {
         Destination[] arr = getDestinationArr();
         for(int i=0; i<arr.length; i++) {
            SessionName sessionName = arr[i].getDestination();
            if (sessionName == null) {
              throw new XmlBlasterException(this.glob, ErrorCode.USER_PUBLISH, "PublishQosServer", "Invalid destination address, please check your PtP PublishQos");
            }
            if (sessionName.getNodeId() == null) {
               sessionName = new SessionName(glob, glob.getNodeId(), sessionName.getRelativeName());
               arr[i].setDestination(sessionName);
            }
         }
      }
   }
View Full Code Here

         map.put("/qos/queue/@index", ""+getQueueIndex());
         map.put("/qos/queue/@size", ""+getQueueSize());
         map.put("/qos/redeliver/text()", ""+getRedeliver());
      }

      SessionName sender = getSender();
      if (sender != null) {
         map.put("/qos/sender/text()", sender.toString());
      }
      map.put("/qos/expiration/@lifeTime", ""+getLifeTime());
      map.put("/qos/expiration/@remainingLife", ""+getRemainingLife());

      if (isPublish()) {
View Full Code Here

   public void subscriptionAdd(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 subscribe event on topic '" + oid + "' from '" + sessionName.getRelativeName() + "' to avoid recursion");
         return;
      }

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

      // "topic/hello/event/subscribe"
      String foundEvent = ContextNode.TOPIC_MARKER_TAG + ContextNode.SEP + oid + event;
      boolean found = true;
      if (this.topicSet != null) {
         if (!this.topicSet.contains(foundEvent)) {
            // "topic/*/event/subscribe"
            foundEvent = ContextNode.TOPIC_MARKER_TAG + ContextNode.SEP + "*" + event;
            if (!this.topicSet.contains(foundEvent)) {
               found = false;
            }
         }
      }
      /*
      if (found) {
         if (subscriptionInfo.isQuery() && wouldMatcheOurSysEventOid) {
            log.info("Ignoring XPATH subscribe event on topic '" + oid + "' from '" + sessionName.getRelativeName() + "' to avoid recursion");
            return;
         }
      }
      */
      if (!found) {
         if (this.clientSet == null) return;
         if (!this.clientSet.contains(foundEvent)) {
            // "client/joe/session/*/event/subscribe"
            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/subscribe"
               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

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.