Strabon

changeset 225:bd824b11051a

Fixed StoreOp bug. StoreOp no longer uses storeFile but the method remains for the time being as its is used in other parts of the code.
author constant
date Sat Jun 02 01:18:19 2012 +0300 (2012-06-02)
parents fd43d9f83de7
children dbbfb1a23017
files runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java
line diff
     1.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Jun 01 15:33:42 2012 +0300
     1.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Sat Jun 02 01:18:19 2012 +0300
     1.3 @@ -11,6 +11,7 @@
     1.4  import java.io.OutputStream;
     1.5  import java.io.OutputStreamWriter;
     1.6  import java.io.StringReader;
     1.7 +import java.net.MalformedURLException;
     1.8  import java.net.URL;
     1.9  import java.nio.charset.Charset;
    1.10  import java.sql.SQLException;
    1.11 @@ -832,8 +833,27 @@
    1.12  		{
    1.13  			throw new InvalidDatasetFormatFault();
    1.14  		}
    1.15 +       try{
    1.16 +    	   URL source = new URL((String) src);
    1.17 +    	   storeURL(source, baseURI, uriContext, realFormat);
    1.18 +    	   
    1.19 +       }catch(MalformedURLException e){
    1.20 +    	   File file = new File((String) src);
    1.21 +    	   String urlfile = "file://"+src;
    1.22  
    1.23 -		try
    1.24 +    	   try
    1.25 +    	   {
    1.26 +    		   URL urlf  = new URL(urlfile);
    1.27 +    		   storeURL(urlf, baseURI, uriContext, realFormat); //file.toURL is deprecated  
    1.28 +    	   }
    1.29 +    	   catch(MalformedURLException ex)
    1.30 +    	   {
    1.31 +    		   storeString((String)src, baseURI, uriContext, realFormat);
    1.32 +    	   }
    1.33 +    	   
    1.34 +       }
    1.35 +
    1.36 +		/*try
    1.37  		{
    1.38  			if(File.class.isInstance(src))
    1.39  			{
    1.40 @@ -850,7 +870,7 @@
    1.41  		}
    1.42  		catch(NullPointerException e) {
    1.43  			logger.error("[Strabon.storeInRepo]", e.getStackTrace());
    1.44 -		}
    1.45 +		}*/
    1.46  	}
    1.47  
    1.48  	private void storeFile(File file, String baseURI, URI context, RDFFormat format) throws RDFParseException, RepositoryException, IOException, RDFHandlerException
     2.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java	Fri Jun 01 15:33:42 2012 +0300
     2.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java	Sat Jun 02 01:18:19 2012 +0300
     2.3 @@ -36,9 +36,8 @@
     2.4  		}
     2.5  
     2.6  		Strabon strabon = new Strabon(db, user, passwd, port, host, true);
     2.7 -		
     2.8 -		File file = new File (src);
     2.9 -		strabon.storeInRepo(file, format);
    2.10 +
    2.11 +		strabon.storeInRepo(src, format);
    2.12  //		strabon.storeInRepo(file, null, null, fileRDFFormat);
    2.13  
    2.14  		strabon.close();