Revision 40058
tags/extensions/org.gvsig.geodb/2.0/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
|
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<artifactId>org.gvsig.geodb</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<version>2.0</version> |
|
9 |
<name>extGeoDB</name> |
|
10 |
<description>Connection manager to spatial databases. |
|
11 |
- PostgreSQL |
|
12 |
- MySQL |
|
13 |
- H2</description> |
|
14 |
|
|
15 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop</url> |
|
16 |
|
|
17 |
<parent> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>gvsig-base-extension-pom</artifactId> |
|
20 |
<version>2.0</version> |
|
21 |
</parent> |
|
22 |
|
|
23 |
<scm> |
|
24 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/tags/extensions/org.gvsig.geodb/2.0</connection> |
|
25 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-desktop/tags/extensions/org.gvsig.geodb/2.0</developerConnection> |
|
26 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/show/tags/extensions/org.gvsig.geodb/2.0</url> |
|
27 |
</scm> |
|
28 |
|
|
29 |
<dependencies> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
38 |
<classifier>spi</classifier> |
|
39 |
<scope>compile</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
43 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
44 |
<scope>compile</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.gvsig</groupId> |
|
48 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
49 |
<scope>compile</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>org.gvsig</groupId> |
|
53 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
54 |
<classifier>store.jdbc</classifier> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
60 |
<classifier>store.postgresql</classifier> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.fmap.dal.db</artifactId> |
|
66 |
<classifier>store.mysql</classifier> |
|
67 |
<scope>compile</scope> |
|
68 |
</dependency> |
|
69 |
<dependency> |
|
70 |
<groupId>org.gvsig</groupId> |
|
71 |
<artifactId>org.gvsig.ui</artifactId> |
|
72 |
<scope>compile</scope> |
|
73 |
</dependency> |
|
74 |
<dependency> |
|
75 |
<groupId>org.gvsig</groupId> |
|
76 |
<artifactId>org.gvsig.app</artifactId> |
|
77 |
<version>2.0</version> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
83 |
<version>2.0.0</version> |
|
84 |
<scope>compile</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>org.gvsig</groupId> |
|
88 |
<artifactId>org.gvsig.about.api</artifactId> |
|
89 |
<scope>compile</scope> |
|
90 |
</dependency> |
|
91 |
<dependency> |
|
92 |
<groupId>org.gvsig</groupId> |
|
93 |
<artifactId>org.gvsig.andami</artifactId> |
|
94 |
<scope>compile</scope> |
|
95 |
</dependency> |
|
96 |
<dependency> |
|
97 |
<groupId>org.gvsig</groupId> |
|
98 |
<artifactId>org.gvsig.utils</artifactId> |
|
99 |
<scope>compile</scope> |
|
100 |
</dependency> |
|
101 |
<dependency> |
|
102 |
<groupId>org.gvsig</groupId> |
|
103 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
104 |
<scope>compile</scope> |
|
105 |
</dependency> |
|
106 |
<dependency> |
|
107 |
<groupId>org.gvsig</groupId> |
|
108 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
109 |
<scope>compile</scope> |
|
110 |
</dependency> |
|
111 |
<dependency> |
|
112 |
<groupId>org.gvsig</groupId> |
|
113 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
114 |
<scope>compile</scope> |
|
115 |
</dependency> |
|
116 |
<dependency> |
|
117 |
<groupId>org.gvsig</groupId> |
|
118 |
<artifactId>org.gvsig.projection</artifactId> |
|
119 |
<scope>compile</scope> |
|
120 |
</dependency> |
|
121 |
<dependency> |
|
122 |
<groupId>org.gvsig</groupId> |
|
123 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
124 |
<scope>compile</scope> |
|
125 |
</dependency> |
|
126 |
<dependency> |
|
127 |
<groupId>org.gvsig</groupId> |
|
128 |
<artifactId>org.gvsig.personaldb.lib.api</artifactId> |
|
129 |
<scope>compile</scope> |
|
130 |
</dependency> |
|
131 |
<dependency> |
|
132 |
<groupId>org.gvsig</groupId> |
|
133 |
<artifactId>org.gvsig.personaldb.lib.impl</artifactId> |
|
134 |
<scope>compile</scope> |
|
135 |
</dependency> |
|
136 |
<dependency> |
|
137 |
<groupId>org.gvsig</groupId> |
|
138 |
<artifactId>org.gvsig.timesupport.lib.api</artifactId> |
|
139 |
<scope>compile</scope> |
|
140 |
</dependency> |
|
141 |
<dependency> |
|
142 |
<groupId>org.slf4j</groupId> |
|
143 |
<artifactId>slf4j-api</artifactId> |
|
144 |
<scope>compile</scope> |
|
145 |
</dependency> |
|
146 |
<dependency> |
|
147 |
<groupId>commons-collections</groupId> |
|
148 |
<artifactId>commons-collections</artifactId> |
|
149 |
<scope>compile</scope> |
|
150 |
</dependency> |
|
151 |
<dependency> |
|
152 |
<groupId>org.gvsig</groupId> |
|
153 |
<artifactId>org.gvsig.i18n</artifactId> |
|
154 |
<scope>compile</scope> |
|
155 |
</dependency> |
|
156 |
</dependencies> |
|
157 |
<properties> |
|
158 |
<build-dir>${basedir}/../build</build-dir> |
|
159 |
<eclipse.project.name>extGeoDB</eclipse.project.name> |
|
160 |
<package.info.dependencies>required: org.gvsig.app.document.table.app.mainplugin -ge 2</package.info.dependencies> |
|
161 |
<package.info.state>final</package.info.state> |
|
162 |
<!-- alpha-devel --> |
|
163 |
<package.info.categories>Formats,Database</package.info.categories> |
|
164 |
</properties> |
|
165 |
<build> |
|
166 |
<sourceDirectory>src</sourceDirectory> |
|
167 |
<!-- <testSourceDirectory>src-test</testSourceDirectory> --> |
|
168 |
<plugins> |
|
169 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
170 |
<plugin> |
|
171 |
<groupId>org.apache.maven.plugins</groupId> |
|
172 |
<artifactId>maven-surefire-plugin</artifactId> |
|
173 |
<configuration> |
|
174 |
<skipTests>true</skipTests> |
|
175 |
</configuration> |
|
176 |
</plugin> |
|
177 |
|
|
178 |
<plugin> |
|
179 |
<artifactId>maven-release-plugin</artifactId> |
|
180 |
<version>2.0</version> |
|
181 |
<configuration> |
|
182 |
<tagBase>https://devel.gvsig.org/svn/gvsig-desktop/tags/extensions/${artifactId}</tagBase> |
|
183 |
</configuration> |
|
184 |
</plugin> |
|
185 |
|
|
186 |
</plugins> |
|
187 |
</build> |
|
188 |
</project> |
tags/extensions/org.gvsig.geodb/2.0/resources/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
more_provider_parameters_needed_message=El driver seleccionado necesita par?metros adicionales.\nA continuaci?n se abrir? el editor de propiedades avanzado. |
|
3 |
more_provider_parameters_needed_title=Par?metros adicionales requeridos |
|
4 |
_Advanced_properties=Propiedades avanzadas |
|
5 |
_Get_view_extent=Capturar extensi?n de la vista |
|
6 |
choose_connection=Elija conexi?n |
|
7 |
choose_table=Elija tabla |
|
8 |
connection_error=Error de conexi?n |
|
9 |
table_fields=Columnas de la tabla |
|
10 |
_All=Todos |
|
11 |
_None=Ninguno |
|
12 |
_Name=Nombre |
|
13 |
_SQL_restriction=Restricci?n SQL |
|
14 |
_Id_field=Campo ID |
|
15 |
_Table_settings=Configuraci?n de tabla |
|
16 |
_Advanced_properties=Propiedades avanzadas |
|
17 |
_Working_area=?rea de trabajo |
|
18 |
_Geo_field=Campo geom?trico |
|
19 |
_Get_view_extent=Obtener ?rea de la vista |
|
20 |
_Schema=Esquema |
|
21 |
_Host=Servidor |
|
22 |
_Port=Puerto |
|
23 |
_User=Usuario |
|
24 |
_Password=Contrase?a |
|
25 |
_Database=Base de datos |
|
26 |
_Driver_type=Conector |
|
27 |
_Connection_name=Nombre de conexi?n |
|
28 |
_Connection_parameters=Par?metros de conexi?n |
|
29 |
_Connected=Conectado |
|
30 |
more_provider_parameters_needed_message=Hubo un problema con los par?metros. Se abrir? el di?logo de propiedades avanzadas. |
|
31 |
more_provider_parameters_needed_title=Faltan par?metros |
|
32 |
|
tags/extensions/org.gvsig.geodb/2.0/resources/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
more_provider_parameters_needed_message=The selected driver requires more additional parameters.\nNext the advanced properties editor will be opened. |
|
3 |
more_provider_parameters_needed_title=More parameters required |
|
4 |
_Advanced_properties=Advanced properties |
|
5 |
_Get_view_extent=Get view extent |
|
6 |
choose_connection=Choose connection |
|
7 |
choose_table=Choose table |
|
8 |
connection_error=Connection error |
|
9 |
table_fields=Table fields |
|
10 |
_All=All |
|
11 |
_None=None |
|
12 |
_Name=Name |
|
13 |
_SQL_restriction=SQL restriction |
|
14 |
_Id_field=ID field |
|
15 |
_Table_settings=Table settings |
|
16 |
_Advanced_properties=Advanced properties |
|
17 |
_Working_area=Working area |
|
18 |
_Geo_field=Geometry field |
|
19 |
_Get_view_extent=Get view extent |
|
20 |
_Schema=Schema |
|
21 |
_Host=Host |
|
22 |
_Port=Port |
|
23 |
_User=User |
|
24 |
_Password=Password |
|
25 |
_Database=Database |
|
26 |
_Driver_type=Driver |
|
27 |
_Connection_name=Connection name |
|
28 |
_Connection_parameters=Connection parameters |
|
29 |
_Connected=Connected |
|
30 |
more_provider_parameters_needed_message=There was a problem with parameters. Advanced properties dialog will now open. |
|
31 |
more_provider_parameters_needed_title=Missing parameters |
|
32 |
|
tags/extensions/org.gvsig.geodb/2.0/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<!-- Extructure for the extension --> |
|
8 |
<fileSet> |
|
9 |
<directory>config</directory> |
|
10 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
11 |
</fileSet> |
|
12 |
<fileSet> |
|
13 |
<directory>images</directory> |
|
14 |
<outputDirectory>/${extension.install.dir.name}/images |
|
15 |
</outputDirectory> |
|
16 |
</fileSet> |
|
17 |
<fileSet> |
|
18 |
<directory>resources</directory> |
|
19 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
20 |
</fileSet> |
|
21 |
</fileSets> |
|
22 |
<files> |
|
23 |
<file> |
|
24 |
<source>package.info</source> |
|
25 |
<outputDirectory>${extension.install.dir.name} |
|
26 |
</outputDirectory> |
|
27 |
</file> |
|
28 |
</files> |
|
29 |
<!-- |
|
30 |
*********************************************************************** |
|
31 |
--> |
|
32 |
<!-- * *--> |
|
33 |
<!-- |
|
34 |
*********************************************************************** |
|
35 |
--> |
|
36 |
<dependencySets> |
|
37 |
<dependencySet> |
|
38 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
39 |
</outputDirectory> |
|
40 |
<includes> |
|
41 |
<include>org.gvsig:org.gvsig.geodb</include> |
|
42 |
<include>org.gvsig:org.gvsig.fmap.dal.db</include> |
|
43 |
<include>org.gvsig:org.gvsig.fmap.dal.db:jar:store.jdbc</include> |
|
44 |
<include>commons-dbcp:commons-dbcp</include> |
|
45 |
<include>commons-collections:commons-collections</include> |
|
46 |
<include>commons-pool:commons-pool</include> |
|
47 |
<include>org.gvsig:org.gvsig.fmap.dal.db:jar:store.postgresql</include> |
|
48 |
<include>postgresql:postgresql</include> |
|
49 |
<include>org.gvsig:org.gvsig.fmap.dal.db:jar:store.mysql</include> |
|
50 |
<include>mysql:mysql-connector-java</include> |
|
51 |
|
|
52 |
<!-- Personal DB support --> |
|
53 |
<include>org.gvsig:org.gvsig.personaldb*</include> |
|
54 |
<include>com.h2database:h2</include> |
|
55 |
|
|
56 |
</includes> |
|
57 |
</dependencySet> |
|
58 |
</dependencySets> |
|
59 |
</assembly> |
tags/extensions/org.gvsig.geodb/2.0/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Fri Feb 08 11:26:03 CET 2013 |
|
3 |
buildNumber=2076 |
tags/extensions/org.gvsig.geodb/2.0/config/plugin-persistence.def | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of plugin persistence org.gvsig.geodb. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
<class name="org.gvsig.geodb"> |
|
9 |
<description>plugin persistence org.gvsig.geodb</description> |
|
10 |
<fields> |
|
11 |
<field name="db_connections" type="map" classOfItems="org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters" mandatory="false"> |
|
12 |
<description>Connections</description> |
|
13 |
</field> |
|
14 |
</fields> |
|
15 |
</class> |
|
16 |
</classes> |
|
17 |
</definitions> |
tags/extensions/org.gvsig.geodb/2.0/config/prodevelop.html | ||
---|---|---|
1 |
<html> |
|
2 |
<body> |
|
3 |
|
|
4 |
<img src="prodevelop-logo.png"><br> |
|
5 |
|
|
6 |
<h2>PRODEVELOP</h2> |
|
7 |
<br> |
|
8 |
|
|
9 |
<p>EN CONSTRUCCION</p> |
|
10 |
|
|
11 |
</body> |
|
12 |
</html> |
tags/extensions/org.gvsig.geodb/2.0/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<libraries library-dir="lib"/> |
|
4 |
<depends plugin-name="org.gvsig.app"/> |
|
5 |
<depends plugin-name="org.gvsig.app.document.table.app.mainplugin" /> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.geodb.ExtDB_Spatial" |
|
9 |
description="Support to access Spatial databases" |
|
10 |
active="true"> |
|
11 |
</extension> |
|
12 |
</extensions> |
|
13 |
</plugin-config> |
|
0 | 14 |
tags/extensions/org.gvsig.geodb/2.0/src/org/gvsig/geodb/vectorialdb/DlgConnection.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 26-oct-2005 |
|
3 |
* |
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
5 |
* |
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
7 |
* |
|
8 |
* This program is free software; you can redistribute it and/or |
|
9 |
* modify it under the terms of the GNU General Public License |
|
10 |
* as published by the Free Software Foundation; either version 2 |
|
11 |
* of the License, or (at your option) any later version. |
|
12 |
* |
|
13 |
* This program is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with this program; if not, write to the Free Software |
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
* |
|
22 |
* For more information, contact: |
|
23 |
* |
|
24 |
* Generalitat Valenciana |
|
25 |
* Conselleria d'Infraestructures i Transport |
|
26 |
* Av. Blasco Ib??ez, 50 |
|
27 |
* 46010 VALENCIA |
|
28 |
* SPAIN |
|
29 |
* |
|
30 |
* +34 963862235 |
|
31 |
* gvsig@gva.es |
|
32 |
* www.gvsig.gva.es |
|
33 |
* |
|
34 |
* or |
|
35 |
* |
|
36 |
* IVER T.I. S.A |
|
37 |
* Salamanca 50 |
|
38 |
* 46005 Valencia |
|
39 |
* Spain |
|
40 |
* |
|
41 |
* +34 963163400 |
|
42 |
* dac@iver.es |
|
43 |
*/ |
|
44 |
package org.gvsig.geodb.vectorialdb; |
|
45 |
|
|
46 |
import java.awt.BorderLayout; |
|
47 |
import java.awt.event.ActionListener; |
|
48 |
import java.util.ArrayList; |
|
49 |
import java.util.HashMap; |
|
50 |
import java.util.Iterator; |
|
51 |
import java.util.List; |
|
52 |
|
|
53 |
import javax.swing.JButton; |
|
54 |
import javax.swing.JDialog; |
|
55 |
import javax.swing.JOptionPane; |
|
56 |
import javax.swing.JPanel; |
|
57 |
|
|
58 |
import org.gvsig.andami.PluginServices; |
|
59 |
import org.gvsig.andami.messages.NotificationManager; |
|
60 |
import org.gvsig.fmap.dal.DALLocator; |
|
61 |
import org.gvsig.fmap.dal.DataManager; |
|
62 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
63 |
import org.gvsig.fmap.dal.exception.DataException; |
|
64 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
|
65 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
66 |
import org.gvsig.utils.NotExistInXMLEntity; |
|
67 |
import org.gvsig.utils.XMLEntity; |
|
68 |
|
|
69 |
|
|
70 |
public class DlgConnection extends JDialog { |
|
71 |
|
|
72 |
private JPanel jContentPane = null; |
|
73 |
private ConnectionPanel jConnPanel = null; |
|
74 |
private JButton jBtnOK = null; |
|
75 |
private JPanel jPanel1 = null; |
|
76 |
private JButton jBtnCancel = null; |
|
77 |
private ConnectionSettings connSettings = null; |
|
78 |
|
|
79 |
/** |
|
80 |
* This is the default constructor |
|
81 |
*/ |
|
82 |
public DlgConnection() { |
|
83 |
super(); |
|
84 |
initialize(); |
|
85 |
} |
|
86 |
|
|
87 |
private void setPreferences() |
|
88 |
{ |
|
89 |
XMLEntity xml = PluginServices.getPluginServices(this).getPersistentXML(); |
|
90 |
|
|
91 |
if (xml == null) { |
|
92 |
xml = new XMLEntity(); |
|
93 |
} |
|
94 |
|
|
95 |
if (!xml.contains("db-connections")) { |
|
96 |
String[] servers = new String[0]; |
|
97 |
xml.putProperty("db-connections", servers); |
|
98 |
} |
|
99 |
|
|
100 |
try { |
|
101 |
String[] servers = xml.getStringArrayProperty("db-connections"); |
|
102 |
HashMap settings = new HashMap(); |
|
103 |
for (int i = 0; i < servers.length; i++) { |
|
104 |
ConnectionSettings cs = new ConnectionSettings(); |
|
105 |
cs.setFromString(servers[i]); |
|
106 |
settings.put(cs.getName(), cs); |
|
107 |
} |
|
108 |
getJConnPanel().setSettings(settings); |
|
109 |
} catch (NotExistInXMLEntity e) { |
|
110 |
} |
|
111 |
|
|
112 |
} |
|
113 |
/** |
|
114 |
* This method initializes this |
|
115 |
* |
|
116 |
* @return void |
|
117 |
*/ |
|
118 |
private void initialize() { |
|
119 |
this.setSize(320, 332); |
|
120 |
this.setTitle(PluginServices.getText(this, "database_connection")); |
|
121 |
this.setContentPane(getJContentPane()); |
|
122 |
setPreferences(); |
|
123 |
DataManager dm= DALLocator.getDataManager(); |
|
124 |
List explorers = dm.getExplorerProviders(); |
|
125 |
Iterator iter = explorers.iterator(); |
|
126 |
DataServerExplorerParameters exParam = null; |
|
127 |
String name; |
|
128 |
List<String> dbExplores = new ArrayList<String>(explorers.size()); |
|
129 |
while (iter.hasNext()) { |
|
130 |
name = (String) iter.next(); |
|
131 |
try { |
|
132 |
exParam = dm.createServerExplorerParameters(name); |
|
133 |
} catch (DataException e) { |
|
134 |
NotificationManager.addError(e); |
|
135 |
} |
|
136 |
if (exParam instanceof DBServerExplorerParameters) { |
|
137 |
dbExplores.add(name); |
|
138 |
} |
|
139 |
} |
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
jConnPanel |
|
144 |
.setDrivers(dbExplores |
|
145 |
.toArray(new String[dbExplores.size()])); |
|
146 |
} |
|
147 |
|
|
148 |
// private String[] getDriverNames(){ |
|
149 |
// Class[] classes = new Class[] { IVectorialDatabaseDriver.class }; |
|
150 |
// |
|
151 |
// ArrayList ret = new ArrayList(); |
|
152 |
// String[] driverNames = LayerFactory.getDM().getDriverNames(); |
|
153 |
// |
|
154 |
// for (int i = 0; i < driverNames.length; i++) { |
|
155 |
// boolean is = false; |
|
156 |
// |
|
157 |
// for (int j = 0; j < classes.length; j++) { |
|
158 |
// if (LayerFactory.getDM().isA(driverNames[i], classes[j])) { |
|
159 |
// ret.add(driverNames[i]); |
|
160 |
// } |
|
161 |
// } |
|
162 |
// } |
|
163 |
// |
|
164 |
// return (String[]) ret.toArray(new String[0]); |
|
165 |
// |
|
166 |
// } |
|
167 |
|
|
168 |
/** |
|
169 |
* This method initializes jContentPane |
|
170 |
* |
|
171 |
* @return javax.swing.JPanel |
|
172 |
*/ |
|
173 |
private JPanel getJContentPane() { |
|
174 |
if (jContentPane == null) { |
|
175 |
jContentPane = new JPanel(); |
|
176 |
jContentPane.setLayout(new BorderLayout()); |
|
177 |
jContentPane.add(getJConnPanel(), java.awt.BorderLayout.CENTER); |
|
178 |
jContentPane.add(getJPanel1(), java.awt.BorderLayout.SOUTH); |
|
179 |
|
|
180 |
} |
|
181 |
return jContentPane; |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* This method initializes jPanel |
|
186 |
* |
|
187 |
* @return javax.swing.JPanel |
|
188 |
*/ |
|
189 |
private ConnectionPanel getJConnPanel() { |
|
190 |
if (jConnPanel == null) { |
|
191 |
jConnPanel = new ConnectionPanel(); |
|
192 |
} |
|
193 |
return jConnPanel; |
|
194 |
} |
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
/** |
|
199 |
* This method initializes jPanel1 |
|
200 |
* |
|
201 |
* @return javax.swing.JPanel |
|
202 |
*/ |
|
203 |
private JPanel getJPanel1() { |
|
204 |
if (jPanel1 == null) { |
|
205 |
ActionListener okAction = new java.awt.event.ActionListener() { |
|
206 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
207 |
if (!jConnPanel.done()) { |
|
208 |
JOptionPane.showMessageDialog(DlgConnection.this, "No estan todos los datos rellenos", "Error", JOptionPane.ERROR_MESSAGE); |
|
209 |
return; |
|
210 |
} |
|
211 |
jConnPanel.saveConnectionSettings(); |
|
212 |
connSettings = jConnPanel.getConnectionSettings(); |
|
213 |
dispose(); |
|
214 |
} |
|
215 |
}; |
|
216 |
|
|
217 |
ActionListener cancelAction = new java.awt.event.ActionListener() { |
|
218 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
219 |
connSettings = null; |
|
220 |
dispose(); |
|
221 |
} |
|
222 |
}; |
|
223 |
jPanel1 = new AcceptCancelPanel(okAction, cancelAction); |
|
224 |
|
|
225 |
|
|
226 |
} |
|
227 |
return jPanel1; |
|
228 |
} |
|
229 |
|
|
230 |
|
|
231 |
public ConnectionSettings getConnSettings() { |
|
232 |
return connSettings; |
|
233 |
} |
|
234 |
|
|
235 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 236 |
tags/extensions/org.gvsig.geodb/2.0/src/org/gvsig/geodb/vectorialdb/DBResourceManager.java | ||
---|---|---|
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 |
|
tags/extensions/org.gvsig.geodb/2.0/src/org/gvsig/geodb/vectorialdb/ConnectionPanel.java | ||
---|---|---|
1 |
package org.gvsig.geodb.vectorialdb; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.Dimension; |
|
5 |
import java.awt.FlowLayout; |
|
6 |
import java.awt.Rectangle; |
|
7 |
import java.awt.event.ActionEvent; |
|
8 |
import java.awt.event.ActionListener; |
|
9 |
import java.util.HashMap; |
|
10 |
import java.util.Iterator; |
|
11 |
|
|
12 |
import javax.swing.DefaultComboBoxModel; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JPanel; |
|
15 |
import javax.swing.JPasswordField; |
|
16 |
import javax.swing.JTextField; |
|
17 |
import javax.swing.SwingConstants; |
|
18 |
|
|
19 |
import org.gvsig.andami.PluginServices; |
|
20 |
import org.gvsig.fmap.dal.DALLocator; |
|
21 |
import org.gvsig.fmap.dal.DataManager; |
|
22 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
23 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
24 |
import org.gvsig.fmap.dal.resource.db.DBParameters; |
|
25 |
import org.gvsig.utils.NotExistInXMLEntity; |
|
26 |
import org.gvsig.utils.XMLEntity; |
|
27 |
import org.gvsig.utils.swing.JComboBox; |
|
28 |
import org.gvsig.utils.swing.wizard.Step; |
|
29 |
import org.gvsig.utils.swing.wizard.WizardControl; |
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
/** |
|
34 |
* DOCUMENT ME! |
|
35 |
* |
|
36 |
* @author Fernando Gonz?lez Cort?s |
|
37 |
*/ |
|
38 |
public class ConnectionPanel extends JPanel implements Step { |
|
39 |
private static String passw = null; |
|
40 |
|
|
41 |
private JPanel jPanelLabels = null; |
|
42 |
private JLabel jLabel = null; |
|
43 |
private JTextField txtHost = null; |
|
44 |
private JPanel jPanelTexts = null; |
|
45 |
private JTextField txtPort = null; |
|
46 |
private JLabel jLabel1 = null; |
|
47 |
private JLabel jLabel2 = null; |
|
48 |
private JTextField txtUser = null; |
|
49 |
private JLabel jLabel3 = null; |
|
50 |
private JPasswordField txtPassword = null; |
|
51 |
private JLabel jLabel4 = null; |
|
52 |
private JTextField txtBD = null; |
|
53 |
private JLabel jLabel5 = null; |
|
54 |
private JComboBox cmbDriver = null; |
|
55 |
private JLabel jLabel6 = null; |
|
56 |
private org.gvsig.utils.swing.JComboBox cmbName = null; |
|
57 |
private HashMap cs = new HashMap(); |
|
58 |
|
|
59 |
private JPanel jPanel = null; |
|
60 |
|
|
61 |
private JLabel jLabelSchema = null; |
|
62 |
|
|
63 |
private ConnectionPanel XYZ = null; |
|
64 |
|
|
65 |
private JPanel jPanel1 = null; |
|
66 |
|
|
67 |
private JPanel jPanelLabels1 = null; |
|
68 |
|
|
69 |
private JLabel jLabel61 = null; |
|
70 |
|
|
71 |
private JLabel jLabel7 = null; |
|
72 |
|
|
73 |
private JLabel jLabel11 = null; |
|
74 |
|
|
75 |
private JLabel jLabel21 = null; |
|
76 |
|
|
77 |
private JLabel jLabel31 = null; |
|
78 |
|
|
79 |
private JLabel jLabel51 = null; |
|
80 |
|
|
81 |
private JPanel jPanelTexts1 = null; |
|
82 |
|
|
83 |
private JComboBox cmbName1 = null; |
|
84 |
|
|
85 |
private JTextField txtHost1 = null; |
|
86 |
|
|
87 |
private JTextField txtPort1 = null; |
|
88 |
|
|
89 |
private JTextField txtUser1 = null; |
|
90 |
|
|
91 |
private JPasswordField txtPassword1 = null; |
|
92 |
|
|
93 |
private JTextField txtBD1 = null; |
|
94 |
|
|
95 |
private JComboBox cmbDriver1 = null; |
|
96 |
|
|
97 |
private JTextField txtSchema = null; |
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
/** |
|
102 |
* This is the default constructor |
|
103 |
*/ |
|
104 |
public ConnectionPanel() { |
|
105 |
super(); |
|
106 |
initialize(); |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* This method initializes this |
|
111 |
*/ |
|
112 |
private void initialize() { |
|
113 |
this.setLayout(null); |
|
114 |
this.setSize(335, 240); |
|
115 |
this.add(getJPanel(), null); |
|
116 |
|
|
117 |
if (passw != null) { |
|
118 |
txtPassword.setText(passw); |
|
119 |
} |
|
120 |
|
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* This method initializes jPanel |
|
125 |
* |
|
126 |
* @return javax.swing.JPanel |
|
127 |
*/ |
|
128 |
private JPanel getJPanelLabels() { |
|
129 |
if (jPanelLabels == null) { |
|
130 |
String string = PluginServices.getText(this, "_Schema") + ":"; |
|
131 |
jLabelSchema = new JLabel(); |
|
132 |
jLabelSchema.setName("jLabel4"); |
|
133 |
jLabelSchema.setHorizontalAlignment(SwingConstants.RIGHT); |
|
134 |
jLabelSchema.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
135 |
jLabelSchema.setText(string); |
|
136 |
jLabelSchema.setPreferredSize(new Dimension(140, 19)); |
|
137 |
FlowLayout flowLayout3 = new FlowLayout(); |
|
138 |
flowLayout3.setVgap(15); |
|
139 |
jLabel5 = new JLabel(); |
|
140 |
jLabel4 = new JLabel(); |
|
141 |
jLabel3 = new JLabel(); |
|
142 |
jLabel2 = new JLabel(); |
|
143 |
jLabel1 = new JLabel(); |
|
144 |
jLabel = new JLabel(); |
|
145 |
jPanelLabels = new JPanel(); |
|
146 |
jPanelLabels.setLayout(flowLayout3); |
|
147 |
jPanelLabels.setName("jPanelLabels"); |
|
148 |
jPanelLabels.setPreferredSize(new java.awt.Dimension(150,400)); |
|
149 |
jLabel.setText(PluginServices.getText(this, "_Host") + ":"); |
|
150 |
jLabel.setPreferredSize(new java.awt.Dimension(140,19)); |
|
151 |
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
152 |
jLabel.setName("jLabel"); |
|
153 |
jLabel1.setText(PluginServices.getText(this, "_Port")+":"); |
|
154 |
jLabel1.setPreferredSize(new java.awt.Dimension(140,19)); |
|
155 |
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); |
|
156 |
jLabel1.setName("jLabel1"); |
|
157 |
jLabel2.setText(PluginServices.getText(this, "_User")+":"); |
|
158 |
jLabel2.setName("jLabel2"); |
|
159 |
jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
160 |
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
161 |
jLabel2.setPreferredSize(new java.awt.Dimension(140,19)); |
|
162 |
jLabel3.setText(PluginServices.getText(this, "_Password")+":"); |
|
163 |
jLabel3.setName("jLabel3"); |
|
164 |
jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
165 |
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
166 |
jLabel3.setPreferredSize(new java.awt.Dimension(140,19)); |
|
167 |
jLabel4.setText(PluginServices.getText(this, "_Database")+":"); |
|
168 |
jLabel4.setName("jLabel4"); |
|
169 |
jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
170 |
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
171 |
jLabel4.setPreferredSize(new java.awt.Dimension(140,19)); |
|
172 |
jLabel5.setText(PluginServices.getText(this, "_Driver_type")+":"); |
|
173 |
jLabel5.setName("jLabel5"); |
|
174 |
jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
|
175 |
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
176 |
jLabel5.setPreferredSize(new java.awt.Dimension(140,19)); |
|
177 |
jPanelLabels.add(getJLabel6(), null); |
|
178 |
jPanelLabels.add(jLabel, null); |
|
179 |
jPanelLabels.add(jLabel1, null); |
|
180 |
jPanelLabels.add(jLabel2, null); |
|
181 |
jPanelLabels.add(jLabel3, null); |
|
182 |
jPanelLabels.add(jLabel4, null); |
|
183 |
jPanelLabels.add(jLabelSchema, null); |
|
184 |
jPanelLabels.add(jLabel5, null); |
|
185 |
|
|
186 |
} |
|
187 |
|
|
188 |
return jPanelLabels; |
|
189 |
} |
|
190 |
|
|
191 |
/** |
|
192 |
* This method initializes txtHost |
|
193 |
* |
|
194 |
* @return javax.swing.JTextField |
|
195 |
*/ |
|
196 |
private JTextField getTxtHost() { |
|
197 |
if (txtHost == null) { |
|
198 |
txtHost = new JTextField(); |
|
199 |
txtHost.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
200 |
txtHost.setName("txtHost"); |
|
201 |
} |
|
202 |
|
|
203 |
return txtHost; |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* This method initializes jPanel1 |
|
208 |
* |
|
209 |
* @return javax.swing.JPanel |
|
210 |
*/ |
|
211 |
private JPanel getJPanelTexts() { |
|
212 |
if (jPanelTexts == null) { |
|
213 |
FlowLayout flowLayout2 = new FlowLayout(FlowLayout.LEFT); |
|
214 |
flowLayout2.setVgap(15); |
|
215 |
jPanelTexts = new JPanel(); |
|
216 |
jPanelTexts.setLayout(flowLayout2); |
|
217 |
jPanelTexts.setPreferredSize(new Dimension(200, 300)); |
|
218 |
|
|
219 |
jPanelTexts.setName("jPanelText"); |
|
220 |
jPanelTexts.add(getCmbName(), null); |
|
221 |
jPanelTexts.add(getTxtHost(), null); |
|
222 |
jPanelTexts.add(getTxtPort(), null); |
|
223 |
jPanelTexts.add(getTxtUser(), null); |
|
224 |
jPanelTexts.add(getTxtPassword(), null); |
|
225 |
jPanelTexts.add(getTxtBD(), null); |
|
226 |
jPanelTexts.add(getTxtSchema(), null); |
|
227 |
jPanelTexts.add(getCmbDriver(), null); |
|
228 |
} |
|
229 |
|
|
230 |
return jPanelTexts; |
|
231 |
} |
|
232 |
|
|
233 |
/** |
|
234 |
* This method initializes txtPort |
|
235 |
* |
|
236 |
* @return javax.swing.JTextField |
|
237 |
*/ |
|
238 |
private JTextField getTxtPort() { |
|
239 |
if (txtPort == null) { |
|
240 |
txtPort = new JTextField(); |
|
241 |
txtPort.setPreferredSize(new java.awt.Dimension(40, 19)); |
|
242 |
txtPort.setName("txtPort"); |
|
243 |
txtPort.setText(""); |
|
244 |
txtPort.setHorizontalAlignment(javax.swing.JTextField.LEFT); |
|
245 |
} |
|
246 |
|
|
247 |
return txtPort; |
|
248 |
} |
|
249 |
|
|
250 |
/** |
|
251 |
* This method initializes txtUser |
|
252 |
* |
|
253 |
* @return javax.swing.JTextField |
|
254 |
*/ |
|
255 |
private JTextField getTxtUser() { |
|
256 |
if (txtUser == null) { |
|
257 |
txtUser = new JTextField(); |
|
258 |
txtUser.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
259 |
txtUser.setName("txtUser"); |
|
260 |
} |
|
261 |
|
|
262 |
return txtUser; |
|
263 |
} |
|
264 |
|
|
265 |
/** |
|
266 |
* This method initializes txtPassword |
|
267 |
* |
|
268 |
* @return javax.swing.JTextField |
|
269 |
*/ |
|
270 |
private JPasswordField getTxtPassword() { |
|
271 |
if (txtPassword == null) { |
|
272 |
txtPassword = new JPasswordField(); |
|
273 |
txtPassword.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
274 |
txtPassword.setName("txtPassword"); |
|
275 |
} |
|
276 |
|
|
277 |
return txtPassword; |
|
278 |
} |
|
279 |
|
|
280 |
/** |
|
281 |
* This method initializes txtBD |
|
282 |
* |
|
283 |
* @return javax.swing.JTextField |
|
284 |
*/ |
|
285 |
private JTextField getTxtBD() { |
|
286 |
if (txtBD == null) { |
|
287 |
txtBD = new JTextField(); |
|
288 |
txtBD.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
289 |
txtBD.setName("txtBD"); |
|
290 |
} |
|
291 |
|
|
292 |
return txtBD; |
|
293 |
} |
|
294 |
|
|
295 |
/** |
|
296 |
* DOCUMENT ME! |
|
297 |
* |
|
298 |
* @return DOCUMENT ME! |
|
299 |
*/ |
|
300 |
public String getHost() { |
|
301 |
return getTxtHost().getText(); |
|
302 |
} |
|
303 |
|
|
304 |
/** |
|
305 |
* DOCUMENT ME! |
|
306 |
* |
|
307 |
* @return DOCUMENT ME! |
|
308 |
*/ |
|
309 |
public String getPort() { |
|
310 |
return getTxtPort().getText(); |
|
311 |
} |
|
312 |
|
|
313 |
/** |
|
314 |
* DOCUMENT ME! |
|
315 |
* |
|
316 |
* @return DOCUMENT ME! |
|
317 |
*/ |
|
318 |
public String getUser() { |
|
319 |
return getTxtUser().getText(); |
|
320 |
} |
|
321 |
|
|
322 |
/** |
|
323 |
* DOCUMENT ME! |
|
324 |
* |
|
325 |
* @return DOCUMENT ME! |
|
326 |
*/ |
|
327 |
public String getSettingsName() { |
|
328 |
if (getCmbName().getSelectedItem() == null){ |
|
329 |
return null; |
|
330 |
} |
|
331 |
return getCmbName().getSelectedItem().toString(); |
|
332 |
} |
|
333 |
|
|
334 |
/** |
|
335 |
* DOCUMENT ME! |
|
336 |
* |
|
337 |
* @return DOCUMENT ME! |
|
338 |
*/ |
|
339 |
public String getPassword() { |
|
340 |
passw = String.copyValueOf(getTxtPassword().getPassword()); |
|
341 |
return passw; |
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* DOCUMENT ME! |
|
346 |
* |
|
347 |
* @return DOCUMENT ME! |
|
348 |
*/ |
|
349 |
public String getDBName() { |
|
350 |
return getTxtBD().getText(); |
|
351 |
} |
|
352 |
|
|
353 |
/** |
|
354 |
* DOCUMENT ME! |
|
355 |
* |
|
356 |
* @param drivers DOCUMENT ME! |
|
357 |
*/ |
|
358 |
public void setDrivers(String[] drivers) { |
|
359 |
DefaultComboBoxModel model = new DefaultComboBoxModel(); |
|
360 |
|
|
361 |
for (int i = 0; i < drivers.length; i++) { |
|
362 |
model.addElement(drivers[i]); |
|
363 |
} |
|
364 |
|
|
365 |
getCmbDriver().setModel(model); |
|
366 |
|
|
367 |
//Para que refresque el textbox del puerto |
|
368 |
if (drivers.length > 0) { |
|
369 |
cmbDriver.setSelectedIndex(0); |
|
370 |
} |
|
371 |
|
|
372 |
} |
|
373 |
|
|
374 |
|
|
375 |
/** |
|
376 |
* @return ConnectionSettings based on values in this panel |
|
377 |
*/ |
|
378 |
public ConnectionSettings getConnectionSettings() |
|
379 |
{ |
|
380 |
ConnectionSettings cs = new ConnectionSettings(); |
|
381 |
cs.setDb(getDBName()); |
|
382 |
cs.setSchema(getSchema()); |
|
383 |
cs.setDriver(getDriver()); |
|
384 |
cs.setHost(getHost()); |
|
385 |
cs.setPort(getPort()); |
|
386 |
cs.setUser(getUser()); |
|
387 |
cs.setPassw(getPassword()); |
|
388 |
cs.setName(getSettingsName()); |
|
389 |
return cs; |
|
390 |
} |
|
391 |
|
|
392 |
public String getSchema() { |
|
393 |
return txtSchema.getText(); |
|
394 |
} |
|
395 |
|
|
396 |
/** |
|
397 |
* Makes persistent the connection settings of this panel. |
|
398 |
*/ |
|
399 |
public void saveConnectionSettings() |
|
400 |
{ |
|
401 |
ConnectionSettings cs = new ConnectionSettings(); |
|
402 |
cs.setDb(getDBName()); |
|
403 |
cs.setSchema(getSchema()); |
|
404 |
cs.setDriver(getDriver()); |
|
405 |
cs.setHost(getHost()); |
|
406 |
cs.setPort(getPort()); |
|
407 |
cs.setUser(getUser()); |
|
408 |
cs.setPassw(getPassword()); |
|
409 |
cs.setName(getSettingsName()); |
|
410 |
|
|
411 |
PluginServices ps = PluginServices.getPluginServices(this); |
|
412 |
XMLEntity xml = ps.getPersistentXML(); |
|
413 |
|
|
414 |
try { |
|
415 |
String[] connections = xml.getStringArrayProperty("jdbc-connections"); |
|
416 |
String[] newConnections = new String[connections.length + 1]; |
|
417 |
System.arraycopy(connections, 0, newConnections, 0, connections.length); |
|
418 |
newConnections[connections.length] = cs.toString(); |
|
419 |
xml.putProperty("jdbc-connections", newConnections); |
|
420 |
} catch (NotExistInXMLEntity e) { |
|
421 |
xml.putProperty("jdbc-connections", new String[] { cs.toString() }); |
|
422 |
} |
|
423 |
|
|
424 |
|
|
425 |
} |
|
426 |
|
|
427 |
/** |
|
428 |
* DOCUMENT ME! |
|
429 |
* |
|
430 |
* @return DOCUMENT ME! |
|
431 |
*/ |
|
432 |
public String getDriver() { |
|
433 |
return cmbDriver.getSelectedItem().toString(); |
|
434 |
} |
|
435 |
|
|
436 |
/** |
|
437 |
* DOCUMENT ME! |
|
438 |
* |
|
439 |
* @param cs DOCUMENT ME! |
|
440 |
*/ |
|
441 |
public void setSettings(HashMap cs) { |
|
442 |
this.cs = cs; |
|
443 |
((DefaultComboBoxModel) getCmbName().getModel()).removeAllElements(); |
|
444 |
|
|
445 |
Iterator i = cs.keySet().iterator(); |
|
446 |
|
|
447 |
while (i.hasNext()) { |
|
448 |
String item = (String) i.next(); |
|
449 |
((DefaultComboBoxModel) getCmbName().getModel()).addElement(item); |
|
450 |
} |
|
451 |
} |
|
452 |
|
|
453 |
/** |
|
454 |
* @see org.gvsig.utils.swing.wizard.Step#init(org.gvsig.utils.swing.wizard.WizardControl) |
|
455 |
*/ |
|
456 |
public void init(WizardControl w) { |
|
457 |
} |
|
458 |
|
|
459 |
/** |
|
460 |
* This method initializes cmbDriver |
|
461 |
* |
|
462 |
* @return com.iver.utiles.swing.JComboBox |
|
463 |
*/ |
|
464 |
private JComboBox getCmbDriver() { |
|
465 |
if (cmbDriver == null) { |
|
466 |
cmbDriver = new JComboBox(); |
|
467 |
cmbDriver.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
468 |
cmbDriver.setName("cmbDriver"); |
|
469 |
cmbDriver.addActionListener(new ActionListener() { |
|
470 |
public void actionPerformed(ActionEvent e) { |
|
471 |
String driverName = cmbDriver.getSelectedItem().toString(); |
|
472 |
DataManager dm = DALLocator.getDataManager(); |
|
473 |
DBParameters dsp=null; |
|
474 |
try { |
|
475 |
dsp = (DBParameters) dm |
|
476 |
.createServerExplorerParameters(driverName); |
|
477 |
} catch (InitializeException e1) { |
|
478 |
// TODO Auto-generated catch block |
|
479 |
e1.printStackTrace(); |
|
480 |
} catch (ProviderNotRegisteredException e1) { |
|
481 |
// TODO Auto-generated catch block |
|
482 |
e1.printStackTrace(); |
|
483 |
} |
|
484 |
|
|
485 |
// String port = dsp.getPort() + ""; |
|
486 |
// getTxtPort().setText(port); |
|
487 |
} |
|
488 |
}); |
|
489 |
} |
|
490 |
|
|
491 |
return cmbDriver; |
|
492 |
} |
|
493 |
|
|
494 |
/** |
|
495 |
* DOCUMENT ME! |
|
496 |
* |
|
497 |
* @return |
|
498 |
*/ |
|
499 |
public boolean done() { |
|
500 |
return (getTxtBD().getText().length() > 0) && |
|
501 |
(getTxtHost().getText().length() > 0) && |
|
502 |
(getCmbName().getSelectedItem() != null) && |
|
503 |
(getCmbName().getSelectedItem().toString().length() > 0); |
|
504 |
} |
|
505 |
|
|
506 |
/** |
|
507 |
* This method initializes jLabel6 |
|
508 |
* |
|
509 |
* @return javax.swing.JLabel |
|
510 |
*/ |
|
511 |
private JLabel getJLabel6() { |
|
512 |
if (jLabel6 == null) { |
|
513 |
jLabel6 = new JLabel(); |
|
514 |
jLabel6.setText(PluginServices.getText(this, "_Connection_name")+":"); |
|
515 |
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
|
516 |
jLabel6.setPreferredSize(new java.awt.Dimension(140,19)); |
|
517 |
} |
|
518 |
|
|
519 |
return jLabel6; |
|
520 |
} |
|
521 |
|
|
522 |
/** |
|
523 |
* This method initializes jComboBox |
|
524 |
* |
|
525 |
* @return com.iver.utiles.swing.JComboBox |
|
526 |
*/ |
|
527 |
private org.gvsig.utils.swing.JComboBox getCmbName() { |
|
528 |
if (cmbName == null) { |
|
529 |
cmbName = new org.gvsig.utils.swing.JComboBox(); |
|
530 |
cmbName.setEditable(true); |
|
531 |
cmbName.setPreferredSize(new java.awt.Dimension(170, 19)); |
|
532 |
cmbName.setModel(new DefaultComboBoxModel()); |
|
533 |
cmbName.addActionListener(new ActionListener() { |
|
534 |
public void actionPerformed(ActionEvent e) { |
|
535 |
Object item = cmbName.getSelectedItem(); |
|
536 |
|
|
537 |
if (item == null) { |
|
538 |
return; |
|
539 |
} |
|
540 |
|
|
541 |
ConnectionSettings c = (ConnectionSettings) cs.get(item.toString()); |
|
542 |
|
|
543 |
if (c != null) { |
|
544 |
getTxtHost().setText(c.getHost()); |
|
545 |
getTxtPort().setText(c.getPort()); |
|
546 |
getTxtBD().setText(c.getDb()); |
|
547 |
getTxtUser().setText(c.getUser()); |
|
548 |
if (c.getPassw() != null) { |
|
549 |
getTxtPassword().setText(c.getPassw()); |
|
550 |
} |
|
551 |
getCmbDriver().setSelectedItem(c.getDriver()); |
|
552 |
} |
|
553 |
} |
|
554 |
}); |
|
555 |
} |
|
556 |
|
|
557 |
return cmbName; |
|
558 |
} |
|
559 |
|
|
560 |
/** |
|
561 |
* This method initializes jPanel |
|
562 |
* |
|
563 |
* @return javax.swing.JPanel |
|
564 |
*/ |
|
565 |
private JPanel getJPanel() { |
|
566 |
if (jPanel == null) { |
|
567 |
jPanel = new JPanel(); |
|
568 |
jPanel.setLayout(new BorderLayout()); |
|
569 |
jPanel.setBounds(0, 0, 363, 240); |
|
570 |
jPanel.add(getJPanelLabels(), java.awt.BorderLayout.WEST); |
|
571 |
jPanel.add(getJPanelTexts(), java.awt.BorderLayout.EAST); |
|
572 |
} |
|
573 |
return jPanel; |
|
574 |
} |
|
575 |
|
|
576 |
/** |
|
577 |
* This method initializes XYZ |
|
578 |
* |
|
579 |
* @return com.iver.cit.gvsig.jdbc_spatial.gui.jdbcwizard.ConnectionPanel |
|
580 |
*/ |
|
581 |
private ConnectionPanel getXYZ() { |
|
582 |
if (XYZ == null) { |
|
583 |
XYZ = new ConnectionPanel(); |
|
584 |
XYZ.setLayout(null); |
|
585 |
XYZ.setSize(new java.awt.Dimension(335,240)); |
|
586 |
XYZ.add(getJPanel1(), null); |
|
587 |
} |
|
588 |
return XYZ; |
|
589 |
} |
|
590 |
|
|
591 |
/** |
|
592 |
* This method initializes jPanel1 |
|
593 |
* |
|
594 |
* @return javax.swing.JPanel |
|
595 |
*/ |
|
596 |
private JPanel getJPanel1() { |
|
597 |
if (jPanel1 == null) { |
|
598 |
jPanel1 = new JPanel(); |
|
599 |
jPanel1.setLayout(new BorderLayout()); |
|
600 |
jPanel1.setBounds(new Rectangle(0, 0, 363, 240)); |
|
601 |
jPanel1.add(getJPanelLabels1(), java.awt.BorderLayout.WEST); |
|
602 |
jPanel1.add(getJPanelTexts1(), java.awt.BorderLayout.EAST); |
|
603 |
} |
|
604 |
return jPanel1; |
|
605 |
} |
|
606 |
|
|
607 |
/** |
|
608 |
* This method initializes jPanelLabels1 |
|
609 |
* |
|
610 |
* @return javax.swing.JPanel |
|
611 |
*/ |
|
612 |
private JPanel getJPanelLabels1() { |
|
613 |
if (jPanelLabels1 == null) { |
|
614 |
jLabel51 = new JLabel(); |
|
615 |
jLabel51.setName("jLabel5"); |
|
616 |
jLabel51.setHorizontalAlignment(SwingConstants.RIGHT); |
|
617 |
jLabel51.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
618 |
jLabel51.setText(PluginServices.getText(getXYZ(), "_Driver_type") + ":"); |
|
619 |
jLabel51.setPreferredSize(new Dimension(140, 19)); |
|
620 |
jLabel31 = new JLabel(); |
|
621 |
jLabel31.setName("jLabel3"); |
|
622 |
jLabel31.setHorizontalAlignment(SwingConstants.RIGHT); |
|
623 |
jLabel31.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
624 |
jLabel31.setText(PluginServices.getText(getXYZ(), "_Password") + ":"); |
|
625 |
jLabel31.setPreferredSize(new Dimension(140, 19)); |
|
626 |
jLabel21 = new JLabel(); |
|
627 |
jLabel21.setName("jLabel2"); |
|
628 |
jLabel21.setHorizontalAlignment(SwingConstants.RIGHT); |
|
629 |
jLabel21.setHorizontalTextPosition(SwingConstants.RIGHT); |
|
630 |
jLabel21.setText(PluginServices.getText(getXYZ(), "_User") + ":"); |
|
631 |
jLabel21.setPreferredSize(new Dimension(140, 19)); |
|
632 |
jLabel11 = new JLabel(); |
|
633 |
jLabel11.setName("jLabel1"); |
|
634 |
jLabel11.setHorizontalAlignment(SwingConstants.TRAILING); |
|
635 |
jLabel11.setText(PluginServices.getText(getXYZ(), "_Port") + ":"); |
|
636 |
jLabel11.setPreferredSize(new Dimension(140, 19)); |
|
637 |
jLabel7 = new JLabel(); |
|
638 |
jLabel7.setName("jLabel"); |
|
639 |
jLabel7.setHorizontalAlignment(SwingConstants.RIGHT); |
|
640 |
jLabel7.setText(PluginServices.getText(getXYZ(), "_Host") + ":"); |
|
641 |
jLabel7.setPreferredSize(new Dimension(140, 19)); |
|
642 |
jLabel61 = new JLabel(); |
|
643 |
jLabel61.setPreferredSize(new Dimension(140, 19)); |
|
644 |
jLabel61.setText(PluginServices.getText(getXYZ(), "_Connection_name") + ":"); |
|
645 |
jLabel61.setHorizontalAlignment(SwingConstants.RIGHT); |
|
646 |
FlowLayout flowLayout31 = new FlowLayout(); |
|
647 |
flowLayout31.setVgap(15); |
|
648 |
jPanelLabels1 = new JPanel(); |
|
649 |
jPanelLabels1.setPreferredSize(new Dimension(150, 400)); |
|
650 |
jPanelLabels1.setLayout(flowLayout31); |
|
651 |
jPanelLabels1.setName("jPanelLabels"); |
|
652 |
jPanelLabels1.add(jLabel61, null); |
|
653 |
jPanelLabels1.add(jLabel7, null); |
|
654 |
jPanelLabels1.add(jLabel11, null); |
|
655 |
jPanelLabels1.add(jLabel21, null); |
|
656 |
jPanelLabels1.add(jLabel31, null); |
|
657 |
jPanelLabels1.add(jLabelSchema, jLabelSchema.getName()); |
|
658 |
jPanelLabels1.add(jLabel51, null); |
|
659 |
} |
|
660 |
return jPanelLabels1; |
|
661 |
} |
|
662 |
|
|
663 |
/** |
|
664 |
* This method initializes jPanelTexts1 |
|
665 |
* |
|
666 |
* @return javax.swing.JPanel |
|
667 |
*/ |
|
668 |
private JPanel getJPanelTexts1() { |
|
669 |
if (jPanelTexts1 == null) { |
|
670 |
FlowLayout flowLayout21 = new FlowLayout(FlowLayout.LEFT); |
|
671 |
flowLayout21.setVgap(15); |
|
672 |
jPanelTexts1 = new JPanel(); |
|
673 |
jPanelTexts1.setPreferredSize(new Dimension(200, 300)); |
|
674 |
jPanelTexts1.setLayout(flowLayout21); |
|
675 |
jPanelTexts1.setName("jPanelText"); |
|
676 |
jPanelTexts1.add(getCmbName1(), null); |
Also available in: Unified diff