]> source.dussan.org Git - archiva.git/commitdiff
XmlRpc servlet works :)
authorJames William Dumay <jdumay@apache.org>
Thu, 4 Sep 2008 03:58:48 +0000 (03:58 +0000)
committerJames William Dumay <jdumay@apache.org>
Thu, 4 Sep 2008 03:58:48 +0000 (03:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@691863 13f79535-47bb-0310-9956-ffa450edef68

MRM-124/archiva-modules/archiva-web/archiva-webapp/pom.xml
MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/pom.xml
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java [deleted file]
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaXmlRpcServlet.java [deleted file]
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/services/PingServiceImpl.java [deleted file]
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/services/PingServiceImpl.java [new file with mode: 0644]
MRM-124/pom.xml

index 7e1927a81872cd98f35ce1cb72b72d8d756e8fb0..6fcd9f6d2762dc36a8808b47c1927b393ee8ec13 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-rss</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-xmlrpc-services</artifactId>
+    </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <artifactId>commons-logging-api</artifactId>
       <version>1.1</version>
     </dependency>
+    <dependency>
+      <groupId>com.atlassian.xmlrpc</groupId>
+      <artifactId>atlassian-xmlrpc-binder-server-spring</artifactId>
+      <scope>runtime</scope>
+    </dependency>
   </dependencies>
   <build>
     <resources>
index 93bd4a30ba4ba1b17bb94e6e20b9f8b76bd859da..0e34612040717617fc9d244848366c2dde0823cb 100644 (file)
   <bean id="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
     <property name="location" value="classpath:application.properties" />
   </bean>
+
+
+  <bean name="testXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.maven.archiva.web.xmlrpc.services.PingServiceImpl"/>
+
+  <bean name="xmlrpcServicesList" class="java.util.ArrayList">
+    <constructor-arg>
+        <ref bean="testXmlRpcService"/>
+    </constructor-arg>
+  </bean>
+
 </beans>
index b732fe8b50d6d8f17b65a0fc81ba89ba25f0a7d9..23e276ff86f20a1e3d2129f753cef687b9c1cb24 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?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
   ~ specific language governing permissions and limitations
   ~ under the License.
   -->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
   <display-name>Apache Archiva</display-name>
 
     <!-- Loading this on startup so as to take advantage of configuration listeners -->
     <load-on-startup>1</load-on-startup>
   </servlet>
+
+  <servlet>
+    <servlet-name>XmlRpcServlet</servlet-name>
+    <servlet-class>com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet</servlet-class>
+    <init-param>
+        <param-name>serviceListBeanName</param-name>
+        <param-value>xmlrpcServicesList</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
   
   <servlet>
     <servlet-name>RssFeedServlet</servlet-name>
     <url-pattern>/repository/*</url-pattern>
   </servlet-mapping>
 
+  <servlet-mapping>
+    <servlet-name>XmlRpcServlet</servlet-name>
+    <url-pattern>/xmlrpc</url-pattern>
+  </servlet-mapping>
+
   <resource-ref>
     <res-ref-name>jdbc/users</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
     <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
-
 </web-app>
index 9728407dc54e29fdcdbb89348d00fd7c9032aa04..f38d11ec92a87dd31f4ea55fdb2efe3299b56d7c 100644 (file)
@@ -26,8 +26,8 @@
         <version>1.2-SNAPSHOT</version>
     </parent>
 
-    <artifactId>archiva-xmlrpc-server</artifactId>
-    <name>Archiva Web :: XML-RPC Server</name>
+    <artifactId>archiva-xmlrpc-services</artifactId>
+    <name>Archiva Web :: XML-RPC Services</name>
     <dependencies>
         <dependency>
             <groupId>org.apache.archiva</groupId>
@@ -41,9 +41,5 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-web</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.atlassian.xmlrpc</groupId>
-            <artifactId>atlassian-xmlrpc-binder-server</artifactId>
-        </dependency>
     </dependencies>
 </project>
diff --git a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java
deleted file mode 100644 (file)
index 1059e15..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.maven.archiva.web.xmlrpc.server;\r
-\r
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one\r
- * or more contributor license agreements.  See the NOTICE file\r
- * distributed with this work for additional information\r
- * regarding copyright ownership.  The ASF licenses this file\r
- * to you under the Apache License, Version 2.0 (the\r
- * "License"); you may not use this file except in compliance\r
- * with the License.  You may obtain a copy of the License at\r
- *\r
- *  http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing,\r
- * software distributed under the License is distributed on an\r
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
- * KIND, either express or implied.  See the License for the\r
- * specific language governing permissions and limitations\r
- * under the License.\r
- */\r
-\r
-import java.util.Map;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import org.apache.xmlrpc.XmlRpcException;\r
-import org.apache.xmlrpc.XmlRpcRequest;\r
-import org.apache.xmlrpc.server.RequestProcessorFactoryFactory;\r
-\r
-public class ArchivaRequestProcessorFactoryFactory implements RequestProcessorFactoryFactory\r
-{\r
-    private final Map<Class, ArchivaRequestProcessorFactory> services;\r
-\r
-    public ArchivaRequestProcessorFactoryFactory(List serviceList)\r
-    {\r
-        services = new HashMap<Class, ArchivaRequestProcessorFactory>();\r
-        for (Object service : serviceList)\r
-        {\r
-            services.put(service.getClass(), new ArchivaRequestProcessorFactory(service.getClass(), service));\r
-        }\r
-    }\r
-\r
-    public RequestProcessorFactory getRequestProcessorFactory(Class pClass)\r
-        throws XmlRpcException\r
-    {\r
-        ArchivaRequestProcessorFactory processorFactory = services.get(pClass);\r
-        if (processorFactory == null)\r
-        {\r
-            throw new XmlRpcException("Could not find service object instance for type " + pClass.getName());\r
-        }\r
-        return processorFactory;\r
-    }\r
-    \r
-    private class ArchivaRequestProcessorFactory implements RequestProcessorFactory\r
-    {\r
-        private final Class pType;\r
-\r
-        private final Object serviceObject;\r
-\r
-        public ArchivaRequestProcessorFactory(Class pType, Object serviceObject)\r
-        {\r
-            this.pType = pType;\r
-            this.serviceObject = serviceObject;\r
-        }\r
-\r
-        public Object getRequestProcessor(XmlRpcRequest request)\r
-            throws XmlRpcException\r
-        {\r
-            return serviceObject;\r
-        }\r
-    }\r
-}\r
diff --git a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaXmlRpcServlet.java b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaXmlRpcServlet.java
deleted file mode 100644 (file)
index bce890c..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.maven.archiva.web.xmlrpc.server;\r
-\r
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one\r
- * or more contributor license agreements.  See the NOTICE file\r
- * distributed with this work for additional information\r
- * regarding copyright ownership.  The ASF licenses this file\r
- * to you under the Apache License, Version 2.0 (the\r
- * "License"); you may not use this file except in compliance\r
- * with the License.  You may obtain a copy of the License at\r
- *\r
- *  http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing,\r
- * software distributed under the License is distributed on an\r
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
- * KIND, either express or implied.  See the License for the\r
- * specific language governing permissions and limitations\r
- * under the License.\r
- */\r
-\r
-import com.atlassian.xmlrpc.BinderXmlRpcServlet;\r
-import java.util.List;\r
-import javax.servlet.ServletConfig;\r
-import javax.servlet.ServletException;\r
-import org.apache.xmlrpc.XmlRpcException;\r
-import org.apache.xmlrpc.XmlRpcRequest;\r
-import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler;\r
-import org.springframework.context.ApplicationContext;\r
-import org.springframework.web.context.support.WebApplicationContextUtils;\r
-\r
-public class ArchivaXmlRpcServlet extends BinderXmlRpcServlet\r
-{\r
-    private final String XMLRPC_SERVICES_BEAN_NAME = "xmlrpcServices";\r
-\r
-    private ApplicationContext context;\r
-\r
-    @Override\r
-    public void init(ServletConfig pConfig)\r
-        throws ServletException\r
-    {\r
-        super.init(pConfig);\r
-        \r
-        context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());\r
-        setAuthenticationHandler(new ArchivaAuthenticationHandler());\r
-        initRequestProcessorFactoryFactory();\r
-    }\r
-\r
-    private void initRequestProcessorFactoryFactory() throws ServletException\r
-    {\r
-        List serviceList = (List)context.getBean(XMLRPC_SERVICES_BEAN_NAME);\r
-        if (serviceList == null)\r
-        {\r
-            throw new ServletException("Could not find bean " +  XMLRPC_SERVICES_BEAN_NAME);\r
-        }\r
-\r
-        setRequestProcessorFactoryFactory(new ArchivaRequestProcessorFactoryFactory(serviceList));\r
-    }\r
-\r
-    /**\r
-     * Servlet Security\r
-     */\r
-    private class ArchivaAuthenticationHandler implements AuthenticationHandler\r
-    {\r
-        public boolean isAuthorized(XmlRpcRequest request) throws XmlRpcException {\r
-            return false;\r
-        }\r
-    }\r
-}\r
diff --git a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/services/PingServiceImpl.java b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/services/PingServiceImpl.java
deleted file mode 100644 (file)
index c7a8723..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.apache.maven.archiva.web.xmlrpc.server.services;\r
-\r
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one\r
- * or more contributor license agreements.  See the NOTICE file\r
- * distributed with this work for additional information\r
- * regarding copyright ownership.  The ASF licenses this file\r
- * to you under the Apache License, Version 2.0 (the\r
- * "License"); you may not use this file except in compliance\r
- * with the License.  You may obtain a copy of the License at\r
- *\r
- *  http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing,\r
- * software distributed under the License is distributed on an\r
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
- * KIND, either express or implied.  See the License for the\r
- * specific language governing permissions and limitations\r
- * under the License.\r
- */\r
-\r
-import org.apache.maven.archiva.web.xmlrpc.api.TestService;\r
-\r
-public class PingServiceImpl implements TestService\r
-{\r
-    public String ping()\r
-    {\r
-        return "pong";\r
-    }\r
-}\r
diff --git a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/services/PingServiceImpl.java b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/services/PingServiceImpl.java
new file mode 100644 (file)
index 0000000..e77adff
--- /dev/null
@@ -0,0 +1,30 @@
+package org.apache.maven.archiva.web.xmlrpc.services;\r
+\r
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one\r
+ * or more contributor license agreements.  See the NOTICE file\r
+ * distributed with this work for additional information\r
+ * regarding copyright ownership.  The ASF licenses this file\r
+ * to you under the Apache License, Version 2.0 (the\r
+ * "License"); you may not use this file except in compliance\r
+ * with the License.  You may obtain a copy of the License at\r
+ *\r
+ *  http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing,\r
+ * software distributed under the License is distributed on an\r
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ * KIND, either express or implied.  See the License for the\r
+ * specific language governing permissions and limitations\r
+ * under the License.\r
+ */\r
+\r
+import org.apache.maven.archiva.web.xmlrpc.api.TestService;\r
+\r
+public class PingServiceImpl implements TestService\r
+{\r
+    public String ping()\r
+    {\r
+        return "pong";\r
+    }\r
+}\r
index 1a992ada194371ffc9fff53d15d71e62c07bab25..7d88ee0be8b874dd5bd0ccce458dac6ae7c32991 100644 (file)
       </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
-        <artifactId>archiva-xmlrpc-server</artifactId>
+        <artifactId>archiva-xmlrpc-services</artifactId>
         <version>1.2-SNAPSHOT</version>        
       </dependency>
       <dependency>
       <dependency>
         <groupId>com.atlassian.xmlrpc</groupId>
         <artifactId>atlassian-xmlrpc-binder-annotations</artifactId>
-        <version>0.5</version>
+        <version>0.6-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>com.atlassian.xmlrpc</groupId>
-        <artifactId>atlassian-xmlrpc-binder-server</artifactId>
-        <version>0.5</version>
+        <artifactId>atlassian-xmlrpc-binder-server-spring</artifactId>
+        <version>0.6-SNAPSHOT</version>
         <exclusions>
           <exclusion>
             <groupId>commons-logging</groupId>
       <dependency>
         <groupId>com.atlassian.xmlrpc</groupId>
         <artifactId>atlassian-xmlrpc-binder</artifactId>
-        <version>0.5</version>
+        <version>0.6-SNAPSHOT</version>
         <scope>test</scope>
       </dependency>
       <dependency>
         <groupId>com.atlassian.xmlrpc</groupId>
         <artifactId>atlassian-xmlrpc-binder-testing</artifactId>
-        <version>0.5</version>
+        <version>0.6-SNAPSHOT</version>
         <scope>test</scope>
       </dependency>