From: James William Dumay Date: Thu, 4 Sep 2008 03:58:48 +0000 (+0000) Subject: XmlRpc servlet works :) X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79c634f2dfd194d8b31ff36de43a9710adb7e157;p=archiva.git XmlRpc servlet works :) git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@691863 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/MRM-124/archiva-modules/archiva-web/archiva-webapp/pom.xml b/MRM-124/archiva-modules/archiva-web/archiva-webapp/pom.xml index 7e1927a81..6fcd9f6d2 100644 --- a/MRM-124/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/MRM-124/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -84,6 +84,10 @@ org.apache.archiva archiva-rss + + org.apache.archiva + archiva-xmlrpc-services + javax.servlet servlet-api @@ -221,6 +225,11 @@ commons-logging-api 1.1 + + com.atlassian.xmlrpc + atlassian-xmlrpc-binder-server-spring + runtime + diff --git a/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml index 93bd4a30b..0e3461204 100644 --- a/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml @@ -30,4 +30,14 @@ + + + + + + + + + + diff --git a/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml b/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml index b732fe8b5..23e276ff8 100644 --- a/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml +++ b/MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/web.xml @@ -1,4 +1,4 @@ - + - - + Apache Archiva @@ -85,6 +82,16 @@ 1 + + + XmlRpcServlet + com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet + + serviceListBeanName + xmlrpcServicesList + + 1 + RssFeedServlet @@ -101,6 +108,11 @@ /repository/* + + XmlRpcServlet + /xmlrpc + + jdbc/users javax.sql.DataSource @@ -119,5 +131,4 @@ Container Shareable - diff --git a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/pom.xml b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/pom.xml index 9728407dc..f38d11ec9 100644 --- a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/pom.xml +++ b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/pom.xml @@ -26,8 +26,8 @@ 1.2-SNAPSHOT - archiva-xmlrpc-server - Archiva Web :: XML-RPC Server + archiva-xmlrpc-services + Archiva Web :: XML-RPC Services org.apache.archiva @@ -41,9 +41,5 @@ org.springframework spring-web - - com.atlassian.xmlrpc - atlassian-xmlrpc-binder-server - 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 index 1059e1541..000000000 --- a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.archiva.web.xmlrpc.server; - -/* - * 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 java.util.Map; -import java.util.HashMap; -import java.util.List; -import org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.XmlRpcRequest; -import org.apache.xmlrpc.server.RequestProcessorFactoryFactory; - -public class ArchivaRequestProcessorFactoryFactory implements RequestProcessorFactoryFactory -{ - private final Map services; - - public ArchivaRequestProcessorFactoryFactory(List serviceList) - { - services = new HashMap(); - for (Object service : serviceList) - { - services.put(service.getClass(), new ArchivaRequestProcessorFactory(service.getClass(), service)); - } - } - - public RequestProcessorFactory getRequestProcessorFactory(Class pClass) - throws XmlRpcException - { - ArchivaRequestProcessorFactory processorFactory = services.get(pClass); - if (processorFactory == null) - { - throw new XmlRpcException("Could not find service object instance for type " + pClass.getName()); - } - return processorFactory; - } - - private class ArchivaRequestProcessorFactory implements RequestProcessorFactory - { - private final Class pType; - - private final Object serviceObject; - - public ArchivaRequestProcessorFactory(Class pType, Object serviceObject) - { - this.pType = pType; - this.serviceObject = serviceObject; - } - - public Object getRequestProcessor(XmlRpcRequest request) - throws XmlRpcException - { - return serviceObject; - } - } -} 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 index bce890ccb..000000000 --- a/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaXmlRpcServlet.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.apache.maven.archiva.web.xmlrpc.server; - -/* - * 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 com.atlassian.xmlrpc.BinderXmlRpcServlet; -import java.util.List; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.XmlRpcRequest; -import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -public class ArchivaXmlRpcServlet extends BinderXmlRpcServlet -{ - private final String XMLRPC_SERVICES_BEAN_NAME = "xmlrpcServices"; - - private ApplicationContext context; - - @Override - public void init(ServletConfig pConfig) - throws ServletException - { - super.init(pConfig); - - context = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); - setAuthenticationHandler(new ArchivaAuthenticationHandler()); - initRequestProcessorFactoryFactory(); - } - - private void initRequestProcessorFactoryFactory() throws ServletException - { - List serviceList = (List)context.getBean(XMLRPC_SERVICES_BEAN_NAME); - if (serviceList == null) - { - throw new ServletException("Could not find bean " + XMLRPC_SERVICES_BEAN_NAME); - } - - setRequestProcessorFactoryFactory(new ArchivaRequestProcessorFactoryFactory(serviceList)); - } - - /** - * Servlet Security - */ - private class ArchivaAuthenticationHandler implements AuthenticationHandler - { - public boolean isAuthorized(XmlRpcRequest request) throws XmlRpcException { - return false; - } - } -} 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 index c7a87238a..000000000 --- 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 +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.maven.archiva.web.xmlrpc.server.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.apache.maven.archiva.web.xmlrpc.api.TestService; - -public class PingServiceImpl implements TestService -{ - public String ping() - { - return "pong"; - } -} 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 index 000000000..e77adffe0 --- /dev/null +++ b/MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/services/PingServiceImpl.java @@ -0,0 +1,30 @@ +package org.apache.maven.archiva.web.xmlrpc.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.apache.maven.archiva.web.xmlrpc.api.TestService; + +public class PingServiceImpl implements TestService +{ + public String ping() + { + return "pong"; + } +} diff --git a/MRM-124/pom.xml b/MRM-124/pom.xml index 1a992ada1..7d88ee0be 100644 --- a/MRM-124/pom.xml +++ b/MRM-124/pom.xml @@ -388,7 +388,7 @@ org.apache.archiva - archiva-xmlrpc-server + archiva-xmlrpc-services 1.2-SNAPSHOT @@ -882,12 +882,12 @@ com.atlassian.xmlrpc atlassian-xmlrpc-binder-annotations - 0.5 + 0.6-SNAPSHOT com.atlassian.xmlrpc - atlassian-xmlrpc-binder-server - 0.5 + atlassian-xmlrpc-binder-server-spring + 0.6-SNAPSHOT commons-logging @@ -898,13 +898,13 @@ com.atlassian.xmlrpc atlassian-xmlrpc-binder - 0.5 + 0.6-SNAPSHOT test com.atlassian.xmlrpc atlassian-xmlrpc-binder-testing - 0.5 + 0.6-SNAPSHOT test