1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.transport.jms; |
11 | |
|
12 | |
import org.mule.endpoint.ResourceNameEndpointURIBuilder; |
13 | |
import org.mule.api.endpoint.MalformedEndpointException; |
14 | |
|
15 | |
import java.util.Properties; |
16 | |
import java.net.URI; |
17 | |
import java.net.URISyntaxException; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | 0 | public class JmsEndpointURIBuilder extends ResourceNameEndpointURIBuilder |
23 | |
{ |
24 | |
@Override |
25 | |
protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException |
26 | |
{ |
27 | 0 | super.setEndpoint(uri, props); |
28 | |
|
29 | 0 | String newUri = null; |
30 | 0 | if (uri.getScheme().equals("topic")) |
31 | |
{ |
32 | 0 | props.setProperty(RESOURCE_INFO_PROPERTY, "topic"); |
33 | 0 | newUri = uri.toString().replace("topic://", "jms://"); |
34 | |
} |
35 | 0 | else if (uri.getScheme().equals("queue")) |
36 | |
{ |
37 | 0 | newUri = uri.toString().replace("queue://", "jms://"); |
38 | |
} |
39 | |
|
40 | |
try |
41 | |
{ |
42 | 0 | if (newUri != null) |
43 | |
{ |
44 | 0 | rewriteURI(new URI(newUri)); |
45 | |
} |
46 | |
} |
47 | 0 | catch (URISyntaxException e) |
48 | |
{ |
49 | 0 | throw new MalformedEndpointException(e); |
50 | 0 | } |
51 | |
|
52 | 0 | } |
53 | |
} |