]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1490] Expose Archiva services trough rest
authorOlivier Lamy <olamy@apache.org>
Wed, 17 Aug 2011 23:53:30 +0000 (23:53 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 17 Aug 2011 23:53:30 +0000 (23:53 +0000)
add modules structure with the very first service : ping :-)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1158972 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Dependency.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultPingService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/pom.xml [new file with mode: 0644]
archiva-modules/archiva-web/pom.xml
pom.xml

diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
new file mode 100644 (file)
index 0000000..55071aa
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>archiva-rest</artifactId>
+    <groupId>org.apache.archiva</groupId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-rest-api</artifactId>
+  <name>Archiva Web :: REST support :: Api</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authorization-api</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>jsr311-api</artifactId>
+    </dependency>
+    <!-- normally not needed but here for wadl feature currently in cxf -->
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-bundle-jaxrs</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
new file mode 100644 (file)
index 0000000..251c5ea
--- /dev/null
@@ -0,0 +1,173 @@
+package org.apache.archiva.rest.api.model;
+
+/*
+ * 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.
+ */
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+@XmlRootElement( name = "artifact" )
+public class Artifact
+    implements Serializable
+{
+    private String repositoryId;
+
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String type;
+
+    //private Date whenGathered;
+
+    public Artifact()
+    {
+
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        Artifact artifact = (Artifact) o;
+
+        if ( !artifactId.equals( artifact.artifactId ) )
+        {
+            return false;
+        }
+        if ( !groupId.equals( artifact.groupId ) )
+        {
+            return false;
+        }
+        if ( !repositoryId.equals( artifact.repositoryId ) )
+        {
+            return false;
+        }
+        if ( type != null ? !type.equals( artifact.type ) : artifact.type != null )
+        {
+            return false;
+        }
+        if ( !version.equals( artifact.version ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = repositoryId.hashCode();
+        result = 31 * result + groupId.hashCode();
+        result = 31 * result + artifactId.hashCode();
+        result = 31 * result + version.hashCode();
+        result = 31 * result + ( type != null ? type.hashCode() : 0 );
+        return result;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Artifact{" + "repositoryId='" + repositoryId + '\'' + ", groupId='" + groupId + '\'' + ", artifactId='"
+            + artifactId + '\'' + ", version='" + version + '\'' + ", type='" + type + '\'' + '}';
+    }
+
+    public Artifact( String repositoryId, String groupId, String artifactId, String version, String type )
+//                     String type, Date whenGathered )
+    {
+        this.repositoryId = repositoryId;
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+        this.type = type;
+        //this.whenGathered = whenGathered;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public String getRepositoryId()
+    {
+        return repositoryId;
+    }
+
+    /*public Date getWhenGathered()
+    {
+        return whenGathered;
+    }*/
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public void setRepositoryId( String repositoryId )
+    {
+        this.repositoryId = repositoryId;
+    }
+
+    /*@ServiceBeanField( "whenGathered" )
+    public void setWhenGathered( Date whenGathered )
+    {
+        this.whenGathered = whenGathered;
+    }*/
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Dependency.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Dependency.java
new file mode 100644 (file)
index 0000000..0d945ef
--- /dev/null
@@ -0,0 +1,172 @@
+package org.apache.archiva.rest.api.model;
+
+/*
+ * 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.
+ */
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+@XmlRootElement( name = "dependency" )
+public class Dependency
+    implements Serializable
+{
+    private String groupId;
+
+    private String artifactId;
+
+    private String version;
+
+    private String classifier;
+
+    private String type;
+
+    private String scope;
+
+    @Override
+    public String toString()
+    {
+        return "Dependency{" + "groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='"
+            + version + '\'' + ", classifier='" + classifier + '\'' + ", type='" + type + '\'' + ", scope='" + scope
+            + '\'' + '}';
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        Dependency that = (Dependency) o;
+
+        if ( !artifactId.equals( that.artifactId ) )
+        {
+            return false;
+        }
+        if ( classifier != null ? !classifier.equals( that.classifier ) : that.classifier != null )
+        {
+            return false;
+        }
+        if ( !groupId.equals( that.groupId ) )
+        {
+            return false;
+        }
+        if ( scope != null ? !scope.equals( that.scope ) : that.scope != null )
+        {
+            return false;
+        }
+        if ( type != null ? !type.equals( that.type ) : that.type != null )
+        {
+            return false;
+        }
+        if ( !version.equals( that.version ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = groupId.hashCode();
+        result = 31 * result + artifactId.hashCode();
+        result = 31 * result + version.hashCode();
+        result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
+        result = 31 * result + ( type != null ? type.hashCode() : 0 );
+        result = 31 * result + ( scope != null ? scope.hashCode() : 0 );
+        return result;
+    }
+
+    public Dependency( String groupId, String artifactId, String version, String classifier, String type, String scope )
+    {
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+        this.version = version;
+        this.classifier = classifier;
+        this.type = type;
+        this.scope = scope;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public void setGroupId( String groupId )
+    {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public void setClassifier( String classifier )
+    {
+        this.classifier = classifier;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getScope()
+    {
+        return scope;
+    }
+
+    public void setScope( String scope )
+    {
+        this.scope = scope;
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PingService.java
new file mode 100644 (file)
index 0000000..e03362d
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.archiva.rest.api.services;
+
+/*
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/pingService/" )
+public interface PingService
+{
+
+    /**
+     *
+     * ping service to monitor Archiva with a nice returned message :-)
+     * @return Yeah Baby It rocks!
+     */
+    @Path( "addAuthenticationKey" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    String ping( );
+
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
new file mode 100644 (file)
index 0000000..5ca1d23
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>archiva-rest</artifactId>
+    <groupId>org.apache.archiva</groupId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-rest-services</artifactId>
+  <version>1.4-SNAPSHOT</version>
+  <name>Archiva Web :: REST support :: Services</name>
+
+  <properties>
+    <jettyVersion>7.4.5.v20110725</jettyVersion>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authorization-api</artifactId>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authentication-api</artifactId>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-common-integrations</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-rest-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rest-services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rest-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>jsr311-api</artifactId>
+    </dependency>
+    <!-- normally not needed but here for wadl feature currently in cxf -->
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-bundle-jaxrs</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rest-services</artifactId>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-server</artifactId>
+      <version>${jettyVersion}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.jetty</groupId>
+      <artifactId>jetty-plus</artifactId>
+      <version>${jettyVersion}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authentication-memory</artifactId>
+      <scope>test</scope>
+      <version>${redback.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-keys-memory</artifactId>
+      <scope>test</scope>
+      <version>${redback.version}</version>
+    </dependency>
+
+  </dependencies>
+</project>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultPingService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org.apache.archiva.rest.services/DefaultPingService.java
new file mode 100644 (file)
index 0000000..e6d8c28
--- /dev/null
@@ -0,0 +1,18 @@
+package org.apache.archiva.rest.services;
+
+import org.apache.archiva.rest.api.services.PingService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Olivier Lamy
+ * @since TODO
+ */
+@Service( "pingService#rest" )
+public class DefaultPingService
+    implements PingService
+{
+    public String ping()
+    {
+        return "Yeah Baby It rocks!";
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..053891e
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context 
+           http://www.springframework.org/schema/context/spring-context-3.0.xsd
+           http://cxf.apache.org/jaxrs
+           http://cxf.apache.org/schemas/jaxrs.xsd">
+
+  <import resource="classpath:META-INF/cxf/cxf.xml"/>
+  <!--
+  <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+  -->
+  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+  <context:annotation-config />
+  <context:component-scan
+    base-package="org.apache.archiva.rest.services"/>
+
+  <jaxrs:server id="archivaServices" address="/archivaServices">
+
+    <jaxrs:serviceBeans>
+      <ref bean="pingService#rest"/>
+    </jaxrs:serviceBeans>
+    <jaxrs:providers>
+      <ref bean="authenticationInterceptor#rest"/>
+      <ref bean="permissionInterceptor#rest"/>
+    </jaxrs:providers>
+
+   </jaxrs:server>
+
+</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PingServiceTest.java
new file mode 100644 (file)
index 0000000..73d3b23
--- /dev/null
@@ -0,0 +1,50 @@
+package org.apache.archiva.rest.services;
+
+import org.apache.archiva.rest.api.services.PingService;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.codehaus.redback.rest.services.AbstractRestServicesTest;
+import org.codehaus.redback.rest.services.FakeCreateAdminService;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author Olivier Lamy
+ * @since TODO
+ */
+public class PingServiceTest
+    extends AbstractRestServicesTest
+{
+
+    @Before
+    public void setUp()
+        throws Exception
+    {
+        super.startServer();
+
+        FakeCreateAdminService fakeCreateAdminService =
+            JAXRSClientFactory.create( "http://localhost:" + port + "/services/fakeCreateAdminService/",
+                                       FakeCreateAdminService.class );
+
+        Boolean res = fakeCreateAdminService.createAdminIfNeeded();
+        assertTrue( res.booleanValue() );
+    }
+
+    PingService getPingService()
+    {
+        return JAXRSClientFactory.create( "http://localhost:" + port + "/services/archivaServices/",
+                                          PingService.class );
+
+    }
+
+
+    @Test
+    public void ping()
+        throws Exception
+    {
+        // 1000000L
+        //WebClient.getConfig( userService ).getHttpConduit().getClient().setReceiveTimeout(3000);
+
+        String res = getPingService().ping();
+        assertEquals( "Yeah Baby It rocks!", res );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..8c55a1c
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~ 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.
+  -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
+    </layout>
+  </appender>
+  <!--
+  <logger name="org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor">
+    <level value="trace"/>
+  </logger>
+  <logger name="org.apache.cxf.jaxrs.utils.JAXRSUtils">
+    <level value="trace"/>
+  </logger>
+  -->
+  <logger name="org.codehaus.redback.rest.services" >
+    <level value="debug"/>
+  </logger>
+
+  <root>
+    <priority value ="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
diff --git a/archiva-modules/archiva-web/archiva-rest/pom.xml b/archiva-modules/archiva-web/archiva-rest/pom.xml
new file mode 100644 (file)
index 0000000..74ad443
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-web</artifactId>
+    <version>1.4-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-rest</artifactId>
+  <name>Archiva Web :: REST support</name>
+  <packaging>pom</packaging>
+  <modules>
+    <module>archiva-rest-api</module>
+    <module>archiva-rest-services</module>
+  </modules>
+</project>
\ No newline at end of file
index c4b17053d8c0f87fb3d6b437a873d648d50b9250..5ec8f7174afc7d108335daa04fbaf982388b3a79 100644 (file)
@@ -13,9 +13,7 @@
   ~ 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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.archiva</groupId>
@@ -34,6 +32,7 @@
     <module>archiva-webdav</module>
     <module>archiva-rss</module>
     <module>archiva-xmlrpc</module>
+    <module>archiva-rest</module>
   </modules>
 
   <profiles>
@@ -44,4 +43,4 @@
       </modules>
     </profile>
   </profiles>
-</project>
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 340ba9d24bc9ad81230dafbea36788aa5853d824..f8be21c8ddb6a78a8d0e7f3debc54f6d4027ec19 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -75,6 +75,7 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <surefire.redirectTestOutputToFile>true</surefire.redirectTestOutputToFile>
     <lucene.version>3.0.3</lucene.version>
+    <cxfVersion>2.4.2</cxfVersion>
   </properties>
 
   <dependencyManagement>
         <artifactId>archiva-indexer</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.archiva</groupId>
+        <artifactId>archiva-rest-api</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.archiva</groupId>
+        <artifactId>archiva-rest-services</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.maven.indexer</groupId>
         <artifactId>indexer-core</artifactId>
         <version>3.0.1</version>
       </dependency>
 
+      <dependency>
+        <groupId>javax.ws.rs</groupId>
+        <artifactId>jsr311-api</artifactId>
+        <version>1.1.1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-bundle-jaxrs</artifactId>
+        <version>${cxfVersion}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+          </exclusion>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
+
 
       <dependency>
         <groupId>com.google.guava</groupId>
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-authorization-api</artifactId>
+        <version>${redback.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.codehaus.redback</groupId>
         <artifactId>redback-users-memory</artifactId>
         <version>${redback.version}</version>
       </dependency>
 
-      <!-- redback -->
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-rest-api</artifactId>
+        <version>${redback.version}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-rest-services</artifactId>
+        <version>${redback.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-rest-services</artifactId>
+        <version>${redback.version}</version>
+        <classifier>tests</classifier>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.redback</groupId>
+        <artifactId>redback-authentication-api</artifactId>
+        <version>${redback.version}</version>
+          <exclusions>
+            <exclusion>
+              <groupId>commons-logging</groupId>
+              <artifactId>commons-logging</artifactId>
+            </exclusion>
+          </exclusions>
+      </dependency>
+
+      <!-- redback components -->
 
       <dependency>
         <groupId>org.codehaus.redback.components.registry</groupId>