svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.h2 / src / main / java / org / gvsig / fmap / dal / store / h2 / H2StoreParameters.java @ 41719
History | View | Annotate | Download (2.74 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2009 IVER T.I {{Task}}
|
26 |
*/
|
27 |
package org.gvsig.fmap.dal.store.h2; |
28 |
|
29 |
import java.io.File; |
30 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
31 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
32 |
|
33 |
import static org.gvsig.fmap.dal.store.h2.H2ConnectionParameters.PARAMETER_NAME_BASEFOLDER; |
34 |
|
35 |
public class H2StoreParameters extends JDBCStoreParameters implements |
36 |
H2ConnectionParameters { |
37 |
|
38 |
public static final String PARAMETERS_DEFINITION_NAME = "H2SQLStoreParameters"; |
39 |
|
40 |
public H2StoreParameters() {
|
41 |
super(PARAMETERS_DEFINITION_NAME, H2StoreProvider.NAME);
|
42 |
} |
43 |
|
44 |
public H2StoreParameters(String parametersDefinitionName) { |
45 |
super(parametersDefinitionName, H2StoreProvider.NAME);
|
46 |
} |
47 |
|
48 |
public Boolean getUseSSL() { |
49 |
return (Boolean) this.getDynValue(PARAMETER_NAME_USESSL); |
50 |
} |
51 |
|
52 |
public void setUseSSL(Boolean useSSL) { |
53 |
this.setDynValue(PARAMETER_NAME_USESSL, useSSL);
|
54 |
} |
55 |
|
56 |
public void setUseSSL(boolean useSSL) { |
57 |
this.setDynValue(PARAMETER_NAME_USESSL, new Boolean(useSSL)); |
58 |
} |
59 |
|
60 |
public File getBaseFolder() { |
61 |
return (File) this.getDynValue(PARAMETER_NAME_BASEFOLDER); |
62 |
} |
63 |
|
64 |
public void setBaseFolder(File baseFolder) { |
65 |
this.setDynValue(PARAMETER_NAME_BASEFOLDER, baseFolder);
|
66 |
} |
67 |
|
68 |
public void validate() throws ValidateDataParametersException { |
69 |
if ( getJDBCDriverClassName() == null ) { |
70 |
setJDBCDriverClassName(H2Library.DEFAULT_H2_DRIVER_NAME); |
71 |
} |
72 |
if( getBaseFolder()==null ) { |
73 |
this.setBaseFolder(H2ParametersHelper.getDefaultBaseFolder());
|
74 |
} |
75 |
if ( getPort() == null ) { |
76 |
setPort(new Integer(9123)); |
77 |
} |
78 |
if ( getUrl() == null ) { |
79 |
setUrl(H2ParametersHelper.getConnectionString(this));
|
80 |
} |
81 |
|
82 |
super.validate();
|
83 |
} |
84 |
|
85 |
} |