1
2
3
4
5
6
7 package org.mule.transport.jdbc;
8
9 import org.mule.api.endpoint.MalformedEndpointException;
10 import org.mule.endpoint.AbstractEndpointURIBuilder;
11
12 import java.net.URI;
13 import java.util.Properties;
14
15
16
17
18 public class JdbcEndpointURIBuilder extends AbstractEndpointURIBuilder
19 {
20
21 protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
22 {
23 if (uri.getHost() != null && !"localhost".equals(uri.getHost()))
24 {
25 endpointName = uri.getHost();
26 }
27 int i = uri.getPath().indexOf("/", 1);
28 if (i > 0)
29 {
30 endpointName = uri.getPath().substring(1, i);
31 address = uri.getPath().substring(i + 1);
32 }
33 else if (uri.getPath() != null && uri.getPath().length() != 0)
34 {
35 address = uri.getPath().substring(1);
36 }
37 else
38 {
39 address = uri.getAuthority();
40 }
41
42
43
44 if (address == null)
45 {
46 address = uri.getScheme();
47 }
48 }
49 }