Revision 36179
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/prepare-workspace.xml | ||
---|---|---|
1 |
<project name="org.gvsig.initial.build" default="prepare-workspace"> |
|
2 |
|
|
3 |
<dirname property="org.gvsig.initial.build.basedir" file="${ant.file.org.gvsig.initial.build}" /> |
|
4 |
|
|
5 |
<property name="workspace.basedir" value="${org.gvsig.initial.build.basedir}/.." /> |
|
6 |
<property name="build.basedir" value="${workspace.basedir}/org.gvsig.maven.base.build" description="Eclipse workspace location" /> |
|
7 |
<property name="build.jar.version" value="1.0.6-SNAPSHOT" /> |
|
8 |
<property name="build.jar.file" value="org.gvsig.maven.base.build-${build.jar.version}.jar" /> |
|
9 |
|
|
10 |
<property name="ant.libs.dir" location="${build.basedir}" description="Additional ant tasks libs folder" /> |
|
11 |
|
|
12 |
<target name="check-maven-base-build-available"> |
|
13 |
<available file="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" property="maven-base-build-available" /> |
|
14 |
</target> |
|
15 |
|
|
16 |
<target name="get-maven-base-build-local" depends="check-maven-base-build-available" if="maven-base-build-available"> |
|
17 |
<!-- Unzip de build jar file from the maven repository into the workspace root folder --> |
|
18 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
19 |
<zipfileset src="${user.home}/.m2/repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}"> |
|
20 |
<patternset> |
|
21 |
<exclude name="META-INF/**" /> |
|
22 |
</patternset> |
|
23 |
</zipfileset> |
|
24 |
</copy> |
|
25 |
</target> |
|
26 |
|
|
27 |
<target name="get-maven-base-build-remote" depends="check-maven-base-build-available" unless="maven-base-build-available"> |
|
28 |
<mkdir dir="target" /> |
|
29 |
|
|
30 |
<!-- Download the build jar file --> |
|
31 |
<get src="http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository/org/gvsig/org.gvsig.maven.base.build/${build.jar.version}/${build.jar.file}" dest="target/${build.jar.file}" verbose="true" /> |
|
32 |
|
|
33 |
<!-- Unzip de build jar file into the workspace root folder --> |
|
34 |
<copy todir="${workspace.basedir}" preservelastmodified="false" filtering="false"> |
|
35 |
<zipfileset src="target/${build.jar.file}"> |
|
36 |
<patternset> |
|
37 |
<exclude name="META-INF/**" /> |
|
38 |
</patternset> |
|
39 |
</zipfileset> |
|
40 |
</copy> |
|
41 |
|
|
42 |
</target> |
|
43 |
|
|
44 |
<target name="prepare-workspace" depends="get-maven-base-build-local,get-maven-base-build-remote"> |
|
45 |
|
|
46 |
<mkdir dir="target" /> |
|
47 |
|
|
48 |
<chmod dir="${build.basedir}/maven/bin" perm="u+x" includes="m2,mvn,mvnDebug" /> |
|
49 |
|
|
50 |
<!-- Copy the maven launchers to the workspace metadata folder --> |
|
51 |
<copy todir="${workspace.basedir}/.metadata"> |
|
52 |
<fileset dir="${build.basedir}/eclipse-launchers"> |
|
53 |
<exclude name="**/org.eclipse.jdt.core.prefs" /> |
|
54 |
<exclude name="**/org.eclipse.core.variables.prefs" /> |
|
55 |
</fileset> |
|
56 |
</copy> |
|
57 |
|
|
58 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" append="true"> |
|
59 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.jdt.core.prefs" /> |
|
60 |
</concat> |
|
61 |
<concat destfile="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" append="true"> |
|
62 |
<filelist dir="${build.basedir}/eclipse-launchers/.plugins/org.eclipse.core.runtime/.settings" files="org.eclipse.core.variables.prefs" /> |
|
63 |
</concat> |
|
64 |
|
|
65 |
<!-- Configure the eclipse workspace --> |
|
66 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-configure-eclipse-workspace" /> |
|
67 |
|
|
68 |
<!-- Configure the gvSIG profile --> |
|
69 |
<ant antfile="${build.basedir}/check-gvsig-profile.xml" target="initialize" /> |
|
70 |
|
|
71 |
<property name="user-settings-file-location" value="${user.home}/.m2/settings.xml" /> |
|
72 |
|
|
73 |
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask"> |
|
74 |
<classpath> |
|
75 |
<pathelement location="${ant.libs.dir}/com.oopsconsultancy.xmltask-1.16.1.jar" /> |
|
76 |
</classpath> |
|
77 |
</taskdef> |
|
78 |
|
|
79 |
<xmltask source="${user-settings-file-location}" dest="${user-settings-file-location}"> |
|
80 |
<copy path="//:settings/:profiles/:profile[:id/text() = 'gvsig-install']/:properties/:gvsig.install.dir/text()" property="current-gvsig-location" /> |
|
81 |
</xmltask> |
|
82 |
|
|
83 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.core.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
84 |
<replace file="${workspace.basedir}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.variables.prefs" token="@GVSIG_HOME@" value="${current-gvsig-location}" /> |
|
85 |
|
|
86 |
<!-- Compile, install and generate eclipse projects --> |
|
87 |
<ant antfile="${build.basedir}/maven-goals.xml" target="mvn-install-and-eclipse-eclipse" /> |
|
88 |
|
|
89 |
<echo>INFORMATION!!!</echo> |
|
90 |
<echo>Restart eclipse and then proceed to import the subprojects contained into the main project</echo> |
|
91 |
|
|
92 |
<!-- TODO: copiar al proyecto de configuraciĆ³n general --> |
|
93 |
</target> |
|
94 |
|
|
95 |
<target name="clean"> |
|
96 |
<delete dir="target" /> |
|
97 |
</target> |
|
98 |
|
|
99 |
</project> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
<modelVersion>4.0.0</modelVersion> |
|
6 |
<groupId>org.gvsig</groupId> |
|
7 |
<artifactId>org.gvsig.personaldb</artifactId> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<version>1.0.0-SNAPSHOT</version> |
|
10 |
<name>org.gvsig.personaldb</name> |
|
11 |
<description>PersonalDB example project</description> |
|
12 |
<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.personaldb/${project.version}/basic/org.gvsig.personaldb</url> |
|
13 |
<parent> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.maven.base.pom</artifactId> |
|
16 |
<version>1.0.6-SNAPSHOT</version> |
|
17 |
</parent> |
|
18 |
|
|
19 |
<scm> |
|
20 |
<connection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-personaldb/org.gvsig.personaldb/library/trunk</connection> |
|
21 |
<developerConnection>scm:svn:https://svn.forge.osor.eu/svn/gvsig-personaldb/org.gvsig.personaldb/library/trunk</developerConnection> |
|
22 |
<url>https://forge.osor.eu/plugins/scmsvn/viewcvs.php/org.gvsig.personaldb/library/trunk/?root=gvsig-personaldb</url> |
|
23 |
</scm> |
|
24 |
|
|
25 |
<developers> |
|
26 |
<developer> |
|
27 |
<id>jjdelcerro</id> |
|
28 |
<name>Joaqu?n Jos? del Cerro</name> |
|
29 |
<email>jjdelcerro@gvsig.com</email> |
|
30 |
<roles> |
|
31 |
<role>Architect</role> |
|
32 |
</roles> |
|
33 |
</developer> |
|
34 |
<developer> |
|
35 |
<id>cordinyana</id> |
|
36 |
<name>C?sar Ordi?ana Navarro</name> |
|
37 |
<email>cordinyana@gvsig.com</email> |
|
38 |
<roles> |
|
39 |
<role>Architect</role> |
|
40 |
<role>Developer</role> |
|
41 |
</roles> |
|
42 |
</developer> |
|
43 |
</developers> |
|
44 |
|
|
45 |
<distributionManagement> |
|
46 |
<site> |
|
47 |
<id>gvsig-repository</id> |
|
48 |
<url>scp://shell.forge.osor.eu/home/groups/gvsig-desktop/www/downloads/pub/projects/gvSIG-desktop/docs/reference/org.gvsig.personaldb/${project.version}/basic/org.gvsig.personaldb</url> |
|
49 |
</site> |
|
50 |
</distributionManagement> |
|
51 |
<repositories> |
|
52 |
<repository> |
|
53 |
<id>gvsig-public-http-repository</id> |
|
54 |
<name>gvSIG maven public HTTP repository</name> |
|
55 |
<url>http://gvsig-desktop.forge.osor.eu/downloads/pub/projects/gvSIG-desktop/maven-repository</url> |
|
56 |
<releases> |
|
57 |
<enabled>true</enabled> |
|
58 |
<updatePolicy>daily</updatePolicy> |
|
59 |
<checksumPolicy>warn</checksumPolicy> |
|
60 |
</releases> |
|
61 |
<snapshots> |
|
62 |
<enabled>true</enabled> |
|
63 |
<updatePolicy>daily</updatePolicy> |
|
64 |
<checksumPolicy>warn</checksumPolicy> |
|
65 |
</snapshots> |
|
66 |
</repository> |
|
67 |
</repositories> |
|
68 |
<build> |
|
69 |
<plugins> |
|
70 |
<plugin> |
|
71 |
<groupId>org.apache.maven.plugins</groupId> |
|
72 |
<artifactId>maven-release-plugin</artifactId> |
|
73 |
<configuration> |
|
74 |
<tagBase>https://svn.forge.osor.eu/svn/gvsig-personaldb/org.gvsig.personaldb/library/tags</tagBase> |
|
75 |
</configuration> |
|
76 |
</plugin> |
|
77 |
</plugins> |
|
78 |
</build> |
|
79 |
<dependencyManagement> |
|
80 |
<dependencies> |
|
81 |
<dependency> |
|
82 |
<groupId>org.gvsig</groupId> |
|
83 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
84 |
<version>2.0.1-SNAPSHOT</version> |
|
85 |
<type>pom</type> |
|
86 |
<scope>import</scope> |
|
87 |
</dependency> |
|
88 |
</dependencies> |
|
89 |
</dependencyManagement> |
|
90 |
|
|
91 |
<dependencies> |
|
92 |
<dependency> |
|
93 |
<groupId>org.gvsig</groupId> |
|
94 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
95 |
<scope>compile</scope> |
|
96 |
</dependency> |
|
97 |
<dependency> |
|
98 |
<groupId>org.gvsig</groupId> |
|
99 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
100 |
<type>test-jar</type> |
|
101 |
<scope>test</scope> |
|
102 |
</dependency> |
|
103 |
</dependencies> |
|
104 |
|
|
105 |
<modules> |
|
106 |
<module>org.gvsig.personaldb.lib</module> |
|
107 |
|
|
108 |
<module>org.gvsig.personaldb.main</module> |
|
109 |
|
|
110 |
</modules> |
|
111 |
|
|
112 |
</project> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/README.txt | ||
---|---|---|
1 |
The first time you checkout the current project to a new workspace, |
|
2 |
you have to prepare it to be able to work easily with maven from |
|
3 |
eclipse itself. |
|
4 |
|
|
5 |
Perform the following steps: |
|
6 |
|
|
7 |
1.- Launch the *prepare-workspace.xml* ant build file. |
|
8 |
You can do it by loading the file into the ant view, |
|
9 |
and running the default task, or right-clicking the |
|
10 |
file from the package explorer or the navigator and |
|
11 |
select the option: *Run as > Ant build*. |
|
12 |
|
|
13 |
2.- Restart eclipse. |
|
14 |
|
|
15 |
3.- Import the subprojects of the project you have just checked out. |
|
16 |
|
|
17 |
Those steps are only needed once per workspace. |
|
18 |
|
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.main/src/main/java/org/gvsig/personaldb/main/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.personaldb package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>PersonalDB library testing and demo application.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.main/src/main/java/org/gvsig/personaldb/main/Main.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 |
package org.gvsig.personaldb.main; |
|
24 |
|
|
25 |
import java.sql.Connection; |
|
26 |
import java.sql.DatabaseMetaData; |
|
27 |
import java.sql.SQLException; |
|
28 |
|
|
29 |
import org.slf4j.Logger; |
|
30 |
import org.slf4j.LoggerFactory; |
|
31 |
|
|
32 |
import org.gvsig.personaldb.PersonalDBException; |
|
33 |
import org.gvsig.personaldb.PersonalDBLocator; |
|
34 |
import org.gvsig.personaldb.PersonalDBManager; |
|
35 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
36 |
|
|
37 |
/** |
|
38 |
* Main executable class for testing the PersonalDB library. |
|
39 |
* |
|
40 |
* @author gvSIG Team |
|
41 |
* @version $Id$ |
|
42 |
*/ |
|
43 |
public class Main { |
|
44 |
|
|
45 |
private static final Logger LOG = LoggerFactory.getLogger(Main.class); |
|
46 |
|
|
47 |
public static void main(String args[]) { |
|
48 |
Main main = new Main(); |
|
49 |
try { |
|
50 |
main.show(); |
|
51 |
} catch (Throwable e) { |
|
52 |
e.printStackTrace(); |
|
53 |
System.exit(-1); |
|
54 |
} |
|
55 |
System.exit(0); |
|
56 |
} |
|
57 |
|
|
58 |
public void show() throws PersonalDBException, SQLException { |
|
59 |
|
|
60 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
61 |
PersonalDBManager manager = PersonalDBLocator.getManager(); |
|
62 |
|
|
63 |
Connection connection = manager.getConnection(); |
|
64 |
DatabaseMetaData metadata = connection.getMetaData(); |
|
65 |
LOG.info("DatabaseMetadata: {}", metadata); |
|
66 |
} |
|
67 |
|
|
68 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.main/src/main/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your classes. |
|
2 |
|
|
3 |
This folder is added to the classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your classes. |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.main/src/main/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.personaldb"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.main/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.personaldb.main</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.personaldb.main</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.personaldb</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.personaldb.lib.api</artifactId> |
|
17 |
<version>1.0.0-SNAPSHOT</version> |
|
18 |
<scope>compile</scope> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.personaldb.lib.impl</artifactId> |
|
23 |
<version>1.0.0-SNAPSHOT</version> |
|
24 |
<scope>runtime</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.core.maven.dependencies</artifactId> |
|
34 |
<version>2.0.1-SNAPSHOT</version> |
|
35 |
<type>pom</type> |
|
36 |
<scope>runtime</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.slf4j</groupId> |
|
40 |
<artifactId>slf4j-api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
</dependencies> |
|
44 |
<build> |
|
45 |
<plugins> |
|
46 |
<plugin> |
|
47 |
<groupId>org.codehaus.mojo</groupId> |
|
48 |
<artifactId>exec-maven-plugin</artifactId> |
|
49 |
<executions> |
|
50 |
<execution> |
|
51 |
<goals> |
|
52 |
<goal>exec</goal> |
|
53 |
</goals> |
|
54 |
</execution> |
|
55 |
</executions> |
|
56 |
<configuration> |
|
57 |
<executable>java</executable> |
|
58 |
<arguments> |
|
59 |
<argument>-classpath</argument> |
|
60 |
<!-- automatically creates the classpath using all project |
|
61 |
dependencies, also adding the project build directory --> |
|
62 |
<classpath /> |
|
63 |
<argument>org.gvsig.personaldb.main.Main</argument> |
|
64 |
</arguments> |
|
65 |
<environmentVariables> |
|
66 |
</environmentVariables> |
|
67 |
</configuration> |
|
68 |
</plugin> |
|
69 |
</plugins> |
|
70 |
</build> |
|
71 |
</project> |
|
0 | 72 |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/test/java/org/gvsig/personaldb/PersonalDBManagerTest.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
25 |
|
|
26 |
/** |
|
27 |
* API compatibility tests for {@link PersonalDBManager} implementations. |
|
28 |
* |
|
29 |
* @author gvSIG Team |
|
30 |
* @version $Id$ |
|
31 |
*/ |
|
32 |
public abstract class PersonalDBManagerTest extends |
|
33 |
AbstractLibraryAutoInitTestCase { |
|
34 |
|
|
35 |
protected PersonalDBManager manager; |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doSetUp() throws Exception { |
|
39 |
manager = PersonalDBLocator.getManager(); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Dummy Test for the {@link PersonalDBManager} method. |
|
44 |
* |
|
45 |
* @throws Exception |
|
46 |
* if there is any error in the tests |
|
47 |
*/ |
|
48 |
public void testDummy() throws Exception { |
|
49 |
// Nothing to do |
|
50 |
} |
|
51 |
|
|
52 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.personaldb.PersonalDBLibrary |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/PersonalDBLocator.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import org.gvsig.tools.locator.BaseLocator; |
|
25 |
import org.gvsig.tools.locator.Locator; |
|
26 |
import org.gvsig.tools.locator.LocatorException; |
|
27 |
|
|
28 |
/** |
|
29 |
* This locator is the entry point for the PersonalDB library, providing |
|
30 |
* access to all PersonalDB services through the {@link PersonalDBManager} |
|
31 |
* . |
|
32 |
* |
|
33 |
* @author gvSIG team |
|
34 |
* @version $Id$ |
|
35 |
*/ |
|
36 |
public class PersonalDBLocator extends BaseLocator { |
|
37 |
|
|
38 |
/** |
|
39 |
* PersonalDB manager name. |
|
40 |
*/ |
|
41 |
public static final String MANAGER_NAME = "PersonalDB.manager"; |
|
42 |
|
|
43 |
/** |
|
44 |
* PersonalDB manager description. |
|
45 |
*/ |
|
46 |
public static final String MANAGER_DESCRIPTION = "PersonalDB Manager"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "PersonalDB.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final PersonalDBLocator INSTANCE = |
|
54 |
new PersonalDBLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static PersonalDBLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name. |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Return a reference to the PersonalDBManager. |
|
76 |
* |
|
77 |
* @return a reference to the PersonalDBManager |
|
78 |
* @throws LocatorException |
|
79 |
* if there is no access to the class or the class cannot be |
|
80 |
* instantiated |
|
81 |
* @see Locator#get(String) |
|
82 |
*/ |
|
83 |
public static PersonalDBManager getManager() throws LocatorException { |
|
84 |
return (PersonalDBManager) getInstance().get(MANAGER_NAME); |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Registers the Class implementing the PersonalDBManager interface. |
|
89 |
* |
|
90 |
* @param clazz |
|
91 |
* implementing the PersonalDBManager interface |
|
92 |
*/ |
|
93 |
public static void registerManager( |
|
94 |
Class<? extends PersonalDBManager> clazz) { |
|
95 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
96 |
} |
|
97 |
|
|
98 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/PersonalDBLibrary.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import org.gvsig.tools.library.AbstractLibrary; |
|
25 |
import org.gvsig.tools.library.LibraryException; |
|
26 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
27 |
|
|
28 |
/** |
|
29 |
* Library for PersonalDB API initialization and configuration. |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public class PersonalDBLibrary extends AbstractLibrary { |
|
35 |
|
|
36 |
@Override |
|
37 |
public void doRegistration() { |
|
38 |
registerAsAPI(PersonalDBLibrary.class); |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
protected void doInitialize() throws LibraryException { |
|
43 |
// Do nothing |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
protected void doPostInitialize() throws LibraryException { |
|
48 |
// Validate there is any implementation registered. |
|
49 |
PersonalDBManager manager = PersonalDBLocator.getManager(); |
|
50 |
if (manager == null) { |
|
51 |
throw new ReferenceNotRegisteredException( |
|
52 |
PersonalDBLocator.MANAGER_NAME, PersonalDBLocator |
|
53 |
.getInstance()); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.personaldb package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>PersonalDB library API.</p> |
|
11 |
|
|
12 |
<p> |
|
13 |
It allows to get new PersonalDB and get their text. |
|
14 |
</p> |
|
15 |
|
|
16 |
</body> |
|
17 |
</html> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/DataServerExplorerParametersException.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
|
|
25 |
/** |
|
26 |
* Exception thrown when there is an error creating a connection to the |
|
27 |
* personal database. |
|
28 |
* |
|
29 |
* @author gvSIG Team |
|
30 |
* @version $Id$ |
|
31 |
*/ |
|
32 |
public class DataServerExplorerParametersException extends PersonalDBException { |
|
33 |
|
|
34 |
private static final long serialVersionUID = 8918999379397938916L; |
|
35 |
|
|
36 |
private final static String MESSAGE_FORMAT = |
|
37 |
"Error creating a DataServerExplorerParameters for the personal " |
|
38 |
+ "database of the type: %(name)"; |
|
39 |
private final static String MESSAGE_KEY = |
|
40 |
"_DataServerExplorerParametersException"; |
|
41 |
|
|
42 |
/** |
|
43 |
* Constructor with a message and a cause |
|
44 |
*/ |
|
45 |
public DataServerExplorerParametersException(String name, |
|
46 |
Throwable cause) { |
|
47 |
super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID); |
|
48 |
setValue("name", name); |
|
49 |
} |
|
50 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/PersonalDBManager.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import java.sql.Connection; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DataParameters; |
|
27 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
28 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
29 |
|
|
30 |
/** |
|
31 |
* This class is responsible of the management of the library's business logic. |
|
32 |
* It is the library's main entry point, and provides all the services to manage |
|
33 |
* {@link Connection}s and {@link DataParameters} to connect to the personal |
|
34 |
* database. |
|
35 |
* |
|
36 |
* @see PersonalDBService |
|
37 |
* @author gvSIG team |
|
38 |
* @version $Id$ |
|
39 |
*/ |
|
40 |
public interface PersonalDBManager { |
|
41 |
|
|
42 |
/** |
|
43 |
* Returns a {@link Connection} the personal database. |
|
44 |
* |
|
45 |
* @return a connection to the personal database |
|
46 |
* @throws PersonalDBException |
|
47 |
* if there is an error getting the connection |
|
48 |
*/ |
|
49 |
public Connection getConnection() throws PersonalDBException; |
|
50 |
|
|
51 |
/** |
|
52 |
* Returns a {@link DataStoreParameters} to connect to the personal database |
|
53 |
* through the DAL library. |
|
54 |
* |
|
55 |
* @return the DAL data store parameters to connect to connect to the |
|
56 |
* database |
|
57 |
* @throws PersonalDBException |
|
58 |
* if there is an error creating the parameters |
|
59 |
*/ |
|
60 |
public DataStoreParameters getDataStoreParameters() |
|
61 |
throws PersonalDBException; |
|
62 |
|
|
63 |
/** |
|
64 |
* Returns a {@link DataStoreParameters} to connect to the personal database |
|
65 |
* through the DAL library. |
|
66 |
* |
|
67 |
* @param schema |
|
68 |
* the schema of the table to load data from |
|
69 |
* @param table |
|
70 |
* the name of the table to load data from |
|
71 |
* @return the DAL data store parameters to connect to connect to the |
|
72 |
* database |
|
73 |
* @throws PersonalDBException |
|
74 |
* if there is an error creating the parameters |
|
75 |
*/ |
|
76 |
public DataStoreParameters getDataStoreParameters(String schema, |
|
77 |
String table) throws PersonalDBException; |
|
78 |
|
|
79 |
/** |
|
80 |
* Returns a {@link DataServerExplorerParameters} to connect to the personal |
|
81 |
* database |
|
82 |
* through the DAL library. |
|
83 |
* |
|
84 |
* @return the DAL data server explorer parameters to connect to connect to |
|
85 |
* the |
|
86 |
* database |
|
87 |
* @throws PersonalDBException |
|
88 |
* if there is an error creating the parameters |
|
89 |
*/ |
|
90 |
public DataServerExplorerParameters getDataServerExplorerParameters() |
|
91 |
throws PersonalDBException; |
|
92 |
|
|
93 |
/** |
|
94 |
* Returns a {@link DataServerExplorerParameters} to connect to the personal |
|
95 |
* database |
|
96 |
* through the DAL library. |
|
97 |
* |
|
98 |
* @param schema |
|
99 |
* the schema of the database to connect to |
|
100 |
* @return the DAL data server explorer parameters to connect to connect to |
|
101 |
* the |
|
102 |
* database |
|
103 |
* @throws PersonalDBException |
|
104 |
* if there is an error creating the parameters |
|
105 |
*/ |
|
106 |
public DataServerExplorerParameters getDataServerExplorerParameters( |
|
107 |
String schema) throws PersonalDBException; |
|
108 |
|
|
109 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/DBAccessException.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.DataParameters; |
|
25 |
|
|
26 |
/** |
|
27 |
* Exception thrown when there is an error creating a connection to the |
|
28 |
* personal database. |
|
29 |
* |
|
30 |
* @author gvSIG Team |
|
31 |
* @version $Id$ |
|
32 |
*/ |
|
33 |
public class DBAccessException extends PersonalDBException { |
|
34 |
|
|
35 |
private static final long serialVersionUID = 8918999379397938916L; |
|
36 |
|
|
37 |
private final static String MESSAGE_FORMAT = |
|
38 |
"Access error to a database whose parameters are: %(parameters)"; |
|
39 |
private final static String MESSAGE_KEY = "_DBAccessException"; |
|
40 |
|
|
41 |
/** |
|
42 |
* Constructor with a message and a cause |
|
43 |
*/ |
|
44 |
public DBAccessException(DataParameters parameters, Throwable cause) { |
|
45 |
super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID); |
|
46 |
setValue("parameters", parameters.toString()); |
|
47 |
} |
|
48 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/src/main/java/org/gvsig/personaldb/PersonalDBException.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 |
package org.gvsig.personaldb; |
|
23 |
|
|
24 |
import org.gvsig.tools.exception.BaseException; |
|
25 |
|
|
26 |
/** |
|
27 |
* Generic exception thrown in the PersonalDB API when the exception or error |
|
28 |
* may be dealt by the program or the user of the program which is a client of |
|
29 |
* the PersonalDB API. |
|
30 |
* |
|
31 |
* @see {@link PersonalDBManager} |
|
32 |
* @author gvSIG team. |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class PersonalDBException extends BaseException { |
|
36 |
|
|
37 |
private static final long serialVersionUID = 6756475060924237176L; |
|
38 |
|
|
39 |
private static final String MESSAGE = |
|
40 |
"An error has been produced in the PersonalDB library"; |
|
41 |
|
|
42 |
private static final String KEY = "_PersonalDBException"; |
|
43 |
|
|
44 |
/** |
|
45 |
* Constructor to be used in rare cases, usually you must create a new child |
|
46 |
* exception class for each case. |
|
47 |
* <strong>Don't use this constructor in child classes.</strong> |
|
48 |
*/ |
|
49 |
public PersonalDBException() { |
|
50 |
super(MESSAGE, KEY, serialVersionUID); |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Constructor to be used in rare cases, usually you must create a new child |
|
55 |
* exception class for each case. |
|
56 |
* <p> |
|
57 |
* <strong>Don't use this constructor in child classes.</strong> |
|
58 |
* </p> |
|
59 |
* |
|
60 |
* @param cause |
|
61 |
* the original cause of the exception |
|
62 |
*/ |
|
63 |
public PersonalDBException(Exception cause) { |
|
64 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
65 |
} |
|
66 |
|
|
67 |
/** |
|
68 |
* @see BaseException#BaseException(String, String, long). |
|
69 |
* @param message |
|
70 |
* the default messageFormat to describe the exception |
|
71 |
* @param key |
|
72 |
* the key to use to search a localized messageFormnata |
|
73 |
* @param code |
|
74 |
* the unique code to identify the exception |
|
75 |
*/ |
|
76 |
protected PersonalDBException(String message, String key, long code) { |
|
77 |
super(message, key, code); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see BaseException#BaseException(String, Throwable, String, long). |
|
82 |
* @param message |
|
83 |
* the default messageFormat to describe the exception |
|
84 |
* @param cause |
|
85 |
* the original cause of the exception |
|
86 |
* @param key |
|
87 |
* the key to use to search a localized messageFormnata |
|
88 |
* @param code |
|
89 |
* the unique code to identify the exception |
|
90 |
*/ |
|
91 |
protected PersonalDBException(String message, Throwable cause, |
|
92 |
String key, long code) { |
|
93 |
super(message, cause, key, code); |
|
94 |
} |
|
95 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.api/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.personaldb.lib.api</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>org.gvsig.personaldb.lib.api</name> |
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.personaldb.lib</artifactId> |
|
11 |
<version>1.0.0-SNAPSHOT</version> |
|
12 |
</parent> |
|
13 |
<build> |
|
14 |
<plugins> |
|
15 |
<plugin> |
|
16 |
<groupId>org.apache.maven.plugins</groupId> |
|
17 |
<artifactId>maven-jar-plugin</artifactId> |
|
18 |
<configuration> |
|
19 |
</configuration> |
|
20 |
<executions> |
|
21 |
<!-- Generates a jar file only with the test classes --> |
|
22 |
<execution> |
|
23 |
<goals> |
|
24 |
<goal>test-jar</goal> |
|
25 |
</goals> |
|
26 |
</execution> |
|
27 |
</executions> |
|
28 |
</plugin> |
|
29 |
</plugins> |
|
30 |
</build> |
|
31 |
<dependencies> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.fmap.dal</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
</dependencies> |
|
43 |
</project> |
|
0 | 44 |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
4 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
5 |
|
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<artifactId>org.gvsig.personaldb.lib</artifactId> |
|
8 |
<packaging>pom</packaging> |
|
9 |
<name>org.gvsig.personaldb.lib</name> |
|
10 |
<parent> |
|
11 |
<groupId>org.gvsig</groupId> |
|
12 |
<artifactId>org.gvsig.personaldb</artifactId> |
|
13 |
<version>1.0.0-SNAPSHOT</version> |
|
14 |
</parent> |
|
15 |
|
|
16 |
<modules> |
|
17 |
<module>org.gvsig.personaldb.lib.api</module> |
|
18 |
<module>org.gvsig.personaldb.lib.impl</module> |
|
19 |
</modules> |
|
20 |
</project> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/test/java/org/gvsig/personaldb/impl/DefaultPersonalDBManagerTest.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 |
package org.gvsig.personaldb.impl; |
|
23 |
|
|
24 |
import org.gvsig.personaldb.PersonalDBManager; |
|
25 |
import org.gvsig.personaldb.PersonalDBManagerTest; |
|
26 |
import org.gvsig.personaldb.impl.DefaultPersonalDBManager; |
|
27 |
|
|
28 |
/** |
|
29 |
* {@link PersonalDBManager} API compatibility tests for the |
|
30 |
* {@link DefaultPersonalDBManager} implementation. |
|
31 |
* |
|
32 |
* @author gvSIG Team |
|
33 |
* @version $Id$ |
|
34 |
*/ |
|
35 |
public class DefaultPersonalDBManagerTest extends PersonalDBManagerTest { |
|
36 |
|
|
37 |
// Nothing to add |
|
38 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/test/resources/README.txt | ||
---|---|---|
1 |
Put into this folder the resources needed by your test classes. |
|
2 |
|
|
3 |
This folder is added to the Tests classpath, so you can load any resources |
|
4 |
through the ClassLoader. |
|
5 |
|
|
6 |
By default, in this folder you can find an example of log4j configuration, |
|
7 |
prepared to log messages through the console, so logging works when you |
|
8 |
run your tests classes. |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/test/resources/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<!-- |
|
5 |
Log4J configuration file for unit tests execution. |
|
6 |
--> |
|
7 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
8 |
|
|
9 |
<!-- Appender configuration to show logging messages through the console --> |
|
10 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
11 |
<layout class="org.apache.log4j.PatternLayout"> |
|
12 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
13 |
</layout> |
|
14 |
</appender> |
|
15 |
|
|
16 |
<!-- |
|
17 |
Activate logging messages of DEBUG level of higher only for the |
|
18 |
org.gvsig.tools packages. |
|
19 |
You can put full classes names or packages instead, to configure |
|
20 |
logging for all the classes and subpackages of the package. |
|
21 |
--> |
|
22 |
<category name="org.gvsig.tools"> |
|
23 |
<priority value="DEBUG" /> |
|
24 |
</category> |
|
25 |
<category name="org.gvsig.personaldb"> |
|
26 |
<priority value="DEBUG" /> |
|
27 |
</category> |
|
28 |
|
|
29 |
<!-- |
|
30 |
By default, show only logging messages of INFO level or higher, |
|
31 |
through the previously configured CONSOLE appender. |
|
32 |
--> |
|
33 |
<root> |
|
34 |
<priority value="INFO" /> |
|
35 |
<appender-ref ref="CONSOLE" /> |
|
36 |
</root> |
|
37 |
</log4j:configuration> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/main/java/org/gvsig/personaldb/impl/package.html | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
4 |
<head> |
|
5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
6 |
<title>org.gvsig.personaldb package documentation</title> |
|
7 |
</head> |
|
8 |
<body> |
|
9 |
|
|
10 |
<p>PersonalDB library API default implementation.</p> |
|
11 |
|
|
12 |
</body> |
|
13 |
</html> |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/main/java/org/gvsig/personaldb/impl/PersonalDBDefaultImplLibrary.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 |
package org.gvsig.personaldb.impl; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.store.jdbc.JDBCLibrary; |
|
25 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters; |
|
26 |
import org.gvsig.personaldb.PersonalDBLibrary; |
|
27 |
import org.gvsig.personaldb.PersonalDBLocator; |
|
28 |
import org.gvsig.tools.library.AbstractLibrary; |
|
29 |
import org.gvsig.tools.library.LibraryException; |
|
30 |
|
|
31 |
/** |
|
32 |
* Library for default implementation initialization and configuration. |
|
33 |
* |
|
34 |
* @author gvSIG team |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class PersonalDBDefaultImplLibrary extends AbstractLibrary { |
|
38 |
|
|
39 |
@Override |
|
40 |
public void doRegistration() { |
|
41 |
registerAsImplementationOf(PersonalDBLibrary.class); |
|
42 |
require(JDBCLibrary.class); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doInitialize() throws LibraryException { |
|
47 |
PersonalDBLocator.registerManager(DefaultPersonalDBManager.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
if (PersonalDBLocator.getManager() instanceof DefaultPersonalDBManager) { |
|
53 |
|
|
54 |
String databasePath = |
|
55 |
System.getProperty("personalDBPath", "~/.gvsig-personaldb"); |
|
56 |
String databasePort = System.getProperty("personalDBPort"); |
|
57 |
|
|
58 |
String personalDBURL = |
|
59 |
databasePort == null ? "jdbc:h2:" + databasePath |
|
60 |
: "jdbc:h2:tcp://localhost:" + databasePort + "/" |
|
61 |
+ databasePath; |
|
62 |
|
|
63 |
JDBCResourceParameters parameters = new JDBCResourceParameters(); |
|
64 |
parameters.setJDBCDriverClassName("org.h2.Driver"); |
|
65 |
parameters.setUrl(personalDBURL); |
|
66 |
|
|
67 |
((DefaultPersonalDBManager) PersonalDBLocator.getManager()) |
|
68 |
.open(parameters); |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
} |
tags/v2_0_0_Build_2032/libraries/org.gvsig.personaldb/org.gvsig.personaldb.lib/org.gvsig.personaldb.lib.impl/src/main/java/org/gvsig/personaldb/impl/DefaultPersonalDBManager.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 |
package org.gvsig.personaldb.impl; |
|
23 |
|
|
24 |
import java.sql.Connection; |
|
25 |
import java.sql.SQLException; |
|
26 |
|
|
27 |
import javax.sql.DataSource; |
|
28 |
|
|
29 |
import org.apache.commons.dbcp.BasicDataSource; |
|
30 |
import org.slf4j.Logger; |
|
31 |
import org.slf4j.LoggerFactory; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.DALLocator; |
|
34 |
import org.gvsig.fmap.dal.DataServerExplorerParameters; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
37 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
38 |
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters; |
|
39 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorer; |
|
40 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
41 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
42 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreProvider; |
|
43 |
import org.gvsig.personaldb.DBAccessException; |
|
44 |
import org.gvsig.personaldb.DataServerExplorerParametersException; |
|
45 |
import org.gvsig.personaldb.PersonalDBException; |
|
46 |
import org.gvsig.personaldb.PersonalDBManager; |
|
47 |
import org.gvsig.tools.dispose.impl.AbstractDisposable; |
|
48 |
import org.gvsig.tools.exception.BaseException; |
|
49 |
|
|
50 |
/** |
|
51 |
* Default {@link PersonalDBManager} implementation. |
|
52 |
* |
|
53 |
* @author gvSIG Team |
|
54 |
* @version $Id$ |
|
55 |
*/ |
|
56 |
public class DefaultPersonalDBManager extends AbstractDisposable implements |
|
57 |
PersonalDBManager { |
|
58 |
|
|
59 |
private static final Logger LOG = LoggerFactory |
|
60 |
.getLogger(DefaultPersonalDBManager.class); |
|
61 |
|
|
62 |
private BasicDataSource dataSource; |
|
63 |
private JDBCResourceParameters resourceParameters; |
|
64 |
|
|
65 |
public Connection getConnection() throws PersonalDBException { |
|
66 |
|
|
67 |
try { |
|
68 |
return getDataSource().getConnection(); |
|
69 |
} catch (SQLException e) { |
|
70 |
throw new DBAccessException(resourceParameters, e); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
private synchronized DataSource getDataSource() { |
|
75 |
|
|
76 |
if (dataSource == null) { |
|
77 |
dataSource = new BasicDataSource(); |
|
78 |
dataSource.setDriverClassName(resourceParameters |
|
79 |
.getJDBCDriverClassName()); |
|
80 |
dataSource.setUsername(resourceParameters.getUser()); |
|
81 |
dataSource.setPassword(resourceParameters.getPassword()); |
|
82 |
dataSource.setUrl(resourceParameters.getUrl()); |
|
83 |
|
|
84 |
dataSource.setMaxWait(60L * 1000); // FIXME |
|
85 |
|
|
86 |
dataSource.setMaxActive(20); |
|
87 |
dataSource.setMaxIdle(4); |
|
88 |
dataSource.setMinIdle(1); |
|
89 |
dataSource.setInitialSize(1); |
|
90 |
|
|
91 |
// FIXME Set Pool parameters: |
|
92 |
/* |
|
93 |
* dataSource.setMaxOpenPreparedStatements(maxActive); |
|
94 |
* dataSource.setMaxWait(maxActive); |
|
95 |
* dataSource.setDefaultReadOnly(defaultReadOnly); |
|
96 |
* dataSource.setDefaultTransactionIsolation(defaultTransactionIsolation |
|
97 |
* ) |
|
98 |
* ; |
|
99 |
* dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis |
|
100 |
* ); |
|
101 |
* dataSource.setTestOnBorrow(testOnBorrow); |
|
102 |
* dataSource.setTestOnReturn(testOnReturn); |
|
103 |
* dataSource.setTestWhileIdle(testOnReturn); |
|
104 |
* dataSource |
|
105 |
* .setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); |
|
106 |
* |
|
107 |
* dataSource.setAccessToUnderlyingConnectionAllowed(allow); |
|
108 |
* dataSource.setLoginTimeout(seconds); |
|
109 |
* dataSource.setLogWriter(out); |
|
110 |
*/ |
|
111 |
} |
|
112 |
|
|
113 |
return dataSource; |
|
114 |
} |
|
115 |
|
|
116 |
public DataStoreParameters getDataStoreParameters() |
|
117 |
throws PersonalDBException { |
|
118 |
|
|
119 |
return getJDBCStoreParameters(); |
|
120 |
} |
|
121 |
|
|
122 |
public DataStoreParameters getDataStoreParameters(String schema, |
|
123 |
String table) throws PersonalDBException { |
|
124 |
|
|
125 |
JDBCStoreParameters params = getJDBCStoreParameters(); |
|
126 |
params.setSchema(schema); |
|
127 |
params.setTable(table); |
|
128 |
return params; |
|
129 |
} |
|
130 |
|
|
131 |
private JDBCStoreParameters getJDBCStoreParameters() |
|
132 |
throws PersonalDBException { |
|
133 |
try { |
|
134 |
JDBCStoreParameters params = |
|
135 |
(JDBCStoreParameters) DALLocator.getDataManager() |
|
136 |
.createStoreParameters(JDBCStoreProvider.NAME); |
|
137 |
|
|
138 |
params.setUrl(resourceParameters.getUrl()); |
|
139 |
params.setJDBCDriverClassName(resourceParameters |
|
140 |
.getJDBCDriverClassName()); |
|
141 |
|
|
142 |
return params; |
|
143 |
} catch (InitializeException e) { |
|
144 |
throw new DataServerExplorerParametersException( |
|
145 |
JDBCServerExplorer.NAME, e); |
|
146 |
} catch (ProviderNotRegisteredException e) { |
|
147 |
throw new DataServerExplorerParametersException( |
|
148 |
JDBCServerExplorer.NAME, e); |
|
149 |
} |
|
150 |
} |
|
151 |
|
|
152 |
public DataServerExplorerParameters getDataServerExplorerParameters() |
|
153 |
throws PersonalDBException { |
|
154 |
return getJDBCServerExplorerParameters(); |
|
155 |
} |
|
156 |
|
|
157 |
public DataServerExplorerParameters getDataServerExplorerParameters( |
|
158 |
String schema) throws PersonalDBException { |
|
159 |
JDBCServerExplorerParameters params = getJDBCServerExplorerParameters(); |
|
160 |
params.setSchema(schema); |
|
161 |
return params; |
Also available in: Unified diff