Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.MsgUnit.toXml()


      String xmlQos_literal = FileLocator.readAsciiFile(this.path, fileName + this.XMLQOS_TOKEN);

      msgUnit = new MsgUnit(glob, xmlKey_literal, content, xmlQos_literal);

      if (log.isLoggable(Level.FINE)) log.fine("Successfully fetched message " + fileName);
      if (log.isLoggable(Level.FINEST)) log.finest("Successfully fetched message\n" + msgUnit.toXml());

      return msgUnit;
   }

   /**
 
View Full Code Here


   }

   public final void embeddedObjectToXml(java.io.OutputStream out, java.util.Properties props) throws java.io.IOException {
      MsgUnit msgUnit = getMsgUnitOrNull();
      if (msgUnit != null) // TODO: Messages with no meat can't be loaded again by ServerEntryFactory
         msgUnit.toXml(out, props);
   }
  
   /**
    * Returns a shallow clone
    */
 
View Full Code Here

      sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      sb.append("\n<").append(rootTag).append(">");
      if (comment != null && comment.length() > 0) sb.append("\n<!-- " + comment + " -->");
      for (int i=0; i<msgUnitArr.length; i++) {
         MsgUnit msgUnit = msgUnitArr[i];
         String xml = msgUnit.toXml((String)null, (Properties)null);
         sb.append("\n <").append(msgUnit.getMethodName().toString()).append(">");
         sb.append(xml);
         sb.append("\n </").append(msgUnit.getMethodName().toString()).append(">");
      }
      sb.append("\n</").append(rootTag).append(">");
View Full Code Here

         if (MethodName.PUBLISH.equals(methodName)) {
            MsgUnit msgUnit = buildMsgUnit();
            if (this.msgUnitCb != null) {
               this.msgUnitCb.intercept(msgUnit);
            }
            if (log.isLoggable(Level.FINE)) XmlScriptClient.log.fine("appendEndOfElement publish: " + msgUnit.toXml());
            PublishReturnQos ret = this.access.publish(msgUnit);
            writeResponse(methodName, (ret != null)?ret.toXml("  "):null);
            return true;
         }
         if (MethodName.PUBLISH_ARR.equals(methodName)) {
View Full Code Here

         PublishKey pk = new PublishKey(glob, publishOid, "text/xml", "1.0");
         PublishQos pq = new PublishQos(glob);
         MsgUnit msgUnit = new MsgUnit(pk, content, pq);
         PublishReturnQos publishReturnQos = con.publish(msgUnit);
         assertEquals("Retunred oid is invalid", publishOid, publishReturnQos.getKeyOid());
         log.info("Sending of '" + content + "' done, returned oid=" + publishOid + " " + msgUnit.toXml());
         return publishReturnQos;
      } catch(XmlBlasterException e) {
         log.severe("publish() XmlBlasterException: " + e.getMessage());
         assertTrue("publish - XmlBlasterException: " + e.getMessage(), false);
      }
View Full Code Here

         try { maxContentLen = new Integer((String)props.get("maxContentLen")).intValue(); } catch(NumberFormatException e) {}
      }
      */
      MsgUnit msgUnit = getMsgUnit();
      if (msgUnit != null)
         msgUnit.toXml(out, props);
   }

   /**
    * Dumps the message.
    * NOTE: max 80 bytes of the content are displayed
View Full Code Here

   }

   public final void embeddedObjectToXml(java.io.OutputStream out, java.util.Properties props) throws java.io.IOException {
      MsgUnit msgUnit = this.msgUnit;
      if (msgUnit != null)
         msgUnit.toXml(out, props);
   }

   /**
    * Returns a shallow clone
    */
 
View Full Code Here

            for (int ii=0; ii<msgs.length; ii++) {
               MsgUnit msg = msgs[ii];
               if ("text/plain".equalsIgnoreCase(msg.getKeyData().getContentMime()))
                  sb./*append(msg.getKey()).append("=").*/append(msg.getContentStr()).append(CRLF);
               else
                  sb.append(msg.toXml());
            }
            return sb.toString() + CRLF;
         }
         else if (cmdType.equalsIgnoreCase("SET")) {
            SetReturn ret = commandManager.set(this.addressServer, sessionId, query);
View Full Code Here

            log.info("Hit a key to publish '" + oid + "'");
            try { System.in.read(); } catch(java.io.IOException e) {}
            MsgUnit msgUnit = new MsgUnit(glob, "<key oid='"+oid+"'/>", "Hi".getBytes(), "<qos><persistent>true</persistent></qos>");
            PublishReturnQos publishReturnQos = xmlBlasterAccess.publish(msgUnit);
            log.info("Successfully published message to xmlBlaster, msg=" + msgUnit.toXml() + "\n returned QoS=" + publishReturnQos.toXml());
            try { Thread.sleep(1000L); } catch( InterruptedException i) {} // wait for update

            {
               log.info("Hit a key to 3 times publishOneway '" + oid + "'");
               try { System.in.read(); } catch(java.io.IOException e) {}
View Full Code Here

            log.info("Hit a key to publish #" + (ii+1) + "/" + numPublish);
            try { System.in.read(); } catch(java.io.IOException e) {}

            MsgUnit msgUnit = new MsgUnit(glob, "<key oid=''/>", ("Hi #"+(ii+1)).getBytes(), "<qos><persistent>true</persistent></qos>");
            PublishReturnQos publishReturnQos = xmlBlasterAccess.publish(msgUnit);
            log.info("Successfully published message #" + (ii+1) + " to xmlBlaster, msg=" + msgUnit.toXml() + "\n returned QoS=" + publishReturnQos.toXml());
         }

         log.info("Hit a key to disconnect ...");
         try { System.in.read(); } catch(java.io.IOException e) {}
         xmlBlasterAccess.disconnect(null);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.