summaryrefslogtreecommitdiffstats
path: root/src/wcps/server/cli/WCPService.java
diff options
context:
space:
mode:
authorAndrei Aiordachioaie <a.aiordachioaie@jacobs-university.de>2009-05-25 10:23:43 +0200
committerAndrei Aiordachioaie <andrei@kahlua.eecs.jacobs-university.de>2009-07-07 10:50:05 +0200
commit256aa4ff66f4bcd87e9c9b3ae5fcd4455a65f67f (patch)
treecc4c83035d4b61f58f661463e9ad8845c37672ad /src/wcps/server/cli/WCPService.java
parentfcf40c09879355d0b1860cf5545ac26ac0aca681 (diff)
Updated WCPS source code to match spec WCPS 1.0.0
Diffstat (limited to 'src/wcps/server/cli/WCPService.java')
-rw-r--r--src/wcps/server/cli/WCPService.java126
1 files changed, 0 insertions, 126 deletions
diff --git a/src/wcps/server/cli/WCPService.java b/src/wcps/server/cli/WCPService.java
deleted file mode 100644
index 2090109..0000000
--- a/src/wcps/server/cli/WCPService.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is part of Petascope.
- *
- * Petascope is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of
- * the License, or (at your option) any later version.
- *
- * Petascope is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Petascope. If not, see <http://www.gnu.org/licenses/>.
- *
- * For more information please see <http://www.Petascope.org>
- * or contact Peter Baumann via <baumann@rasdaman.com>.
- *
- * Copyright 2009 Jacobs University Bremen, Peter Baumann.
- */
-
-package wcps.server.cli;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import wcps.server.core.CachedMetadataSource;
-import wcps.server.core.DbMetadataSource;
-import wcps.server.core.ProcessCoverageRequest;
-import wcps.server.core.WCPS;
-
-// This is a small application around the WCPS core. It takes XML requests as files and runs them through WCPS. The resulting radaman queries are displayed, but not executed. This is very useful for testing whether your metadata is valid.
-
-public class WCPService {
-
- private static WCPS wcps;
-
- public static void main( String[] args ) {
-
- if( args.length != 1 ) {
- System.err.println( "WCPS: no input files" );
- System.exit( 1 );
- }
-
- String pcSchemaFileName = ".." + File.separator + "xml" + File.separator + "ogc" + File.separator + "wcps" + File.separator + "1.0.0" + File.separator + "wcpsProcessCoverage.xsd";
- File pcSchemaFile = new File( pcSchemaFileName );
- if( !pcSchemaFile.exists() ) {
- System.err.println( "WCPS: could not find the WCPS ProcessCoverage schema (" + pcSchemaFileName + ")" );
- System.exit( 1 );
- }
-
- DbMetadataSource metadataSource = null;
- try {
- Properties dbParams = new Properties();
- dbParams.load( new FileInputStream( ".." + File.separator + "dbparams.properties" ) );
- metadataSource = new DbMetadataSource( dbParams.getProperty( "metadata_driver" ), dbParams.getProperty( "metadata_url" ), dbParams.getProperty( "metadata_user" ), dbParams.getProperty( "metadata_pass" ), false );
- wcps = new WCPS( pcSchemaFile, new CachedMetadataSource( metadataSource ) );
- }
- catch( Exception e ) {
- System.err.println( "WCPS: could not initialize WCPS:" );
- e.printStackTrace( System.err );
- System.exit( 1 );
- }
-
- for( int i = 0; i < args.length; i++ ) {
- File fileIn = null;
- try {
- fileIn = new File( args[i] );
- }
- catch( Exception fnfe ) {
- System.err.println( "WCPS: " + args[i] + ": no such file or directory" + fnfe );
- System.exit( 1 );
- }
- boolean ok = processCoverage( fileIn, i );
- if( !ok ) {
- System.err.println( "WCPS: " + args[i] + " failed" );
- System.exit( 1 );
- }
- }
-
- metadataSource.close();
- System.exit( 0 );
-
- }
-
- // TODO: Here's a fun idea: make this function multithreaded! ;)
- private static boolean processCoverage( File in, int i ) {
-
- try {
-
- ProcessCoverageRequest r = wcps.pcPrepare("http://kahlua.eecs.jacobs-university.de:7001", "RASSERVICE", in );
-
- System.err.println( "Request " + i );
-
- System.out.println( r.getQuery() );
-
-
-/* Iterator<byte[]> results = r.execute().iterator();
-
- int j = 0;
- while( results.hasNext() ) {
- String outFileName = "WCPS-" + i + "-" + j++;
- FileOutputStream out = new FileOutputStream( outFileName );
- out.write( results.next() );
- out.close();
- System.out.println( "WCPS: " + outFileName + " written" );
- }*/
-
- }
- catch( Exception e ) {
- System.err.println( "WCPS: request " + i + " failed with the following exception:" );
- e.printStackTrace( System.err );
- }
-
- return true;
-
- }
-
-}