1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.config.spring.editors; |
8 | |
|
9 | |
import org.mule.api.MuleContext; |
10 | |
import org.mule.api.transport.Connector; |
11 | |
import org.mule.config.i18n.CoreMessages; |
12 | |
|
13 | |
import java.beans.PropertyEditorSupport; |
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
public class ConnectorPropertyEditor extends PropertyEditorSupport |
22 | |
{ |
23 | |
private MuleContext muleContext; |
24 | |
|
25 | |
public ConnectorPropertyEditor(MuleContext muleContext) |
26 | 0 | { |
27 | 0 | this.muleContext = muleContext; |
28 | 0 | } |
29 | |
|
30 | |
public void setAsText(String text) |
31 | |
{ |
32 | |
|
33 | 0 | Connector connector = muleContext.getRegistry().lookupConnector(text); |
34 | |
|
35 | 0 | if (connector == null) |
36 | |
{ |
37 | 0 | throw new IllegalArgumentException(CoreMessages.objectNotRegistered("Connector", text).getMessage()); |
38 | |
} |
39 | 0 | setValue(connector); |
40 | 0 | } |
41 | |
} |