1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.impl.endpoint; |
12 | |
|
13 | |
import org.mule.umo.endpoint.MalformedEndpointException; |
14 | |
import org.mule.util.StringUtils; |
15 | |
|
16 | |
import java.net.URI; |
17 | |
import java.util.Properties; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | 860 | public class ResourceNameEndpointBuilder extends AbstractEndpointBuilder |
25 | |
{ |
26 | |
public static final String RESOURCE_INFO_PROPERTY = "resourceInfo"; |
27 | |
|
28 | |
protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException |
29 | |
{ |
30 | 860 | address = StringUtils.EMPTY; |
31 | 860 | if (uri.getHost() != null && !"localhost".equals(uri.getHost())) |
32 | |
{ |
33 | 848 | address = uri.getHost(); |
34 | |
} |
35 | |
|
36 | 860 | if (uri.getPath() != null && uri.getPath().length() != 0) |
37 | |
{ |
38 | 6 | if (address.length() > 0) |
39 | |
{ |
40 | 6 | address += "/"; |
41 | |
} |
42 | 6 | address += uri.getPath().substring(1); |
43 | |
} |
44 | 854 | else if (uri.getAuthority() != null && !uri.getAuthority().equals(address)) |
45 | |
{ |
46 | 14 | address += uri.getAuthority(); |
47 | |
} |
48 | |
|
49 | 860 | int y = address.indexOf("@"); |
50 | 860 | if (y > -1) |
51 | |
{ |
52 | 8 | this.userInfo = address.substring(0, y); |
53 | |
} |
54 | |
|
55 | 860 | y++; |
56 | |
|
57 | 860 | int x = address.indexOf(":", y); |
58 | 860 | if (x > -1) |
59 | |
{ |
60 | 0 | String resourceInfo = address.substring(y, x); |
61 | 0 | props.setProperty("resourceInfo", resourceInfo); |
62 | 0 | address = address.substring(x + 1); |
63 | |
} |
64 | 860 | } |
65 | |
} |