Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.MsgUnitRaw


   public void updateOneway(String cbSessionId, String updateKeyLiteral, byte[] content, String updateQosLiteral)
   {
      try {
         I_ClientPlugin secPlgn = getSecurityPlugin();
         if (secPlgn != null) {
            MsgUnitRaw in = new MsgUnitRaw(updateKeyLiteral, content, updateQosLiteral);
            CryptDataHolder dataHolder = new CryptDataHolder(MethodName.UPDATE_ONEWAY, in, null);
            MsgUnitRaw msg = secPlgn.importMessage(dataHolder);

            updateKeyLiteral = msg.getKey();
            content = msg.getContent();
            updateQosLiteral = msg.getQos();
         }

         UpdateKey updateKey = new UpdateKey(glob, updateKeyLiteral);
         UpdateQos updateQos = new UpdateQos(glob, updateQosLiteral);
         if (log.isLoggable(Level.FINE)) log.fine("Received message [" + updateKey.getOid() + "] from publisher " + updateQos.getSender());
View Full Code Here


      }
      if (log.isLoggable(Level.FINER)) log.finer("Receiving update of " + msgUnitArr.length + " messages ...");

      String[] retArr = new String[msgUnitArr.length];
      for (int ii=0; ii<msgUnitArr.length; ii++) {
         MsgUnitRaw msgUnit = msgUnitArr[ii];
         retArr[ii] = update(cbSessionId, msgUnit.getKey(), msgUnit.getContent(), msgUnit.getQos());
      }
      if (this.updateBulkAck && retArr.length > 1) {
         for (int i=0; i < retArr.length; i++) {
            if (!Constants.RET_OK.equals(retArr[i]) && !"OK".equals(retArr[i]))
               return new String[] { retArr[i] };
View Full Code Here

         return;
      }
      if (log.isLoggable(Level.FINER)) log.finer("Receiving updateOneway of " + msgUnitArr.length + " messages ...");

      for (int ii=0; ii<msgUnitArr.length; ii++) {
         MsgUnitRaw msgUnit = msgUnitArr[ii];
         updateOneway(cbSessionId, msgUnit.getKey(), msgUnit.getContent(), msgUnit.getQos());
      }
   }
View Full Code Here

   public final void addKeyAndQos(String key, String qos)
         throws XmlBlasterException {
      if (!msgVec.isEmpty())
         throw new IllegalArgumentException(ME
               + ".addKeyAndQos() may only be invoked once");
      MsgUnitRaw msg = new MsgUnitRaw(key, (byte[]) null, qos);
      msgVec.add(msg);
   }
View Full Code Here

   public final void addException(XmlBlasterException e)
         throws XmlBlasterException {
      if (!msgVec.isEmpty())
         throw new IllegalArgumentException(ME
               + ".addException() may only be invoked once");
      MsgUnitRaw msg = new MsgUnitRaw(e.getMessage(), e.toByteArr(), e
            .getErrorCodeStr());
      msgVec.add(msg);
   }
View Full Code Here

    */
   public final void addMessage(String qos) throws XmlBlasterException {
      if (!msgVec.isEmpty())
         throw new IllegalArgumentException(ME
               + ".addQos() may only be invoked once");
      MsgUnitRaw msg = new MsgUnitRaw(null, (byte[]) null, qos);
      msgVec.add(msg);
   }
View Full Code Here

   public final void addMessage(String[] qos) throws XmlBlasterException {
      if (!msgVec.isEmpty())
         throw new IllegalArgumentException(ME
               + ".addQos() may only be invoked once");
      for (int ii = 0; ii < qos.length; ii++) {
         MsgUnitRaw msg = new MsgUnitRaw(null, (byte[]) null, qos[ii]);
         msgVec.add(msg);
      }
   }
View Full Code Here

       * response"); }
       */
      if (msgVec.isEmpty()) {
         return null;
      }
      MsgUnitRaw msg = (MsgUnitRaw) msgVec.elementAt(0);
      return msg.getQos();
   }
View Full Code Here

   public final XmlBlasterException getException() {
      if (msgVec.isEmpty()) {
         throw new IllegalArgumentException(ME
               + ": getException() is called without having an exception");
      }
      MsgUnitRaw msg = (MsgUnitRaw) msgVec.elementAt(0);
     
      if (msg.getContent() == null || msg.getContent().length == 0) {
         // For example when using XmlInterpreter
         // <qos><state id='ERROR' info='communication'/></qos>
         ErrorCode errorCode = ErrorCode.INTERNAL; // default setting
         try{
            // See serialization in XmlScriptInterpreter.java
            StatusQosData data = glob.getStatusQosFactory().readObject(msg.getQos());
            errorCode = ErrorCode.toErrorCode(data.getStateInfo());
         }
         catch (Throwable e) {
            log.severe("Unexpected exception markup in: '" + msg.getQos() + "': " + e.toString());
         }
         XmlBlasterException e = new XmlBlasterException(glob, errorCode, ME, "");
         e.isServerSide(!glob.isServerSide()); // mark to be from the other side
         return e;
      }
     
      return XmlBlasterException.parseByteArr(glob, msg.getContent(), ErrorCode.USER_UPDATE_INTERNALERROR);
   }
View Full Code Here

    *               Message size is limited to Integer.MAX_VALUE bytes
    */
   long getUserDataLen() {
      long len = 0L;
      for (int ii = 0; ii < msgVec.size(); ii++) {
         MsgUnitRaw unit = (MsgUnitRaw) msgVec.elementAt(ii);
         len += unit.size() + 3; // three null bytes
         String tmp = "" + unit.getContent().length;
         len += tmp.length();
      }
      if (len > Integer.MAX_VALUE)
         throw new IllegalArgumentException(ME
               + ": Message size is limited to " + Integer.MAX_VALUE + " bytes");
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.MsgUnitRaw

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.