1 | { **************************************************************
|
---|
2 | Package: XWB - Kernel RPCBroker
|
---|
3 | Date Created: Sept 18, 1997 (Version 1.1)
|
---|
4 | Site Name: Oakland, OI Field Office, Dept of Veteran Affairs
|
---|
5 | Developers: Danila Manapsal, Don Craven, Joel Ivey
|
---|
6 | Description: Property Editors for TRPCBroker component.
|
---|
7 | Current Release: Version 1.1 Patch 47 (Jun. 17, 2008))
|
---|
8 | *************************************************************** }
|
---|
9 |
|
---|
10 | unit RpcbEdtr;
|
---|
11 |
|
---|
12 | {$I IISBase.inc}
|
---|
13 |
|
---|
14 | interface
|
---|
15 |
|
---|
16 | uses
|
---|
17 | {Delphi standard}
|
---|
18 | Classes, Controls, Dialogs,
|
---|
19 | {$IFDEF D6_OR_HIGHER}
|
---|
20 | DesignIntf, DesignEditors, DesignMenus,
|
---|
21 | {$ELSE}
|
---|
22 | DsgnIntf,
|
---|
23 | {$ENDIF}
|
---|
24 | Forms, Graphics, Messages, SysUtils,
|
---|
25 | WinProcs, WinTypes,
|
---|
26 | Trpcb; //P14 -- pack split
|
---|
27 |
|
---|
28 |
|
---|
29 | type
|
---|
30 |
|
---|
31 | {------ TRemoteProc property editor ------}
|
---|
32 | {This property editor gets a list of remote procedures from the API file.}
|
---|
33 |
|
---|
34 | TRemoteProcProperty = class(TStringProperty)
|
---|
35 | private
|
---|
36 | { Private declarations }
|
---|
37 | protected
|
---|
38 | { Protected declarations }
|
---|
39 | public
|
---|
40 | { Public declarations }
|
---|
41 | function GetAttributes: TPropertyAttributes; override;
|
---|
42 | procedure GetValues(Proc: TGetStrProc); override;
|
---|
43 | procedure SetValue(const Value: string); override;
|
---|
44 | end;
|
---|
45 |
|
---|
46 |
|
---|
47 | {------ TServerProperty property editor ------}
|
---|
48 | {This property editor gets a list of servers from the C:\WINDOWS\HOSTS file}
|
---|
49 |
|
---|
50 | TServerProperty = class(TStringProperty)
|
---|
51 | private
|
---|
52 | { Private declarations }
|
---|
53 | protected
|
---|
54 | { Protected declarations }
|
---|
55 | public
|
---|
56 | { Public declarations }
|
---|
57 | function GetAttributes: TPropertyAttributes; override;
|
---|
58 | procedure GetValues(Proc: TGetStrProc); override;
|
---|
59 | function GetValue: string; override;
|
---|
60 | procedure SetValue(const Value: string); override;
|
---|
61 | end;
|
---|
62 |
|
---|
63 |
|
---|
64 | {------ TRpcVersion property editor ------}
|
---|
65 | {This property editor checks to make sure that RpcVersion is not eimpty.
|
---|
66 | If it is, it stuffs '0' (default).}
|
---|
67 |
|
---|
68 | TRpcVersionProperty = class(TStringProperty)
|
---|
69 | private
|
---|
70 | { Private declarations }
|
---|
71 | protected
|
---|
72 | { Protected declarations }
|
---|
73 | public
|
---|
74 | { Public declarations }
|
---|
75 | procedure SetValue(const Value: string); override;
|
---|
76 | end;
|
---|
77 |
|
---|
78 |
|
---|
79 | procedure Register;
|
---|
80 |
|
---|
81 |
|
---|
82 | implementation
|
---|
83 |
|
---|
84 |
|
---|
85 | uses
|
---|
86 | XWBut1, MFunStr, {TRPCB,} Hash, RpcbErr; //P14 -- pack split
|
---|
87 |
|
---|
88 | function TRemoteProcProperty.GetAttributes;
|
---|
89 | begin
|
---|
90 | Result := [paAutoUpdate,paValueList];
|
---|
91 | end;
|
---|
92 |
|
---|
93 | procedure TRemoteProcProperty.GetValues(Proc: TGetStrProc);
|
---|
94 | var
|
---|
95 | RpcbEdited, RPCBTemp: TRPCBroker;
|
---|
96 | I: integer;
|
---|
97 | begin
|
---|
98 | RPCBTemp := nil;
|
---|
99 | RpcbEdited := GetComponent(0) as TRPCBroker;
|
---|
100 | try
|
---|
101 | RPCBTemp := TRPCBroker.Create(RpcbEdited);
|
---|
102 | with RpcbTemp do begin
|
---|
103 | ShowErrorMsgs := RpcbEdited.ShowErrorMsgs;
|
---|
104 | Server := RpcbEdited.Server;
|
---|
105 | ListenerPort := RpcbEdited.ListenerPort;
|
---|
106 | ClearParameters := True;
|
---|
107 | ClearResults := True;
|
---|
108 | RemoteProcedure := 'XWB RPC LIST';
|
---|
109 | Param[0].Value := GetValue;
|
---|
110 | Param[0].PType := literal;
|
---|
111 | Call;
|
---|
112 | for I := 0 to Results.Count - 1 do Proc(Results[I]);
|
---|
113 | end;
|
---|
114 | finally
|
---|
115 | RPCBTemp.Free;
|
---|
116 | end;
|
---|
117 | end;
|
---|
118 |
|
---|
119 | procedure TRemoteProcProperty.SetValue(const Value: string);
|
---|
120 | begin
|
---|
121 | SetStrValue(UpperCase(Piece(Value,' [',1))); {convert user entry all to upper case}
|
---|
122 | end;
|
---|
123 |
|
---|
124 | function TServerProperty.GetAttributes;
|
---|
125 | begin
|
---|
126 | Result := [paAutoUpdate,paValueList];
|
---|
127 | end;
|
---|
128 |
|
---|
129 | function TServerProperty.GetValue: string;
|
---|
130 | begin
|
---|
131 | Result := Piece(GetStrValue,' [',1); {get just the name}
|
---|
132 | end;
|
---|
133 |
|
---|
134 | procedure TServerProperty.GetValues(Proc: TGetStrProc);
|
---|
135 | var
|
---|
136 | ServerList: TStringList;
|
---|
137 | I: integer;
|
---|
138 | begin
|
---|
139 | ServerList := TStringList.Create;
|
---|
140 | GetHostList(ServerList);
|
---|
141 | for I := 0 to ServerList.Count - 1 do Proc(ServerList[I]);
|
---|
142 | ServerList.Free;
|
---|
143 | end;
|
---|
144 |
|
---|
145 | procedure TServerProperty.SetValue(const Value: string);
|
---|
146 | begin
|
---|
147 | SetStrValue(Piece(Value,' [',1)); {get just the name}
|
---|
148 | end;
|
---|
149 |
|
---|
150 | procedure TRpcVersionProperty.SetValue(const Value: string);
|
---|
151 | begin
|
---|
152 | {
|
---|
153 | try
|
---|
154 | if Value = '' then NetError('Configure',XWB_NullRpcVer)
|
---|
155 | else SetStrValue(Value);
|
---|
156 | except
|
---|
157 | on E: EBrokerError do begin
|
---|
158 | ShowBrokerError(E);
|
---|
159 | SetStrValue('0');
|
---|
160 | end;
|
---|
161 | end;
|
---|
162 | }
|
---|
163 | if Value <> '' then SetStrValue(Value)
|
---|
164 | else begin
|
---|
165 | ShowMessage('RPCVersion cannot be empty. Default is 0 (zero).');
|
---|
166 | SetStrValue('0');
|
---|
167 | end;
|
---|
168 | end;
|
---|
169 |
|
---|
170 | procedure Register;
|
---|
171 | begin
|
---|
172 | RegisterPropertyEditor(TypeInfo(TRemoteProc),nil,'',TRemoteProcProperty);
|
---|
173 | RegisterPropertyEditor(TypeInfo(TServer),nil,'',TServerProperty);
|
---|
174 | RegisterPropertyEditor(TypeInfo(TRpcVersion),nil,'',TRpcVersionProperty);
|
---|
175 | end;
|
---|
176 |
|
---|
177 | end.
|
---|