Package org.xmlBlaster.util

Examples of org.xmlBlaster.util.Timestamp


            else {
               log.warning("QoS <route><node> misses stratum attribute, setting to 0: " + xmlLiteral);
               //Thread.currentThread().dumpStack();
            }

            Timestamp timestamp = null;
            tmp = attrs.getValue("timestamp");
            if (tmp != null) {
               try { timestamp = new Timestamp(Long.parseLong(tmp.trim())); } catch(NumberFormatException e) { log.severe("Invalid route Timestamp - nanos =" + tmp); };
            }
            else {
               log.warning("QoS <route><node> misses receive timestamp attribute, setting to 0");
               timestamp = new Timestamp(0L);
            }

            String tmpDirty = attrs.getValue("dirtyRead");
            boolean dirtyRead = RouteInfo.DEFAULT_dirtyRead;
            if (tmpDirty != null) {
View Full Code Here


    * Generates a unique key oid in scope of a cluster node (on server or on client side).
    * @param glob.getStrippedId() on server side
    */
   public String generateOid(String uniquePrefix) {
      StringBuffer oid = new StringBuffer(80);
      Timestamp timestamp = new Timestamp();
      oid.append(uniquePrefix).append("-").append(timestamp.getTimestamp());
      return oid.toString();
   }
View Full Code Here

   /**
    * On startup subscribe to topic __sys__deadMessage.
    */
   private void subscribeToDeadMessages() throws XmlBlasterException {
      try {
         final String secretCbSessionId = new Timestamp().toString();

         this.connection = new XmlBlasterAccess(this.global);

         ConnectQos connectQos = new ConnectQos(this.global, loginName, password);
         connectQos.setSecretCbSessionId(secretCbSessionId);
View Full Code Here

         String oid = updateQos.getClientProperty(Constants.CLIENTPROPERTY_OID, "");              //"__oid"
         String txt = updateQos.getClientProperty(Constants.CLIENTPROPERTY_DEADMSGREASON, "");    //"__deadMessageReason"
         String receiver = updateQos.getClientProperty(Constants.CLIENTPROPERTY_DEADMSGRECEIVER, ""); // PtP absolute name

         if (fn.length() == 0)
           fn = new Timestamp().toString();
        
         fn = Global.getStrippedString(fn); // Strip chars like ":" so that fn is usable as a file name
         fn = fn + ".xml";

         String dir = this.directoryName;
View Full Code Here

               counter = 0L;
            counter++;
            this.requestId = prefix + counter;
         }
         */
         Timestamp ts = new Timestamp();
         // TODO: getMethodNameStr for debugging only, can be removed again 2008-06-01
         // NOTE (2008-12-17 michele: if you will take it away, make sure to take away also the semicolumn
         // otherwise you may have troubles in the email protocol
         if (prefix.length() > 0 && !(prefix.lastIndexOf(':') == (prefix.length()-1)))
               prefix += ":";
         this.requestId = prefix + getMethodNameStr() + ":" + ts.getTimestamp();
      }
      return this.requestId;
   }
View Full Code Here

      }
      else {
          // "device.joe.response" -> can be useful for authorization, must be distinguishable to other clients
          String responseTopicIdPrefix = msgUnit.getQosData().getClientProperty("__responseTopicIdPrefix", "");
          if (responseTopicIdPrefix.length() > 0) {
             responseTopicId = responseTopicIdPrefix + new Timestamp().getTimestamp(); // now thread safe for request()s in parallel
             msgUnit.getQosData().getClientProperties().remove("__responseTopicIdPrefix");
          }
      }
      if (createResponseTopic) {
        PublishReturnQos tempTopic = createTemporaryTopic(responseTopicId, destroyDelay, maxEntries);
View Full Code Here

         msg.getQosData().addClientProperty(Constants.addJmsPrefix(XBConnectionMetaData.JMSX_GROUP_EX, log), ex.getMessage());
      return publish(msg);
   }
  
   public PublishReturnQos[] publishStream(InputStream is, MsgKeyData keyData, MsgQosData qosData, int maxBufSize, I_ReplaceContent contentReplacer) throws XmlBlasterException {
      String streamId = (getGlobal()).getId() + "-" + (new Timestamp()).getTimestamp();
      qosData.addClientProperty(Constants.addJmsPrefix(XBConnectionMetaData.JMSX_GROUP_ID, log), streamId);
      int bufSize = 0;
      String tmpKey = Constants.addJmsPrefix(XBConnectionMetaData.JMSX_MAX_CHUNK_SIZE, log);
      if (qosData.getClientProperty(tmpKey) != null)
         bufSize = qosData.getClientProperty(tmpKey).getIntValue();
View Full Code Here

            byte[] content = (byte[])obj[2];
            MsgQosData msgQosData = glob.getMsgQosFactory().readObject(qos);
            MsgKeyData msgKeyData = glob.getMsgKeyFactory().readObject(key);
            MsgUnit msgUnit = new MsgUnit(msgKeyData, content, msgQosData);
            return new MsgQueuePublishEntry(glob, methodName, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, msgUnit);
         }
         else if (methodName == MethodName.SUBSCRIBE) {
            if (obj.length != 2) {
               throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
                  "Expected 2 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
            }
            String qos = (String)obj[0];
            String key = (String)obj[1];
            return new MsgQueueSubscribeEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       glob.getQueryKeyFactory().readObject(key),
                       glob.getQueryQosFactory().readObject(qos));

         }
         else if (methodName == MethodName.UNSUBSCRIBE) {
            if (obj.length != 2) {
               throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
                  "Expected 2 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
            }
            String qos = (String)obj[0];
            String key = (String)obj[1];
            return new MsgQueueUnSubscribeEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       new UnSubscribeKey(glob, glob.getQueryKeyFactory().readObject(key)),
                       new UnSubscribeQos(glob, glob.getQueryQosFactory().readObject(qos)) );

         }
         else if (methodName == MethodName.ERASE) {
            if (obj.length != 2) {
               throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
                  "Expected 2 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
            }
            String qos = (String)obj[0];
            String key = (String)obj[1];
            return new MsgQueueEraseEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       new EraseKey(glob, glob.getQueryKeyFactory().readObject(key)),
                       new EraseQos(glob, glob.getQueryQosFactory().readObject(qos)) );

         }
         else if (methodName == MethodName.GET) {
            throw new XmlBlasterException(glob, ErrorCode.INTERNAL_NOTIMPLEMENTED, ME, "Object '" + type + "' not implemented, you can't use synchronous GET requests in queues.");
         }
         else if (methodName == MethodName.CONNECT) {
            if (obj.length != 1) {
               throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
                  "Expected 1 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
            }
            String qos = (String)obj[0];
            ConnectQosData connectQosData = glob.getConnectQosFactory().readObject(qos);
            return new MsgQueueConnectEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, connectQosData);
         }
         else if (methodName == MethodName.DISCONNECT) {
            if (obj.length != 1) {
               throw new XmlBlasterException(glob, ErrorCode.INTERNAL_ILLEGALARGUMENT, ME,
                  "Expected 1 entries in serialized object '" + type + "' but got " + obj.length + " for priority=" + priority + " timestamp=" + timestamp + ". Could be a version incompatibility.");
            }
            String qos = (String)obj[0];
            DisconnectQos disconnectQos = new DisconnectQos(glob, glob.getDisconnectQosFactory().readObject(qos));
            return new MsgQueueDisconnectEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, disconnectQos);
         }
         else if (methodName == MethodName.DUMMY) { // for testsuite only
            byte[] bytes = (byte[])obj[0];
            DummyEntry entry = new DummyEntry(glob, PriorityEnum.toPriorityEnum(priority), new Timestamp(timestamp),
                  storageId, bytes.length, bytes, persistent);
            //entry.setUniqueId(timestamp);
            return entry;
         }
View Full Code Here

               || methodName == MethodName.PUBLISH_ARR) {
            MsgQosData msgQosData = glob.getMsgQosFactory().readObject(qos);
            MsgKeyData msgKeyData = glob.getMsgKeyFactory().readObject(key);
            MsgUnit msgUnit = new MsgUnit(msgKeyData, content, msgQosData);
            return new MsgQueuePublishEntry(glob, methodName, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, msgUnit);
         }
         else if (methodName == MethodName.SUBSCRIBE) {
            return new MsgQueueSubscribeEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       glob.getQueryKeyFactory().readObject(key),
                       glob.getQueryQosFactory().readObject(qos));

         }
         else if (methodName == MethodName.UNSUBSCRIBE) {
            return new MsgQueueUnSubscribeEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       new UnSubscribeKey(glob, glob.getQueryKeyFactory().readObject(key)),
                       new UnSubscribeQos(glob, glob.getQueryQosFactory().readObject(qos)) );

         }
         else if (methodName == MethodName.ERASE) {
            return new MsgQueueEraseEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                       new Timestamp(timestamp), sizeInBytes,
                       new EraseKey(glob, glob.getQueryKeyFactory().readObject(key)),
                       new EraseQos(glob, glob.getQueryQosFactory().readObject(qos)) );

         }
         else if (methodName == MethodName.GET) {
            throw new XmlBlasterException(glob, ErrorCode.INTERNAL_NOTIMPLEMENTED, ME, "Object '" + type + "' not implemented, you can't use synchronous GET requests in queues.");
         }
         else if (methodName == MethodName.CONNECT) {
            ConnectQosData connectQosData = glob.getConnectQosFactory().readObject(qos);
            return new MsgQueueConnectEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, connectQosData);
         }
         else if (methodName == MethodName.DISCONNECT) {
            DisconnectQos disconnectQos = new DisconnectQos(glob, glob.getDisconnectQosFactory().readObject(qos));
            return new MsgQueueDisconnectEntry(glob, PriorityEnum.toPriorityEnum(priority), storageId,
                                            new Timestamp(timestamp), sizeInBytes, disconnectQos);
         }
         else if (methodName == MethodName.DUMMY) { // for testsuite only
            DummyEntry entry = null;
            if (content != null)
               entry = new DummyEntry(glob, PriorityEnum.toPriorityEnum(priority), new Timestamp(timestamp), storageId,
                     sizeInBytes, content, ref.isDurable());
            else
               entry = new DummyEntry(glob, PriorityEnum.toPriorityEnum(priority), new Timestamp(timestamp), storageId, sizeInBytes, ref.isDurable());
            return entry;
         }

      }
      catch (Exception ex) {
View Full Code Here

         if (to_file.getParent() != null) {
            to_file.getParentFile().mkdirs();
         }
         final FileOutputStream out = new FileOutputStream(to_file);
         out_ = out;
         out_.write(("XmlBlaster " + new Timestamp().toString()).getBytes());
         out_.write(("\n"+XmlBlasterException.createVersionInfo()+"\n").getBytes());

         log.info("Reporting check to '" + to_file.getAbsolutePath() + "'");

         // Check no 1: find callback entries with negative session id and no logged in such session
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.Timestamp

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.