/** ** Main client thread loop */ public void run() { this.setRunStatus(THREAD_RUNNING); this.threadStarted(); try { this.openSocket(); this.inputThread = new InputThread(this.socket, this.readTimeout, this.ioThreadLock); this.outputThread = new OutputThread(this.socket, this.ioThreadLock); this.inputThread.start(); this.outputThread.start(); synchronized (this.ioThreadLock) { while (this.inputThread.isRunning() || this.outputThread.isRunning()) { try { this.ioThreadLock.wait(); } catch (Throwable t) { } } } } catch (NoRouteToHostException nrthe) { Print.logInfo("Client:ControlThread - Unable to reach " + this.host + ":" + this.port); nrthe.printStackTrace(); } catch (Throwable t) { Print.logInfo("Client:ControlThread - " + t); t.printStackTrace(); } finally { this.closeSocket(); } this.setRunStatus(THREAD_STOPPED); this.threadStopped(); }
@Test public void testTypes() throws IOException, NoSuchElementException { if (url == null) return; WFS_1_0_0_DataStore wfs; try { wfs = WFSDataStoreReadTest.getDataStore(url); } catch (ConnectException e) { e.printStackTrace(System.err); return; } catch (UnknownHostException e) { e.printStackTrace(System.err); return; } catch (NoRouteToHostException e) { e.printStackTrace(System.err); return; } String types[] = wfs.getTypeNames(); String typeName = "unknown"; for (int i = 0; i < types.length; i++) { typeName = types[i]; if (typeName.equals("topp:geometrytype")) continue; SimpleFeatureType type = wfs.getSchema(typeName); type.getTypeName(); type.getName().getNamespaceURI(); SimpleFeatureSource source = wfs.getFeatureSource(typeName); source.getBounds(); SimpleFeatureCollection features = source.getFeatures(); features.getBounds(); features.getSchema(); // features.getFeatureType(); Query query = new Query(typeName, Filter.INCLUDE, 20, Query.ALL_NAMES, "work already"); features = source.getFeatures(query); features.size(); SimpleFeatureIterator iterator = features.features(); try { while (iterator.hasNext()) { SimpleFeature feature = (SimpleFeature) iterator.next(); } } finally { iterator.close(); } } }
@Test public void testSingleType() throws IOException, NoSuchElementException { if (url == null) return; WFS_1_0_0_DataStore wfs; try { wfs = WFSDataStoreReadTest.getDataStore(url); } catch (ConnectException e) { e.printStackTrace(System.err); return; } catch (UnknownHostException e) { e.printStackTrace(System.err); return; } catch (NoRouteToHostException e) { e.printStackTrace(System.err); return; } String typeName = "tiger:poi"; SimpleFeatureType type = wfs.getSchema(typeName); type.getTypeName(); type.getName().getNamespaceURI(); SimpleFeatureSource source = wfs.getFeatureSource(typeName); source.getBounds(); SimpleFeatureCollection features = source.getFeatures(); features.getBounds(); features.getSchema(); // features.getFeatureType(); Query query = new Query(typeName, Filter.INCLUDE, 20, Query.ALL_NAMES, "work already"); features = source.getFeatures(query); features.size(); SimpleFeatureIterator iterator = features.features(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); } iterator.close(); }