77import org .jkiss .dbeaver .model .*;
88import org .jkiss .dbeaver .model .access .DBAAuthProfile ;
99import org .jkiss .dbeaver .model .access .DBACredentialsProvider ;
10+ import org .jkiss .dbeaver .model .app .DBPDataSourceRegistry ;
1011import org .jkiss .dbeaver .model .app .DBPProject ;
1112import org .jkiss .dbeaver .model .connection .DBPConnectionConfiguration ;
1213import org .jkiss .dbeaver .model .connection .DBPDriver ;
1314import org .jkiss .dbeaver .model .net .DBWNetworkProfile ;
15+ import org .jkiss .dbeaver .model .runtime .DBRProgressMonitor ;
1416import org .jkiss .dbeaver .model .struct .DBSObjectFilter ;
15- import org .jkiss .dbeaver .registry .DataSourceDescriptor ;
16- import org .jkiss .dbeaver .registry .DataSourceFolder ;
17+ import org .jkiss .dbeaver .registry .DataSourceConfigurationManager ;
18+ import org .jkiss .dbeaver .registry .DataSourcePersistentRegistry ;
1719import org .jkiss .dbeaver .registry .DataSourceRegistry ;
1820
1921import java .util .List ;
22+ import java .util .Set ;
23+ import java .util .function .Predicate ;
2024import java .util .stream .Collectors ;
2125
22- public class WebDataSourceRegistryProxy extends DataSourceRegistry {
26+ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry , DataSourcePersistentRegistry {
2327 private final DataSourceFilter dataSourceFilter ;
28+ private final DataSourceRegistry dataSourceRegistry ;
2429
2530 public WebDataSourceRegistryProxy (DataSourceRegistry dataSourceRegistry , DataSourceFilter filter ) {
26- super ( dataSourceRegistry . getProject ()) ;
31+ this . dataSourceRegistry = dataSourceRegistry ;
2732 this .dataSourceFilter = filter ;
2833 }
2934
35+ @ Override
36+ public DBPProject getProject () {
37+ return dataSourceRegistry .getProject ();
38+ }
39+
3040 @ Nullable
3141 @ Override
32- public DataSourceDescriptor getDataSource (String id ) {
33- DataSourceDescriptor dataSource = super .getDataSource (id );
42+ public DBPDataSourceContainer getDataSource (String id ) {
43+ DBPDataSourceContainer dataSource = dataSourceRegistry .getDataSource (id );
3444 if (dataSourceFilter != null && !dataSourceFilter .filter (dataSource )) {
3545 return null ;
3646 }
@@ -39,17 +49,17 @@ public DataSourceDescriptor getDataSource(String id) {
3949
4050 @ Nullable
4151 @ Override
42- public DataSourceDescriptor getDataSource (DBPDataSource dataSource ) {
52+ public DBPDataSourceContainer getDataSource (DBPDataSource dataSource ) {
4353 if (dataSourceFilter != null && !dataSourceFilter .filter (dataSource .getContainer ())) {
4454 return null ;
4555 }
46- return super .getDataSource (dataSource );
56+ return dataSourceRegistry .getDataSource (dataSource );
4757 }
4858
4959 @ Nullable
5060 @ Override
51- public DataSourceDescriptor findDataSourceByName (String name ) {
52- var dataSource = super .findDataSourceByName (name );
61+ public DBPDataSourceContainer findDataSourceByName (String name ) {
62+ var dataSource = dataSourceRegistry .findDataSourceByName (name );
5363 if (dataSource != null ) {
5464 if (dataSourceFilter == null || dataSourceFilter .filter (dataSource )) {
5565 return dataSource ;
@@ -61,18 +71,241 @@ public DataSourceDescriptor findDataSourceByName(String name) {
6171 @ NotNull
6272 @ Override
6373 public List <? extends DBPDataSourceContainer > getDataSourcesByProfile (@ NotNull DBWNetworkProfile profile ) {
64- return super .getDataSourcesByProfile (profile )
74+ return dataSourceRegistry .getDataSourcesByProfile (profile )
6575 .stream ()
6676 .filter (dataSourceFilter ::filter )
6777 .collect (Collectors .toList ());
6878 }
6979
7080 @ NotNull
7181 @ Override
72- public List <DataSourceDescriptor > getDataSources () {
73- return super .getDataSources ()
82+ public List <DBPDataSourceContainer > getDataSources () {
83+ return dataSourceRegistry .getDataSources ()
7484 .stream ()
7585 .filter (dataSourceFilter ::filter )
7686 .collect (Collectors .toList ());
7787 }
88+
89+ @ NotNull
90+ @ Override
91+ public DBPDataSourceContainer createDataSource (DBPDriver driver , DBPConnectionConfiguration connConfig ) {
92+ return dataSourceRegistry .createDataSource (driver , connConfig );
93+ }
94+
95+ @ NotNull
96+ @ Override
97+ public DBPDataSourceContainer createDataSource (DBPDataSourceContainer source ) {
98+ return dataSourceRegistry .createDataSource (source );
99+ }
100+
101+ @ Override
102+ public void addDataSourceListener (@ NotNull DBPEventListener listener ) {
103+ dataSourceRegistry .addDataSourceListener (listener );
104+ }
105+
106+ @ Override
107+ public boolean removeDataSourceListener (@ NotNull DBPEventListener listener ) {
108+ return dataSourceRegistry .removeDataSourceListener (listener );
109+ }
110+
111+ @ Override
112+ public void addDataSource (@ NotNull DBPDataSourceContainer dataSource ) {
113+ dataSourceRegistry .addDataSource (dataSource );
114+ }
115+
116+ @ Override
117+ public void removeDataSource (@ NotNull DBPDataSourceContainer dataSource ) {
118+ dataSourceRegistry .removeDataSource (dataSource );
119+ }
120+
121+ @ Override
122+ public void updateDataSource (@ NotNull DBPDataSourceContainer dataSource ) {
123+ dataSourceRegistry .updateDataSource (dataSource );
124+ }
125+
126+ @ NotNull
127+ @ Override
128+ public List <? extends DBPDataSourceFolder > getAllFolders () {
129+ return dataSourceRegistry .getAllFolders ();
130+ }
131+
132+ @ NotNull
133+ @ Override
134+ public List <? extends DBPDataSourceFolder > getRootFolders () {
135+ return dataSourceRegistry .getRootFolders ();
136+ }
137+
138+ @ Override
139+ public DBPDataSourceFolder getFolder (String path ) {
140+ return dataSourceRegistry .getFolder (path );
141+ }
142+
143+ @ Override
144+ public DBPDataSourceFolder addFolder (DBPDataSourceFolder parent , String name ) {
145+ return dataSourceRegistry .addFolder (parent , name );
146+ }
147+
148+ @ Override
149+ public void removeFolder (DBPDataSourceFolder folder , boolean dropContents ) {
150+ dataSourceRegistry .removeFolder (folder , dropContents );
151+ }
152+
153+ @ Nullable
154+ @ Override
155+ public DBSObjectFilter getSavedFilter (String name ) {
156+ return dataSourceRegistry .getSavedFilter (name );
157+ }
158+
159+ @ NotNull
160+ @ Override
161+ public List <DBSObjectFilter > getSavedFilters () {
162+ return dataSourceRegistry .getSavedFilters ();
163+ }
164+
165+ @ Override
166+ public void updateSavedFilter (DBSObjectFilter filter ) {
167+ dataSourceRegistry .updateSavedFilter (filter );
168+ }
169+
170+ @ Override
171+ public void removeSavedFilter (String filterName ) {
172+ dataSourceRegistry .removeSavedFilter (filterName );
173+ }
174+
175+ @ Nullable
176+ @ Override
177+ public DBWNetworkProfile getNetworkProfile (String name ) {
178+ return dataSourceRegistry .getNetworkProfile (name );
179+ }
180+
181+ @ NotNull
182+ @ Override
183+ public List <DBWNetworkProfile > getNetworkProfiles () {
184+ return dataSourceRegistry .getNetworkProfiles ();
185+ }
186+
187+ @ Override
188+ public void updateNetworkProfile (DBWNetworkProfile profile ) {
189+ dataSourceRegistry .updateNetworkProfile (profile );
190+ }
191+
192+ @ Override
193+ public void removeNetworkProfile (DBWNetworkProfile profile ) {
194+ dataSourceRegistry .removeNetworkProfile (profile );
195+ }
196+
197+ @ Nullable
198+ @ Override
199+ public DBAAuthProfile getAuthProfile (String id ) {
200+ return dataSourceRegistry .getAuthProfile (id );
201+ }
202+
203+ @ NotNull
204+ @ Override
205+ public List <DBAAuthProfile > getAllAuthProfiles () {
206+ return dataSourceRegistry .getAllAuthProfiles ();
207+ }
208+
209+ @ NotNull
210+ @ Override
211+ public List <DBAAuthProfile > getApplicableAuthProfiles (@ Nullable DBPDriver driver ) {
212+ return dataSourceRegistry .getApplicableAuthProfiles (driver );
213+ }
214+
215+ @ Override
216+ public void updateAuthProfile (DBAAuthProfile profile ) {
217+ dataSourceRegistry .updateAuthProfile (profile );
218+ }
219+
220+ @ Override
221+ public void removeAuthProfile (DBAAuthProfile profile ) {
222+ dataSourceRegistry .removeAuthProfile (profile );
223+ }
224+
225+ @ Override
226+ public void flushConfig () {
227+ dataSourceRegistry .flushConfig ();
228+ }
229+
230+ @ Override
231+ public void refreshConfig () {
232+ dataSourceRegistry .refreshConfig ();
233+ }
234+
235+ @ Override
236+ public Throwable getLastError () {
237+ return dataSourceRegistry .getLastError ();
238+ }
239+
240+ @ Override
241+ public boolean hasError () {
242+ return dataSourceRegistry .hasError ();
243+ }
244+
245+ @ Override
246+ public void checkForErrors () throws DBException {
247+ dataSourceRegistry .checkForErrors ();
248+ }
249+
250+ @ Override
251+ public void notifyDataSourceListeners (DBPEvent event ) {
252+ dataSourceRegistry .notifyDataSourceListeners (event );
253+ }
254+
255+ @ NotNull
256+ @ Override
257+ public ISecurePreferences getSecurePreferences () {
258+ return dataSourceRegistry .getSecurePreferences ();
259+ }
260+
261+ @ Nullable
262+ @ Override
263+ public DBACredentialsProvider getAuthCredentialsProvider () {
264+ return dataSourceRegistry .getAuthCredentialsProvider ();
265+ }
266+
267+ @ Override
268+ public void dispose () {
269+ dataSourceRegistry .dispose ();
270+ }
271+
272+ @ Override
273+ public void setAuthCredentialsProvider (DBACredentialsProvider authCredentialsProvider ) {
274+ dataSourceRegistry .setAuthCredentialsProvider (authCredentialsProvider );
275+ }
276+
277+ @ Override
278+ public Set <DBPDataSourceFolder > getTemporaryFolders () {
279+ return dataSourceRegistry .getTemporaryFolders ();
280+ }
281+
282+ @ Override
283+ public void loadDataSources (
284+ @ NotNull List <DBPDataSourceConfigurationStorage > storages ,
285+ @ NotNull DataSourceConfigurationManager manager ,
286+ boolean refresh ,
287+ boolean purgeUntouched
288+ ) {
289+ dataSourceRegistry .loadDataSources (storages , manager , refresh , purgeUntouched );
290+ }
291+
292+ @ Override
293+ public void saveDataSources () {
294+ dataSourceRegistry .saveDataSources ();
295+ }
296+
297+ @ Override
298+ public DataSourceConfigurationManager getConfigurationManager () {
299+ return dataSourceRegistry .getConfigurationManager ();
300+ }
301+
302+ @ Override
303+ public void saveConfigurationToManager (
304+ @ NotNull DBRProgressMonitor monitor ,
305+ @ NotNull DataSourceConfigurationManager configurationManager ,
306+ @ Nullable Predicate <DBPDataSourceContainer > filter
307+ ) {
308+ dataSourceRegistry .saveConfigurationToManager (monitor , configurationManager , filter );
309+ }
310+
78311}
0 commit comments