📄 msgqossaxfactory.java
字号:
return; } if (name.equalsIgnoreCase("topic")) { if (!inQos) return; inTopic = true; TopicProperty tmpProp = new TopicProperty(glob); String tmp = attrs.getValue("readonly"); if (tmp != null) { tmpProp.setReadonly(new Boolean(tmp.trim()).booleanValue()); } tmp = attrs.getValue("destroyDelay"); if (tmp != null) { try { tmpProp.setDestroyDelay(Long.parseLong(tmp.trim())); } catch(NumberFormatException e) { log.warning("Invalid topic destroyDelay - millis =" + tmp); }; } tmp = attrs.getValue("createDomEntry"); if (tmp != null) { tmpProp.setCreateDomEntry(new Boolean(tmp.trim()).booleanValue()); } msgQosData.setTopicProperty(tmpProp); return; } if (name.equalsIgnoreCase("queue")) { if (!inQos) return;// this.inQueue = true; if (attrs != null) { String indexVal = attrs.getValue("index"); // UpdateQos contains queue informations if (indexVal != null) { try { msgQosData.setQueueIndex(Integer.parseInt(indexVal)); } catch(NumberFormatException e) { log.severe("Invalid queue - index =" + indexVal); }; String tmp = attrs.getValue("size"); if (tmp != null) { try { msgQosData.setQueueSize(Integer.parseInt(tmp)); } catch(NumberFormatException e) { log.severe("Invalid queue - index =" + tmp); }; } return; } if (inTopic) { String relatedVal = attrs.getValue("relating"); if (relatedVal == null) relatedVal = Constants.RELATING_MSGUNITSTORE; relatedVal = relatedVal.trim(); if (Constants.RELATING_MSGUNITSTORE.equalsIgnoreCase(relatedVal)) { // <queue related='msgUnitStore' is deprecated here! (is parsed now as msgUnitStore, see below) MsgUnitStoreProperty tmpProp = new MsgUnitStoreProperty(glob, glob.getId()); tmpProp.startElement(uri, localName, name, attrs); msgQosData.getTopicProperty().setMsgUnitStoreProperty(tmpProp); } else { // assuming related="history" HistoryQueueProperty tmpProp = new HistoryQueueProperty(glob, glob.getId()); tmpProp.startElement(uri, localName, name, attrs); msgQosData.getTopicProperty().setHistoryQueueProperty(tmpProp); } return; } log.warning("Found queue tag but don't know how to handle it: " + xmlLiteral); } return; } if (name.equalsIgnoreCase("persistence")) { if (!inQos) return;// this.inPersistence = true; if (attrs != null) { if (inTopic) { MsgUnitStoreProperty tmpProp = new MsgUnitStoreProperty(glob, glob.getId()); tmpProp.startElement(uri, localName, name, attrs); msgQosData.getTopicProperty().setMsgUnitStoreProperty(tmpProp); return; } log.warning("Found msgUnitStore tag but don't know how to handle it: " + xmlLiteral); } return; } if (name.equalsIgnoreCase("rcvTimestamp")) { if (!inQos) return; if (attrs != null) { int len = attrs.getLength(); for (int i = 0; i < len; i++) { if( attrs.getQName(i).equalsIgnoreCase("nanos") ) { String tmp = attrs.getValue(i).trim(); try { msgQosData.setRcvTimestamp(new RcvTimestamp(Long.parseLong(tmp))); } catch(NumberFormatException e) { log.severe("Invalid rcvTimestamp - nanos =" + tmp); }; } } }// this.inRcvTimestamp = true; return; } if (name.equalsIgnoreCase("redeliver")) { if (!inQos) return;// this.inRedeliver = true; if (attrs != null) { int len = attrs.getLength(); for (int i = 0; i < len; i++) { log.warning("Ignoring sent <redeliver> attribute " + attrs.getQName(i) + "=" + attrs.getValue(i).trim()); } } return; } if (name.equalsIgnoreCase("route")) { if (!inQos) return; inRoute = true; return; } if (name.equalsIgnoreCase("node")) { if (!inRoute) { log.severe("Ignoring <node>, it is not inside <route>"); return; } if (attrs != null) { String id = attrs.getValue("id"); if (id == null || id.length() < 1) { log.severe("QoS <route><node> misses id attribute, ignoring node"); return; } NodeId nodeId = new NodeId(id); int stratum = 0; String tmp = attrs.getValue("stratum"); if (tmp != null) { try { stratum = Integer.parseInt(tmp.trim()); } catch(NumberFormatException e) { log.severe("Invalid stratum =" + tmp); }; } 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) { try { dirtyRead = new Boolean(tmpDirty.trim()).booleanValue(); } catch(NumberFormatException e) { log.severe("Invalid dirtyRead =" + tmpDirty); }; } routeInfo = new RouteInfo(nodeId, stratum, timestamp); if (tmpDirty != null) routeInfo.setDirtyRead(dirtyRead); } return; } // deprecated if (name.equalsIgnoreCase("forceQueuing")) { if (!inDestination) return; log.severe("forceQueuing is an attribute of destination - change your code"); return; } if (name.equalsIgnoreCase(MethodName.SUBSCRIBE.getMethodName())) { // "subscribe" if (!inQos) return;// this.inSubscribe = true; if (attrs != null) { msgQosData.setSubscriptionId(attrs.getValue("id")); } return; } if (name.equalsIgnoreCase("isVolatile")) { // deprecated if (!inQos) return;// this.inIsVolatile = true; if (attrs != null) { int len = attrs.getLength(); for (int i = 0; i < len; i++) { log.warning("Ignoring sent <isVolatile> attribute " + attrs.getQName(i) + "=" + attrs.getValue(i).trim()); } // if (log.isLoggable(Level.FINE)) log.trace(ME, "Found isVolatile tag"); } return; } if (name.equalsIgnoreCase("administrative")) { if (!inQos) return;// this.inAdministrative = true; msgQosData.setAdministrative(true); return; } if (name.equalsIgnoreCase("persistent")) { if (!inQos) return;// this.inIsPersistent = true; msgQosData.setPersistent(true); return; } if (name.equalsIgnoreCase("forceUpdate")) { if (!inQos) return;// this.inForceUpdate = true; msgQosData.setForceUpdate(true); return; } if (name.equalsIgnoreCase("readonly")) { if (!inQos) return;// this.inReadonly = true; msgQosData.setReadonly(true); log.severe("<qos><readonly/></qos> is deprecated, please use readonly as topic attribute <qos><topic readonly='true'></qos>"); return; } if (name.equalsIgnoreCase("isPublish")) { if (!inQos) return; msgQosData.setMethod(MethodName.PUBLISH); return; } if (name.equalsIgnoreCase("isUpdate")) { if (!inQos) return; msgQosData.setMethod(MethodName.UPDATE); return; } if (name.equalsIgnoreCase("isGet")) { if (!inQos) return; msgQosData.setMethod(MethodName.GET); return; } if (name.equalsIgnoreCase("msgDistributor")) { if (!this.inTopic) return; String typeVersion = attrs.getValue("typeVersion"); this.msgQosData.getTopicProperty().setMsgDistributor(typeVersion); character.setLength(0); return; } } /** * End element, event from SAX parser. * <p /> * @param name Tag name */ public void endElement(String uri, String localName, String name) { if (super.endElementBase(uri, localName, name) == true) { if (name.equalsIgnoreCase("clientProperty")) { this.msgQosData.addClientProperty(this.clientProperty); } return; } if(name.equalsIgnoreCase("state")) { //this.inState = false; character.setLength(0); return; } if(name.equalsIgnoreCase("subscribable")) {// this.inSubscribable = false; String tmp = character.toString().trim(); if (tmp.length() > 0) { msgQosData.setSubscribable(new Boolean(tmp).booleanValue()); } character.setLength(0); return; } if( name.equalsIgnoreCase("destination") ) { inDestination = false; String tmp = character.toString().trim(); // The address or XPath query string if (tmp.length() > 0) { this.destination.setDestination(new SessionName(glob, tmp)); // set address or XPath query string if it is before the forceQueuing tag character.setLength(0); } msgQosData.addDestination(this.destination); return; } if(name.equalsIgnoreCase("sender")) {// this.inSender = false; msgQosData.setSender(new SessionName(glob, character.toString().trim())); // if (log.isLoggable(Level.FINE)) log.trace(ME, "Found message sender login name = " + msgQosData.getSender()); character.setLength(0); return; } if(name.equalsIgnoreCase("priority")) {// this.inPriority = false; try { msgQosData.setPriority(PriorityEnum.parsePriority(character.toString())); } catch (IllegalArgumentException e) { msgQosData.setPriority(PriorityEnum.NORM_PRIORITY); log.warning("Problems parsing priority, setting priority to " + msgQosData.getPriority().toString() + ": " + e.toString()); } // if (log.isLoggable(Level.FINE)) log.trace(ME, "Found priority = " + msgQosData.getPriority());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -