Package org.xmlBlaster.client.key

Examples of org.xmlBlaster.client.key.UpdateKey


         MsgUnit[] msgArr = null;
         try {
            msgArr = con.get(xmlKey, "<qos></qos>");
            log.info("Got " + msgArr.length + " messages for query '" + queryString + "':");
            for (int ii=0; ii<msgArr.length; ii++) {
               UpdateKey updateKey = new UpdateKey(glob, msgArr[ii].getKey());
               log.info("\n" + updateKey.toXml());
               log.info("\n" + new String(msgArr[ii].getContent()) + "\n");
            }
         } catch(XmlBlasterException e) {
            log.severe("XmlBlasterException: " + e.getMessage());
         }
View Full Code Here


      String[] ret = new String[corbaMsgUnitArr.length];
      try {
         MsgUnitRaw[] msgUnitArr = OrbInstanceFactory.convert(glob, corbaMsgUnitArr);
         for (int ii=0; ii<msgUnitArr.length; ii++) {
            MsgUnitRaw msgUnit = msgUnitArr[ii];
            UpdateKey xmlKey = null;
            try {
               xmlKey = new UpdateKey(null, msgUnit.getKey());
            } catch (XmlBlasterException e) {
               log.severe(e.getMessage());
            }
            log.info("Callback invoked for " + xmlKey.toString() + " content length = " + msgUnit.getContent().length);
            log.info(new String(msgUnit.getContent()));
            ret[ii] = Constants.RET_OK; // "<qos><state id='OK'/></qos>";
         }
      }
      catch (XmlBlasterException e) {
View Full Code Here

   public String[] update(String cbSessionId, MessageUnit[] msgUnitArr)
   {
      String[] ret = new String[msgUnitArr.length];
      for (int ii=0; ii<msgUnitArr.length; ii++) {
         MessageUnit msgUnit = msgUnitArr[ii];
         UpdateKey key = null;
         //UpdateQos qos = null;
         try { // SAX parse the received message key and QoS:
            key = new UpdateKey(glob, msgUnit.xmlKey);
            //qos = new UpdateQos(glob, msgUnit.qos);
         } catch (org.xmlBlaster.util.XmlBlasterException e) {
            log.severe(e.getMessage());
         }
         System.out.println("\n================== BlasterCallback update START =============");
         System.out.println("Callback invoked for " + key.toString() + " content length = " + msgUnit.content.length);
         System.out.println(new String(msgUnit.content));
         System.out.println("================== BlasterCallback update END ===============\n");
         ret[ii] = "<qos><state id='OK'/></qos>";
      }
      return ret;
View Full Code Here

         String xml =
           "<key oid='HELLO' contentMime='image/png' contentMimeExtended='2.5' domain='RUGBY'>\n" +
           clientTags +
           "</key>\n";
         MsgKeyData key = factory.readObject(xml);
         UpdateKey updateKey = new UpdateKey(glob, xml);

         System.out.println("UpdateKey: " + updateKey.toXml());

         assertEquals("", "HELLO", updateKey.getOid());
         assertEquals("", "RUGBY", updateKey.getDomain());
         assertEquals("", "image/png", updateKey.getContentMime());
         assertEquals("", "2.5", updateKey.getContentMimeExtended());
         assertEquals("Input='"+clientTags+"' output='"+key.getClientTags()+"'", clientTags.trim(), updateKey.getClientTags());
         assertEquals("", false, updateKey.isInternal());
         assertEquals("", false, updateKey.isPluginInternal());
         assertEquals("", false, updateKey.isDeadMessage());
      }
      catch (Throwable e) {
         System.out.println("Test failed: " + e.toString());
      }
      System.out.println("***MsgKeyFactoryTest: UpdateKey [SUCCESS]");
View Full Code Here

         public void valueChanged(ListSelectionEvent evt) {
            JList source = (JList) evt.getSource();
            MessageWrapper selection = (MessageWrapper) source.getSelectedValue();
            if (selection != null) {
               String secretCallbackSessionId = selection.getSecretCallbackSessionId();
               UpdateKey updateKey = selection.getUpdateKey();
               byte[] content = selection.getContent();
               UpdateQos updateQos = selection.getUpdateQos();
               Properties props = new Properties();
               props.put(Constants.TOXML_FORCEREADABLE, ""+true);
               String text = (
                  new StringBuffer()
                     .append(" - - - secretCallbackSessionId: - - -\n")
                     .append(secretCallbackSessionId)
                     .append("\n - - - updateKey: - - -")
                     .append(updateKey.toXml())
                     .append("\n - - - content: - - -\n")
                     .append(new String(content))
                     .append("\n - - - updateQos: - - -")
                     .append(updateQos.getData().toXml("", props)))
                     .append("\n - - - end - - -\n")
View Full Code Here

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

      // parse XML key and QoS
      UpdateKey updateKey = null;
      UpdateQos updateQos = null;
      try {
         updateKey = new UpdateKey(glob, updateKeyLiteral);
         //updateKey.init(updateKeyLiteral); // does the parsing
         updateQos = new UpdateQos(glob, updateQosLiteral); // does the parsing
      }
      catch (XmlBlasterException e) {
         log.severe("Parsing error: " + e.toString());
         throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_ILLEGALARGUMENT, ME+".update", "Parsing error", e);
      }

      // invoke client code
      try {
         // Now we know all about the received message, dump it or do some checks
         /*
         if (log.isLoggable(Level.FINEST)) log.dump(ME+".UpdateKey", "\n" + updateKey.toXml());
         if (log.isLoggable(Level.FINEST)) log.dump(ME+".content", "\n" + new String(content));
         if (log.isLoggable(Level.FINEST)) log.dump(ME+".UpdateQos", "\n" + updateQos.toXml());
         */
         if (log.isLoggable(Level.FINE)) log.fine("Received message [" + updateKey.getOid() + "] from publisher " + updateQos.getSender());

         String ret = update(cbSessionId, updateKey, content, updateQos);

         DispatchStatistic statistic = getDispatchStatistic();
         if (statistic != null) statistic.incrNumUpdate(1);
        
         // export (encrypt) return value
         if (secPlgn != null) {
            MsgUnitRaw msg = new MsgUnitRaw(null, (byte[])null, ret);
            CryptDataHolder dataHolder = new CryptDataHolder(MethodName.UPDATE, msg, null);
            dataHolder.setReturnValue(true);
            ret = secPlgn.exportMessage(dataHolder).getQos();
         }

         return ret;
      }
      catch (XmlBlasterException e) {
         throw e;
      }
      catch (Throwable e) {
         e.printStackTrace();
         log.warning("Error in client user code of update("+
                      ((updateKey!=null)?updateKey.getOid():"")+
                      ((updateQos!=null)?", "+updateQos.getRcvTime():"")+
                      "): " + e.toString());
         throw new XmlBlasterException(glob, ErrorCode.USER_UPDATE_INTERNALERROR, ME+".update", "Error in client code, please check your clients update() implementation.", e);
      }
   }
View Full Code Here

            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());

         update(cbSessionId, updateKey, content, updateQos);

         DispatchStatistic statistic = getDispatchStatistic();
         if (statistic != null) statistic.incrNumUpdateOneway(1);
View Full Code Here

         MsgQosData qos =(MsgQosData)entry.getMsgUnit().getQosData();
         byte[] cont = entry.getMsgUnit().getContent();
         String entryCbSessionId = qos.getClientProperty(ENTRY_CB_SESSION_ID, (String)null);
         qos.getClientProperties().remove(ENTRY_CB_SESSION_ID);
         final boolean isExternal = false; // we don't want to store these entries since already here
         updateInternal(entryCbSessionId, new UpdateKey(key), cont, new UpdateQos(this.global, qos), isExternal);
      }
      this.queue.clear();
      return list.size();
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.key.UpdateKey

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.