Revision 25475

View differences:

branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/serverexplorer/db/DBServerExplorerParameters.java
1
package org.gvsig.fmap.dal.serverexplorer.db;
2

  
3
import org.gvsig.fmap.dal.DataServerExplorerParameters;
4
import org.gvsig.fmap.dal.DataTypes;
5
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DynClass;
8
import org.gvsig.tools.dynobject.DynField;
9
import org.gvsig.tools.dynobject.DynObjectManager;
10

  
11
public class DBServerExplorerParameters extends AbstractDataParameters
12
		implements DataServerExplorerParameters {
13

  
14
	public static final String DYNCLASS_NAME = "DBServerExplorerParameters";
15

  
16
	public DBServerExplorerParameters() {
17
		this.delegatedDynObjet = ToolsLocator.getDynObjectManager()
18
				.createDynObject(this.registerDynClass());
19
	}
20

  
21
	private DynClass registerDynClass() {
22
	   	DynObjectManager dynman = ToolsLocator.getDynObjectManager();
23
    	DynClass dynClass = dynman.get(DYNCLASS_NAME);
24
    	DynField field;
25
    	if (dynClass == null) {
26
    		dynClass = dynman.add(DYNCLASS_NAME);
27

  
28
    		field = dynClass.addDynField("db");
29
    		field.setTheTypeOfAvailableValues(DataTypes.STRING);
30
    		field.setDescription("Data base name");
31
    		field.setType(DynField.SINGLE);
32

  
33
    		field = dynClass.addDynField("host");
34
			field.setTheTypeOfAvailableValues(DataTypes.STRING);
35
			field.setDescription("Url to host");
36
			field.setType(DynField.SINGLE);
37

  
38
    		field = dynClass.addDynField("port");
39
			field.setTheTypeOfAvailableValues(DataTypes.INT);
40
			field.setDescription("Server port");
41
			field.setType(DynField.SINGLE);
42

  
43
    		field = dynClass.addDynField("user");
44
			field.setTheTypeOfAvailableValues(DataTypes.STRING);
45
			field.setDescription("User name");
46
			field.setType(DynField.SINGLE);
47

  
48
			field = dynClass.addDynField("schema");
49
			field.setTheTypeOfAvailableValues(DataTypes.STRING);
50
			field.setDescription("Schema name");
51
			field.setType(DynField.SINGLE);
52

  
53
			field = dynClass.addDynField("password");
54
			field.setTheTypeOfAvailableValues(DataTypes.STRING);
55
			field.setDescription("Password"); //???
56
			field.setType(DynField.SINGLE);
57

  
58

  
59
    	}
60
    	return dynClass;
61
	}
62

  
63
	public String getDb() {
64
		return (String) this.getDynValue("db");
65
	}
66

  
67
	public void setDb(String db) {
68
		this.setDynValue("db", db);
69
	}
70

  
71
	public String getHost() {
72
		return (String) this.getDynValue("host");
73
	}
74

  
75
	public void setHost(String host) {
76
		this.setDynValue("host", host);
77
	}
78

  
79
	public String getPort() {
80
		return (String) this.getDynValue("port");
81
	}
82

  
83
	public void setPort(String port) {
84
		this.setDynValue("port", port);
85
	}
86

  
87
	public String getSchema() {
88
		return (String) this.getDynValue("schema");
89
	}
90

  
91
	public void setSchema(String schema) {
92
		this.setDynValue("schema", schema);
93
	}
94

  
95
	public String getPassw() {
96
		return (String) this.getDynValue("passw");
97
	}
98

  
99
	public void setPassw(String passw) {
100
		this.setDynValue("passw", passw);
101
	}
102

  
103
	public String getUser() {
104
		return (String) this.getDynValue("user");
105
	}
106

  
107
	public void setUser(String user) {
108
		this.setDynValue("user", user);
109
	}
110

  
111
	public String getCatalog() {
112
		return (String) this.getDynValue("catalog");
113
	}
114

  
115
	public void setCatalog(String catalog) {
116
		this.setDynValue("catalog", catalog);
117
	}
118

  
119
	public String getExplorerName() {
120
		return DBServerExplorer.NAME;
121
	}
122

  
123
}
0 124

  
branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/serverexplorer/db/DBStoreParameters.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.serverexplorer.db;
29

  
30

  
31
public interface DBStoreParameters {
32
	public String getDb();
33

  
34
	public String getHost();
35

  
36
	public Integer getPort();
37

  
38
	public String getSchema();
39

  
40
	public String getPassword();
41

  
42
	public String getUser();
43

  
44
	public String getCatalog();
45

  
46
	public void setDb(String db);
47

  
48
	public void setHost(String host);
49

  
50
	public void setPort(Integer port);
51

  
52
	public void setSchema(String schema);
53

  
54
	public void setPassword(String Password);
55

  
56
	public void setUser(String user);
57

  
58
	public void setCatalog(String catalog);
59

  
60
}
0 61

  
branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/serverexplorer/db/DBServerExplorer.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.serverexplorer.db;
29

  
30
import java.util.List;
31

  
32
import org.gvsig.fmap.dal.DataServerExplorer;
33
import org.gvsig.fmap.dal.DataServerExplorerParameters;
34
import org.gvsig.fmap.dal.DataStore;
35
import org.gvsig.fmap.dal.DataStoreParameters;
36
import org.gvsig.fmap.dal.NewDataStoreParameters;
37
import org.gvsig.fmap.dal.exception.DataException;
38
import org.gvsig.fmap.dal.exception.RemoveException;
39
import org.gvsig.fmap.dal.feature.FeatureType;
40

  
41
public interface DBServerExplorer extends DataServerExplorer {
42
	public static final String NAME = "DBExplorer";
43

  
44
	public abstract DataServerExplorerParameters getParameters();
45

  
46
	public abstract void dispose() throws DataException;
47

  
48
	public abstract List list() throws DataException;
49

  
50
	public abstract void remove(DataStoreParameters dsp) throws RemoveException;
51

  
52
	public abstract boolean add(NewDataStoreParameters ndsp, boolean overwrite)
53
			throws DataException;
54

  
55
	public abstract boolean canAdd();
56

  
57
	public abstract String getName();
58

  
59
	public abstract NewDataStoreParameters getAddParameters(String storeName)
60
			throws DataException;
61

  
62
	public abstract boolean canAdd(String storeName) throws DataException;
63

  
64
	public abstract FeatureType getFeatureType(DataStoreParameters dsp)
65
			throws DataException;
66

  
67
	public abstract DataStore open(DataStoreParameters dsp)
68
			throws DataException;
69

  
70
}
0 71

  

Also available in: Unified diff