Package org.xmlBlaster.engine.xml2java

Examples of org.xmlBlaster.engine.xml2java.XmlKey


      }
     
      // The following checks run for each MsgUnit key (not the immutable TopicHandler key)

      // Now check if we are master
      XmlKey xmlKey = new XmlKey(glob, msgUnit.getKeyData());
      for (int ii=0; ii<keyMappings.length; ii++) {
         QueryKeyData keyMapping = keyMappings[ii];
         /*
         if (ii==0) {
            // Try to find the DOM parsed XmlKey object:
            TopicHandler topicHandler = this.glob.getTopicAccessor().access(msgUnit.getKeyOid());
            try {
               if (topicHandler != null && topicHandler.hasXmlKey()) {
                  xmlKey = topicHandler.getXmlKey();
               }
               else {
                  xmlKey = new XmlKey(glob, msgUnit.getKeyData());
               }
            }
            finally {
               if (topicHandler != null) this.glob.getTopicAccessor().release(topicHandler);
            }
         }
         */
        
         if (keyMapping.isDomain() && !msgUnit.hasDomain()) {
            if (nodeMasterInfo.getClusterNode().isLocalNode()) {
               if (nodeMasterInfo.isAcceptDefault()==true) {
                  // if no domain is specified and the local node accepts default messages -> local node is master
                  if (log.isLoggable(Level.FINE)) log.fine("Message oid='" + msgUnit.getKeyOid() + "' domain='" + xmlKey.getDomain() + "' is handled by local node");
                  AccessFilterQos[] filterQos = keyMapping.getAccessFilterArr();
                  if (filterQos != null && filterQos.length > 0) {
                     log.warning("<filter> additional check is not implemented: " + keyMapping.toXml());
                  }
                  return nodeMasterInfo; // Found the master nodeMasterInfo.getClusterNode();
               }
            }
            else {
               if (nodeMasterInfo.isAcceptOtherDefault()==true) {
                  log.info("Found master='" + nodeMasterInfo.getNodeId().getId() + "' for message oid='" + msgUnit.getKeyOid() + "' which accepts other default domains");
                  AccessFilterQos[] filterQos = keyMapping.getAccessFilterArr();
                  if (filterQos != null && filterQos.length > 0) {
                     log.warning("<filter> additional check is not implemented: " + keyMapping.toXml());
                  }
                  return nodeMasterInfo; // Found the master nodeMasterInfo.getClusterNode();
               }
            }
         }
        
         // TODO: If filter has a prepared query cache switched on,
         // we should go over the TopicHandlerAccessor to force single threaded match() access
         if (xmlKey.match(keyMapping)) {
            if (log.isLoggable(Level.FINE)) log.fine("Found master='" + nodeMasterInfo.getNodeId().getId() +
                           "' stratum=" + nodeMasterInfo.getStratum() + " for message '" + msgUnit.getLogId() +
                           "' domain='" + xmlKey.getDomain() + "'.");
            AccessFilterQos[] filterQos = keyMapping.getAccessFilterArr();
            if (filterQos != null && filterQos.length > 0) {
               if (log.isLoggable(Level.FINE)) log.fine("Found " + filterQos.length + " key specific filter rules in XmlKey ...");
               for (int jj=0; jj<filterQos.length; jj++) {
                  I_AccessFilter filter = glob.getRequestBroker().getAccessPluginManager().getAccessFilter(
View Full Code Here


   public final XmlKey getXmlKey() throws XmlBlasterException {
      if (this.msgKeyData == null) { // isUnconfigured()) {
         throw new XmlBlasterException(serverScope, ErrorCode.INTERNAL_UNKNOWN, getId(), "In state '" + getStateStr() + "' no XmlKey object is available");
      }
      if (this.xmlKey == null) {  // expensive DOM parse
         this.xmlKey = new XmlKey(serverScope, this.msgKeyData);
      }
      return this.xmlKey;
   }
View Full Code Here

      */

      // Do a log.warning if topic meta XML is different
      if (!clientTagLog) {
         try {
            XmlKey xmlKey = this.xmlKey;
            if (xmlKey != null) {
               String newTags = msgKeyData.getClientTags();
               if (newTags != null && newTags.length() > 0) {
                  String oldTags = ((MsgKeyData)xmlKey.getKeyData()).getClientTags();
                  if (!newTags.equals(oldTags)) {
                     log.warning(ME+": Changing topic meta information from '" + oldTags + "' to '" + newTags + "' is not supported and this change is ignored, please check your publisher.");
                     clientTagLog = true;
                  }
               }
View Full Code Here

                                  throws XmlBlasterException
   {
      if (log.isLoggable(Level.FINER)) log.finer("checkExistingSubscriptions(" + topicHandler.getUniqueKey() + "), should happen only once for each topic.");

      if (topicHandler.hasDomTree()) {  // A topic may suppress XPATH visibility
         XmlKey keyDom = topicHandler.getXmlKey()// This is DOM parsed already

         if (log.isLoggable(Level.FINE)) log.fine("Checking existing query subscriptions if they match with this new one");

         Set set = clientSubscriptions.getQuerySubscribeRequestsSet();
         Vector matchingSubsVec = new Vector();
         synchronized (set) {
            Iterator iterator = set.iterator();
            // for every XPath subscription ...
            while (iterator.hasNext()) {

               SubscriptionInfo existingQuerySubscription = (SubscriptionInfo)iterator.next();
               KeyData queryXmlKey = existingQuerySubscription.getKeyData();
               if (!queryXmlKey.isXPath()) { // query: subscription without a given oid
                  log.warning("Only XPath queries are supported, ignoring subscription.");
                  continue;
               }
               String xpath = ((QueryKeyData)queryXmlKey).getQueryString();

               // ... check if the new message matches ...
               if (keyDom.match(xpath) == true) {
                  SubscriptionInfo subs = new SubscriptionInfo(glob, existingQuerySubscription.getSessionInfo(),
                                                existingQuerySubscription, keyDom.getKeyData());
                  existingQuerySubscription.addSubscription(subs);
                  matchingSubsVec.addElement(subs);
               }
            }
         }

         // now after closing the synchronized block, me may fire the events
         // doing it inside the synchronized could cause a deadlock
         for (int ii=0; ii<matchingSubsVec.size(); ii++) {
            subscribeToOid((SubscriptionInfo)matchingSubsVec.elementAt(ii), true);    // fires event for subscription
         }

         // we don't need this DOM tree anymore ...
         keyDom.cleanupMatch();
      }
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.engine.xml2java.XmlKey

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.