1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.mule.transport.service; |
11 | |
|
12 | |
import org.mule.api.registry.ServiceException; |
13 | |
import org.mule.api.registry.ServiceType; |
14 | |
import org.mule.api.transport.Connector; |
15 | |
import org.mule.config.i18n.CoreMessages; |
16 | |
import org.mule.transport.AbstractConnector; |
17 | |
import org.mule.util.PropertiesUtils; |
18 | |
import org.mule.util.SpiUtils; |
19 | |
|
20 | |
import java.util.Properties; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public class MetaTransportServiceDescriptor extends DefaultTransportServiceDescriptor |
28 | |
{ |
29 | |
private String metaScheme; |
30 | |
|
31 | |
public MetaTransportServiceDescriptor(String metaScheme, String scheme, Properties props, ClassLoader classLoader) throws ServiceException |
32 | |
{ |
33 | 0 | super(metaScheme, props, classLoader); |
34 | 0 | this.metaScheme = metaScheme; |
35 | 0 | Properties p = SpiUtils.findServiceDescriptor(ServiceType.TRANSPORT, scheme); |
36 | |
|
37 | 0 | if (p == null) |
38 | |
{ |
39 | 0 | throw new ServiceException(CoreMessages.failedToCreate("transport: " + metaScheme + ":" + scheme)); |
40 | |
} |
41 | 0 | Properties temp = new Properties(); |
42 | 0 | PropertiesUtils.getPropertiesWithPrefix(props, scheme + ".", temp); |
43 | 0 | if (temp.size() > 0) |
44 | |
{ |
45 | 0 | p.putAll(PropertiesUtils.removeNamespaces(temp)); |
46 | |
} |
47 | 0 | setOverrides(p); |
48 | 0 | } |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
@Override |
59 | |
public Connector createConnector() throws TransportServiceException |
60 | |
{ |
61 | 0 | AbstractConnector c = (AbstractConnector) super.createConnector(); |
62 | 0 | c.registerSupportedMetaProtocol(metaScheme); |
63 | 0 | return c; |
64 | |
} |
65 | |
} |