gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r571423 - in /gump/mvnrepo/trunk: lib/ src/java/org/apache/gump/mvnrepo/ src/java/org/apache/gump/mvnrepo/restlets/
Date Fri, 31 Aug 2007 10:33:50 GMT
Author: bodewig
Date: Fri Aug 31 03:33:48 2007
New Revision: 571423

URL: http://svn.apache.org/viewvc?rev=571423&view=rev
Log:
provide a way to stop the server

Added:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java   (with props)
Modified:
    gump/mvnrepo/trunk/lib/com.noelios.restlet.ext.httpclient_3.1.jar   (props changed)
    gump/mvnrepo/trunk/lib/com.noelios.restlet.ext.jetty_6.1.jar   (props changed)
    gump/mvnrepo/trunk/lib/com.noelios.restlet.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.apache.commons.codec.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.apache.commons.httpclient.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.apache.commons.logging.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.mortbay.jetty.ajp.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.mortbay.jetty.https.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.mortbay.jetty.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.mortbay.jetty.util.jar   (props changed)
    gump/mvnrepo/trunk/lib/org.restlet.jar   (props changed)
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java

Propchange: gump/mvnrepo/trunk/lib/com.noelios.restlet.ext.httpclient_3.1.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/com.noelios.restlet.ext.jetty_6.1.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/com.noelios.restlet.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.apache.commons.codec.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.apache.commons.httpclient.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.apache.commons.logging.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.mortbay.jetty.ajp.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.mortbay.jetty.https.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.mortbay.jetty.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.mortbay.jetty.util.jar
            ('svn:executable' removed)

Propchange: gump/mvnrepo/trunk/lib/org.restlet.jar
            ('svn:executable' removed)

Modified: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java?rev=571423&r1=571422&r2=571423&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/Main.java Fri Aug 31 03:33:48 2007
@@ -24,6 +24,7 @@
 import org.apache.gump.mvnrepo.resources.LogFile;
 import org.apache.gump.mvnrepo.restlets.ArtifactAdder;
 import org.apache.gump.mvnrepo.restlets.Proxy;
+import org.apache.gump.mvnrepo.restlets.Stop;
 
 import org.restlet.Application;
 import org.restlet.Component;
@@ -57,7 +58,7 @@
      * Configures the MVN Repository application
      */
     public static Component getRepositoryComponent() {
-        Component component = new Component();
+        final Component component = new Component();
         
         Application repoApp = new Application(component.getContext()) {
 
@@ -84,6 +85,9 @@
                                     Constants.ARTIFACT_ID, true);
                     r.extractEntity(Constants.FILE_NAME,
                                     Constants.FILE_NAME, true);
+
+                    // Restlet that stops the server
+                    router.attach("/stop", new Stop(getContext(), component));
 
                     // catch all - proxy to real repository
                     router.attach("/", new Proxy(getContext(),

Added: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java?rev=571423&view=auto
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java (added)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java Fri Aug 31 03:33:48
2007
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.gump.mvnrepo.restlets;
+
+import org.restlet.Component;
+import org.restlet.Context;
+import org.restlet.Restlet;
+import org.restlet.data.Request;
+import org.restlet.data.Response;
+
+/**
+ * Simple Restlet that stops the server.
+ */
+public class Stop extends Restlet {
+
+    private final Component comp;
+
+    public Stop(Context ctx, Component comp) {
+        super(ctx);
+        this.comp = comp;
+    }
+
+    @Override
+    public void handle(Request request, Response response) {
+        try {
+            comp.stop();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
\ No newline at end of file

Propchange: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepo/restlets/Stop.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message