jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1378088 - in /jena/trunk/jena-fuseki/src: main/java/org/apache/jena/fuseki/http/ main/java/org/apache/jena/fuseki/servlets/ test/java/org/apache/jena/fuseki/
Date Tue, 28 Aug 2012 11:45:05 GMT
Author: andy
Date: Tue Aug 28 11:45:05 2012
New Revision: 1378088

URL: http://svn.apache.org/viewvc?rev=1378088&view=rev
Log:
Remove UpdateRemote - replaced by ARQ code.

Modified:
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/HttpSC.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/UpdateRemote.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Dataset.java
    jena/trunk/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/HttpSC.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/HttpSC.java?rev=1378088&r1=1378087&r2=1378088&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/HttpSC.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/HttpSC.java Tue Aug 28
11:45:05 2012
@@ -30,14 +30,12 @@
 // ========================================================================
 
 //package org.eclipse.jetty.http;
-/* This code is a direct copy of the Jetty 7 HttpStatus class.
+/* This code is a copy of the Jetty 7 HttpStatus class.
  * I found the naming which includes the number, more useful than the standard constants.

  */
 
 package org.apache.jena.fuseki.http;
 
-
-
 /**
  * <p>
  * HttpStatusCode enum class, for status codes based on various HTTP RFCs. (see
@@ -191,7 +189,7 @@ package org.apache.jena.fuseki.http;
  * <tr>
  * <td>{@link #MULTIPLE_CHOICES_300}</td>
  * <td>300</td>
- * <td>Multiple Choices</td>
+ * <td>Multipldirecte Choices</td>
  * <td>
  * <a href="http://tools.ietf.org/html/rfc1945#section-9.3">Sec. 9.3</a></td>
  * <td>
@@ -304,7 +302,7 @@ package org.apache.jena.fuseki.http;
  * <td>Payment Required</td>
  * <td>
  * <a href="http://tools.ietf.org/html/rfc1945#section-9.4">Sec. 9.4</a></td>
- * <td>
+ * <td>direct
  * <a href="http://tools.ietf.org/html/rfc2616#section-10.4.3">Sec. 10.4.3</a></td>
  * <td>&nbsp;</td>
  * </tr>
@@ -469,7 +467,7 @@ package org.apache.jena.fuseki.http;
  * <td>&nbsp;</td>
  * <td><strike>418</strike></td>
  * <td><strike>Unprocessable Entity</strike></td>
- * <td>&nbsp;</td>
+ * <td>&nbsp;<direct/td>
  * <td>&nbsp;</td>
  * <td>
  * <a href=

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/UpdateRemote.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/UpdateRemote.java?rev=1378088&r1=1378087&r2=1378088&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/UpdateRemote.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/http/UpdateRemote.java Tue
Aug 28 11:45:05 2012
@@ -18,71 +18,66 @@
 
 package org.apache.jena.fuseki.http;
 
-import java.io.ByteArrayOutputStream ;
-import java.io.IOException ;
-
-import org.apache.http.HttpResponse ;
-import org.apache.http.client.HttpClient ;
-import org.apache.http.client.methods.HttpPost ;
-import org.apache.http.entity.AbstractHttpEntity ;
-import org.apache.http.entity.ByteArrayEntity ;
-import org.apache.http.impl.client.DefaultHttpClient ;
-import org.apache.http.protocol.HTTP ;
-import org.openjena.atlas.io.IndentedWriter ;
-import org.openjena.riot.WebContent ;
-
 import com.hp.hpl.jena.sparql.modify.request.Target ;
 import com.hp.hpl.jena.sparql.modify.request.UpdateDrop ;
-import com.hp.hpl.jena.sparql.modify.request.UpdateWriter ;
 import com.hp.hpl.jena.update.Update ;
-import com.hp.hpl.jena.update.UpdateException ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
 import com.hp.hpl.jena.update.UpdateRequest ;
 
 public class UpdateRemote
 {
-    /** Reset the remote repository by execution a "DROP ALL" command on it */
+    /** @deprecated Use  UpdateExecutionFactory.createRemote */
+    @Deprecated 
     public static void executeClear(String serviceURL)
     {
         Update clear = new UpdateDrop(Target.ALL) ;
         UpdateRemote.execute(clear, serviceURL) ;
     }
     
+    /** @deprecated Use  UpdateExecutionFactory.createRemote */
+    @Deprecated 
     public static void execute(Update request, String serviceURL)
     {
         execute(new UpdateRequest(request) , serviceURL) ;
     }
     
+    /** @deprecated Use  UpdateExecutionFactory.createRemote */
+    @Deprecated 
     public static void execute(UpdateRequest request, String serviceURL)
     {
-        HttpPost httpPost = new HttpPost(serviceURL) ;
-        ByteArrayOutputStream b_out = new ByteArrayOutputStream() ;
-        IndentedWriter out = new IndentedWriter(b_out) ; 
-        UpdateWriter.output(request, out) ;
-        out.flush() ;
-        byte[] bytes = b_out.toByteArray() ;
-        AbstractHttpEntity reqEntity = new ByteArrayEntity(bytes) ;
-        reqEntity.setContentType(WebContent.contentTypeSPARQLUpdate) ;
-        reqEntity.setContentEncoding(HTTP.UTF_8) ;
-        httpPost.setEntity(reqEntity) ;
-        HttpClient httpclient = new DefaultHttpClient() ;
+        UpdateProcessor proc = UpdateExecutionFactory.createRemote(request, serviceURL) ;
+        proc.execute() ;
 
-        try
-        {
-            HttpResponse response = httpclient.execute(httpPost) ;
-            int responseCode = response.getStatusLine().getStatusCode() ;
-            String responseMessage = response.getStatusLine().getReasonPhrase() ;
-            
-            if ( responseCode == HttpSC.NO_CONTENT_204 )
-                return ;
-            if ( responseCode == HttpSC.OK_200 )
-                // But what was the content?
-                // TODO read body 
-                return ; 
-            throw new UpdateException(responseCode+" "+responseMessage) ;
-        } catch (IOException ex)
-        {
-            throw new UpdateException(ex) ;
-        }
+//        HttpPost httpPost = new HttpPost(serviceURL) ;
+//        ByteArrayOutputStream b_out = new ByteArrayOutputStream() ;
+//        IndentedWriter out = new IndentedWriter(b_out) ; 
+//        UpdateWriter.output(request, out) ;
+//        out.flush() ;
+//        byte[] bytes = b_out.toByteArray() ;
+//        AbstractHttpEntity reqEntity = new ByteArrayEntity(bytes) ;
+//        reqEntity.setContentType(WebContent.contentTypeSPARQLUpdate) ;
+//        reqEntity.setContentEncoding(HTTP.UTF_8) ;
+//        httpPost.setEntity(reqEntity) ;
+//        HttpClient httpclient = new DefaultHttpClient() ;
+//
+//        try
+//        {
+//            HttpResponse response = httpclient.execute(httpPost) ;
+//            int responseCode = response.getStatusLine().getStatusCode() ;
+//            String responseMessage = response.getStatusLine().getReasonPhrase() ;
+//            
+//            if ( responseCode == HttpSC.NO_CONTENT_204 )
+//                return ;
+//            if ( responseCode == HttpSC.OK_200 )
+//                // But what was the content?
+//                // TODO read body 
+//                return ; 
+//            throw new UpdateException(responseCode+" "+responseMessage) ;
+//        } catch (IOException ex)
+//        {
+//            throw new UpdateException(ex) ;
+//        }
             
     }
 }

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Dataset.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Dataset.java?rev=1378088&r1=1378087&r2=1378088&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Dataset.java
(original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Dataset.java
Tue Aug 28 11:45:05 2012
@@ -120,10 +120,17 @@ public class SPARQL_Dataset extends SPAR
         DatasetRef desc = DatasetRegistry.get().get(dsname) ;
         
         log.info(format("[%d] All: %S %s :: %s :: %s ? %s", id, method, dsname, trailing,
(mt==null?"<none>":mt), (qs==null?"":qs))) ;
-        
+                       
         boolean hasTrailing = ( trailing.length() != 0 ) ;
         boolean hasQueryString = ( qs != null ) ;
         
+        /* Better:
+         *   Is it a query? => dispatch 
+         *   Is it an update? => dispatch
+         *   Trailing? =>  direct naming
+         *   Dataset REST operation.
+         */
+        
         if ( hasTrailing )
         {
             // Is it a registered service?

Modified: jena/trunk/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java?rev=1378088&r1=1378087&r2=1378088&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java (original)
+++ jena/trunk/jena-fuseki/src/test/java/org/apache/jena/fuseki/ServerTest.java Tue Aug 28
11:45:05 2012
@@ -18,7 +18,6 @@
 
 package org.apache.jena.fuseki;
 
-import org.apache.jena.fuseki.http.UpdateRemote ;
 import org.apache.jena.fuseki.server.FusekiConfig ;
 import org.apache.jena.fuseki.server.SPARQLServer ;
 import org.apache.jena.fuseki.server.ServerConfig ;
@@ -28,6 +27,11 @@ import org.openjena.atlas.logging.Log ;
 
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.core.DatasetGraphFactory ;
+import com.hp.hpl.jena.sparql.modify.request.Target ;
+import com.hp.hpl.jena.sparql.modify.request.UpdateDrop ;
+import com.hp.hpl.jena.update.Update ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
 
 /** Manage a server for testing.
  * <pre>
@@ -88,6 +92,8 @@ public class ServerTest extends BaseServ
     
     public static void resetServer()
     {
-        UpdateRemote.executeClear(serviceUpdate) ;
+        Update clearRequest = new UpdateDrop(Target.ALL) ;
+        UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, serviceUpdate)
;
+        proc.execute() ;
     }
 }



Mime
View raw message