jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1540757 - in /jena/branches/jena-fuseki-new-ui: src-dev/dev/ src/main/java/org/apache/jena/fuseki/ src/main/java/org/apache/jena/fuseki/mgt/
Date Mon, 11 Nov 2013 15:55:59 GMT
Author: andy
Date: Mon Nov 11 15:55:58 2013
New Revision: 1540757

URL: http://svn.apache.org/r1540757
Log:
Include admin port details in server description.

Modified:
    jena/branches/jena-fuseki-new-ui/src-dev/dev/RunFuseki.java
    jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java
    jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
    jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/DescriptionServlet.java
    jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java

Modified: jena/branches/jena-fuseki-new-ui/src-dev/dev/RunFuseki.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src-dev/dev/RunFuseki.java?rev=1540757&r1=1540756&r2=1540757&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src-dev/dev/RunFuseki.java (original)
+++ jena/branches/jena-fuseki-new-ui/src-dev/dev/RunFuseki.java Mon Nov 11 15:55:58 2013
@@ -61,7 +61,7 @@ public class RunFuseki
         
         FusekiCmd.main(
                      //  "-v",
-                     "--update", "--mem", "--mgtPort=-10", "/ds"
+                     "--update", "--mem", "--mgtPort=0", "/ds"
                      //"--update", "--loc="+tmpdir+"DB", "--set=tdb:unionDefaultGraph=true",
"/ds"
                      //"--update", "--mem", "/ds"
 

Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java?rev=1540757&r1=1540756&r2=1540757&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/Fuseki.java Mon
Nov 11 15:55:58 2013
@@ -22,6 +22,7 @@ import org.apache.jena.fuseki.server.SPA
 import org.apache.jena.riot.RIOT ;
 import org.apache.jena.riot.stream.LocatorURL ;
 import org.apache.jena.riot.stream.StreamManager ;
+import org.eclipse.jetty.server.Server ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
@@ -162,6 +163,8 @@ public class Fuseki
     
     // Temporary ...
     private static SPARQLServer server ;
+    private static Server jettyServer ;
+    private static Server mgtJettyServer ;
     
     /** set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.*/
     public static void setServer(SPARQLServer _server)      { server = _server ; }
@@ -169,6 +172,18 @@ public class Fuseki
     /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
     public static SPARQLServer getServer()                  { return server ; }
 
+    /** set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.*/
+    public static void setJettyServer(Server _server)      { jettyServer = _server ; }
+    
+    /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
+    public static Server getJettyServer()                  { return jettyServer ; }
+
+    /** set/specify the {@link org.apache.jena.fuseki.server.SPARQLServer} instance.*/
+    public static void setJettyMgtServer(Server _server)      { mgtJettyServer = _server
; }
+    
+    /** get the {@link org.apache.jena.fuseki.server.SPARQLServer} instance. */
+    public static Server getJettyMgtServer()                  { return mgtJettyServer ; }
+
     // Force a call to init.
     static { init() ; }
 }

Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java?rev=1540757&r1=1540756&r2=1540757&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java (original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/FusekiCmd.java Mon
Nov 11 15:55:58 2013
@@ -475,11 +475,16 @@ public class FusekiCmd extends CmdARQ {
 
         if ( mgtPort <= 0 || mgtPort == port ) {
             // TODO Temporary!
+            mgtServer = server.getServer() ;
             ServletContextHandler context = (ServletContextHandler)server.getServer().getHandler()
;
             ManagementServer.addServerFunctions(context, "/$/") ;
             ManagementServer.addAdminFunctions(context, "/$/") ;
         }
 
+        // Temporary?
+        Fuseki.setJettyMgtServer(mgtServer) ;
+        Fuseki.setJettyServer(server.getServer()) ;
+
         server.start() ;
         try {
             server.getServer().join() ;

Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/DescriptionServlet.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/DescriptionServlet.java?rev=1540757&r1=1540756&r2=1540757&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/DescriptionServlet.java
(original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/DescriptionServlet.java
Mon Nov 11 15:55:58 2013
@@ -26,12 +26,15 @@ import javax.servlet.http.HttpServlet ;
 import javax.servlet.http.HttpServletRequest ;
 import javax.servlet.http.HttpServletResponse ;
 
-import org.apache.jena.atlas.json.* ;
+import org.apache.jena.atlas.json.JSON ;
+import org.apache.jena.atlas.json.JsonBuilder ;
+import org.apache.jena.atlas.json.JsonValue ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.server.DatasetRef ;
 import org.apache.jena.fuseki.server.DatasetRegistry ;
 import org.apache.jena.riot.WebContent ;
 import org.apache.jena.web.HttpSC ;
+import org.eclipse.jetty.server.Server ;
 
 /** Description of datasets for a server */ 
 public class DescriptionServlet extends HttpServlet
@@ -65,8 +68,6 @@ public class DescriptionServlet extends 
         builder.startObject() ;
         describeServer(builder) ;
         describeDataset(builder) ;
-        
-        
         builder.finishObject() ;
         
         JsonValue v = builder.build() ;
@@ -80,9 +81,19 @@ public class DescriptionServlet extends 
             .key("server")
             .startObject()
             //.key("hostname").value(req.getLocalName())
-            .key("port").value(Fuseki.getServer().getPort())
+            .key("port").value(port(Fuseki.getJettyServer()))
+            .finishObject() ;
+        builder
+            .key("admin")
+            .startObject()
+            //.key("hostname").value(req.getLocalName())
+            .key("port").value(port(Fuseki.getJettyMgtServer()))
             .finishObject() ;
     }
+    
+    private int port(Server jettyServer ) {
+        return jettyServer.getConnectors()[0].getPort() ;
+    }
 
     private void describeDataset(JsonBuilder builder) {
         builder.key("datasets") ;

Modified: jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
URL: http://svn.apache.org/viewvc/jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java?rev=1540757&r1=1540756&r2=1540757&view=diff
==============================================================================
--- jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
(original)
+++ jena/branches/jena-fuseki-new-ui/src/main/java/org/apache/jena/fuseki/mgt/ManagementServer.java
Mon Nov 11 15:55:58 2013
@@ -59,19 +59,15 @@ public class ManagementServer
         return server  ;
     }        
         
-    
-//        addServerFunctions(context) ;
-//        addAdminFunctions(context) ;
-        
     public static void addServerFunctions(ServletContextHandler context, String base) {
         Fuseki.serverLog.info("Adding server information functions") ;
         if ( !base.endsWith("/" ) )
             base = base + "/" ;
         if ( !base.startsWith("/"))
-            throw new FusekiException("Base URI does nto start with a '/'") ; 
+            throw new FusekiException("Base URI does not start with a '/'") ; 
         // Dump request
-        addServlet(context, new DumpServlet(),      base+"dump") ;
-        addServlet(context, new DescriptionServlet(),     base+"datasets") ;
+        addServlet(context, new DumpServlet(),          base+"dump") ;
+        addServlet(context, new DescriptionServlet(),   base+"datasets") ;
     }
     
     public static void addAdminFunctions(ServletContextHandler context, String base) {



Mime
View raw message