Revision 21569

View differences:

branches/Mobile_Compatible_Hito_1/libFMap_data/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0"
2
	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
	<groupId>org.gvsig</groupId>
6
	<artifactId>libFMAP_data</artifactId>
7
	<packaging>jar</packaging>
8
	<version>1.0-SNAPSHOT</version>
9
	<name>libFMAP_data</name>
10
	<url>http://gvsig.org</url>
11
	<parent>
12
		<groupId>org.gvsig</groupId>
13
		<artifactId>gvsig-library-base-pom</artifactId>
14
		<version>1.0-SNAPSHOT</version>
15
	</parent>
16
	<dependencies>
17
		<dependency>
18
			<groupId>org.gvsig</groupId>
19
			<artifactId>libExceptions</artifactId>
20
			<version>1.0-SNAPSHOT</version>
21
		</dependency>
22
		<dependency>
23
			<groupId>org.gvsig</groupId>
24
			<artifactId>libProjection</artifactId>
25
			<version>1.0-SNAPSHOT</version>
26
		</dependency>
27
		<dependency>
28
			<groupId>sqljep</groupId>
29
			<artifactId>sqljep</artifactId>
30
			<version>0.2</version>
31
		</dependency>
32
		<dependency>
33
			<groupId>com.vividsolutions</groupId>
34
			<artifactId>jts</artifactId>
35
			<version>1.8</version>
36
		</dependency>
37
		<dependency>
38
			<groupId>org.gvsig</groupId>
39
			<artifactId>libMetadata</artifactId>
40
			<version>1.0-SNAPSHOT</version>
41
		</dependency>
42
		<dependency>
43
			<groupId>org.gvsig</groupId>
44
			<artifactId>libGeometries</artifactId>
45
			<version>1.0-SNAPSHOT</version>
46
		</dependency>
47
	</dependencies>
48
	<build>
49
		<sourceDirectory>src</sourceDirectory>
50
		<testSourceDirectory>src-test</testSourceDirectory>
51
	</build>
52
</project>
branches/Mobile_Compatible_Hito_1/libFMap_data/.settings/org.eclipse.jdt.core.prefs
1
#Wed Feb 20 16:20:56 CET 2008
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.4
7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
12
org.eclipse.jdt.core.compiler.source=1.3
branches/Mobile_Compatible_Hito_1/libFMap_data/.settings/org.eclipse.jdt.ui.prefs
1
#Wed Feb 20 16:20:56 CET 2008
2
eclipse.preferences.version=1
3
internal.default.compliance=default
branches/Mobile_Compatible_Hito_1/libFMap_data/build.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- ======================================================================
3
     09/01/2008 13:02:25
4

  
5
     libDataStore
6
     Build del libDataStore
7

  
8
     jmvivo
9
     ====================================================================== -->
10
<project name="libDataSource" default="generar-tar-fuentes">
11
    <description>
12
            Build del libDataStore
13
    </description>
14
	<dirname file="${ant.file.libDataStore}" property="proyectDir"/>
15
	<property name="workspaceDir" location="${proyectDir}/.."/>
16

  
17
    <!-- =================================
18
          target: default
19
         ================================= -->
20
    <target name="generar-tar-fuentes" description="--> genera el tar de fuentes">
21
    	<tar destfile="${workspaceDir}/${ant.project.name}.tar.gz">
22
    		<tarfileset dir="${proyectDir}" prefix="${ant.project.name}/" excludes="*.*~,bin/,**/CVS"/>
23
    	</tar>
24

  
25

  
26
    </target>
27

  
28

  
29
</project>
branches/Mobile_Compatible_Hito_1/libFMap_data/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="src-test"/>
5
	<classpathentry combineaccessrules="false" kind="src" path="/libMetadata"/>
6
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7
	<classpathentry combineaccessrules="false" kind="src" path="/libExceptions"/>
8
	<classpathentry combineaccessrules="false" kind="src" path="/libFMap_Geometries"/>
9
	<classpathentry kind="lib" path="D:/PROYECTOS/gvsigtrunk/libFMap/lib/org.cresques.cts.jar"/>
10
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
11
	<classpathentry kind="lib" path="lib/geoapi-nogenerics-2.1.0.jar"/>
12
	<classpathentry kind="output" path="bin"/>
13
</classpath>
branches/Mobile_Compatible_Hito_1/libFMap_data/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>libFMap_data</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>de.loskutov.FileSync.FSBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jdt.core.javanature</nature>
21
	</natures>
22
</projectDescription>
branches/Mobile_Compatible_Hito_1/libFMap_data/src-test/org/gvsig/data/vectorial/VectorialTest.java
1
package org.gvsig.data.vectorial;
2

  
3
import junit.framework.TestCase;
4

  
5
public class VectorialTest extends TestCase {
6

  
7
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src-test/org/gvsig/data/datastores/DataStoreTest.java
1
package org.gvsig.data.datastores;
2

  
3
import junit.framework.TestCase;
4

  
5
public class DataStoreTest extends TestCase {
6

  
7
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src-test/org/gvsig/data/AllTests.java
1
package org.gvsig.data;
2

  
3
import junit.framework.Test;
4
import junit.framework.TestCase;
5
import junit.framework.TestSuite;
6

  
7
import org.gvsig.data.commands.CommandTest;
8
import org.gvsig.data.datastores.DataStoreTest;
9
import org.gvsig.data.vectorial.VectorialTest;
10

  
11
public class AllTests extends TestCase{
12
	public static Test suite() {
13
		TestSuite suite = new TestSuite("Test for libDataSource");
14
		//$JUnit-BEGIN$
15
		suite.addTestSuite(CommandTest.class);
16
		suite.addTestSuite(DataStoreTest.class);
17
		suite.addTestSuite(VectorialTest.class);
18

  
19
		//$JUnit-END$
20
		return suite;
21
	}
22
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src-test/org/gvsig/data/commands/CommandTest.java
1
package org.gvsig.data.commands;
2

  
3
import junit.framework.TestCase;
4

  
5
public class CommandTest extends TestCase {
6

  
7
	public static void main(String[] args) {
8
		junit.textui.TestRunner.run(CommandTest.class);
9
	}
10

  
11
	protected void setUp() throws Exception {
12
		super.setUp();
13
	}
14

  
15
	public void testInitialize() {
16

  
17
	}
18
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/spatialprovisionalold/Extent.java
1
package org.gvsig.data.spatialprovisionalold;
2

  
3
import java.awt.geom.Rectangle2D;
4

  
5
public class Extent implements IExtent{
6

  
7
	private int numberOfDimensions;
8
	private double[] min;
9
	private double[] max;
10
	private String[] dimensionLabel;
11

  
12
	public Extent (int dimiensions,double[] min, double[] max){
13
		//TODO
14

  
15
	}
16
	public Extent(double x1,double y1,double x2,double y2){
17
		this.initDimiensions(2);
18
		this.dimensionLabel[0] = "x";
19
		if (x1 < x2){
20
			this.min[0] = x1;
21
			this.max[0] = x2;
22
		} else {
23
			this.min[0] = x2;
24
			this.max[0] = x1;
25
		}
26
		this.dimensionLabel[1] = "y";
27
		if (y1 < y2){
28
			this.min[0] = y1;
29
			this.max[0] = y2;
30
		} else {
31
			this.min[0] = y2;
32
			this.max[0] = y1;
33
		}
34
	}
35

  
36
	public Extent(double x1,double y1,double z1,double x2,double y2,double z2){
37
		this.initDimiensions(3);
38
		this.dimensionLabel[0] = "x";
39
		if (x1 < x2){
40
			this.min[0] = x1;
41
			this.max[0] = x2;
42
		} else {
43
			this.min[0] = x2;
44
			this.max[0] = x1;
45
		}
46
		this.dimensionLabel[1] = "y";
47
		if (y1 < y2){
48
			this.min[0] = y1;
49
			this.max[0] = y2;
50
		} else {
51
			this.min[0] = y2;
52
			this.max[0] = y1;
53
		}
54
		this.dimensionLabel[2] = "z";
55
		if (z1 < z2){
56
			this.min[0] = z1;
57
			this.max[0] = z2;
58
		} else {
59
			this.min[0] = z2;
60
			this.max[0] = z1;
61
		}
62

  
63
	}
64
	public Extent(Rectangle2D bounds2D) {
65
		this.initDimiensions(2);
66
		this.dimensionLabel[0] = "x";
67
		this.dimensionLabel[0] = "y";
68
		this.min[0]=bounds2D.getMinX();
69
		this.min[1]=bounds2D.getMinY();
70
		this.max[0]=bounds2D.getMaxX();
71
		this.max[1]=bounds2D.getMaxY();
72
	}
73

  
74
	public void add(IExtent extent) {
75
		int maxDimension = Math.min(this.numberOfDimensions, extent.getDimiensionsCount());
76
		int i;
77
		for (i=0;i<maxDimension;i++){
78
			this.min[i] = Math.min(this.min[i], extent.getMin(i));
79
			this.max[i] = Math.max(this.max[i], extent.getMin(i));
80
		}
81
	}
82

  
83
	private void initDimiensions(int ndimensions){
84
		this.numberOfDimensions = ndimensions;
85
		this.min = new double[ndimensions];
86
		this.max = new double[ndimensions];
87
		this.dimensionLabel = new String[ndimensions];
88
	}
89

  
90

  
91
	public boolean contains(Object geometry) {
92
//		Extent bounds=new Extent(geometry.getBounds2D());
93
//		if (bounds.x1 == bounds.x2 || bounds.y1 == bounds.y2) {
94
//		    return false;
95
//		}
96
//		double x0 = x1;
97
//		double y0 = y1;
98
//		return (bounds.x1 >= x0 &&
99
//			bounds.y1 >= y0 &&
100
//			(bounds.x2) <= x2 &&
101
//			(bounds.y2) <= y2);
102
		return false;
103
	}
104

  
105
	public String getDimiensionLabel(int index) {
106
		return this.getDimiensionLabel(index);
107
	}
108

  
109
	public int getDimiensionsCount() {
110
		return this.numberOfDimensions;
111
	}
112

  
113
	public double getMax(int index) {
114
		return this.max[index];
115
	}
116

  
117
	public double getMin(int index) {
118
		return this.min[index];
119
	}
120

  
121
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/spatialprovisionalold/IExtent.java
1
package org.gvsig.data.spatialprovisionalold;
2

  
3

  
4
public interface IExtent {
5
	public int getDimiensionsCount();
6
	public String getDimiensionLabel(int index);
7
	void add(IExtent extent);
8
	boolean contains(Object geometry);
9
	public double getMin(int index);
10
	public double getMax(int index);
11
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/DefaultDataStoreNotification.java
1
package org.gvsig.data;
2

  
3
import org.gvsig.data.commands.Command;
4
import org.gvsig.data.vectorial.Feature;
5

  
6
public class DefaultDataStoreNotification implements DataStoreNotification {
7
	private String type;
8
	private DataStore source;
9
	private DataCollection previousSelection = null;
10
	private DataCollection newSelection = null;
11
	private Feature feature = null;
12
	private Command command = null;
13

  
14
	public DefaultDataStoreNotification(DataStore source, String type){
15
		this.init(source,type);
16
	}
17

  
18
	protected void init(DataStore source, String type){
19
		this.source = source;
20
		this.type = type;
21
	}
22

  
23
	public DefaultDataStoreNotification(DataStore source, String type, Feature feature){
24
		this.init(source,type);
25
		this.feature = feature;
26
	}
27
	public DefaultDataStoreNotification(DataStore source, String type, Command command){
28
		this.init(source,type);
29
		this.command = command;
30
	}
31

  
32
	public DefaultDataStoreNotification(DataStore source, String type, DataCollection previousSeCollection, DataCollection newSelection){
33
		this.init(source,type);
34
		this.previousSelection = previousSeCollection;
35
		this.newSelection = newSelection;
36
	}
37

  
38
	public DataCollection getNewSelection() {
39
		return newSelection;
40
	}
41

  
42
	public DataCollection getPreviousSelection() {
43
		return previousSelection;
44
	}
45

  
46
	public DataStore getSource() {
47
		return source;
48
	}
49

  
50
	public String getType() {
51
		return type;
52
	}
53

  
54
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/DefaultResourceNotification.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   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.data;
32
/**
33
 * @author jmvivo
34
 *
35
 */
36
public class DefaultResourceNotification implements ResourceNotification {
37

  
38
	private Resource resource;
39
	private String type;
40
	private DataStore store = null;
41

  
42

  
43
	public DefaultResourceNotification(Resource resource,String type){
44
		this.resource = resource;
45
		this.type = type;
46
	}
47

  
48
	public DefaultResourceNotification(Resource resource,String type,DataStore store){
49
		this.resource = resource;
50
		this.type = type;
51
		this.store = store;
52
	}
53

  
54
	/* (non-Javadoc)
55
	 * @see org.gvsig.data.ResourceNotification#getResource()
56
	 */
57
	public Resource getResource() {
58
		return this.resource;
59
	}
60
	/* (non-Javadoc)
61
	 * @see org.gvsig.data.ResourceNotification#getType()
62
	 */
63
	public String getType() {
64
		// TODO Auto-generated method stub
65
		return this.type;
66
	}
67

  
68
	/* (non-Javadoc)
69
	 * @see org.gvsig.data.ResourceNotification#getStore()
70
	 */
71
	public DataStore getStore() {
72
		// TODO Auto-generated method stub
73
		return this.store;
74
	}
75

  
76

  
77
}
78

  
0 79

  
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/DataManager.java
1
package org.gvsig.data;
2

  
3
import java.util.ArrayList;
4
import java.util.Iterator;
5

  
6

  
7
public class DataManager {
8
	private static ArrayList registers = new ArrayList();
9

  
10
	private static DataManager manager = null;
11

  
12
	public static DataManager getManager() {
13
		if( manager == null ) {
14
			manager = new DataManager();
15
		}
16
		return manager;
17
	}
18

  
19
	public static ResourceManager getResourceManager() {
20
		return ResourceManager.getResourceManager();
21
	}
22

  
23
	public DataManager() {
24
//		org.gvsig.data.datastores.vectorial.driver.shp.Register.selfRegister();
25
//		org.gvsig.data.datastores.vectorial.driver.Register.selfRegister();
26

  
27
//		org.gvsig.data.datastores.gml.Register.selfRegister();
28
	}
29

  
30
	public void registerGeometryHandler(String dataStoreID, Class geometryHandlerClass) {
31

  
32
	}
33

  
34
	public void registerDataStore(String name, Class dataStoreClass, Class parametersClass) {
35
		RegisterInfo register=new RegisterInfo(name,dataStoreClass,parametersClass);
36
		if (registers.contains(register)){
37
			return;
38
		}
39
		registers.add(register);
40
	}
41
	/**
42
	 * Levanta una instancia de los parametros solicitados
43
	 * inicializa el nombre en la instancia
44
	 * y la devuelve.
45
	 **/
46
	public DataStoreParameters createDataStoreParameters(String name){
47
		Iterator iterator=registers.iterator();
48
		while (iterator.hasNext()) {
49
			RegisterInfo registerInfo = (RegisterInfo) iterator.next();
50
			if (name.equals(registerInfo.name)){
51
				try {
52
					return (DataStoreParameters)registerInfo.parametersClazz.newInstance();
53
				} catch (InstantiationException e) {
54
					// TODO Auto-generated catch block
55
					e.printStackTrace();
56
				} catch (IllegalAccessException e) {
57
					// TODO Auto-generated catch block
58
					e.printStackTrace();
59
				}
60
			}
61
		}
62
		return null;
63
	}
64
	/**
65
	 * Levanta la instancia del datasource,
66
	 * levanta una instancia del driver que precisa el datasource
67
	 * y por ultimo invoca al metodo init del datasource.
68
	 * @throws InitializeException
69
	 **/
70
	public DataStore createDataStore(DataStoreParameters parameters) throws InitializeException {
71
		Iterator iterator=registers.iterator();
72
		while (iterator.hasNext()) {
73
			RegisterInfo registerInfo = (RegisterInfo) iterator.next();
74
			if (parameters.getDataStoreName().equals(registerInfo.name)){
75
				try {
76
					DataStore dataStore= (DataStore)registerInfo.clazz.newInstance();
77
					dataStore.init(parameters);
78
					return dataStore;
79
				} catch (InstantiationException e) {
80
					// TODO Auto-generated catch block
81
					e.printStackTrace();
82
				} catch (IllegalAccessException e) {
83
					// TODO Auto-generated catch block
84
					e.printStackTrace();
85
				}
86
			}
87
		}
88
		return null;
89
	}
90

  
91

  
92
	/* Como conjunto de propiedades genericas a un tipo de DataStore
93
	 * a las que se puede acceder sin tener que crear un DataStore/Driver.
94
	 *
95
	 * Por ejemplo para "DriverDataSource.shp" podria tener el
96
	 * tamaño de identificador de campo.
97
	 *
98
	 * En "DriverDataSource.postgres" podria aportar informacion sobre
99
	 * las tablas disponibles o cosas asi. Hay que ver que precisa
100
	 * GeoDB y de donde lo puede obtener.
101
	 *
102
	 * Hay que pensarlo bien.
103
	 *
104
	 */
105

  
106
	public void registerDataExplorer(String name, Class dataSourceClass, Class parametersClass) {
107
		RegisterInfo register=new RegisterInfo(name,dataSourceClass,parametersClass);
108
		if (registers.contains(register)){
109
			return;
110
		}
111
		registers.add(register);
112
	}
113
	/**
114
	 * Levanta una instancia de los parametros solicitados
115
	 * inicializa el nombre en la instancia
116
	 * y la devuelve.
117
	 **/
118
	public DataExplorerParameters createDataExplorerParameters(String name){
119
		Iterator iterator=registers.iterator();
120
		while (iterator.hasNext()) {
121
			RegisterInfo registerInfo = (RegisterInfo) iterator.next();
122
			if (name.equals(registerInfo.name)){
123
				try {
124
					return (DataExplorerParameters)registerInfo.parametersClazz.newInstance();
125
				} catch (InstantiationException e) {
126
					// TODO Auto-generated catch block
127
					e.printStackTrace();
128
				} catch (IllegalAccessException e) {
129
					// TODO Auto-generated catch block
130
					e.printStackTrace();
131
				}
132
			}
133
		}
134
		return null;
135
	}
136

  
137
	public DataExplorer createDataExplorer(DataExplorerParameters parameters) throws InitializeException {
138
		Iterator iterator=registers.iterator();
139
		while (iterator.hasNext()) {
140
			RegisterInfo registerInfo = (RegisterInfo) iterator.next();
141
			if (parameters.getDataExplorerName().equals(registerInfo.name)){
142
				try {
143
					DataExplorer dataSource= (DataExplorer)registerInfo.clazz.newInstance();
144
					dataSource.init(parameters);
145
					return dataSource;
146
				} catch (InstantiationException e) {
147
					// TODO Auto-generated catch block
148
					e.printStackTrace();
149
				} catch (IllegalAccessException e) {
150
					// TODO Auto-generated catch block
151
					e.printStackTrace();
152
				}
153
			}
154
		}
155

  
156
		return null;
157
	}
158
	private class RegisterInfo{
159
		private String name;
160
		private Class clazz;
161
		private Class parametersClazz;
162

  
163
		public RegisterInfo(String name, Class dsc, Class pc){
164
			this.name=name;
165
			this.clazz=dsc;
166
			this.parametersClazz=pc;
167
		}
168

  
169
		public boolean equals(Object obj) {
170
			if (obj instanceof RegisterInfo){
171
				RegisterInfo ri = (RegisterInfo)obj;
172
				return ri.name.equals(this.name) &&
173
					ri.clazz.equals(this.clazz) &&
174
					ri.parametersClazz.equals(this.parametersClazz);
175
			}
176
			return super.equals(obj);
177
		}
178

  
179

  
180

  
181
	}
182

  
183
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/exceptions_hierarchy.mm
1
<map version="0.8.1">
2
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
3
<node CREATED="1208241399576" ID="Freemind_Link_1091473561" MODIFIED="1208241415967" TEXT="Excepciones de libData">
4
<node CREATED="1208241431252" ID="_" MODIFIED="1208241437907" POSITION="right" TEXT="DataException">
5
<node CREATED="1208241470021" ID="Freemind_Link_981251953" MODIFIED="1208241474457" TEXT="ReadException">
6
<node CREATED="1208241498819" ID="Freemind_Link_881323281" MODIFIED="1208241505041" TEXT="CloseException"/>
7
<node CREATED="1208241505667" ID="Freemind_Link_1556911998" MODIFIED="1208241530057" TEXT="EvaluationExpressionException"/>
8
<node CREATED="1208241531453" ID="Freemind_Link_1913524181" MODIFIED="1208241547804" TEXT="InitializeException">
9
<node CREATED="1208241616423" ID="Freemind_Link_898717563" MODIFIED="1208241622216" TEXT="OpenException">
10
<node CREATED="1208241665195" ID="Freemind_Link_631985578" MODIFIED="1208241667566" TEXT="UnsupportedEncodingException"/>
11
<node CREATED="1208241670430" ID="Freemind_Link_774404741" MODIFIED="1208241681842" TEXT="UnsupportedVersionException"/>
12
</node>
13
</node>
14
</node>
15
<node CREATED="1208241475857" ID="Freemind_Link_1571515948" MODIFIED="1208241482354" TEXT="WriteException">
16
<node CREATED="1208241728259" ID="Freemind_Link_696993722" MODIFIED="1208241735132" TEXT="InitializeWriterException"/>
17
<node CREATED="1208241735618" ID="Freemind_Link_97625364" MODIFIED="1208241749322" TEXT="UnsupportedTypeException"/>
18
</node>
19
</node>
20
</node>
21
</map>
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/expressionevaluator/FeatureComparator.java
1
package org.gvsig.data.vectorial.expressionevaluator;
2

  
3
import java.util.Comparator;
4
import java.util.Iterator;
5

  
6
import org.gvsig.data.ReadException;
7
import org.gvsig.data.vectorial.Feature;
8
import org.gvsig.data.vectorial.FeatureAttributeDescriptor;
9
import org.gvsig.data.vectorial.FeatureID;
10
import org.gvsig.data.vectorial.FeatureType;
11
import org.gvsig.data.vectorial.IsNotFeatureSettingException;
12
import org.opengis.filter.Filter;
13
import org.opengis.filter.FilterFactory2;
14
import org.opengis.filter.expression.Expression;
15
import org.opengis.filter.sort.SortBy;
16
import org.opengis.filter.sort.SortOrder;
17

  
18
public class FeatureComparator implements Comparator {
19
	protected FeatureType featureType;
20
	SortBy[] order;
21

  
22
	public FeatureComparator(FeatureType featureType, SortBy[] order){
23
		this.featureType=featureType;
24
		this.order=order;
25
	}
26

  
27
	private Feature toFeature(Object arg) throws ReadException, IsNotFeatureSettingException{
28
		if (arg instanceof FeatureID){
29
			return ((FeatureID)arg).getFeature(featureType);
30
		} else {
31
			return (Feature)arg;
32
		}
33
	}
34

  
35
	public int compare(Object arg0, Object arg1) {
36
		Feature feature0, feature1;
37
		try {
38
			feature0 = toFeature(arg0);
39
			feature1 = toFeature(arg1);
40
		} catch (ReadException e1) {
41
			throw new RuntimeException(e1);
42
			//FIXME: OJO!!!! Revisar la excepcion que lanzamos aqui!!!!
43
			// Tendriamos que lanzar un ReadException, pero
44
			// no podemos por implementar el interface 'Comparator'.
45

  
46
		} catch (IsNotFeatureSettingException e) {
47
			throw new RuntimeException(e);
48
		}
49

  
50
		for (int i=0;i<order.length;i++){
51
			int result = compareFeatures(feature0, 
52
					feature1, 
53
					order[i].getSortOrder(),
54
					(FeatureAttributeDescriptor)featureType.get(order[i].getPropertyName().getPropertyName())
55
					);
56
			if (result!=0) return result; 
57
		}
58
		
59
		
60
		// Son iguales sus valores, pero si devolvemos
61
		// un 0 java puede considera que 'ES EL MISMO OBJETO'
62
		// y decidir NO A?ADIR a una lista una de las dos
63
		// features.
64
		// Por eso comparamo primero sus 'FeatureID' y
65
		// si son iguales devolvemos un 0 (es la misma feature)
66
		// sino devuelve -1.
67

  
68
		if (feature0.getID().equals(feature1.getID())){
69
			return 0;
70
		}
71
		return -1;
72
	}
73
	
74
	public int compareFeatures(Feature feature1, 
75
			Feature feature2, 
76
			SortOrder order,
77
			FeatureAttributeDescriptor type){
78
		
79
		int reverse = 1;
80
		if (order.equals(SortOrder.DESCENDING))
81
			reverse=-1;
82
		int pos = type.ordinal();
83
		if (feature1.get(pos).equals(feature2.get(pos)))
84
			return 0;
85
		if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_BOOLEAN)){
86
			if (feature1.getBoolean(pos)== false) return -1 * reverse;
87
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_BYTE)){
88
			if (feature1.getByte(pos)<feature2.getByte(pos)) return -1 * reverse;
89
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_DATE)){
90
			if (feature1.getDate(pos).before(feature2.getDate(pos))) return -1 * reverse;
91
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_DOUBLE)){
92
			if (feature1.getDouble(pos)<feature2.getDouble(pos)) return -1 * reverse;
93
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_FLOAT)){
94
			if (feature1.getFloat(pos)<feature2.getFloat(pos)) return -1 * reverse;
95
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_INT)){
96
			if (feature1.getInt(pos)<feature2.getInt(pos)) return -1 * reverse;
97
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_LONG)){
98
			if (feature1.getLong(pos)<feature2.getLong(pos)) return -1 * reverse;
99
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_STRING)){
100
			return feature1.getString(pos).compareTo(feature2.getString(pos)) * reverse;
101
		}else if (type.getDataType().equals(FeatureAttributeDescriptor.TYPE_GEOMETRY)){
102
			return -1; //TODO: How to order by geometries?
103
		}
104
		
105
		return reverse;
106
	}
107

  
108

  
109

  
110

  
111
}
0 112

  
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/DefaultFeatureType.java
1
package org.gvsig.data.vectorial;
2

  
3
import java.lang.ref.WeakReference;
4
import java.text.DateFormat;
5
import java.util.ArrayList;
6
import java.util.Iterator;
7
import java.util.List;
8

  
9
import org.gvsig.data.DataException;
10
import org.gvsig.data.InitializeException;
11

  
12
public class DefaultFeatureType extends ArrayList implements FeatureType{
13
	/**
14
	 *
15
	 */
16
	private static final long serialVersionUID = 5120922022663837016L;
17
	protected List featureRules=new ArrayList();//<FeatureRule>
18
	private String geometryColumn;
19
	private List allSRS;
20
	private String defaultSRS;
21
	private int[] geometryTypes = new int[0];
22
	private DateFormat dateFormat=DateFormat.getDateInstance();
23
	private String[] fieldsId;
24

  
25
	private int count=0;
26
	private WeakReference originalFeatureType=null;
27

  
28
	public DefaultFeatureType(){
29

  
30
	}
31
	public void addRule(FeatureRule rule) {
32
		featureRules.add(rule);
33
	}
34

  
35
	public void clearRules() {
36
		featureRules.clear();
37
	}
38

  
39

  
40
	public void validateFeatureEnd(Feature feature, FeatureStore featureStore) {
41
		Iterator rulesIterator=featureRules.iterator();
42
		FeatureRule rule;
43
		while(rulesIterator.hasNext()){
44
			rule = (FeatureRule)rulesIterator.next();
45
			if (rule.checkAtEnd()){
46
				rule.validate(feature,featureStore);
47
			}
48
		}
49
	}
50

  
51
	public void validateFeatureModifiction(Feature feature, FeatureStore featureStore) {
52
		Iterator rulesIterator=featureRules.iterator();
53
		FeatureRule rule;
54
		while(rulesIterator.hasNext()){
55
			rule = (FeatureRule)rulesIterator.next();
56
			if (rule.checkAtModification()){
57
				rule.validate(feature,featureStore);
58
			}
59
		}
60
	}
61

  
62
	public void validateFeature(Feature feature, FeatureStore featureStore) {
63
		Iterator rulesIterator=featureRules.iterator();
64
		FeatureRule rule;
65
		while(rulesIterator.hasNext()){
66
			rule = (FeatureRule)rulesIterator.next();
67
			rule.validate(feature,featureStore);
68
		}
69
	}
70

  
71
	public void setDefaultGeometry(String name) {
72
		this.geometryColumn=name;
73

  
74
	}
75

  
76
	public String getDefaultGeometry() {
77
		return geometryColumn;
78
	}
79

  
80
	public Feature create(FeatureStore store) throws InitializeException {
81
		return store.createFeature(this, false);
82
	}
83

  
84
	public List getAllSRS() {
85
		return allSRS;
86
	}
87

  
88
	public String getDefaultSRS() {
89
		return defaultSRS;
90
	}
91

  
92
	public int[] getGeometryTypes() {
93
		return geometryTypes;
94
	}
95

  
96

  
97
	public void setAllSRS(List allSRS) {
98
		this.allSRS = allSRS;
99
	}
100

  
101
	public void setDefaultSRS(String defaultSRS) {
102
		this.defaultSRS = defaultSRS;
103
	}
104

  
105
	public DateFormat getDateFormat() {
106
		return dateFormat;
107
	}
108

  
109
	public void setDateFormat(DateFormat dateFormat) {
110
		this.dateFormat=dateFormat;
111
	}
112

  
113
	public void setGeometryTypes(int[] geometryTypes) {
114
		this.geometryTypes=geometryTypes;
115
	}
116

  
117
	public String[] getFieldsId() {
118
		return fieldsId;
119
	}
120

  
121
	public void setFieldsId(String[] fieldsId) throws DataException {
122
		this.fieldsId = fieldsId;
123
		if (fieldsId != null) {
124
			AttributeDescriptor attr = null;
125
			int index = -1;
126
			for (int i = 0; i < fieldsId.length; i++) {
127
				index = this.getFieldIndex(fieldsId[i]);
128
				if (!(index < 0 || index >= this.size())) {
129
					attr = (AttributeDescriptor) this.get(index);
130
					attr.loading();
131
					attr.setPrimaryKey(true);
132
					attr.stopLoading();
133
				} else {
134
					throw new DataException("Field '" +fieldsId[i] + "' not found");
135
				}
136
			}
137
		}
138
	}
139

  
140
	public int getFieldIndex(String name) {
141
		int i;
142
		for (i=0;i<this.size();i++){
143
			AttributeDescriptor attr=((AttributeDescriptor)this.get(i));
144
			if (attr.getName().equals(name))
145
				return attr.originalPosition();
146
		}
147
		return -1;
148
	}
149

  
150
	public void add(int arg0, Object arg1) {
151
		throw new RuntimeException("Not supported!");
152
	}
153

  
154
	public boolean add(Object arg0) {
155
		((AttributeDescriptor)arg0).setOrdinal(count);
156
		count++;
157
		return super.add(arg0);
158
	}
159

  
160
	protected boolean addWithoutOrdinal(Object arg0) {
161
		int max=((FeatureAttributeDescriptor)arg0).ordinal();
162
		if (count<=max){
163
			count=max+1;
164
		}
165
		return super.add(arg0);
166
	}
167

  
168
	public FeatureType cloneFeatureType() {
169
		DefaultFeatureType newFType = (DefaultFeatureType) this.newFeatureType();
170
		newFType.setWeakReferenceOriginal(this);
171
		if (this.allSRS != null){
172
			newFType.allSRS = new ArrayList();
173
			newFType.allSRS.addAll(this.allSRS);
174
		}
175
		newFType.dateFormat = this.dateFormat;
176
		newFType.defaultSRS = this.defaultSRS;
177
		newFType.featureRules.addAll(this.featureRules);
178
		if (this.fieldsId != null){
179
			newFType.fieldsId = new String[this.fieldsId.length];
180
			System.arraycopy(this.fieldsId, 0, newFType.fieldsId, 0, this.fieldsId.length);
181
		}
182
		newFType.geometryColumn = this.geometryColumn;
183
		if (this.geometryTypes != null){
184
			newFType.geometryTypes = new int[this.geometryTypes.length];
185
			System.arraycopy(this.geometryTypes, 0, newFType.geometryTypes, 0, this.geometryTypes.length);
186
		}
187
		Iterator iter = this.iterator();
188
		while (iter.hasNext()){
189
			newFType.addWithoutOrdinal(((FeatureAttributeDescriptor)iter.next()).cloneAttribute());
190
		}
191
		newFType.count=this.count;
192
		return newFType;
193
	}
194

  
195
	protected FeatureType newFeatureType(){
196
		return new DefaultFeatureType();
197

  
198
	}
199

  
200
	public Object get(String name){
201
		return this.get(this.getFieldIndex(name));
202
	}
203
	protected int getCount() {
204
		return count;
205
	}
206
	
207
	public void clear(){
208
		super.clear();
209
		this.count=0;
210
	}
211
	public FeatureAttributeDescriptor getByOrder(int i) {
212
		Iterator iterator=this.iterator();
213
		while (iterator.hasNext()) {
214
			FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) iterator.next();
215
			if (i==fad.ordinal()){
216
				return fad;
217
			}
218
		}
219
		return null;
220
	}
221

  
222
	/* (non-Javadoc)
223
	 * @see org.gvsig.data.vectorial.FeatureType#createNewAttributeDescriptor()
224
	 */
225
	public FeatureAttributeDescriptor createNewAttributeDescriptor() {
226
		return new AttributeDescriptor(this,true);
227
	}
228

  
229

  
230
	public FeatureAttributeDescriptor createAttributeDescriptor() {
231
		return new AttributeDescriptor(this,false);
232
	}
233
	public FeatureType getSubFeatureType(String[] fields) throws DataException {
234
		DefaultFeatureType featureType=(DefaultFeatureType)this.cloneFeatureType();
235
		ArrayList toRemove = new ArrayList();
236
		Iterator iter = this.iterator();
237
		int index=-1;
238
		int i=0;
239
		String name;
240
		boolean found;
241
		for(i=0;i<fields.length;i++){
242
			index=this.getFieldIndex(fields[i]);
243
			if (index<0){
244
				throw new DataException("Field '"+fields[i]+"' not found");
245
			}
246
		}
247
		while (iter.hasNext()){
248
			name = ((AttributeDescriptor)iter.next()).getName();
249
			found=false;
250
			for (i=0;i<fields.length;i++){
251
				if (name.equals(fields[i])){
252
					found=true;
253
					break;
254
				}
255
			}
256
			if (!found){
257
				index=this.getFieldIndex(name);
258
				toRemove.add(new Integer(index));
259
			}
260

  
261
		}
262
		for (i=toRemove.size()-1;i>=0;i--){
263
			featureType.remove(((Integer)toRemove.get(i)).intValue());
264
		}
265
		
266
		return featureType;
267
	}
268
	
269
	protected void setWeakReferenceOriginal(DefaultFeatureType type) {
270
		originalFeatureType = new WeakReference(type);
271
	}
272
	public boolean isSubtypeOf(FeatureType featureType) {
273
		if (featureType.equals(this)){
274
			return true;
275
		}		
276
		if (this.originalFeatureType == null){
277
			return false;
278
		}
279
		FeatureType myOriginal = (FeatureType) this.originalFeatureType.get();
280
		if (myOriginal == null){
281
			return false;
282
		}
283
		return myOriginal.equals(featureType);
284
	}
285

  
286
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/NewFeatureStoreParameters.java
1
package org.gvsig.data.vectorial;
2

  
3
import org.gvsig.data.NewDataStoreParameters;
4

  
5
public interface NewFeatureStoreParameters extends NewDataStoreParameters{
6
	public FeatureType getFeatureType();
7
	public void setFeatureType(FeatureType ft);
8
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/AbstractFeatureRule.java
1

  
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
 *
4
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 *  Generalitat Valenciana
23
 *   Conselleria d'Infraestructures i Transport
24
 *   Av. Blasco Ib??ez, 50
25
 *   46010 VALENCIA
26
 *   SPAIN
27
 *
28
 *      +34 963862235
29
 *   gvsig@gva.es
30
 *      www.gvsig.gva.es
31
 *
32
 *    or
33
 *
34
 *   IVER T.I. S.A
35
 *   Salamanca 50
36
 *   46005 Valencia
37
 *   Spain
38
 *
39
 *   +34 963163400
40
 *   dac@iver.es
41
 */
42

  
43
package org.gvsig.data.vectorial;
44

  
45
/**
46
 *
47
 * @author Vicente Caballero Navarro
48
 */
49
public abstract class AbstractFeatureRule implements FeatureRule {
50
    protected String name;
51
    protected String description;
52
    protected boolean checkItAtModification;
53
    protected boolean checkItAtEnd;
54

  
55
    public AbstractFeatureRule(String name,String description){
56
    	this.init(name,description,true,true);
57
    }
58

  
59
    public AbstractFeatureRule(String name,String description,boolean checkItAtModification, boolean checkItAtEnd){
60
    	this.init(name,description,checkItAtModification,checkItAtEnd);
61
    }
62

  
63
    protected void init(String name,String description,boolean checkItAtModification, boolean checkItAtEnd){
64
    	this.name=name;
65
    	this.description=description;
66
    	this.checkItAtModification= checkItAtModification;
67
    	this.checkItAtEnd = checkItAtEnd;
68
    }
69

  
70
    public String getName() {
71
        return name;
72
    }
73

  
74
    public String getDescription() {
75
        return description;
76
    }
77

  
78
	public boolean checkAtEnd() {
79
		return this.checkItAtEnd;
80
	}
81

  
82
	public boolean checkAtModification() {
83
		return this.checkItAtModification;
84
	}
85

  
86
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/AbstractNewFeatureStoreParameter.java
1
package org.gvsig.data.vectorial;
2

  
3
import org.gvsig.data.DataStoreParameters;
4

  
5
public abstract class AbstractNewFeatureStoreParameter implements
6
		NewFeatureStoreParameters {
7
	protected DataStoreParameters dsparameters;
8

  
9
	protected FeatureType featureType;
10

  
11
	public DataStoreParameters getDataStoreParameters() {
12
		return dsparameters;
13
	}
14

  
15
	public FeatureType getFeatureType() {
16
		return featureType;
17
	}
18

  
19
	public void init(DataStoreParameters dsp) {
20
		this.dsparameters = dsp;
21
	}
22

  
23
	public void setFeatureType(FeatureType ft) {
24
		this.featureType = ft;
25
	}
26
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/FeatureCollection.java
1
package org.gvsig.data.vectorial;
2

  
3
import org.gvsig.data.DataCollection;
4
import org.gvsig.data.vectorial.visitor.FeaturesVisitable;
5

  
6
public interface FeatureCollection extends DataCollection, FeaturesVisitable{
7

  
8

  
9
}
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/FeatureStore.java
1
package org.gvsig.data.vectorial;
2

  
3
import java.util.List;
4

  
5
import org.gvsig.data.DataException;
6
import org.gvsig.data.DataCollection;
7
import org.gvsig.data.DataStore;
8
import org.gvsig.data.DataStoreParameters;
9
import org.gvsig.data.InitializeException;
10
import org.gvsig.data.ReadException;
11
import org.gvsig.util.observer.Observer;
12
import org.opengis.filter.Filter;
13
import org.opengis.filter.sort.SortBy;
14

  
15
public interface FeatureStore extends DataStore{
16

  
17
	//public DataCollection getDataCollection(FeatureType type, String filter, String order) throws ReadException;
18
	//public DataCollection getDataCollection(String[] fields, String filter, String order) throws ReadException;
19
	public DataCollection getDataCollection(FeatureType type, Filter filter, SortBy[] order) throws ReadException;
20
	public DataCollection getDataCollection(String[] fields, Filter filter, SortBy[] order) throws ReadException;
21

  
22
	/**
23
	 * Para la carga en background
24
	 */
25
	//public void getDataCollection(FeatureType type, String filter, String order,Observer observer) throws DataException;
26
	//public void getDataCollection(String[] fields, String filter, String order,Observer observer) throws DataException;
27
	public void getDataCollection(FeatureType type, Filter filter, SortBy[] order,Observer observer) throws DataException;
28
	public void getDataCollection(String[] fields, Filter filter, SortBy[] order,Observer observer) throws DataException;
29
	public void getDataCollection(Observer observer);
30

  
31
	public Feature getFeatureByID(FeatureID id) throws ReadException;
32
	public Feature getFeatureByID(FeatureID id,FeatureType featureType) throws ReadException;
33

  
34

  
35
	public FeatureType getDefaultFeatureType();
36
	public List getFeatureTypes();
37

  
38
	public Feature createFeature(FeatureType type, boolean defaultValues) throws InitializeException;
39
	public Feature createDefaultFeature(boolean defaultValues) throws InitializeException ;
40

  
41
	public void update(Feature feature) throws DataException;
42
	public void delete(Feature feature) throws DataException;
43
	public void insert(Feature feature) throws DataException;
44

  
45
	public void update(FeatureAttributeDescriptor attributeDescriptor) throws DataException;
46
	public void delete(FeatureAttributeDescriptor attributeDescriptor) throws DataException;
47
	public void insert(FeatureAttributeDescriptor attributeDescriptor) throws DataException;
48

  
49
	public void disableNotifications();
50
	public void enableNotifications();
51

  
52
	//Bloqueo en edici?n
53
	public boolean isLocked(FeatureID id);
54
	public boolean lock(FeatureID id);
55

  
56
	//Cuando el origen de datos define una leyenda a aplicar.
57
	/**
58
	 *@deprecated
59
	 */
60
	public boolean isWithDefaultLegend();
61
	/**
62
	 *@deprecated
63
	 */
64
	public Object getDefaultLegend() throws ReadException;
65
	/**
66
	 *@deprecated
67
	 */
68
	public Object getDefaultLabelingStrategy();
69

  
70
	public boolean canAlterFeatureType();
71

  
72
	public DataStoreParameters getParameters();
73

  
74

  
75
}
76

  
branches/Mobile_Compatible_Hito_1/libFMap_data/src/org/gvsig/data/vectorial/FeatureAttributeDescriptor.java
1
package org.gvsig.data.vectorial;
2

  
3
import java.util.HashMap;
4

  
5

  
6

  
7

  
8
public interface FeatureAttributeDescriptor {
9

  
10
	public static final String TYPE_BYTE = "BYTE";
11
	public static final String TYPE_BOOLEAN = "BOOLEAN";
12
	public static final String TYPE_INT = "INTEGER";
13
	public static final String TYPE_LONG = "LONG";
14
	public static final String TYPE_FLOAT = "FLOAT";
15
	public static final String TYPE_DOUBLE = "DOUBLE";
16
	public static final String TYPE_STRING = "STRING";
17
	public static final String TYPE_DATE = "DATE";
18
	public static final String TYPE_TIME = "TIME";
19
	public static final String TYPE_TIMESTAMP = "TIMESTAMP";
20
	public static final String TYPE_GEOMETRY = "GEOMETRY";
21
	public static final String TYPE_OBJECT = "OBJECT";
22
	public static final String TYPE_FEATURE = "FEATURE";
23

  
24

  
25

  
26
	/**
27
     * Returns the name of this attribute.  This is the name that can be used to
28
     * retrieve the value of an attribute and usually maps to either an XML
29
     * element name or a column name in a relational database.
30
     */
31
    String getName();
32

  
33
    /**
34
     * Returns a constant from {@link DataType}.  The return value of this method
35
     * indicates how the return values of {@link #getSize}, {@link #getPrecision}, and
36
     * {@link #getObjectClass} should be interpreted.  For attributes whose maximum
37
     * cardinality is greater than one, this should return the data type of
38
     * the individual elements of the collection.
39
     */
40
    String getDataType();
41

  
42
    /**
43
     * Returns a number that indicates the size of a given attribute.  See the documentation
44
     * for the various constants of {@link DataType} for how to interpret this value.  As an
45
     * example, when the data type is {@link DataType#STRING STRING}, this value indicates
46
     * the maximum length of the string.
47
     */
48
    int getSize();
49

  
50
    /**
51
     * For attributes of type {@link DataType#DECIMAL DECIMAL}, this returns the maximum number
52
     * of places after the decimal point.  For other types, this must always return zero.
53
     */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff