1 | public class ConnectCommand implements ICommand↵ | | 1 | public class DisconnectCommand implements ICommand↵
|
2 | {↵ | | 2 | {↵
|
3 | private static final StringManager s_stringMgr =↵ | | 3 | private static final StringManager s_stringMgr =↵
|
4 | StringManagerFactory.getStringManager(ConnectCommand.class);↵ | | 4 | StringManagerFactory.getStringManager(DisconnectCommand.class);↵
|
|
|
5 | private final ISession _session;↵ | | 5 | private final ISession _session;↵
|
6 | private final WebServicePreferences _prefs;↵ | | 6 | private final WebServicePreferences _prefs;↵
|
7 | private final WebServiceSessionProperties _sessionProps;↵ | | 7 | private final WebServiceSessionProperties _sessionProps;↵
|
|
8 | public ConnectCommand(ISession session, WebServicePreferences prefs,↵ | | 8 | public DisconnectCommand(ISession session, WebServicePreferences prefs,↵
|
9 | WebServiceSessionProperties sessionProps)↵ | | 9 | WebServiceSessionProperties sessionProps)↵
|
10 | {↵ | | 10 | {↵
|
11 | super();↵ | | 11 | super();↵
|
12 | if (session == null)↵ | | 12 | if (session == null)↵
|
13 | {↵ | | 13 | {↵
|
14 | throw new IllegalArgumentException("ISession == null");↵ | | 14 | throw new IllegalArgumentException("ISession == null");↵
|
15 | }↵ | | 15 | }↵
|
16 | if (prefs == null)↵ | | 16 | if (prefs == null)↵
|
17 | {↵ | | 17 | {↵
|
18 | throw new IllegalArgumentException("WebServicePreferences == null");↵ | | 18 | throw new IllegalArgumentException("WebServicePreferences == null");↵
|
19 | }↵ | | 19 | }↵
|
20 | if (sessionProps == null)↵ | | 20 | if (sessionProps == null)↵
|
21 | {↵ | | 21 | {↵
|
22 | throw new IllegalArgumentException("WebServiceSessionProperties == null");↵ | | 22 | throw new IllegalArgumentException("WebServiceSessionProperties == null");↵
|
23 | }↵ | | 23 | }↵
|
|
24 | _session = session;↵ | | 24 | _session = session;↵
|
25 | _prefs = prefs;↵ | | 25 | _prefs = prefs;↵
|
26 | _sessionProps = sessionProps;↵ | | 26 | _sessionProps = sessionProps;↵
|
27 | }↵ | | 27 | }↵
|
|
28 | /**↵ | | 28 | /**↵
|
29 | * Connect to the web service.↵ | | 29 | * Disconnect from the web service.↵
|
30 | */↵ | | 30 | */↵
|
31 | public void execute() throws BaseException↵ | | 31 | public void execute() throws BaseException↵
|
32 | {↵ | | 32 | {↵
|
33 | try↵ | | 33 | try↵
|
34 | {↵ | | 34 | {↵
|
35 | final WebServiceSession wss = _sessionProps.getWebServiceSession();↵ | | 35 | final WebServiceSession wss = _sessionProps.getWebServiceSession();↵
|
36 | if (!wss.isOpen())↵ | | 36 | if (wss.isOpen())↵
|
37 | {↵ | | 37 | {↵
|
38 | wss.open();↵ | | 38 | wss.close();↵
|
39 | // i18n[sqlval.connected=Connected to the SQL Validation web service]↵ | | 39 | // i18n[sqlval.disconnected=Disconnected from the SQL Validation web service]↵
|
40 | _session.showMessage(s_stringMgr.getString("sqlval.connected"));↵ | | 40 | _session.showMessage(s_stringMgr.getString("sqlval.disconnected"));↵
|
41 | }↵ | | 41 | }↵
|
42 | }↵ | | 42 | }↵
|
43 | catch (Throwable th)↵ | | 43 | catch (Throwable th)↵
|
44 | {↵ | | 44 | {↵
|
45 | throw new BaseException(th) | | 45 | throw new BaseException(th)
|