Package org.xmlBlaster.client.key

Examples of org.xmlBlaster.client.key.PublishKey


      if (xmlKey == null && body != null) { // The filename will be the key-oid ...
         if (contentMime == null) {
            log.severe("File MIME type is unknown, specify MIME type as '-m <MIME>', for example '-m \"image/gif\"' (get help with -?)");
            System.exit(1);
         }
         PublishKey publishKey = new PublishKey(glob, body, contentMime, contentMimeExtended);
         xmlKey = publishKey.toXml()// default <key oid=......></key>
      }
      if (xmlKey == null) {
         log.severe("XmlKey is missing, specify key as '-k <file>' or '-xmlKey <the XML key>' (get help with -?)");
         System.exit(1);
      }
View Full Code Here


      // first strip all qos properties which are specific
      Destination dest = msg.getJMSDestination();
      if (!(dest instanceof XBDestination))
         throw new XBException("client.configuration", "destination is not an xmlblaster destination. Do not know how to handle it");
      PublishQos qos = null;
      PublishKey key = null;
      if (dest != null) {
         XBDestination xbDest = (XBDestination)dest;
         String ptpCompleteName = xbDest.getQueueName();
         if (ptpCompleteName != null) {
            String[] ptpNames = StringPairTokenizer.parseLine(ptpCompleteName, ',');
            org.xmlBlaster.util.qos.address.Destination ptpDest = new org.xmlBlaster.util.qos.address.Destination(global, new SessionName(global, ptpNames[0]));

            if (xbDest.getForceQueuing())
               ptpDest.forceQueuing(true);
            qos = new PublishQos(global, ptpDest);
            for (int i=1; i < ptpNames.length; i++) {
               org.xmlBlaster.util.qos.address.Destination additionalDest = new org.xmlBlaster.util.qos.address.Destination(global, new SessionName(global, ptpNames[i]));
               qos.addDestination(additionalDest);
            }
         }
         else {
            qos = new PublishQos(global);
         }
         String tmp = xbDest.getTopicName();
         if (tmp == null && ptpCompleteName == null)
            throw new XBException("client.configuration", "A Topic must be specified in the message to be sent");

         // determine if it is a complete key
         if (tmp != null && tmp.indexOf('<') > -1) { // complete key
            MsgKeySaxFactory keyFactory = new MsgKeySaxFactory(global);
            key = new PublishKey(global, keyFactory.readObject(tmp));
         }
         else { // then it is a simple oid
            if (tmp != null)
               key = new PublishKey(global, tmp);
            else
               key = new PublishKey(global);
         }
      }
      else
         throw new XBException("client.configuration", "A destination must be specified in the message to be sent");
      String corrId = msg.getJMSCorrelationID();
      if (corrId != null)
         qos.addClientProperty(XBMessage.addToKeyAndCheck(XBPropertyNames.JMS_CORRELATION_ID), corrId);
      int deliveryMode = msg.getJMSDeliveryMode();
      if (deliveryMode == DeliveryMode.PERSISTENT)
         qos.setPersistent(true);
      long expiration = msg.getJMSExpiration();
      if (expiration > -1)
         qos.setLifeTime(expiration);

      int prio = msg.getJMSPriority();
      if (prio > -1)
         qos.setPriority(PriorityEnum.toPriorityEnum(prio));
  
      String mimeType = msg.getJMSType(); // is this correct ?
      if (mimeType != null)
         key.setContentMime(mimeType);

      Enumeration eNum = msg.getPropertyNames();
      while (eNum.hasMoreElements()) {
         String propKey = (String)eNum.nextElement();
         Object obj = msg.getObjectProperty(propKey);
View Full Code Here

TOP

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

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.