public TopicExpressionType toTopicExpression(String name) { TopicExpressionType answer = new TopicExpressionType(); answer.getContent().add(name); answer.setDialect(SIMPLE_DIALECT); return answer; }
/** * Creates a topic expression type from the specified topic information. * * @param topic * the QName associated to the topic of the topic expression type * to build. * * @return a topic expression type from the specified topic information. */ public static TopicExpressionType createTopicExpressionType(QName topic) { TopicExpressionType topicExpressionType = new TopicExpressionType(); topicExpressionType.getOtherAttributes().put( topic, topic.getNamespaceURI()); topicExpressionType.setDialect(WsnConstants.TOPIC_EXPRESSION_DIALECT); topicExpressionType.getContent().add( topic.getPrefix() + ":" + topic.getLocalPart()); return topicExpressionType; }
/** * Creates a topic expression type with a {@code simpleExpressionType} * element from the specified topic information. * * @param topic * the QName associated to the topic of the topic expression type * to build. * * @return a topic expression type with a {@code simpleExpressionType} * element from the specified topic information. */ public static TopicExpressionType createTopicExpressionTypeWithSimpleExpressionType(QName topic) { TopicExpressionType topicExpressionType = new TopicExpressionType(); topicExpressionType.setDialect(WsnConstants.SIMPLE_TOPIC_EXPRESSION_DIALECT); JAXBElement<QName> simpleTopicExpression = new JAXBElement<QName>( WsnConstants.SIMPLE_TOPIC_EXPRESSION_QNAME, QName.class, null, topic); topicExpressionType.getContent().add(simpleTopicExpression); return topicExpressionType; }
private static void RegisterProducer(String t) { try { RegisterPublisher req = new RegisterPublisher(); TopicExpressionType localtopic = new TopicExpressionType(); if (Utility.stringIsNullOrEmpty(configuredWSN_DIALECT)) { localtopic.setDialect(WSNConstants.WST_TOPICEXPRESSION_SIMPLE); } else { localtopic.setDialect(configuredWSN_DIALECT); } if (Utility.stringIsNullOrEmpty(t)) { localtopic.getContent().add("fgsmsAlerts"); } else { localtopic.getContent().add(t); } req.getTopic().add(localtopic); RegisterPublisherResponse registerPublisher = notificationPort.registerPublisher(req); log.log(Level.INFO, String.format(SLACommon.getBundleString("WSNTopicRegisteredSuccess"), t)); isMainTopicRegistered = true; } catch (Exception ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("WSNTopicRegisteredFailed"), t), ex); } }
tet.setDialect(WSNConstants.WST_TOPICEXPRESSION_SIMPLE); } else { if (!Utility.stringIsNullOrEmpty(dialect)) { tet.setDialect(dialect); } else { tet.setDialect(configuredWSN_DIALECT);