Package org.xmlBlaster.authentication

Examples of org.xmlBlaster.authentication.SessionInfo


    */
   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;
               }
            }
         }
      }

      try {
         String summary = "unSubscribe of client "
             + sessionInfo.getSessionName().getAbsoluteName()
             + " on topic " + url;
         String description = subscriptionInfo.toXml();
         String eventType = foundEvent;
         String errorCode = null;

View Full Code Here


         }

         if (this.publishDestinationHelper != null) {
            ClientProperty[] clientProperties = null;
            if (newState == ConnectionStateEnum.ALIVE) {
               SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
               if (sessionInfo != null) {
                  clientProperties = sessionInfo.getRemotePropertyArr();
                  ArrayList list = new ArrayList();
                  for (int i=0; i<clientProperties.length; i++)
                    list.add(clientProperties[i]);
                  list.add(new ClientProperty("_DispatchStatistic",
                      Constants.TYPE_STRING,
View Full Code Here

         }

         if (this.publishDestinationHelper != null) {
            ClientProperty[] clientProperties = null;
            if (newState == ConnectionStateEnum.ALIVE) {
               SessionInfo sessionInfo = this.requestBroker.getAuthenticate().getSessionInfo(sessionName);
               if (sessionInfo != null) {
                  clientProperties = sessionInfo.getRemotePropertyArr();
                  ArrayList list = new ArrayList();
                  for (int i = 0; i < clientProperties.length; i++)
                     list.add(clientProperties[i]);
                  list.add(new ClientProperty("_DispatchStatistic", Constants.TYPE_STRING, Constants.ENCODING_NONE,
                        ((XmlBlasterAccess) connection).getDispatchStatistic().toXml("")));
View Full Code Here

         if (xmlKey.isRemoteProperties()) { // "__sys__remoteProperties"
            // Example usage
            //java javaclients.HelloWorldPublish -oid __sys__remoteProperties -connect/qos/clientProperty[__remoteProperties] true -connect/qos/clientProperty[myProperty] AAAAAA -session.name OTHER/1
            //java javaclients.HelloWorldGet -clientProperty[__sessionName] OTHER/1 -oid __sys__remoteProperties
            String sessionName = getQos.getData().getClientProperty("__sessionName", (String)null);
            SessionInfo otherSessionInfo = (sessionName == null) ? sessionInfo : getAuthenticate().getSessionInfo(new SessionName(glob, sessionName));
            if (otherSessionInfo == null) {
              log.warning(xmlKey.getOid() + " failed, sessionName not known: " + sessionName);
              return new MsgUnit[0];
            }
            //if (sessionName != null) getQos.getData().getClientProperties().remove("__sessionName");
            String prefix = getQos.getData().getClientProperty("__prefix", (String)null);
            //if (prefix != null) publishQos.getData().getClientProperties().remove("__prefix");
            if (log.isLoggable(Level.FINE)) log.fine("Get " + xmlKey.getOid() + " prefix=" + prefix + " on session=" + otherSessionInfo.getSessionName().getRelativeName());
            ClientProperty[] props = otherSessionInfo.getRemotePropertyArr();
            GetReturnQosServer retQos = new GetReturnQosServer(glob, null, null);
            for (int i=0; i<props.length; i++)
               retQos.getData().getClientProperties().put(props[i].getName(), props[i]);
            MsgUnit[] msgUnitArr = new MsgUnit[1];
            GetKey gk = new GetKey(glob, xmlKey.getOid());
View Full Code Here

    *        false The callee is a subscribe() thread from a client
    */
   private void subscribeToOid(SubscriptionInfo subs, boolean calleeIsXPathMatchCheck) throws XmlBlasterException {
      if (log.isLoggable(Level.FINER)) log.finer("Entering subscribeToOid(subId="+subs.getSubscriptionId()+", oid="+subs.getKeyData().getOid()+", queryType="+subs.getKeyData().getQueryType()+") ...");
      String uniqueKey = subs.getKeyData().getOid();
      SessionInfo publisherSessionInfo = null; // subs.getSessionInfo() is the wrong one
      TopicHandler topicHandler = this.glob.getTopicAccessor().findOrCreate(publisherSessionInfo, uniqueKey);
      try {
         subs.incrSubscribeCounter();

         fireSubscribeEvent(subs)// inform all listeners about this new subscription
View Full Code Here

            }
            if (glob.useCluster() && otherSessionName != null && otherSessionName.getNodeId() != null && !glob.getNodeId().equals(otherSessionName.getNodeId())) {
               isForOtherClusterNode = true; // TODO: Create a PtP destination which routes to node
            }
            if (!isForOtherClusterNode) {
               SessionInfo otherSessionInfo = (otherSessionName == null) ? sessionInfo : getAuthenticate().getSessionInfo(otherSessionName);
               if (otherSessionInfo == null) {
                  if ("clearLastError".equals(command) || "clearLastWarning".equals(command)) {
                     otherSessionInfo = sessionInfo; // global action, just use the login sessionInf
                  }
                  else {
                     log.warning(msgKeyData.getOid() + " failed, sessionName not known: " + (otherSessionName == null ? "" : otherSessionName.getAbsoluteName()));
                     return Constants.RET_WARN;
                  }
               }
               if (__sessionNameStr != null) publishQos.getData().getClientProperties().remove("__sessionName");
               String prefix = publishQos.getData().getClientProperty("__prefix", (String)null);
               if (prefix != null) publishQos.getData().getClientProperties().remove("__prefix");
               if (log.isLoggable(Level.FINE)) log.fine("Processing " + msgKeyData.getOid() + " command=" + str + " on session=" + otherSessionInfo.getSessionName().getRelativeName());
               if ("set".equals(command)) {
                  otherSessionInfo.setRemoteProperties(publishQos.getData().getClientProperties());
               }
               else if ("clearLastError".equals(command)) {
                  clearLastError();
               }
               else if ("clearLastWarning".equals(command)) {
                  clearLastWarning();
               }
               else if ("clear".equals(command)) {
                  otherSessionInfo.clearRemoteProperties(prefix);
               }
               else // "merge"
                  otherSessionInfo.mergeRemoteProperties(publishQos.getData().getClientProperties());
               I_RemotePropertiesListener[] arr = getRemotePropertiesListenerArr();
               for (int i=0; i<arr.length; i++)
                  arr[i].update(otherSessionInfo, publishQos.getData().getClientProperties());
               return Constants.RET_OK;
            }
View Full Code Here

    *    &lt;/key>
    * </pre>
    */
   public void sessionAdded(ClientEvent e) throws XmlBlasterException
   {
      SessionInfo sessionInfo = e.getSessionInfo();
      if (log.isLoggable(Level.FINE)) log.fine("Login event for client " + sessionInfo.toString());

      this.glob.sendNotification(this, "Client '" + sessionInfo.getSessionName().getAbsoluteName() + "' logged in",
         "clientNew", "java.lang.String", "", sessionInfo.getSessionName().getAbsoluteName());

      if (this.publishLoginEvent) {
         this.publishQosLoginEvent.clearRoutes();
         MsgQosData msgQosData = (MsgQosData)this.publishQosLoginEvent.getData().clone();
         // __sessionId is deprecated, please use __publicSessionId
         msgQosData.addClientProperty("__sessionId", sessionInfo.getPublicSessionId());
         msgQosData.addClientProperty("__publicSessionId", sessionInfo.getPublicSessionId());
         msgQosData.addClientProperty("__absoluteName", sessionInfo.getSessionName().getAbsoluteName());

         MsgUnit msgUnit = new MsgUnit(this.xmlKeyLoginEvent,
                                  sessionInfo.getLoginName().getBytes(),
                                  msgQosData);
         publish(this.unsecureSessionInfo, msgUnit); // publish that this client has logged in
         this.publishQosLoginEvent.getData().setTopicProperty(null); // only the first publish needs to configure the topic
      }

      if (log.isLoggable(Level.FINE)) log.fine(" client added:"+sessionInfo.getLoginName());
   }
View Full Code Here

    *    &lt;/key>
    * </pre>
    */
   public void sessionRemoved(ClientEvent e) throws XmlBlasterException
   {
      SessionInfo sessionInfo = e.getSessionInfo();

      this.glob.sendNotification(this, "Client '" + sessionInfo.getSessionName().getAbsoluteName() + "' logged out",
         "clientRemoved", "java.lang.String", sessionInfo.getSessionName().getAbsoluteName(), "");

      if (this.publishLogoutEvent) {
         if (log.isLoggable(Level.FINE)) log.fine("Logout event for client " + sessionInfo.toString());
         this.publishQosLogoutEvent.clearRoutes();

         MsgQosData msgQosData = (MsgQosData)this.publishQosLogoutEvent.getData().clone();
         // __sessionId is deprecated, please use __publicSessionId
         msgQosData.addClientProperty("__sessionId", sessionInfo.getPublicSessionId());
         msgQosData.addClientProperty("__publicSessionId", sessionInfo.getPublicSessionId());
         msgQosData.addClientProperty("__absoluteName", sessionInfo.getSessionName().getAbsoluteName());

         MsgUnit msgUnit = new MsgUnit(this.xmlKeyLogoutEvent, sessionInfo.getLoginName().getBytes(), msgQosData);
         publish(this.unsecureSessionInfo, msgUnit); // publish that this client logged out
         this.publishQosLogoutEvent.getData().setTopicProperty(null); // only the first publish needs to configure the topic
      }

      if (log.isLoggable(Level.FINE)) log.fine("Client session '" + sessionInfo.getId() + "' removed");
   }
View Full Code Here

   public String[] getAliveCallbackClients() {
      SessionInfo[] arr = this.authenticate.getSessionInfoArr();
      if (arr == null || arr.length == 0) return new String[0];
      ArrayList list = new ArrayList(arr.length);
      for (int i=0; i<arr.length; i++) {
         SessionInfo info = arr[i];
         org.xmlBlaster.util.dispatch.DispatchManager manager = info.getDispatchManager();
         if (manager != null && manager.getDispatchConnectionsHandler().isAlive()) {
            list.add(info.getSessionName().getAbsoluteName());
         }
      }
      return (String[])list.toArray(new String[list.size()]);
   }
View Full Code Here

                           //final long refId = callbackEntry.getMsgUnitWrapperUniqueId();
                           // TODO: extract if negative sessionId
                           SessionName sessionName = callbackEntry.getReceiver();
                           long publicSessionId = sessionName.getPublicSessionId();
                           if (publicSessionId < 0) {
                              SessionInfo sessionInfo = authenticate.getSessionInfoByName(sessionName);
                              if (sessionInfo == null) {
                                 leakedEntries.add(ent);
                                 out.write(("Found leak entry '" + ent.getLogId() + "' of unknown session " + sessionName.getAbsoluteName() + "\n").getBytes());
                              }
                           }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.authentication.SessionInfo

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.