Package org.xmlBlaster.util.context

Examples of org.xmlBlaster.util.context.ContextNode


           "-/node/heron/logging/org.xmlBlaster.engine.level", "FINE"
      };
     
      Global glob = new Global(args);

      ContextNode ctx = ContextNode.valueOf("/node/heron");
      Map props = glob.getProperty().getPropertiesForContextNode(ctx, "logging", "__default");
     
      assertEquals("Number of entries found", 2, props.size());
   }
View Full Code Here


      getMBeanServer(); // Initialize this.mbeanServer
      init();
      if (useJmx > 0) {
         // Export Global.getProperty() to JMX
         this.jmxProperties = new JmxProperties(this.glob);
         ContextNode propNode = new ContextNode(ContextNode.SYSPROP_MARKER_TAG, null, this.glob.getContextNode());
         this.jmxPropertiesHandle = registerMBean(propNode, jmxProperties); // "sysprop"

         this.jmxLogLevel = new JmxLogLevel(this.glob);
         ContextNode logNode = new ContextNode(ContextNode.LOGGING_MARKER_TAG, null, this.glob.getContextNode());
         this.jmxLogLevelHandle = registerMBean(logNode, jmxLogLevel); // "logging"
      }

      if (useJmx > 0 && this.mbeanServer != null) {
         // display some statistics ...
View Full Code Here

            if (mbeanHandle == null) {
               log.severe("Internal problem: Can't find registration of MBean '" + tmp.toString() + "'");
               continue;
            }
            // /node/heron/connection/joe/session/2
            ContextNode newRoot = ContextNode.valueOf(newRootName);

            // /node/clientjoe1/service/Pop3Driver
            ContextNode current = ContextNode.valueOf(tmp.toString());
            if (current == null) continue;

            // /node/clientjoe1
            ContextNode parent = current.getParent(oldRootClassname);
            if (parent == null) continue;

            // service/Pop3Driver
            ContextNode[] childs = parent.getChildren();
            if (childs.length != 1) continue;

            this.mbeanServer.unregisterMBean(tmp);
            this.mbeanMap.remove(tmp.toString());

            // take this leg and attach it to the newRoot
            ContextNode result = newRoot.mergeChildTree(childs[0]);
            if (log.isLoggable(Level.FINE)) log.fine("Renamed '" + oldName + "' to '" + result.getAbsoluteName(ContextNode.SCHEMA_JMX) + "'");
            if (result != null) {
               registerMBean(result, mbeanHandle.getMBean(), mbeanHandle, true);
               this.mbeanMap.put(mbeanHandle.getObjectInstance().getObjectName().toString(), mbeanHandle);
            }
            else {
View Full Code Here

               log.severe("Internal problem: Can't find registration of MBean '" + tmp.toString() + "'");
               continue;
            }
            this.mbeanServer.unregisterMBean(tmp);
            this.mbeanMap.remove(tmp.toString());
            ContextNode renamed = ContextNode.valueOf(tmp.toString());
            renamed.changeParentName(classNameToChange, instanceName);
            if (log.isLoggable(Level.FINE)) log.fine("Renamed '" + oldName + "' to '" + renamed.getAbsoluteName(ContextNode.SCHEMA_JMX) + "'");
            registerMBean(renamed, mbeanHandle.getMBean(), mbeanHandle, true);
            this.mbeanMap.put(mbeanHandle.getObjectInstance().getObjectName().toString(), mbeanHandle);
            count++;
         }
         return count;
View Full Code Here

            .getObjectEntry(Constants.OBJECT_ENTRY_ServerScope);
      this.requestBroker = engineGlob.getRequestBroker();
      this.sessionInfo = requestBroker.getInternalSessionInfo();

      // For JMX instanceName may not contain ","
      this.contextNode = new ContextNode(ContextNode.SERVICE_MARKER_TAG,
            "EventPlugin[" + getType() + "]", this.engineGlob.getScopeContextNode());
      this.mbeanHandle = this.engineGlob.registerMBean(this.contextNode, this);

      this.eventTypes = this.glob.get("eventTypes", "", null,
            this.pluginConfig);
View Full Code Here

    * Called by timeout or by manual trigger (e.g. over jconsole)
    * @param eventType
    */
   protected void newHeartbeatNotification(String eventType) {
      try {
         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

      if (nodeId == null) return;
      if (nodeId.indexOf("/") == -1) nodeId = "/node/"+nodeId; // add CLUSTER_MARKER_TAG to e.g. "/node/avalon.mycomp.com"

      String oldClusterObjectName = "";      // e.g. "org.xmlBlaster:nodeClass=node,node=clientSUB1"
      String oldServerNodeInstanceName = ""; // e.g. "clientSUB1"
      ContextNode clusterContext = null;
      if (this.contextNode != null) {
         // same instance as glob.getContextNode():
         clusterContext = this.contextNode.getParent(ContextNode.CLUSTER_MARKER_TAG);
         oldServerNodeInstanceName = clusterContext.getInstanceName();
         oldClusterObjectName = clusterContext.getAbsoluteName(ContextNode.SCHEMA_JMX);
      }

      // Verify the publicSessionId ...
      try {
         if (this.mbeanHandle != null && this.jmxPublicSessionId != getPublicSessionId()) {
            /*int count = */this.glob.getJmxWrapper().renameMBean(this.mbeanHandle.getObjectInstance().getObjectName().toString(),
                           ContextNode.SESSION_MARKER_TAG, ""+getPublicSessionId());
            this.mbeanHandle.getContextNode().setInstanceName(""+getPublicSessionId());
            this.jmxPublicSessionId = getPublicSessionId();
         }
         if (this.mbeanHandle == null &&
             this.contextNode != null &&
             !this.contextNode.getInstanceName().equals(""+getPublicSessionId())) {
            this.contextNode.setInstanceName(""+getPublicSessionId());
         }
      }
      catch (XmlBlasterException e) {
         log.warning(getLogId()+"Ignoring problem during JMX session registration: " + e.toString());
      }

      // parse new cluster node name ...
      ContextNode tmp = ContextNode.valueOf(nodeId);
      ContextNode tmpClusterContext = (tmp==null)?null:tmp.getParent(ContextNode.CLUSTER_MARKER_TAG);
      if (tmpClusterContext == null) {
         log.severe(getLogId()+"Ignoring unknown serverNodeId '" + nodeId + "'");
         return;
      }
      String newServerNodeInstanceName = tmpClusterContext.getInstanceName(); // e.g. "heron"

      if (oldServerNodeInstanceName.equals(newServerNodeInstanceName)) {
         return; // nothing to do, same cluster name
      }

      this.glob.getContextNode().setInstanceName(newServerNodeInstanceName);
      if (clusterContext == null) {
         clusterContext = this.glob.getContextNode();
         String ln = getLoginName();
         if (ln != null && ln.length() > 0) {
            String instanceName = this.glob.validateJmxValue(ln);
            ContextNode contextNodeSubject = new ContextNode(ContextNode.CONNECTION_MARKER_TAG, instanceName, clusterContext);
            this.contextNode = new ContextNode(ContextNode.SESSION_MARKER_TAG, ""+getPublicSessionId(), contextNodeSubject);
         }
      }
      else {
         clusterContext.setInstanceName(newServerNodeInstanceName);
      }
View Full Code Here

   public MsgUnit[] receive(String oid, int maxEntries, long timeout, boolean consumable) throws XmlBlasterException {
      if (oid == null || oid.length() == 0)
         throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Please supply a valid oid to receive()");

      ContextNode node = ContextNode.valueOf(oid);
      if (node == null) {
         throw new IllegalArgumentException("Can't parse '" + oid + "' to a ContextNode");
      }
      if (node.isOfClass(ContextNode.SESSION_MARKER_TAG))
         node = node.getParent();
      if (node == null) {
         throw new IllegalArgumentException("Can't parse '" + oid + "' to a ContextNode");
      }
      if (node.isOfClass(ContextNode.TOPIC_MARKER_TAG))
         oid = "__cmd:"+oid+"/?historyQueueEntries"; // "__cmd:topic/hello/?historyQueueEntries"
      else if (node.isOfClass(ContextNode.SUBJECT_MARKER_TAG) && node.getChild(ContextNode.SESSION_MARKER_TAG, null) != null)
            oid = "__cmd:"+oid+"/?callbackQueueEntries"; // "__cmd:client/joe/session/1/?callbackQueueEntries";
      else if (node.isOfClass(ContextNode.SUBJECT_MARKER_TAG))
            oid = "__cmd:"+oid+"/?subjectQueueEntries"; // "__cmd:client/joe/?subjectQueueEntries"

      GetKey getKey = new GetKey(glob, oid);
      String qos = "<qos>" +
                   "<querySpec type='QueueQuery'>" +
View Full Code Here

         log.severe(ME+": Didn't expect a session name for a subject: " + this.subjectName.toXml());
         Thread.dumpStack();
      }

      String instanceName = this.glob.validateJmxValue(this.subjectName.getLoginName());
      this.contextNode = new ContextNode(ContextNode.SUBJECT_MARKER_TAG, instanceName,
                                       this.glob.getContextNode());

      this.ME = this.instanceId + "-" + this.subjectName.getAbsoluteName();
      this.dispatchStatistic = new DispatchStatistic();
View Full Code Here

      }
      this.sessionInfoProtector = new SessionInfoProtector(this);

      //this.id = ((prefix.length() < 1) ? "client/" : (prefix+"/client/")) + subjectInfo.getLoginName() + "/" + getPublicSessionId();

      this.contextNode = new ContextNode(ContextNode.SESSION_MARKER_TAG, ""+this.sessionName.getPublicSessionId(),
                                       subjectInfo.getContextNode());
      this.ME = this.instanceId + "-" + this.sessionName.getRelativeName();


      if (log.isLoggable(Level.FINER)) log.finer(ME+": Creating new SessionInfo " + instanceId + ": " + subjectInfo.toString());
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.context.ContextNode

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.