gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r792040 - in /gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy: Main.java resources/Checksum.java resources/JarChecksum.java resources/POM.java resources/POMChecksum.java restlets/ArtifactAdder.java
Date Wed, 08 Jul 2009 05:30:01 GMT
Author: bodewig
Date: Wed Jul  8 05:30:01 2009
New Revision: 792040

URL: http://svn.apache.org/viewvc?rev=792040&view=rev
Log:
support serving of POMs

Added:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java  
(with props)
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java   (with props)
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java  
(with props)
Modified:
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/Main.java
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/Checksum.java
    gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/restlets/ArtifactAdder.java

Modified: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/Main.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/Main.java?rev=792040&r1=792039&r2=792040&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/Main.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/Main.java Wed Jul  8 05:30:01
2009
@@ -21,9 +21,11 @@
 import java.util.Map;
 
 import org.apache.gump.mvnrepoproxy.resources.ArtifactsForm;
-import org.apache.gump.mvnrepoproxy.resources.Checksum;
 import org.apache.gump.mvnrepoproxy.resources.Jar;
+import org.apache.gump.mvnrepoproxy.resources.JarChecksum;
 import org.apache.gump.mvnrepoproxy.resources.LogFile;
+import org.apache.gump.mvnrepoproxy.resources.POM;
+import org.apache.gump.mvnrepoproxy.resources.POMChecksum;
 import org.apache.gump.mvnrepoproxy.restlets.ArtifactAdder;
 import org.apache.gump.mvnrepoproxy.restlets.Proxy;
 import org.apache.gump.mvnrepoproxy.restlets.Stop;
@@ -140,7 +142,11 @@
         attachResource(router, prefix, Constants.JAR_ARTIFACT_TEMPLATE,
                        Jar.class);
         attachResource(router, prefix, Constants.JAR_CHECKSUM_ARTIFACT_TEMPLATE,
-                       Checksum.class);
+                       JarChecksum.class);
+        attachResource(router, prefix, Constants.POM_ARTIFACT_TEMPLATE,
+                       POM.class);
+        attachResource(router, prefix, Constants.POM_CHECKSUM_ARTIFACT_TEMPLATE,
+                       POMChecksum.class);
     }
 
     private static void attachResource(Router router, String prefix,

Modified: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/Checksum.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/Checksum.java?rev=792040&r1=792039&r2=792040&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/Checksum.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/Checksum.java Wed Jul
 8 05:30:01 2009
@@ -34,13 +34,14 @@
  * A checksum (sha1 or md5) artifact served from the local file system
  * if registered by Gump or proxied from a real mvn repository.
  */
-public class Checksum extends GumpArtifact {
+public abstract class Checksum extends GumpArtifact {
 
     private final String algorithm;
 
-    public Checksum(Context ctx, Request request, Response response) {
+    protected Checksum(Context ctx, Request request, Response response,
+                       String artifactType) {
         super(ctx, request, response, Constants.CHECKSUM_VARIANT,
-              Constants.JAR_TYPE);
+              artifactType);
         this.algorithm =
             (String) request.getAttributes().get(Constants.CS_ALGORITHM);
     }

Added: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java?rev=792040&view=auto
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java (added)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java Wed
Jul  8 05:30:01 2009
@@ -0,0 +1,32 @@
+/*
+ *  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.mvnrepoproxy.resources;
+
+import org.apache.gump.mvnrepoproxy.Constants;
+
+import org.restlet.Context;
+import org.restlet.data.Request;
+import org.restlet.data.Response;
+
+public class JarChecksum extends Checksum {
+
+    public JarChecksum(Context ctx, Request request, Response response) {
+        super(ctx, request, response, Constants.JAR_TYPE);
+    }
+}

Propchange: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/JarChecksum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java?rev=792040&view=auto
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java (added)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java Wed Jul  8
05:30:01 2009
@@ -0,0 +1,46 @@
+/*
+ *  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.mvnrepoproxy.resources;
+
+import org.apache.gump.mvnrepoproxy.Constants;
+
+import org.restlet.Context;
+import org.restlet.data.Request;
+import org.restlet.data.Response;
+import org.restlet.resource.FileRepresentation;
+import org.restlet.resource.Representation;
+
+/**
+ * A POM artifact served from the local file system if registered by
+ * Gump or proxied from a real mvn repository.
+ */
+public class POM extends GumpArtifact {
+
+    public POM(Context ctx, Request request, Response response) {
+        super(ctx, request, response, Constants.POM_VARIANT, Constants.POM_TYPE);
+    }
+
+    @Override
+    protected Representation getRepresentation(String fileName) {
+        return new FileRepresentation(fileName,
+                                      Constants.POM_VARIANT.getMediaType(),
+                                      300);
+    }
+
+}
\ No newline at end of file

Propchange: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POM.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java?rev=792040&view=auto
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java (added)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java Wed
Jul  8 05:30:01 2009
@@ -0,0 +1,32 @@
+/*
+ *  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.mvnrepoproxy.resources;
+
+import org.apache.gump.mvnrepoproxy.Constants;
+
+import org.restlet.Context;
+import org.restlet.data.Request;
+import org.restlet.data.Response;
+
+public class POMChecksum extends Checksum {
+
+    public POMChecksum(Context ctx, Request request, Response response) {
+        super(ctx, request, response, Constants.POM_TYPE);
+    }
+}

Propchange: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/resources/POMChecksum.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/restlets/ArtifactAdder.java
URL: http://svn.apache.org/viewvc/gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/restlets/ArtifactAdder.java?rev=792040&r1=792039&r2=792040&view=diff
==============================================================================
--- gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/restlets/ArtifactAdder.java (original)
+++ gump/mvnrepo/trunk/src/java/org/apache/gump/mvnrepoproxy/restlets/ArtifactAdder.java Wed
Jul  8 05:30:01 2009
@@ -37,21 +37,22 @@
     }
 
     @Override public void handle(Request request, Response response) {
-        getLogger().info("adding artifact with groupId '"
+        String fileName =
+            (String) request.getAttributes().get(Constants.FILE_NAME);
+        String artifactType = fileName.endsWith(Constants.POM_TYPE)
+            ? Constants.POM_TYPE : Constants.JAR_TYPE;
+
+        getLogger().info("adding " + artifactType + " artifact with groupId '"
                          + request.getAttributes().get(Constants.GROUP_ID)
                          + "' artifactId '"
                          + request.getAttributes().get(Constants.ARTIFACT_ID)
                          + "' and file name '"
-                         + request.getAttributes().get(Constants.FILE_NAME)
+                         + fileName
                          + "'");
-        String fileName =
-            (String) request.getAttributes().get(Constants.FILE_NAME);
         Registry.addArtifact((String) request.getAttributes()
 			     .get(Constants.GROUP_ID),
 			     (String) request.getAttributes()
 			     .get(Constants.ARTIFACT_ID),
-                             fileName.endsWith(Constants.POM_TYPE)
-                             ? Constants.POM_TYPE : Constants.JAR_TYPE,
-			     fileName);
+                             artifactType, fileName);
     }
 }
\ No newline at end of file



Mime
View raw message