public static List<String> topicExpressionToList(TopicExpressionType te) { List<String> items = new ArrayList<String>(); if (te == null) { return items; } if (te.getDialect().equalsIgnoreCase(WSNConstants.WST_TOPICEXPRESSION_SIMPLE)) { for (int k = 0; k < te.getContent().size(); k++) { items.add(((String) te.getContent().get(k)).trim()); } } return items; }
public ActiveMQTopic toActiveMQTopic(TopicExpressionType topic) throws InvalidTopicException { String dialect = topic.getDialect(); if (dialect == null || SIMPLE_DIALECT.equals(dialect)) { for (Iterator<Object> iter = topic.getContent().iterator(); iter.hasNext();) { ActiveMQTopic answer = createActiveMQTopicFromContent(iter.next()); if (answer != null) { return answer; } } throw new InvalidTopicException("No topic name available topic: " + topic); } throw new InvalidTopicException("Topic dialect: " + dialect + " not supported"); }
private static void logTopic(TopicExpressionType topicExpressionType, String indentation) { List<Object> topicContent = topicExpressionType.getContent(); if (topicContent != null) { log.info( indentation + "topicContent(dialect={}):", topicExpressionType.getDialect()); for (Object obj2 : topicContent) { if (obj2 instanceof String) { log.info(indentation + " * " + obj2 + " (class " + obj2.getClass().getName() + ")"); } else { Element topicElement = (Element) obj2; String topic = topicElement.getTextContent().trim().replaceAll( "\n", ""); log.info(indentation + " * " + topic + " (namespace " + topicElement.lookupNamespaceURI(org.apache.xml.utils.QName.getPrefixPart(topic)) + ") (class " + obj2.getClass().getName() + ")"); } } logAttributes( " topicAttribute", topicExpressionType, "otherAttributes"); } else { log.info(" topicContent is null"); } }
JAXBElement<TopicExpressionType> item = (JAXBElement<TopicExpressionType>) subscribeRequest.getFilter().getAny().get(i); org.oasis_open.docs.wsn.b_2.TopicExpressionType te = item.getValue(); if (!te.getDialect().equalsIgnoreCase(WSNConstants.WST_TOPICEXPRESSION_SIMPLE)) { InvalidFilterFault iff = new InvalidFilterFault("Only TopicExpressions with the dialect of " + WSNConstants.WST_TOPICEXPRESSION_SIMPLE + " are supported.", new InvalidFilterFaultType()); throw iff;