Revision 23303 branches/v2_0_0_prep/libraries/libFMap_dataDB/src/org/gvsig/fmap/data/feature/db/jdbc/postgresqlbin/PostgresqlBinStore.java

View differences:

PostgresqlBinStore.java
6 6
import java.sql.Statement;
7 7
import java.util.Locale;
8 8

  
9
import org.gvsig.tools.exception.BaseException;
10
import org.gvsig.fmap.data.CloseException;
11 9
import org.gvsig.fmap.data.DataCollection;
10
import org.gvsig.fmap.data.DataException;
12 11
import org.gvsig.fmap.data.DataExplorer;
13
import org.gvsig.fmap.data.InitializeException;
14
import org.gvsig.fmap.data.OpenException;
15 12
import org.gvsig.fmap.data.ReadException;
16 13
import org.gvsig.fmap.data.feature.Feature;
17 14
import org.gvsig.fmap.data.feature.FeatureCollection;
......
21 18
import org.gvsig.fmap.data.feature.db.jdbc.JDBCResource;
22 19
import org.gvsig.fmap.data.feature.db.jdbc.JDBCStoreParameters;
23 20
import org.gvsig.fmap.data.feature.db.jdbc.postgresql.PostgresqlStore;
24
import org.gvsig.fmap.data.feature.db.jdbc.postgresql.PostgresqlStoreParameters;
25 21
import org.gvsig.metadata.IMetadata;
22
import org.gvsig.tools.exception.BaseException;
26 23

  
27 24
public class PostgresqlBinStore extends PostgresqlStore{
28 25
	public static final String CONNECTION_STRING = "postgresql";
......
36 33
	 * @see org.gvsig.fmap.data.feature.db.jdbc.JDBCStore#createResource(org.gvsig.fmap.data.feature.file.dbf.DBFStoreParameters)
37 34
	 */
38 35
	protected JDBCResource createResource(JDBCStoreParameters params) {
39
		return new PostgresqlBinResource((PostgresqlBinStoreParameters)params);
36
		return new PostgresqlBinResource(params);
40 37
	}
41 38

  
42 39
	public String getName() {
......
44 41
	}
45 42

  
46 43
	public DataCollection getDataCollection(FeatureType type, String filter, String order) throws ReadException {
47
		if (type==null){
48
			type=getDefaultFeatureType();
49
		} else {
50
			if (!type.isSubtypeOf(this.getDefaultFeatureType())){
51
				throw new ReadException("invalid type",this.getName());
52
			}
44
		try {
45
			type = this.checkFeatureTypeForCollection(type);
46
		} catch (DataException e) {
47
			throw new ReadException(this.getName(), e);
53 48
		}
54 49

  
50

  
55 51
		if (useSqlSource ){
56 52
			if (filter != null || order != null || type != getDefaultFeatureType()){
57 53
				throw new ReadException("Unsuported filter/order in sqlSource mode",this.getName());
......
119 115
			e.printStackTrace();
120 116
			throw new ReadException(this.getName(), e);
121 117
		} finally{
122
			if (rs != null)
118
			if (rs != null) {
123 119
				try {
124 120
					rs.close();
125 121
				} catch (java.sql.SQLException e) {
126 122
					// TODO ?????
127 123
					e.printStackTrace();
128 124
				}
125
			}
129 126
		}
130 127
		return null;
131 128
	}

Also available in: Unified diff