Package org.xmlBlaster.engine.admin

Examples of org.xmlBlaster.engine.admin.I_AdminSession


         throw new Exception("prepareForRequest: could not retreive the Authenticator object. Can not continue.");
      SessionName sessionName = new SessionName(this.global, sessionId);
      I_AdminSubject subject = auth.getSubjectInfoByName(sessionName);
      if (subject == null)
         throw new Exception("prepareForRequest: no subject (slave) found with the session name '" + sessionId + "'");
      I_AdminSession session = subject.getSessionByPubSessionId(sessionName.getPublicSessionId());
      if (session == null)
         throw new Exception("prepareForRequest: no session '" + sessionId + "' found. Valid sessions for this user are '" + subject.getSessionList() + "'");
      return session;
   }
View Full Code Here


      if (this.statusTopic != null)
         sendStatusInformation("dbInitStart");
      final boolean doPersist = true;
      doPause(doPersist); // stop the dispatcher
     
      I_AdminSession session = getSession();
      // first unsubscribe (in case it did already an initial update previously, this is needed to remove the subscription
      // (and thereby its outdate subscription qos from persistence). On a back replication, i.e. where you have more than
      // one sources you don't want to do this.
      if (individualInfo.getBoolean("replication.forceNewSubscription", true)) {
         try {
            session.unSubscribe(this.dataTopic, "");
         }
         catch (Throwable ex) {
         }
      }
     
      SubscribeQos subQos = new SubscribeQos(this.global);
      subQos.setMultiSubscribe(false);
      subQos.setWantInitialUpdate(false);
      subQos.setPersistent(true);
      // this fills the client properties with the contents of the individualInfo object.
      new ClientPropertiesInfo(subQos.getData().getClientProperties(), individualInfo);
      session.subscribe(this.dataTopic, subQos.toXml());
      synchronized(this.initSync) {
         setStatus(STATUS_INITIAL);
      }
   }
View Full Code Here

         return false;
      }
   }
  
   public final boolean setDispatcher(boolean status, boolean doPersist) throws Exception {
      I_AdminSession session = getSession();
      session.setDispatcherActive(status);
      if (doPersist)
         this.persistentInfo.put(this.slaveSessionId + ".dispatcher", "" + status);
      // to speed up refresh on monitor
      this.dispatcherActive = session.getDispatcherActive();
      if (this.dispatcherActive)
         changeLastMessage(null); // clear the exceptions (and last messages)
      return this.dispatcherActive;
   }
View Full Code Here

    * @see org.xmlBlaster.contrib.replication.ReplSlaveMBean#toggleActive()
    * @return the actual state.
    */
   public boolean toggleActive() throws Exception {
      synchronized(this.initSync) {
         I_AdminSession session = getSession();
         final boolean doPersist = true;
         boolean ret = setDispatcher(!session.getDispatcherActive(), doPersist);
         if (!ret)
            changeLastMessage("Dispatcher stopped manually by Admin");
         return ret;
      }
   }
View Full Code Here

    * The cancelUpdate is invoked asynchronously to avoid log blocking of the monitor
    * when the cancel operation is going on.
    */
   private void cancelUpdateAsyncPart() {
      try {
         I_AdminSession session = getSession();
         long clearedMsg = session.clearCallbackQueue();
         log.info("clearing of callback queue: '" + clearedMsg + "' where removed since a cancel request was done");

         // sending the cancel op to the DbWatcher
         log.info(this.name + " sends now a cancel request to the Master '" + this.dbWatcherSessionName + "'");
         I_XmlBlasterAccess conn = this.global.getXmlBlasterAccess();
View Full Code Here

   public synchronized void checkStatus() {
      if (this.replPrefix == null)
         return;
      log.finest("invoked for '" + this.sessionName + "'");
      I_AdminSession session = null;
      try {
         session = getSession();
      }
      catch (Exception ex) {
         log.severe("an exception occured when retieving the session for '" + this.sessionName + "':" + ex.getMessage());
         ex.printStackTrace();
         return;
      }

      try {
         this.cbQueueEntries = session.getCbQueueNumMsgs();
         // this.messageSeq,
         long[] transactionCountBeforeQueue = this.manager.getCurrentTransactionCount(this.replPrefix);
         // check if the numbers in the queue are correct and fix it
         long pubSubQueueEntries = 0L;
         long maxTransSeq = transactionCountBeforeQueue[0];
         if (transactionSeq == null) // then it is too early
            return;
         for (int i=0; i < this.transactionSeq.length; i++) {
            pubSubQueueEntries += (transactionCountBeforeQueue[i] - this.transactionSeq[i]);
            if (maxTransSeq < transactionCountBeforeQueue[i])
               maxTransSeq = transactionCountBeforeQueue[i];
         }
         this.queueEntries = pubSubQueueEntries + this.ptpQueueEntries;
         this.transactionSeqVisible = maxTransSeq - pubSubQueueEntries;

         if (this.queueEntries != 0 && session != null && session.getCbQueueNumMsgs() == 0) {
            log.warning("Detected wrong number of queue entries: correcting: ptp entries='" + this.ptpQueueEntries + "' total='" + this.queueEntries + "'");
            this.ptpQueueEntries = 0L;
            this.transactionSeq = (long[])transactionCountBeforeQueue.clone();
         }
      }
      catch (Exception ex) {
         log.severe("an exception occured when retieving the number of queue entries for '" + this.sessionName + "':" + ex.getMessage());
         ex.printStackTrace();
         this.queueEntries = -1L;
      }
     
      // isActive
      try {
         this.dispatcherActive = session.getDispatcherActive();
      }
      catch (Exception ex) {
         log.severe("an exception occured when retieving the status of the dispatcher for '" + this.sessionName + "':" + ex.getMessage());
         ex.printStackTrace();
         this.dispatcherActive = false;
      }
     
      try {
         I_AdminSession masterSession = this.manager.getMasterSession(this.replPrefix);
         if (masterSession != null) {
            if (masterSession.isStalled())
               this.masterConn = CONN_STALLED;
            else if (masterSession.getConnectionState().equals(ConnectionStateEnum.ALIVE.toString()))
               this.masterConn = CONN_CONNECTED;
            else
               this.masterConn = CONN_DISCONNECTED;
         }
         else {
View Full Code Here

   }

   // @see org.xmlBlaster.util.dispatch.I_ConnectionStatusListener#toPolling(org.xmlBlaster.util.dispatch.DispatchManager, org.xmlBlaster.util.dispatch.ConnectionStateEnum)
   public void toPolling(DispatchManager dispatchManager, ConnectionStateEnum oldState) {
      try {
         I_AdminSession receiver = ((ServerScope)glob).getAuthenticate().getSubjectInfoByName(dispatchManager.getSessionName()).getSessionByPubSessionId(dispatchManager.getSessionName().getPublicSessionId());
         String[] subIds = receiver.getSubscriptions();
         if (log.isLoggable(Level.FINE))
            log.fine(receiver.getLoginName() + "/" + receiver.getPublicSessionId() + " toPolling, removing " + subIds.length + " subscriptions");
         for (int i=0; i<subIds.length; i++) {
            receiver.unSubscribe(Constants.SUBSCRIPTIONID_URL_PREFIX+subIds[i], null);
         }
      } catch (Throwable e) {
         e.printStackTrace();
      }
   }
View Full Code Here

         if (sessionAttr == null || sessionAttr.length() < 1 || sessionAttr.startsWith("?")==false)
            throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Please pass a command which has a valid session attribute in '" + cmd.getCommand() + "'.");

         if (sessionAttr.startsWith("?")) {
            // for example "client/joe/ses17/?queue/callback/maxEntries"
            I_AdminSession sessionInfo = subjectInfo.getSessionByPubSessionId(Long.parseLong(pubSessionId));
            if (sessionInfo == null)
               throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "The public session ID '" + pubSessionId + "' in '" + cmd.getCommand() + "' is unknown.");
            return doGetInvoke(cmd, sessionAttr.substring(1), sessionInfo, I_AdminSession.class);
         }
      }
View Full Code Here

      if (sessionAttr == null || sessionAttr.length() < 1 || sessionAttr.startsWith("?")==false)
         throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "Please pass a command which has a valid session attribute in '" + cmd.getCommand() + "'.");

      if (sessionAttr.startsWith("?")) {
         // for example "client/joe/ses17/?queue/callback/maxEntries"
         I_AdminSession sessionInfo = subjectInfo.getSessionByPubSessionId(Long.parseLong(pubSessionId));
         if (sessionInfo == null)
            throw new XmlBlasterException(glob, ErrorCode.USER_ILLEGALARGUMENT, ME, "The public session ID '" + pubSessionId + "' in '" + cmd.getCommand() + "' is unknown.");
         /*String ret = ""+*/setInvoke(cmd.getKey(), sessionInfo, I_AdminSession.class, cmd.getArgs());
         log.info("Set " + cmd.getCommandStripAssign() + "=" + cmd.getArgsString());
         return cmd.getArgsString();
View Full Code Here

         //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;
View Full Code Here

TOP

Related Classes of org.xmlBlaster.engine.admin.I_AdminSession

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.