Revision 258
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/buildNumber.properties | ||
---|---|---|
1 |
#Tue Oct 08 20:52:46 CEST 2013 |
|
2 |
buildNumber=2077 |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/resources-plugin/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.mainplugin"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.andami.LibraryExtension" active="false"/> |
|
8 |
</extensions> |
|
9 |
</plugin-config> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.exportto.swing.prov.postgresql.ExporttoV2PostgreSQLProviderLibrary |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
<file> |
|
17 |
<source>src/main/resources-plugin/config.xml</source> |
|
18 |
</file> |
|
19 |
</files> |
|
20 |
|
|
21 |
<dependencySets> |
|
22 |
|
|
23 |
<dependencySet> |
|
24 |
<useProjectArtifact>false</useProjectArtifact> |
|
25 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
26 |
<outputDirectory>lib</outputDirectory> |
|
27 |
<includes> |
|
28 |
<include>org.gvsig:org.gvsig.postgresql.provider</include> |
|
29 |
</includes> |
|
30 |
</dependencySet> |
|
31 |
|
|
32 |
<dependencySet> |
|
33 |
<useProjectArtifact>false</useProjectArtifact> |
|
34 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
35 |
<outputDirectory>lib</outputDirectory> |
|
36 |
<includes> |
|
37 |
<include>postgresql:postgresql</include> |
|
38 |
<include>commons-dbcp:commons-dbcp</include> |
|
39 |
<include>commons-collections:commons-collections</include> |
|
40 |
<include>commons-pool:commons-pool</include> |
|
41 |
</includes> |
|
42 |
</dependencySet> |
|
43 |
|
|
44 |
</dependencySets> |
|
45 |
|
|
46 |
</assembly> |
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2013 gvSIG Association. |
|
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 3 |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
28 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
29 |
<head> |
|
30 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
31 |
<title>org.gvsig.exporto package documentation</title> |
|
32 |
</head> |
|
33 |
<body> |
|
34 |
|
|
35 |
<p>Exporto provider which gets Exporto from a file.</p> |
|
36 |
|
|
37 |
</body> |
|
38 |
</html> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/panel/DefaultConnectionPanel.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
|
|
7 |
package org.gvsig.postgresql.exportto.panel; |
|
8 |
|
|
9 |
import java.util.HashMap; |
|
10 |
import java.util.Iterator; |
|
11 |
import java.util.Map; |
|
12 |
import javax.swing.JComponent; |
|
13 |
import javax.swing.JPanel; |
|
14 |
import org.gvsig.andami.PluginsLocator; |
|
15 |
import org.gvsig.andami.PluginsManager; |
|
16 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
|
17 |
import org.gvsig.tools.swing.api.Component; |
|
18 |
import org.gvsig.geodb.ExtDB_Spatial; |
|
19 |
|
|
20 |
/** |
|
21 |
* |
|
22 |
* @author jjdelcerro |
|
23 |
*/ |
|
24 |
public class DefaultConnectionPanel extends JPanel implements Component { |
|
25 |
|
|
26 |
private String name = null; |
|
27 |
private DBServerExplorerParameters explorerParameters = null; |
|
28 |
private String explorerNameFilter = null; |
|
29 |
|
|
30 |
|
|
31 |
public DefaultConnectionPanel() { |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
public void setFilterByExplorerName(String explorerNameFilter) { |
|
36 |
this.explorerNameFilter = explorerNameFilter; |
|
37 |
} |
|
38 |
|
|
39 |
public JComponent asJComponent() { |
|
40 |
return this; |
|
41 |
} |
|
42 |
|
|
43 |
protected Map<String,DBServerExplorerParameters> getUserConections() { |
|
44 |
PluginsManager pluginsManager = PluginsLocator.getManager(); |
|
45 |
ExtDB_Spatial geodbExtension = pluginsManager.getExtension(ExtDB_Spatial.class); |
|
46 |
Map<String, DBServerExplorerParameters> connections = geodbExtension.getUserConnections(); |
|
47 |
if( this.explorerNameFilter == null ) { |
|
48 |
return connections; |
|
49 |
} |
|
50 |
Map<String,DBServerExplorerParameters> filteredConnections = new HashMap<String,DBServerExplorerParameters>(); |
|
51 |
|
|
52 |
Iterator<Map.Entry<String,DBServerExplorerParameters>> it = connections.entrySet().iterator(); |
|
53 |
while( it.hasNext() ) { |
|
54 |
Map.Entry<String,DBServerExplorerParameters> entry = it.next(); |
|
55 |
if( this.explorerNameFilter.equalsIgnoreCase(entry.getValue().getExplorerName()) ) { |
|
56 |
filteredConnections.put(entry.getKey(), entry.getValue()); |
|
57 |
} |
|
58 |
} |
|
59 |
return filteredConnections; |
|
60 |
} |
|
61 |
|
|
62 |
protected void initComponents() { |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
|
|
67 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/panel/SelectTableNamePanel.java | ||
---|---|---|
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.postgresql.exportto.panel; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import javax.swing.JTextField; |
|
28 |
import org.gvsig.exportto.swing.ExporttoSwingLocator; |
|
29 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
30 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
31 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
|
32 |
|
|
33 |
/** |
|
34 |
* @author gvSIG Team |
|
35 |
* @version $Id$ |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class SelectTableNamePanel extends ExporttoSwingProviderPanel { |
|
39 |
|
|
40 |
private static final long serialVersionUID = 6269512983586358017L; |
|
41 |
|
|
42 |
private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER = |
|
43 |
ExporttoSwingLocator.getSwingManager(); |
|
44 |
|
|
45 |
protected JTextField textField = null; |
|
46 |
|
|
47 |
protected void initializeComponents() { |
|
48 |
this.setLayout(new BorderLayout()); |
|
49 |
textField = new JTextField(); |
|
50 |
add(textField, BorderLayout.NORTH); |
|
51 |
} |
|
52 |
|
|
53 |
public String getText() { |
|
54 |
String field = textField.getText(); |
|
55 |
if ((field == null) || (field.equals(""))) { |
|
56 |
return null; |
|
57 |
} |
|
58 |
return field; |
|
59 |
} |
|
60 |
|
|
61 |
public String getPanelTitle() { |
|
62 |
return EXPORTTO_SWING_MANAGER.getTranslation("intro_tablename"); |
|
63 |
} |
|
64 |
|
|
65 |
public boolean isValidPanel() throws ExporttoPanelValidationException { |
|
66 |
if (getText() == null || getText().equals("")) { |
|
67 |
throw new ExporttoPanelValidationException( |
|
68 |
"The table cannot be empty"); |
|
69 |
} |
|
70 |
return true; |
|
71 |
} |
|
72 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/panel/SelectPkPanel.java | ||
---|---|---|
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 modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.postgresql.exportto.panel; |
|
24 |
|
|
25 |
import java.awt.BorderLayout; |
|
26 |
|
|
27 |
import javax.swing.JLabel; |
|
28 |
import javax.swing.JPanel; |
|
29 |
import javax.swing.JTextField; |
|
30 |
|
|
31 |
import org.gvsig.exportto.swing.ExporttoSwingLocator; |
|
32 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
33 |
import org.gvsig.exportto.swing.spi.ExporttoPanelValidationException; |
|
34 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
37 |
|
|
38 |
/** |
|
39 |
* @author gvSIG Team |
|
40 |
* @version $Id$ |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class SelectPkPanel extends ExporttoSwingProviderPanel { |
|
44 |
|
|
45 |
private static final long serialVersionUID = 2652404227373508779L; |
|
46 |
|
|
47 |
private static final ExporttoSwingManager EXPORTTO_SWING_MANAGER |
|
48 |
= ExporttoSwingLocator.getSwingManager(); |
|
49 |
|
|
50 |
private FeatureType featType = null; |
|
51 |
protected JTextField textField = null; |
|
52 |
|
|
53 |
public SelectPkPanel() { |
|
54 |
super(); |
|
55 |
} |
|
56 |
|
|
57 |
public SelectPkPanel(FeatureType ft) { |
|
58 |
super(); |
|
59 |
featType = ft; |
|
60 |
} |
|
61 |
|
|
62 |
protected void initializeComponents() { |
|
63 |
this.setLayout(new BorderLayout()); |
|
64 |
|
|
65 |
JPanel topPanel = new JPanel(new BorderLayout()); |
|
66 |
textField = new JTextField(); |
|
67 |
|
|
68 |
String msg = EXPORTTO_SWING_MANAGER.getTranslation( |
|
69 |
"_Enter_new_field_name_for_primary_key_or_blank_to_not_add_primary_key"); |
|
70 |
topPanel.add(new JLabel(msg + ":"), BorderLayout.NORTH); |
|
71 |
topPanel.add(textField, BorderLayout.CENTER); |
|
72 |
// ============================================== |
|
73 |
add(topPanel, BorderLayout.NORTH); |
|
74 |
} |
|
75 |
|
|
76 |
public String getText() { |
|
77 |
String field = textField.getText(); |
|
78 |
if ((field == null) || (field.trim().equals(""))) { |
|
79 |
return null; |
|
80 |
} |
|
81 |
return field; |
|
82 |
} |
|
83 |
|
|
84 |
@Override |
|
85 |
public String getPanelTitle() { |
|
86 |
return EXPORTTO_SWING_MANAGER.getTranslation("_Primary_key"); |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public boolean isValidPanel() throws ExporttoPanelValidationException { |
|
91 |
String txt = this.getText(); |
|
92 |
if (isFieldName(txt, featType)) { |
|
93 |
throw new ExporttoPanelValidationException( |
|
94 |
EXPORTTO_SWING_MANAGER.getTranslation( |
|
95 |
"_Field_name_already_exists")); |
|
96 |
} |
|
97 |
return true; |
|
98 |
} |
|
99 |
|
|
100 |
private boolean isFieldName(String txt, FeatureType ft) { |
|
101 |
|
|
102 |
if (ft == null || txt == null) { |
|
103 |
return false; |
|
104 |
} |
|
105 |
|
|
106 |
FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors(); |
|
107 |
for (int i = 0; i < atts.length; i++) { |
|
108 |
if (atts[i].getName().equals(txt)) { |
|
109 |
return true; |
|
110 |
} |
|
111 |
} |
|
112 |
return false; |
|
113 |
} |
|
114 |
|
|
115 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/ExporttoPostgreSQLProvider.java | ||
---|---|---|
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 modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.postgresql.exportto; |
|
24 |
|
|
25 |
import org.cresques.cts.IProjection; |
|
26 |
import org.gvsig.exportto.ExporttoService; |
|
27 |
import org.gvsig.exportto.swing.prov.jdbc.ExporrtoJDBCService; |
|
28 |
import org.gvsig.exportto.swing.prov.jdbc.panel.JDBCConnectionPanel; |
|
29 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProvider; |
|
30 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
33 |
import org.gvsig.tools.service.spi.AbstractProvider; |
|
34 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
35 |
import org.slf4j.Logger; |
|
36 |
import org.slf4j.LoggerFactory; |
|
37 |
import org.gvsig.postgresql.exportto.panel.SelectPkPanel; |
|
38 |
import org.gvsig.postgresql.exportto.panel.SelectTableNamePanel; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* Exporto provider which gets Exporto from a file. |
|
43 |
* |
|
44 |
* @author gvSIG Team |
|
45 |
* @version $Id$ |
|
46 |
*/ |
|
47 |
public class ExporttoPostgreSQLProvider extends AbstractProvider |
|
48 |
implements ExporttoSwingProvider { |
|
49 |
|
|
50 |
private static Logger logger = LoggerFactory.getLogger( |
|
51 |
ExporttoPostgreSQLProvider.class); |
|
52 |
|
|
53 |
protected SelectTableNamePanel selectTableNamePanel = null; |
|
54 |
protected SelectPkPanel selectPkPanel = null; |
|
55 |
protected JDBCConnectionPanel jdbcConnectionPanel = null; |
|
56 |
|
|
57 |
protected FeatureStore featureStore; |
|
58 |
protected IProjection projection; |
|
59 |
|
|
60 |
/** |
|
61 |
* Constructor. |
|
62 |
* |
|
63 |
* @param providerServices the services for the provider |
|
64 |
* @param file to get the Exporto from |
|
65 |
*/ |
|
66 |
public ExporttoPostgreSQLProvider(ProviderServices providerServices, |
|
67 |
FeatureStore featureStore, IProjection projection) { |
|
68 |
super(providerServices); |
|
69 |
this.featureStore = featureStore; |
|
70 |
this.projection = projection; |
|
71 |
|
|
72 |
selectTableNamePanel = new SelectTableNamePanel(); |
|
73 |
|
|
74 |
FeatureType ftype = null; |
|
75 |
try { |
|
76 |
ftype = featureStore.getDefaultFeatureType(); |
|
77 |
} catch (Exception exc) { |
|
78 |
logger.error("While getting feature type.", exc); |
|
79 |
} |
|
80 |
selectPkPanel = new SelectPkPanel(ftype); |
|
81 |
jdbcConnectionPanel = new JDBCConnectionPanel(); |
|
82 |
} |
|
83 |
|
|
84 |
public String getStoreName() { |
|
85 |
return "PostgreSQL"; |
|
86 |
} |
|
87 |
|
|
88 |
public String getExplorerName() { |
|
89 |
return "PostgreSQLExplorer"; |
|
90 |
} |
|
91 |
|
|
92 |
public int getPanelCount() { |
|
93 |
return 3; |
|
94 |
} |
|
95 |
|
|
96 |
public ExporttoSwingProviderPanel getPanelAt(int index) { |
|
97 |
switch (index) { |
|
98 |
case 0: |
|
99 |
return selectTableNamePanel; |
|
100 |
case 1: |
|
101 |
return selectPkPanel; |
|
102 |
case 2: |
|
103 |
return jdbcConnectionPanel; |
|
104 |
} |
|
105 |
return null; |
|
106 |
} |
|
107 |
|
|
108 |
public ExporttoService createExporttoService() { |
|
109 |
ConnectionSettings connectionSettings |
|
110 |
= jdbcConnectionPanel.getConnectionSettings(); |
|
111 |
|
|
112 |
int port = -1; |
|
113 |
if (connectionSettings.getPort() != null |
|
114 |
&& connectionSettings.getPort().length() > 0) { |
|
115 |
port = Integer.valueOf(connectionSettings.getPort()); |
|
116 |
} |
|
117 |
|
|
118 |
String schema = null; |
|
119 |
if (connectionSettings.getSchema() != null |
|
120 |
&& connectionSettings.getSchema().length() > 0) { |
|
121 |
schema = connectionSettings.getSchema(); |
|
122 |
} |
|
123 |
|
|
124 |
return new ExporrtoJDBCService(featureStore, |
|
125 |
connectionSettings.getDb(), schema, selectTableNamePanel.getText(), |
|
126 |
selectPkPanel.getText(), connectionSettings.getUser(), |
|
127 |
connectionSettings.getPassw(), connectionSettings.getHost(), port, |
|
128 |
getExplorerName(), getStoreName(), this.projection); |
|
129 |
} |
|
130 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/ExporttoPostgreSQLProviderLibrary.java | ||
---|---|---|
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.postgresql.exportto; |
|
25 |
|
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.service.spi.ProviderManager; |
|
29 |
import org.gvsig.exportto.swing.ExporttoSwingLibrary; |
|
30 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderLocator; |
|
31 |
|
|
32 |
/** |
|
33 |
* Library to initialize and register the file Exporto provider |
|
34 |
* implementation. |
|
35 |
* |
|
36 |
* @author gvSIG Team |
|
37 |
* @version $Id$ |
|
38 |
*/ |
|
39 |
public class ExporttoPostgreSQLProviderLibrary extends AbstractLibrary { |
|
40 |
|
|
41 |
@Override |
|
42 |
public void doRegistration() { |
|
43 |
registerAsServiceOf(ExporttoSwingLibrary.class); |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doInitialize() throws LibraryException { |
|
48 |
// Nothing to do |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
protected void doPostInitialize() throws LibraryException { |
|
53 |
ProviderManager providerManager = |
|
54 |
ExporttoSwingProviderLocator.getManager(); |
|
55 |
providerManager |
|
56 |
.addProviderFactory(new ExporttoPostgreSQLProviderFactory()); |
|
57 |
} |
|
58 |
|
|
59 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/src/main/java/org/gvsig/postgresql/exportto/ExporttoPostgreSQLProviderFactory.java | ||
---|---|---|
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.postgresql.exportto; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
|
|
28 |
import org.gvsig.exportto.swing.ExporttoSwingManager; |
|
29 |
import org.gvsig.exportto.swing.spi.AbstractExporttoProviderFactory; |
|
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
31 |
import org.gvsig.tools.dynobject.DynObject; |
|
32 |
import org.gvsig.tools.service.ServiceException; |
|
33 |
import org.gvsig.tools.service.spi.Provider; |
|
34 |
import org.gvsig.tools.service.spi.ProviderServices; |
|
35 |
|
|
36 |
/** |
|
37 |
* Factory of file {@link ExportoProvider} objects. |
|
38 |
* |
|
39 |
* @author gvSIG Team |
|
40 |
* @version $Id$ |
|
41 |
*/ |
|
42 |
public class ExporttoPostgreSQLProviderFactory extends |
|
43 |
AbstractExporttoProviderFactory { |
|
44 |
|
|
45 |
private static final String PROVIDER_NAME = "PostgreSQLv2"; |
|
46 |
|
|
47 |
public ExporttoPostgreSQLProviderFactory() { |
|
48 |
super(new int[] { |
|
49 |
ExporttoSwingManager.VECTORIAL_TABLE_WITHOUT_GEOMETRY, |
|
50 |
ExporttoSwingManager.VECTORIAL_TABLE_WITH_GEOMETRY }); |
|
51 |
} |
|
52 |
|
|
53 |
public Provider create(DynObject parameters, ProviderServices services) |
|
54 |
throws ServiceException { |
|
55 |
return new ExporttoPostgreSQLProvider(services, |
|
56 |
(FeatureStore) parameters.getDynValue(PARAMETER_FEATURESTORE), |
|
57 |
(IProjection) parameters.getDynValue(PARAMETER_PROJECTION)); |
|
58 |
} |
|
59 |
|
|
60 |
public String getName() { |
|
61 |
return PROVIDER_NAME; |
|
62 |
} |
|
63 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.export/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.postgresql.app.export</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>Export: PostgreSQL support</name> |
|
9 |
<description>Export support for PostgreSQL</description> |
|
10 |
|
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.postgresql.app</artifactId> |
|
14 |
<version>2.0.21-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<dependencies> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.andami</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.exportto.lib.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.exportto.swing.api</artifactId> |
|
36 |
<scope>compile</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.exportto.swing.spi</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.exportto.swing.prov.jdbc</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.geodb.app.mainplugin</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
|
|
54 |
|
|
55 |
<dependency> |
|
56 |
<groupId>postgresql</groupId> |
|
57 |
<artifactId>postgresql</artifactId> |
|
58 |
<scope>runtime</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>commons-dbcp</groupId> |
|
62 |
<artifactId>commons-dbcp</artifactId> |
|
63 |
<scope>runtime</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>commons-collections</groupId> |
|
67 |
<artifactId>commons-collections</artifactId> |
|
68 |
<scope>runtime</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>commons-pool</groupId> |
|
72 |
<artifactId>commons-pool</artifactId> |
|
73 |
<scope>runtime</scope> |
|
74 |
</dependency> |
|
75 |
|
|
76 |
</dependencies> |
|
77 |
|
|
78 |
<properties> |
|
79 |
<!-- Package info property values --> |
|
80 |
<!-- Default values in org.gvsig.desktop --> |
|
81 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
82 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
83 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.0.1</gvsig.package.info.dependencies> |
|
84 |
<gvsig.package.info.categories>Formats,Vector,Database</gvsig.package.info.categories> |
|
85 |
<gvsig.package.info.poolURL>http://devel.gvsig.org/download/projects/gvsig-postgresql/pool/</gvsig.package.info.poolURL> |
|
86 |
</properties> |
|
87 |
|
|
88 |
|
|
89 |
</project> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Mon Jun 20 16:00:58 CEST 2016 |
|
2 |
buildNumber=2113 |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.mainplugin/src/main/resources-plugin/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.mainplugin"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.andami.LibraryExtension" active="false"/> |
|
8 |
</extensions> |
|
9 |
</plugin-config> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
<file> |
|
17 |
<source>src/main/resources-plugin/config.xml</source> |
|
18 |
</file> |
|
19 |
</files> |
|
20 |
|
|
21 |
<dependencySets> |
|
22 |
|
|
23 |
<dependencySet> |
|
24 |
<useProjectArtifact>false</useProjectArtifact> |
|
25 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
26 |
<outputDirectory>lib</outputDirectory> |
|
27 |
<includes> |
|
28 |
<include>org.gvsig:org.gvsig.postgresql.provider</include> |
|
29 |
</includes> |
|
30 |
</dependencySet> |
|
31 |
|
|
32 |
<dependencySet> |
|
33 |
<useProjectArtifact>false</useProjectArtifact> |
|
34 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
35 |
<outputDirectory>lib</outputDirectory> |
|
36 |
<includes> |
|
37 |
<include>postgresql:postgresql</include> |
|
38 |
<include>commons-dbcp:commons-dbcp</include> |
|
39 |
<include>commons-collections:commons-collections</include> |
|
40 |
<include>commons-pool:commons-pool</include> |
|
41 |
</includes> |
|
42 |
</dependencySet> |
|
43 |
|
|
44 |
</dependencySets> |
|
45 |
|
|
46 |
</assembly> |
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/org.gvsig.postgresql.app.mainplugin/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.postgresql.app.mainplugin</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<description>PostgreSQL file format support</description> |
|
10 |
|
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.postgresql.app</artifactId> |
|
14 |
<version>2.0.56</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<dependencies> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.andami</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.postgresql.provider</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
|
|
34 |
<dependency> |
|
35 |
<groupId>postgresql</groupId> |
|
36 |
<artifactId>postgresql</artifactId> |
|
37 |
<scope>runtime</scope> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>commons-dbcp</groupId> |
|
41 |
<artifactId>commons-dbcp</artifactId> |
|
42 |
<scope>runtime</scope> |
|
43 |
</dependency> |
|
44 |
<dependency> |
|
45 |
<groupId>commons-collections</groupId> |
|
46 |
<artifactId>commons-collections</artifactId> |
|
47 |
<scope>runtime</scope> |
|
48 |
</dependency> |
|
49 |
<dependency> |
|
50 |
<groupId>commons-pool</groupId> |
|
51 |
<artifactId>commons-pool</artifactId> |
|
52 |
<scope>runtime</scope> |
|
53 |
</dependency> |
|
54 |
|
|
55 |
</dependencies> |
|
56 |
|
|
57 |
<properties> |
|
58 |
<!-- Package info property values --> |
|
59 |
<!-- Default values in org.gvsig.desktop --> |
|
60 |
<gvsig.package.info.name>Formats: PostgreSQL support</gvsig.package.info.name> |
|
61 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
62 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
63 |
<gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.0.1</gvsig.package.info.dependencies> |
|
64 |
<gvsig.package.info.categories>Formats,Vector,Database</gvsig.package.info.categories> |
|
65 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-postgresql/pool/</gvsig.package.info.poolURL> |
|
66 |
</properties> |
|
67 |
|
|
68 |
|
|
69 |
</project> |
|
0 | 70 |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.app/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.postgresql.app</artifactId> |
|
7 |
<packaging>pom</packaging> |
|
8 |
<name>${project.artifactId}</name> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.postgresql</artifactId> |
|
12 |
<version>2.0.56</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<modules> |
|
16 |
<module>org.gvsig.postgresql.app.mainplugin</module> |
|
17 |
<!-- |
|
18 |
<module>org.gvsig.postgresql.app.export</module> |
|
19 |
--> |
|
20 |
</modules> |
|
21 |
|
|
22 |
</project> |
tags/org.gvsig.postgresql-2.0.56/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.postgresql</artifactId> |
|
7 |
<version>2.0.56</version> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<description>PostgreSQL support fort DAL and gvSIG</description> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.desktop</artifactId> |
|
14 |
<version>2.0.135</version> |
|
15 |
</parent> |
|
16 |
|
|
17 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-postgresql</url> |
|
18 |
<scm> |
|
19 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-postgresql/tags/org.gvsig.postgresql-2.0.56</connection> |
|
20 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-postgresql/tags/org.gvsig.postgresql-2.0.56</developerConnection> |
|
21 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-postgresql/repository/show/tags/org.gvsig.postgresql-2.0.56</url> |
|
22 |
</scm> |
|
23 |
|
|
24 |
<repositories> |
|
25 |
<repository> |
|
26 |
<id>gvsig-public-http-repository</id> |
|
27 |
<name>gvSIG maven public HTTP repository</name> |
|
28 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
29 |
<releases> |
|
30 |
<enabled>true</enabled> |
|
31 |
<updatePolicy>daily</updatePolicy> |
|
32 |
<checksumPolicy>warn</checksumPolicy> |
|
33 |
</releases> |
|
34 |
<snapshots> |
|
35 |
<enabled>true</enabled> |
|
36 |
<updatePolicy>daily</updatePolicy> |
|
37 |
<checksumPolicy>warn</checksumPolicy> |
|
38 |
</snapshots> |
|
39 |
</repository> |
|
40 |
</repositories> |
|
41 |
|
|
42 |
|
|
43 |
<build> |
|
44 |
<plugins> |
|
45 |
<plugin> |
|
46 |
<groupId>org.apache.maven.plugins</groupId> |
|
47 |
<artifactId>maven-release-plugin</artifactId> |
|
48 |
<configuration> |
|
49 |
<tagBase>https://devel.gvsig.org/svn/gvsig-postgresql/tags/</tagBase> |
|
50 |
<goals>deploy</goals> |
|
51 |
</configuration> |
|
52 |
</plugin> |
|
53 |
</plugins> |
|
54 |
</build> |
|
55 |
|
|
56 |
|
|
57 |
<dependencyManagement> |
|
58 |
<dependencies> |
|
59 |
<dependency> |
|
60 |
<groupId>org.gvsig</groupId> |
|
61 |
<artifactId>org.gvsig.postgresql.provider</artifactId> |
|
62 |
<version>2.0.56</version> |
|
63 |
</dependency> |
|
64 |
<dependency> |
|
65 |
<groupId>org.gvsig</groupId> |
|
66 |
<artifactId>org.gvsig.postgresql.app.mainplugin</artifactId> |
|
67 |
<version>2.0.56</version> |
|
68 |
</dependency> |
|
69 |
</dependencies> |
|
70 |
</dependencyManagement> |
|
71 |
|
|
72 |
<dependencies> |
|
73 |
<dependency> |
|
74 |
<groupId>org.slf4j</groupId> |
|
75 |
<artifactId>slf4j-api</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
</dependencies> |
|
79 |
|
|
80 |
|
|
81 |
<modules> |
|
82 |
<module>org.gvsig.postgresql.app</module> |
|
83 |
<module>org.gvsig.postgresql.provider</module> |
|
84 |
</modules> |
|
85 |
|
|
86 |
|
|
87 |
</project> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.fmap.dal.store.postgresql.PostgreSQLLibrary |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/resources/org/gvsig/fmap/dal/store/postgresql/PostgreSQLParameters.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<definitions> |
|
3 |
<version>1.0.0</version> |
|
4 |
<classes> |
|
5 |
<class name="PostgreSQLResourceParameters"> |
|
6 |
<extends> |
|
7 |
<class>JDBCResourceParameters</class> |
|
8 |
</extends> |
|
9 |
<fields> |
|
10 |
<field name="JDBCDriverClass" type="string" mandatory="true" |
|
11 |
defaultValue="org.postgresql.Driver" group="Advanced"> |
|
12 |
<description>JDBC Driver class</description> |
|
13 |
</field> |
|
14 |
<field name="port" type="integer" mandatory="false" |
|
15 |
defaultValue="5432" group="Connection"> |
|
16 |
<description></description> |
|
17 |
</field> |
|
18 |
<field name="UseSSL" type="boolean" mandatory="false" |
|
19 |
defaultValue="false" group="Basic"> |
|
20 |
<description>Use SSL connetion</description> |
|
21 |
</field> |
|
22 |
</fields> |
|
23 |
</class> |
|
24 |
|
|
25 |
<class name="PostgreSQLStoreParameters"> |
|
26 |
<extends> |
|
27 |
<class>JDBCStoreParameters</class> |
|
28 |
<class>PostgreSQLResourceParameters</class> |
|
29 |
</extends> |
|
30 |
<fields/> |
|
31 |
</class> |
|
32 |
|
|
33 |
<class name="PostgreSQLNewStoreParameters"> |
|
34 |
<extends> |
|
35 |
<class>JDBCNewStoreParameters</class> |
|
36 |
<class>PostgreSQLResourceParameters</class> |
|
37 |
</extends> |
|
38 |
<fields/> |
|
39 |
</class> |
|
40 |
|
|
41 |
|
|
42 |
<class name="PostgreSQLServerExplorerParameters"> |
|
43 |
<extends> |
|
44 |
<class>PostgreSQLResourceParameters</class> |
|
45 |
<class>JDBCServerExplorerParameters</class> |
|
46 |
</extends> |
|
47 |
<fields/> |
|
48 |
</class> |
|
49 |
|
|
50 |
|
|
51 |
</classes> |
|
52 |
</definitions> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/resources/org/gvsig/fmap/dal/store/postgresql/PostgreSQLMetadata.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<definitions> |
|
3 |
<version>1.0.0</version> |
|
4 |
<classes> |
|
5 |
<class name="PostgreSQL" namespace="Metadata"> |
|
6 |
<extends> |
|
7 |
<class name="JDBC" namespace="Metadata"/> |
|
8 |
</extends> |
|
9 |
<description>Metadata of a PostgreSQL store</description> |
|
10 |
<fields> |
|
11 |
</fields> |
|
12 |
</class> |
|
13 |
|
|
14 |
</classes> |
|
15 |
</definitions> |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLLibrary.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. S.A. {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.dal.store.postgresql; |
|
29 |
|
|
30 |
import org.gvsig.fmap.dal.DALLibrary; |
|
31 |
import org.gvsig.fmap.dal.DALLocator; |
|
32 |
import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices; |
|
33 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
34 |
import org.gvsig.fmap.dal.store.db.DBHelper; |
|
35 |
import org.gvsig.fmap.dal.store.jdbc.JDBCLibrary; |
|
36 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
37 |
import org.gvsig.tools.library.AbstractLibrary; |
|
38 |
import org.gvsig.tools.library.LibraryException; |
|
39 |
|
|
40 |
public class PostgreSQLLibrary extends AbstractLibrary { |
|
41 |
|
|
42 |
static String DEFAULT_JDCB_DRIVER_NAME = "org.postgresql.Driver"; |
|
43 |
|
|
44 |
@Override |
|
45 |
public void doRegistration() { |
|
46 |
registerAsServiceOf(DALLibrary.class); |
|
47 |
require(JDBCLibrary.class); |
|
48 |
} |
|
49 |
|
|
50 |
public static String getJdbcUrl(String host, Integer port, String db) { |
|
51 |
String url = null; |
|
52 |
if(host != null){ |
|
53 |
String sport = ""; |
|
54 |
if (port != null) { |
|
55 |
sport = ":" + port; |
|
56 |
} |
|
57 |
url = "jdbc:postgresql://" + host + sport + "/" + db; |
|
58 |
} |
|
59 |
return url; |
|
60 |
} |
|
61 |
|
|
62 |
|
|
63 |
@Override |
|
64 |
protected void doInitialize() throws LibraryException { |
|
65 |
} |
|
66 |
|
|
67 |
|
|
68 |
@Override |
|
69 |
protected void doPostInitialize() throws LibraryException { |
|
70 |
LibraryException ex=null; |
|
71 |
|
|
72 |
new JDBCLibrary().postInitialize(); |
|
73 |
|
|
74 |
DBHelper.registerParametersDefinition( |
|
75 |
PostgreSQLStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
76 |
PostgreSQLStoreParameters.class, |
|
77 |
"PostgreSQLParameters.xml" |
|
78 |
); |
|
79 |
DBHelper.registerParametersDefinition( |
|
80 |
PostgreSQLNewStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
81 |
PostgreSQLNewStoreParameters.class, |
|
82 |
"PostgreSQLParameters.xml" |
|
83 |
); |
|
84 |
DBHelper.registerParametersDefinition( |
|
85 |
PostgreSQLServerExplorerParameters.PARAMETERS_DEFINITION_NAME, |
|
86 |
PostgreSQLServerExplorerParameters.class, |
|
87 |
"PostgreSQLParameters.xml" |
|
88 |
); |
|
89 |
DBHelper.registerParametersDefinition( |
|
90 |
PostgreSQLResourceParameters.PARAMETERS_DEFINITION_NAME, |
|
91 |
PostgreSQLResourceParameters.class, |
|
92 |
"PostgreSQLParameters.xml" |
|
93 |
); |
|
94 |
try { |
|
95 |
DBHelper.registerMetadataDefinition( |
|
96 |
PostgreSQLStoreProvider.METADATA_DEFINITION_NAME, |
|
97 |
PostgreSQLStoreProvider.class, |
|
98 |
"PostgreSQLMetadata.xml" |
|
99 |
); |
|
100 |
} catch (MetadataException e) { |
|
101 |
ex = new LibraryException(this.getClass(),e); |
|
102 |
} |
|
103 |
|
|
104 |
ResourceManagerProviderServices resman = (ResourceManagerProviderServices) DALLocator |
|
105 |
.getResourceManager(); |
|
106 |
|
|
107 |
|
|
108 |
if (!resman.getResourceProviders().contains(PostgreSQLResource.NAME)) { |
|
109 |
resman.register(PostgreSQLResource.NAME, |
|
110 |
PostgreSQLResource.DESCRIPTION, PostgreSQLResource.class, |
|
111 |
PostgreSQLResourceParameters.class); |
|
112 |
} |
|
113 |
|
|
114 |
|
|
115 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
|
116 |
.getDataManager(); |
|
117 |
|
|
118 |
if (!dataman.getStoreProviders().contains(PostgreSQLStoreProvider.NAME)) { |
|
119 |
dataman.registerStoreProvider(PostgreSQLStoreProvider.NAME, |
|
120 |
PostgreSQLStoreProvider.class, |
|
121 |
PostgreSQLStoreParameters.class); |
|
122 |
} |
|
123 |
|
|
124 |
if (!dataman.getExplorerProviders().contains( |
|
125 |
PostgreSQLStoreProvider.NAME)) { |
|
126 |
dataman.registerExplorerProvider(PostgreSQLServerExplorer.NAME, |
|
127 |
PostgreSQLServerExplorer.class, |
|
128 |
PostgreSQLServerExplorerParameters.class); |
|
129 |
} |
|
130 |
if( ex!=null ) { |
|
131 |
throw ex; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLSetProvider.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 |
* 2009 IVER T.I {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
/** |
|
29 |
* |
|
30 |
*/ |
|
31 |
package org.gvsig.fmap.dal.store.postgresql; |
|
32 |
|
|
33 |
import java.util.ArrayList; |
|
34 |
import java.util.List; |
|
35 |
|
|
36 |
import org.cresques.cts.IProjection; |
|
37 |
import org.slf4j.Logger; |
|
38 |
import org.slf4j.LoggerFactory; |
|
39 |
|
|
40 |
import org.gvsig.fmap.dal.exception.DataException; |
|
41 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
42 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
43 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
45 |
import org.gvsig.fmap.dal.feature.exception.CreateGeometryException; |
|
46 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
|
47 |
import org.gvsig.fmap.dal.store.jdbc.JDBCSetProvider; |
|
48 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreProvider; |
|
49 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
50 |
import org.gvsig.tools.evaluator.Evaluator; |
|
51 |
import org.gvsig.tools.evaluator.EvaluatorFieldValue; |
|
52 |
import org.gvsig.tools.evaluator.EvaluatorFieldsInfo; |
|
53 |
|
|
54 |
/** |
|
55 |
* @author jmvivo |
|
56 |
* |
|
57 |
*/ |
|
58 |
public class PostgreSQLSetProvider extends JDBCSetProvider { |
|
59 |
|
|
60 |
private static Logger logger = LoggerFactory.getLogger(PostgreSQLSetProvider.class); |
|
61 |
|
|
62 |
public PostgreSQLSetProvider(JDBCStoreProvider store, FeatureQuery query, |
|
63 |
FeatureType featureType) throws DataException { |
|
64 |
super(store, query, featureType); |
|
65 |
} |
|
66 |
|
|
67 |
|
|
68 |
/* |
|
69 |
* (non-Javadoc) |
|
70 |
* |
|
71 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureSetProvider#canFilter() |
|
72 |
*/ |
|
73 |
public boolean canFilter() { |
|
74 |
// TODO more checks |
|
75 |
if (!super.canFilter()) { |
|
76 |
return false; |
|
77 |
} |
|
78 |
return true; |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
protected String getSqlForEvaluator(Evaluator filter) { |
|
83 |
|
|
84 |
String resp = null; |
|
85 |
if (filter != null && filter.getSQL() != null) { |
|
86 |
// ================================================= |
|
87 |
EvaluatorFieldsInfo info = filter.getFieldsInfo(); |
|
88 |
String filterString = filter.getSQL(); |
|
89 |
|
|
90 |
String[] filterNames = null; |
|
91 |
String[] finalNames = null; |
|
92 |
|
|
93 |
if (info == null) { |
|
94 |
filterNames = getFieldNames(getFeatureType()); |
|
95 |
} else { |
|
96 |
filterNames = info.getFieldNames(); |
|
97 |
} |
|
98 |
|
|
99 |
finalNames = new String[filterNames.length]; |
|
100 |
FeatureAttributeDescriptor attr; |
|
101 |
for (int i = 0; i < filterNames.length; i++) { |
|
102 |
attr = getFeatureType().getAttributeDescriptor(filterNames[i]); |
|
103 |
if (attr == null) { |
|
104 |
finalNames[i] = filterNames[i]; |
|
105 |
continue; |
|
106 |
} |
|
107 |
finalNames[i] = getEscapedFieldName(attr.getName()); |
|
108 |
} |
|
109 |
|
|
110 |
for (int i = 0; i < filterNames.length; i++) { |
|
111 |
if (!filterNames[i].equals(finalNames[i])) { |
|
112 |
filterString = filterString.replaceAll( |
|
113 |
"\\b" + filterNames[i] + "\\b", |
|
114 |
finalNames[i]); |
|
115 |
} |
|
116 |
} |
|
117 |
resp = filterString; |
|
118 |
} |
|
119 |
// ================================ |
|
120 |
// In any case, append working area filter |
|
121 |
|
|
122 |
try { |
|
123 |
resp = appendWorkingAreaCondition(resp); |
|
124 |
} catch (Exception e) { |
|
125 |
logger.error("While appending working area condition.", e); |
|
126 |
} |
|
127 |
return resp; |
|
128 |
} |
|
129 |
|
|
130 |
private String[] getFieldNames(FeatureType ft) { |
|
131 |
|
|
132 |
if (ft == null) { |
|
133 |
return new String[0]; |
|
134 |
} |
|
135 |
FeatureAttributeDescriptor[] atts = ft.getAttributeDescriptors(); |
|
136 |
String[] resp = new String[atts.length]; |
|
137 |
for (int i=0; i<atts.length; i++) { |
|
138 |
resp[i] = atts[i].getName(); |
|
139 |
} |
|
140 |
return resp; |
|
141 |
} |
|
142 |
|
|
143 |
private String getFunctionName(String newFunctionName) { |
|
144 |
|
|
145 |
PostgreSQLStoreProvider pg_sto_prov = (PostgreSQLStoreProvider) this.getStore(); |
|
146 |
PostgreSQLHelper hpr = pg_sto_prov.getPgHelper(); |
|
147 |
if (hpr == null) { |
|
148 |
logger.info("Unable to get PG helper.", new Exception("Helper is null")); |
|
149 |
return newFunctionName; |
|
150 |
} else { |
|
151 |
return hpr.getFunctionName(newFunctionName); |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
155 |
|
|
156 |
private String appendWorkingAreaCondition(String sql) throws Exception { |
|
157 |
|
|
158 |
|
|
159 |
DBStoreParameters dbParams = |
|
160 |
(DBStoreParameters) getStore().getParameters(); |
|
161 |
|
|
162 |
Envelope wa = dbParams.getWorkingArea(); |
|
163 |
if (wa == null) { |
|
164 |
return sql; |
|
165 |
} else { |
|
166 |
|
|
167 |
FeatureStore fstore = this.getStore().getFeatureStore(); |
|
168 |
String geoname = |
|
169 |
fstore.getDefaultFeatureType().getDefaultGeometryAttributeName(); |
|
170 |
|
|
171 |
StringBuffer strbuf = new StringBuffer(); |
|
172 |
|
|
173 |
if (sql == null) { |
|
174 |
strbuf.append( |
|
175 |
getFunctionName("ST_Intersects") + "(" |
|
176 |
+ getFunctionName("ST_GeomFromText") + "('"); |
|
177 |
} else { |
|
178 |
strbuf.append("("); |
|
179 |
strbuf.append(sql); |
|
180 |
strbuf.append(") AND " |
|
181 |
+ getFunctionName("ST_Intersects") + "(" |
|
182 |
+ getFunctionName("ST_GeomFromText") + "('"); |
|
183 |
} |
|
184 |
|
|
185 |
String workAreaWkt = null; |
|
186 |
workAreaWkt = wa.getGeometry().convertToWKT(); |
|
187 |
strbuf.append(workAreaWkt); |
|
188 |
strbuf.append("', "); |
|
189 |
|
|
190 |
PostgreSQLStoreProvider sprov = (PostgreSQLStoreProvider) getStore(); |
|
191 |
PostgreSQLHelper helper = sprov.getPgHelper(); |
|
192 |
|
|
193 |
IProjection proj = dbParams.getCRS(); |
|
194 |
int sridInt = helper.getProviderSRID(proj); |
|
195 |
if (sridInt == -1) { |
|
196 |
throw new CreateGeometryException( |
|
197 |
new Exception("CRS is null or unknown.")); |
|
198 |
} else { |
|
199 |
strbuf.append(Integer.toString(sridInt)); |
|
200 |
} |
|
201 |
strbuf.append("), " + getFunctionName("ST_Envelope") + "("); |
|
202 |
strbuf.append(helper.escapeFieldName(geoname)); |
|
203 |
strbuf.append("))"); |
|
204 |
|
|
205 |
return strbuf.toString(); |
|
206 |
} |
|
207 |
} |
|
208 |
|
|
209 |
|
|
210 |
} |
tags/org.gvsig.postgresql-2.0.56/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLResource.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 |
|
Also available in: Unified diff