private static void setTopic(SubscribeEventType event, ResourceType resource) {
   String topic = null;
   try {
     LOG.debug("######## BEGIN TOPIC EXTRACTION ########");
     JAXBElement<TopicExpressionType> jbElement =
         (JAXBElement<TopicExpressionType>)
             event.getMessage().getSubscribe().getFilter().getAny().get(0);
     TopicExpressionType topicExpression = jbElement.getValue();
     topic = (String) topicExpression.getContent().get(0);
     LOG.debug("Topic extracted: " + topic);
   } catch (Throwable t) {
     LOG.error("Error extracting the topic: " + t.getMessage(), t);
   }
   if (NullChecker.isNotNullish(topic)) {
     if (LOG.isDebugEnabled()) {
       LOG.debug(
           "Adding topic ("
               + topic
               + ") as attribute ("
               + ATTRIBUTE_ID_TOPIC
               + ") and type: "
               + Constants.DataTypeString);
     }
     AttributeHelper attrHelper = new AttributeHelper();
     resource
         .getAttribute()
         .add(attrHelper.attributeFactory(ATTRIBUTE_ID_TOPIC, Constants.DataTypeString, topic));
   }
 }
 public ActiveMQTopic toActiveMQTopic(TopicExpressionType topic) throws InvalidTopicException {
   String dialect = topic.getDialect();
   if (dialect == null || SIMPLE_DIALECT.equals(dialect)) {
     for (Iterator 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);
   } else {
     throw new InvalidTopicException("Topic dialect: " + dialect + " not supported");
   }
 }
 protected String convertTopic(TopicExpressionType topic) {
   String answer = null;
   for (Iterator iter = topic.getContent().iterator(); iter.hasNext(); ) {
     Object contentItem = iter.next();
     if (contentItem instanceof String) answer = ((String) contentItem).trim();
     if (contentItem instanceof QName) answer = ((QName) contentItem).toString();
     if (answer != null) {
       return answer;
     }
   }
   return answer;
 }
 public TopicExpressionType toTopicExpression(String name) {
   TopicExpressionType answer = new TopicExpressionType();
   answer.getContent().add(QName.valueOf(name));
   answer.setDialect(SIMPLE_DIALECT);
   return answer;
 }