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 | 0 | public class JdbcEndpointURIBuilder extends AbstractEndpointURIBuilder |
19 | |
{ |
20 | |
|
21 | |
protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException |
22 | |
{ |
23 | 0 | if (uri.getHost() != null && !"localhost".equals(uri.getHost())) |
24 | |
{ |
25 | 0 | endpointName = uri.getHost(); |
26 | |
} |
27 | 0 | int i = uri.getPath().indexOf("/", 1); |
28 | 0 | if (i > 0) |
29 | |
{ |
30 | 0 | endpointName = uri.getPath().substring(1, i); |
31 | 0 | address = uri.getPath().substring(i + 1); |
32 | |
} |
33 | 0 | else if (uri.getPath() != null && uri.getPath().length() != 0) |
34 | |
{ |
35 | 0 | address = uri.getPath().substring(1); |
36 | |
} |
37 | |
else |
38 | |
{ |
39 | 0 | address = uri.getAuthority(); |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | 0 | if (address == null) |
45 | |
{ |
46 | 0 | address = uri.getScheme(); |
47 | |
} |
48 | 0 | } |
49 | |
} |