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 public class JmsEndpointURIBuilder extends ResourceNameEndpointURIBuilder
23 {
24 @Override
25 protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
26 {
27 super.setEndpoint(uri, props);
28
29 String newUri = null;
30 if (uri.getScheme().equals("topic"))
31 {
32 props.setProperty(RESOURCE_INFO_PROPERTY, "topic");
33 newUri = uri.toString().replace("topic://", "jms://");
34 }
35 else if (uri.getScheme().equals("queue"))
36 {
37 newUri = uri.toString().replace("queue://", "jms://");
38 }
39
40 try
41 {
42 if (newUri != null)
43 {
44 rewriteURI(new URI(newUri));
45 }
46 }
47 catch (URISyntaxException e)
48 {
49 throw new MalformedEndpointException(e);
50 }
51
52 }
53 }