svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.geodb.app / org.gvsig.geodb.app.mainplugin / src / main / java / org / gvsig / geodb / vectorialdb / DBResourceManager.java @ 40596
History | View | Annotate | Download (3.54 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.geodb.vectorialdb; |
25 |
|
26 |
import org.gvsig.andami.PluginServices; |
27 |
import org.gvsig.fmap.dal.DALLocator; |
28 |
import org.gvsig.fmap.dal.resource.Resource; |
29 |
import org.gvsig.fmap.dal.resource.ResourceManager; |
30 |
import org.gvsig.fmap.dal.resource.ResourceNotification; |
31 |
import org.gvsig.fmap.dal.resource.db.DBParameters; |
32 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
33 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResource; |
34 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters; |
35 |
import org.gvsig.tools.observer.Observable; |
36 |
import org.gvsig.tools.observer.Observer; |
37 |
|
38 |
|
39 |
//TODO comentado para que compile
|
40 |
public class DBResourceManager implements Observer { |
41 |
private boolean checking = false; |
42 |
|
43 |
public DBResourceManager(){
|
44 |
|
45 |
} |
46 |
public void update(Observable observable, Object notification) { |
47 |
if (!(notification instanceof ResourceNotification)) { |
48 |
return;
|
49 |
} |
50 |
ResourceNotification resNot = (ResourceNotification) notification; |
51 |
if (!resNot.getType().equals(ResourceNotification.PREPARE)){
|
52 |
return;
|
53 |
} |
54 |
if (!(resNot.getResource() instanceof JDBCResource)){ |
55 |
return;
|
56 |
} |
57 |
JDBCResource res = (JDBCResource)resNot.getResource(); |
58 |
JDBCResourceParameters resPrams = (JDBCResourceParameters) resNot |
59 |
.getParameters(); |
60 |
if (!checking && resPrams.getPassword() == null) { |
61 |
checking = true;
|
62 |
JPasswordDlg passwordPanel=new JPasswordDlg();
|
63 |
passwordPanel.setMessage(PluginServices.getText(this,"falta_por_introducir_la_clave_en_la_conexion")); |
64 |
PluginServices.getMDIManager().addCentredWindow(passwordPanel); |
65 |
resPrams.setPassword(passwordPanel.getPassword()); |
66 |
// TODO check if password is ok ??
|
67 |
// if(!res.testConnection()){
|
68 |
// checking=false;
|
69 |
// try {
|
70 |
// res.setPassword(null);
|
71 |
// } catch (InitializeException e) {
|
72 |
// e.printStackTrace();
|
73 |
// }
|
74 |
// }
|
75 |
// checking=false;
|
76 |
} |
77 |
} |
78 |
|
79 |
private JDBCResource getResource(
|
80 |
DBServerExplorerParameters explorerParameters) { |
81 |
ResourceManager rManager = DALLocator.getResourceManager(); |
82 |
Resource res; |
83 |
|
84 |
|
85 |
|
86 |
return null; |
87 |
} |
88 |
|
89 |
private JDBCResource getResource(DBParameters storeParameters) {
|
90 |
ResourceManager rManager = DALLocator.getResourceManager(); |
91 |
|
92 |
return null; |
93 |
} |
94 |
|
95 |
// public boolean isConnected(DBParameters dbParameters);
|
96 |
//
|
97 |
//
|
98 |
// public boolean isConnected(DBExplorerParameters explorerParameters) {
|
99 |
// DBResourceManager res = this.getResource(explorerParameters);
|
100 |
// if (res == null) {
|
101 |
// return false;
|
102 |
// }
|
103 |
// return res.isOpen();
|
104 |
// }
|
105 |
//
|
106 |
// public boolean isConnected(DBExplorer explorer) {
|
107 |
// JDBCResource res = this.getResource(explorer.getParameters());
|
108 |
// if (res == null) {
|
109 |
// return false;
|
110 |
// }
|
111 |
// return res.isOpen();
|
112 |
// }
|
113 |
|
114 |
} |
115 |
|