Revision 18770

View differences:

trunk/libraries/libGPE/.settings/org.eclipse.jdt.core.prefs
1
#Thu Dec 20 12:52:29 CET 2007
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6
org.eclipse.jdt.core.compiler.compliance=1.5
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=error
11
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12
org.eclipse.jdt.core.compiler.source=1.4
1
#Tue Feb 05 17:22:44 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
trunk/libraries/libGPE/build.xml
5 5
	<property name="targetDir" location="dist"/>
6 6
	<property name="gpeLibs" location="lib" />
7 7
	<property name="schemaJarName" value="org.gvsig.xmlschema"/>
8
	<property name="resources" location="../resources/jars" />			
8 9
	<property name="gpeJarName" value="org.gvsig.gpe"/>
9
	<property name="compile-classpath" value="./lib/gvsig-exceptions.jar" />
10
	<property name="compile-classpath" value="" />
10 11

  
11 12
  <target name="init">
12 13
    <!-- Create the time stamp -->
......
23 24
	<target name="compile" description="compile the source">
24 25
		<!-- Compile the Java code from ${src} to ${build} -->
25 26
		<mkdir dir="${build}" />
26
		<javac  srcdir="${src}"
27
			destdir="${build}"
28
			source="${JavaSourceVersion}"
29
			target="${JavaTargetVersion}"
30
			debug="${debug}"
31
			debuglevel="${debuglevel}"
32
			classpath="${compile-classpath}"
33
			encoding="${encoding}"/>
27
		<javac	srcdir="${src}"
28
				destdir="${build}"
29
				source="1.4"
30
				target="1.4"
31
				debug="${debug}"
32
				debuglevel="${debuglevel}"
33
				classpath="${compile-classpath}"/>
34 34
		<!-- copy any images or resources present in the src dir -->
35 35
		<copy todir="${build}">
36 36
			<fileset dir="${src}" excludes="**/*.java" casesensitive="false"/>
......
45 45
		<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="." includes="build.number" update="true"/>
46 46
		<move todir="${gpeLibs}">
47 47
			<fileset dir="${targetDir}" includes="*.jar" />
48
		</move>
48
		</move>	
49 49
		<delete dir="${targetDir}"/>
50 50
	</target>
51

  
51
	
52
	<target name="create-mobile-jar" description="Crea el jar de la aplicacion">
53
		<mkdir dir="${targetDir}" />
54
		<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="${build}" includes="org/gvsig/gpe/**"/>
55
		<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="." includes="build.number" update="true"/>
56
		<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="${build}" includes="org/gvsig/xmlschema/**"/>
57
		<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="." includes="build.number" update="true"/>
58
		<move todir="${gpeLibs}">
59
			<fileset dir="${targetDir}" includes="*.jar" />
60
		</move>	
61
		<copy todir="${resources}/libGPE" file="${gpeLibs}/org.gvsig.gpe.jar"/>
62
		<copy todir="${resources}/libGPE" file="${gpeLibs}/org.gvsig.xmlschema.jar"/>
63
		<delete dir="${targetDir}"/>
64
	</target>
65
	
52 66
	<target name="clean" description="clean up">
53 67
		<!-- Delete the ${build} and ${dist} directory trees -->
54 68
		<delete dir="${build}" />
55 69
		<delete dir="${targetDir}" />
56 70
	</target>
57

  
71
  
58 72
</project>
trunk/libraries/libGPE/.classpath
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3 3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" output="bin-test" path="src-test"/>
4
	<classpathentry kind="src" path="src-test"/>
5 5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6 6
	<classpathentry kind="lib" path="lib/gvsig-exceptions.jar"/>
7 7
	<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/>
trunk/libraries/libGPE/src/org/gvsig/gpe/writers/IGPEWriterHandlerImplementor.java
5 5

  
6 6
import org.gvsig.gpe.GPEErrorHandler;
7 7
import org.gvsig.xmlschema.som.IXSSchemaDocument;
8
import org.gvsig.xmlschema.som.impl.XSSchemaDocumentImpl;
9 8

  
10 9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11 10
 *
trunk/libraries/libGPE/src/org/gvsig/gpe/utils/StringUtils.java
1
package org.gvsig.gpe.utils;
2

  
3
import java.util.regex.Pattern;
4

  
5
public class StringUtils {
6
	//----------------------------------------------------------------------
7
	// PROBLEM WITH COMPATIBILITY OF "split()" WITH IBM J9 JAVA MICROEDITION
8
	//----------------------------------------------------------------------
9
	public static String[] splitString(String input, String sep) {
10
		return Pattern.compile(sep).split(input, 0);
11
	}
12

  
13
	public static String[] charSplit(String origin, String expresion){
14
		String ns[];
15
		String aux = origin;
16
		int indexFin;
17
		int indexStart=0;
18
		int i=0;
19
			//take the string in couples of words separates by :
20
		indexFin = origin.indexOf(expresion);
21
		if(indexFin!=-1){
22
			while (indexFin!=-1){
23
				aux = aux.substring(indexFin+1);
24
				indexFin = aux.indexOf(expresion);
25
				i++;
26
			}
27
			ns = new String[i+1];
28
			aux = origin;
29
			i=0;
30
			indexFin = aux.indexOf(expresion);
31
			while (indexFin!=-1){
32
				ns[i]= aux.substring(0,indexFin);
33
				indexStart=indexFin+1;
34
				aux = aux.substring(indexStart);
35
				indexFin = aux.indexOf(expresion);
36
				i++;
37
			}
38
			ns[i]=aux;	
39
		}
40
		else
41
		{
42
			ns = new String[1];
43
			ns[0] = origin;
44
		}
45
		return ns;
46
	}
47
	//----------------------------------
48
	// end of the split() compatibility
49
	//----------------------------------
50
	public static String replaceAllString(String original, String match_old,
51
			String match_new) {
52
		return Pattern.compile(match_old).matcher(original).replaceAll(
53
				match_new);
54
	}
55
}
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEDefaults.java
1 1
package org.gvsig.gpe;
2 2

  
3
import java.util.Hashtable;
4 3
import java.util.Iterator;
5 4
import java.util.LinkedHashMap;
6 5

  
trunk/libraries/libGPE/src/org/gvsig/gpe/GPEContentHandler.java
224 224
	public void addParentElementToElement(Object parent, Object element) {
225 225
		addNotSupportedWarning(FeatureNotSupportedWarning.ELEMENTWITHCHILDREN);
226 226
	}
227

  
227
	
228
	
228 229
	/*
229 230
	 * (non-Javadoc)
230 231
	 * @see org.gvsig.gpe.IGPEContentHandler#addParentLayerToLayer(java.lang.Object, java.lang.Object)
......
256 257
	public void endElement(Object element) {
257 258
		
258 259
	}
260
	/*
261
	 * (non-Javadoc)
262
	 * @see org.gvsig.gpe.IGPEContentHandler#endElement(java.lang.Object)
263
	 */
264
	public void endElement(Object element, boolean isGeometryTag) {
265
		
266
	}
259 267

  
260 268
	/*
261 269
	 * (non-Javadoc)
......
564 572
	public Object startCurve(String id, String srs) {
565 573
		addNotSupportedWarning(FeatureNotSupportedWarning.CURVECREATION);
566 574
		return null;
567
	}
568
	
569
	
575
	}	
570 576
}
trunk/libraries/libGPE/src/org/gvsig/xmlschema/som/impl/XSSchemaImpl.java
6 6
import java.util.Iterator;
7 7
import java.util.Map;
8 8

  
9
import javax.xml.namespace.QName;
9
import org.gvsig.xmlschema.utils.QName;
10 10
import javax.xml.transform.Transformer;
11 11
import javax.xml.transform.TransformerConfigurationException;
12 12
import javax.xml.transform.TransformerException;
......
22 22
import org.gvsig.xmlschema.som.IXSTypeDefinition;
23 23
import org.gvsig.xmlschema.utils.DOMObjectsFactory;
24 24
import org.gvsig.xmlschema.utils.SchemaCollection;
25
import org.gvsig.xmlschema.utils.SchemaDefaults;
26 25
import org.gvsig.xmlschema.utils.SchemaObjectsMapping;
27 26
import org.gvsig.xmlschema.utils.SchemaTags;
28 27
import org.gvsig.xmlschema.utils.SchemaUtils;
......
321 320
			NamedNodeMap attributes = element.getAttributes();
322 321
			for (int i=0 ; i<attributes.getLength() ; i++){
323 322
				Node node = attributes.item(i);
324
				String[] name = node.getNodeName().split(":");
323
				//String[] name = node.getNodeName().split(":");
324
				String[] name = org.gvsig.gpe.utils.StringUtils.splitString(node.getNodeName(),":");		
325 325
				if ((name.length == 2) && (name[0].equals(SchemaTags.XMLNS_NS))){
326 326
					if (node.getNodeValue().equals(namespaceURI)){
327 327
						return name[1];
trunk/libraries/libGPE/src/org/gvsig/xmlschema/som/impl/XSComponentImpl.java
2 2

  
3 3
import java.util.Collection;
4 4

  
5
import javax.xml.namespace.QName;
5
import org.gvsig.xmlschema.utils.QName;
6 6

  
7 7
import org.gvsig.xmlschema.som.IXSComponent;
8 8
import org.gvsig.xmlschema.som.IXSSchema;
trunk/libraries/libGPE/src/org/gvsig/xmlschema/som/IXSComponent.java
2 2

  
3 3
import java.util.Collection;
4 4

  
5
import javax.xml.namespace.QName;
5
import org.gvsig.xmlschema.utils.QName;
6 6

  
7 7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8 8
 *
trunk/libraries/libGPE/src/org/gvsig/xmlschema/utils/QName.java
1
package org.gvsig.xmlschema.utils;
2

  
3
	/* JBoss, the OpenSource WebOS
4
	 *
5
	 * Distributable under LGPL license.
6
	 * See terms of license at gnu.org.
7
	 */
8

  
9
	// $Id: QName.java,v 1.2.6.8 2005/04/12 03:35:26 starksm Exp $
10

  
11
	import java.io.Serializable;
12
	import java.util.StringTokenizer;
13
	
14
	/** QName represents an immutable qualified name.
15
	 * The value of a QName contains a Namespace URI, local part and prefix.
16
	 * 
17
	 * The prefix is included in QName to retain lexical information when present
18
	 * in an XML input source. The prefix is NOT used in QName.equals(Object) or
19
	 * to compute the QName.hashCode(). Equality and the hash code are defined
20
	 * using only the Namespace URI and local part.
21
	 * 
22
	 * If not specified, the Namespace URI is set to "" (the empty string).
23
	 * If not specified, the prefix is set to "" (the empty string).
24
	 * 
25
	 * @author Scott.Stark@jboss.org
26
	 * @author Thomas.Diesler@jboss.org
27
	 * @author Jeff Suttor (javadoc)
28
	 * @version $Revision: 1.2.6.8 $
29
	 */
30
	public class QName implements Serializable
31
	{
32
	   /** @since 4.0.2, compatible with jdk5 by default */
33
	   final static long serialVersionUID;
34
	   static
35
	   {
36
	         serialVersionUID = -3852060120346905000L;
37
	   }
38

  
39
	   private String namespaceURI;
40
	   private String localPart;
41
	   private String prefix;
42

  
43
	   /** QName derived from parsing the formatted String.
44
	    * If the String is null or does not conform to QName.toString() formatting,
45
	    * an IllegalArgumentException is thrown.
46
	    * 
47
	    * The String MUST be in the form returned by QName.toString(). There is NO
48
	    * standard specification for representing a QName as a String. The String
49
	    * format is NOT portable across implementations and will change when a
50
	    * standard String representation is defined. This implementation currently
51
	    * parses a String formatted as: "{" + Namespace URI + "}" + local part. If
52
	    * the Namespace URI .equals(""), only the local part should be provided.
53
	    * 
54
	    * The prefix value CANNOT be represented in the String and will be set to ""
55
	    * 
56
	    * This method does not do full validation of the resulting QName. In
57
	    * particular, the local part is not validated as a NCName as specified in
58
	    * Namespaces in XML.
59
	    * 
60
	    * @see #toString()
61
	    * @param toStringName - a QName string in the format of toString().
62
	    * @return QName for the toStringName
63
	    */
64
	   public static QName valueOf(String toStringName)
65
	   {
66
	      String uri = null;
67
	      String localPart = null;
68

  
69
	      StringTokenizer tokenizer = new StringTokenizer(toStringName, "{}");
70
	      int tokenCount = tokenizer.countTokens();
71

  
72
	      if (tokenCount < 1 || tokenCount > 2)
73
	         throw new IllegalArgumentException("Invalid QName string: " + toStringName);
74

  
75
	      if (tokenCount > 1)
76
	         uri = tokenizer.nextToken();
77

  
78
	      localPart = tokenizer.nextToken();
79
	      return new QName(uri, localPart);
80
	   }
81

  
82
	   public QName(String localPart)
83
	   {
84
	      this(null, localPart);
85
	   }
86

  
87
	   public QName(String namespaceURI, String localPart)
88
	   {
89
	      this(namespaceURI, localPart, "");
90
	   }
91

  
92
	   /** QName constructor specifying the Namespace URI, local part and prefix.
93
	    * If the Namespace URI is null, it is set to "". This value represents no
94
	    * explicitly defined Namespace as defined by the Namespaces in XML
95
	    * specification. This action preserves compatible behavior with QName 1.0.
96
	    * 
97
	    * If the local part is null, an IllegalArgumentException is thrown.
98
	    * 
99
	    * If the prefix is null, an IllegalArgumentException is thrown. Use "" to
100
	    * explicitly indicate that no prefix is present or the prefix is not
101
	    * relevant.
102
	    * 
103
	    * @param namespaceURI - Namespace URI of the QName
104
	    * @param localPart - local part of the QName
105
	    * @param prefix - prefix of the QName
106
	    */
107
	   public QName(String namespaceURI, String localPart, String prefix)
108
	   {
109
	      this.namespaceURI = namespaceURI;
110
	      if (this.namespaceURI == null)
111
	         this.namespaceURI = "";
112

  
113
	      if (localPart == null)
114
	         throw new IllegalArgumentException("localPart cannot be null");
115

  
116
	      if (localPart.startsWith(":"))
117
	         throw new IllegalArgumentException("Illegal localPart: " + localPart);
118

  
119
	      this.localPart = localPart;
120

  
121
	      this.prefix = prefix;
122
	      if (this.prefix == null)
123
	         this.prefix = "";
124
	   }
125

  
126
	   public String getNamespaceURI()
127
	   {
128
	      return namespaceURI;
129
	   }
130

  
131
	   public String getLocalPart()
132
	   {
133
	      return localPart;
134
	   }
135

  
136
	   public String getPrefix()
137
	   {
138
	      return prefix;
139
	   }
140

  
141
	   /** There is NO standard specification for representing a QName as a String.
142
	    * The returned String is not portable across implementations and will change when a standard String representation is defined.
143
	    * This implementation currently represents a QName as: "{" + Namespace URI + "}" + local part.
144
	    * If the Namespace URI .equals(""), only the local part is returned.
145
	    * An appropriate use of this method is for debugging or logging for human consumption.
146
	    *
147
	    * Note the prefix value is NOT returned as part of the String representation.
148
	    *
149
	    * @return '{' + namespaceURI + '}' + localPart
150
	    */
151
	   public String toString()
152
	   {
153
	      if (namespaceURI.equals(""))
154
	         return localPart;
155
	      else
156
	         return '{' + namespaceURI + '}' + localPart;
157
	   }
158

  
159
	   /** Equality is based on the namespaceURI and localPart
160
	    * @param obj the QName to compare too
161
	    * @return true if both namespaceURI and localPart, false otherwise
162
	    */
163
	   public boolean equals(Object obj)
164
	   {
165
	      if (obj instanceof QName)
166
	      {
167
	         QName qn = (QName)obj;
168
	         boolean equals = namespaceURI.equals(qn.namespaceURI);
169
	         return equals && localPart.equals(qn.localPart);
170
	      }
171
	      return false;
172
	   }
173

  
174
	   /** Calculate the hash of namespaceURI and localPart 
175
	    * @return namespaceURI.hashCode() + localPart.hashCode()
176
	    */
177
	   public int hashCode()
178
	   {
179
	      int hashCode = namespaceURI.hashCode() + localPart.hashCode();
180
	      return hashCode;
181
	   }
182

  
183
	   /**
184
	    * Compares this object with the specified object for order.  Returns a
185
	    * negative integer, zero, or a positive integer as this object is less
186
	    * than, equal to, or greater than the specified object.<p>
187
	    */
188
	   public int compareTo(Object o)
189
	   {
190
	      QName other = (QName)o;
191
	      return toString().compareTo(other.toString());
192
	   }
193
	}
194

  
trunk/libraries/libGPE/src/org/gvsig/xmlschema/utils/SchemaUtils.java
2 2

  
3 3

  
4 4

  
5
import javax.xml.namespace.QName;
5
import org.gvsig.xmlschema.utils.QName;
6 6

  
7 7
import org.w3c.dom.Element;
8 8
import org.w3c.dom.Node;

Also available in: Unified diff