View Javadoc

1   /*
2    * $Id: JmsTopicResolver.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.jms;
12  
13  import org.mule.api.endpoint.ImmutableEndpoint;
14  
15  import javax.jms.Destination;
16  
17  /**
18   * A strategy interface to detect a {@code javax.jms.Topic} in,
19   * possibly, a vendor-specific way.
20   */
21  public interface JmsTopicResolver
22  {
23      /**
24       * Use endpoint configuration to detect a topic.
25       * @param endpoint endpoint to test
26       * @return true if endpoint's config tells it's a topic
27       * @see #isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean)
28       */
29      boolean isTopic(ImmutableEndpoint endpoint);
30  
31      /**
32       * Use endpoint configuration to detect a topic. Additionally,
33       * specify a fallback mechanism to search in endpoint's properties
34       * in case resource info yields {@code false}. In case resource info
35       * returned {@code true} no endpoint properties would be consulted.
36       * @param endpoint endpoint to test
37       * @param fallbackToEndpointProperties  whether to check endpoint's properties if
38       *        resource info returned false
39       * @return true if endpoint's config tells it's a topic
40       */
41      boolean isTopic(ImmutableEndpoint endpoint, boolean fallbackToEndpointProperties);
42  
43      /**
44       * Use any means suitable to detect a topic. This can
45       * be as simple as an {@code instanceof} call or utilize
46       * reflection and/or vendor API instead. 
47       * @param destination a jms destination to test
48       * @return {@code true} for topic
49       */
50      boolean isTopic(Destination destination);
51  }
52