Revision 18851 branches/v10/applications/appCatalogAndGazetteerClient/src/es/gva/cit/gazetteer/wfsg/drivers/WFSGServiceDriver.java

View differences:

WFSGServiceDriver.java
1 1
package es.gva.cit.gazetteer.wfsg.drivers;
2 2

  
3
import java.io.File;
4
import java.io.IOException;
5
import java.net.ConnectException;
3 6
import java.net.MalformedURLException;
4 7
import java.net.URI;
5 8
import java.net.URL;
9
import java.net.UnknownHostException;
6 10
import java.util.Collection;
7 11

  
12
import org.gvsig.i18n.Messages;
8 13
import org.gvsig.remoteClient.gml.exceptions.GMLException;
14
import org.gvsig.remoteClient.utils.Utilities;
9 15

  
10 16
import com.iver.utiles.swing.jcomboServer.ServerData;
11 17

  
......
94 100
				WFSGMessages.getHTTPPOSTCapabilities(), 0);
95 101
		
96 102
		GazetteerCapabilities capabilities = new GazetteerCapabilities();
97
		capabilities.setFeatureTypes(new WfsgCapabilitiesParser(this).parse((XMLNode)nodes.toArray()[0]));
103
		if (nodes != null){
104
			capabilities.setFeatureTypes(new WfsgCapabilitiesParser(this).parse((XMLNode)nodes.toArray()[0]));
105
		}else{
106
			capabilities.setAvailable(false);
107
			capabilities.setServerMessage(Messages.getText("errorNotParsedReply"));
108
		}
98 109
		return capabilities;		
99 110
	}
100 111
	
......
110 121
				setServerAnswerReady("errorServerNotFound");
111 122
				return null;
112 123
			}
113
			query.setFieldAttribute("geographicIdentifier");
114
			Collection nodes = new HTTPPostProtocol().doQuery(url,
115
					WFSGMessages.getHTTPPOSTFeature(query,0),
116
					0);			
117
			
118
			return new WfsgFeatureParser().parse((XMLNode)nodes.toArray()[0]);
119
					 
124
			query.setFieldAttribute("geographicIdentifier");			
125
			try {
126
				File file = Utilities.downloadFile(url, WFSGMessages.getHTTPPOSTFeature(query,0), "wfsg_getFeature.xml", null);
127
				return parseOutputFile(file,query.getFieldAttribute());
128
			} catch (Exception e) {
129
				throw new GMLException(e);
130
			} 				 
120 131
	 }
121 132

  
122 133
	/*

Also available in: Unified diff