root / branches / v2_0_0_prep / extensions / extGeoDB / src / org / gvsig / geodb / vectorialdb / DBResourceManager.java @ 38608
History | View | Annotate | Download (3.55 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 2
|
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 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2008 IVER T.I {{Task}}
|
26 |
*/
|
27 |
|
28 |
/**
|
29 |
*
|
30 |
*/
|
31 |
package org.gvsig.geodb.vectorialdb; |
32 |
|
33 |
import org.gvsig.andami.PluginServices; |
34 |
import org.gvsig.fmap.dal.DALLocator; |
35 |
import org.gvsig.fmap.dal.resource.Resource; |
36 |
import org.gvsig.fmap.dal.resource.ResourceManager; |
37 |
import org.gvsig.fmap.dal.resource.ResourceNotification; |
38 |
import org.gvsig.fmap.dal.resource.db.DBParameters; |
39 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
40 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResource; |
41 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters; |
42 |
import org.gvsig.tools.observer.Observable; |
43 |
import org.gvsig.tools.observer.Observer; |
44 |
|
45 |
|
46 |
//TODO comentado para que compile
|
47 |
public class DBResourceManager implements Observer { |
48 |
private boolean checking = false; |
49 |
|
50 |
public DBResourceManager(){
|
51 |
|
52 |
} |
53 |
public void update(Observable observable, Object notification) { |
54 |
if (!(notification instanceof ResourceNotification)) { |
55 |
return;
|
56 |
} |
57 |
ResourceNotification resNot = (ResourceNotification) notification; |
58 |
if (!resNot.getType().equals(ResourceNotification.PREPARE)){
|
59 |
return;
|
60 |
} |
61 |
if (!(resNot.getResource() instanceof JDBCResource)){ |
62 |
return;
|
63 |
} |
64 |
JDBCResource res = (JDBCResource)resNot.getResource(); |
65 |
JDBCResourceParameters resPrams = (JDBCResourceParameters) resNot |
66 |
.getParameters(); |
67 |
if (!checking && resPrams.getPassword() == null) { |
68 |
checking = true;
|
69 |
JPasswordDlg passwordPanel=new JPasswordDlg();
|
70 |
passwordPanel.setMessage(PluginServices.getText(this,"falta_por_introducir_la_clave_en_la_conexion")); |
71 |
PluginServices.getMDIManager().addCentredWindow(passwordPanel); |
72 |
resPrams.setPassword(passwordPanel.getPassword()); |
73 |
// TODO check if password is ok ??
|
74 |
// if(!res.testConnection()){
|
75 |
// checking=false;
|
76 |
// try {
|
77 |
// res.setPassword(null);
|
78 |
// } catch (InitializeException e) {
|
79 |
// e.printStackTrace();
|
80 |
// }
|
81 |
// }
|
82 |
// checking=false;
|
83 |
} |
84 |
} |
85 |
|
86 |
private JDBCResource getResource(
|
87 |
DBServerExplorerParameters explorerParameters) { |
88 |
ResourceManager rManager = DALLocator.getResourceManager(); |
89 |
Resource res; |
90 |
|
91 |
|
92 |
|
93 |
return null; |
94 |
} |
95 |
|
96 |
private JDBCResource getResource(DBParameters storeParameters) {
|
97 |
ResourceManager rManager = DALLocator.getResourceManager(); |
98 |
|
99 |
return null; |
100 |
} |
101 |
|
102 |
// public boolean isConnected(DBParameters dbParameters);
|
103 |
//
|
104 |
//
|
105 |
// public boolean isConnected(DBExplorerParameters explorerParameters) {
|
106 |
// DBResourceManager res = this.getResource(explorerParameters);
|
107 |
// if (res == null) {
|
108 |
// return false;
|
109 |
// }
|
110 |
// return res.isOpen();
|
111 |
// }
|
112 |
//
|
113 |
// public boolean isConnected(DBExplorer explorer) {
|
114 |
// JDBCResource res = this.getResource(explorer.getParameters());
|
115 |
// if (res == null) {
|
116 |
// return false;
|
117 |
// }
|
118 |
// return res.isOpen();
|
119 |
// }
|
120 |
|
121 |
} |
122 |
|