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