From d0bb297b76c424fabaef78625b5dfc47f3935f21 Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Thu, 28 Aug 2008 04:13:56 +0000 Subject: [PATCH] Moved ArchivaRequestProcessorFactory into ArchivaRequestProcessorFactoryFactory git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-124@689710 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArchivaRequestProcessorFactory.java | 46 ------------------- ...ArchivaRequestProcessorFactoryFactory.java | 33 ++++++++++--- 2 files changed, 26 insertions(+), 53 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactory.java diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactory.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactory.java deleted file mode 100644 index 671e317bc..000000000 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactory.java +++ /dev/null @@ -1,46 +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 org.apache.xmlrpc.XmlRpcException; -import org.apache.xmlrpc.XmlRpcRequest; -import org.apache.xmlrpc.server.RequestProcessorFactoryFactory; - -/** - * Service an instance of the service object - */ -public class ArchivaRequestProcessorFactory implements RequestProcessorFactoryFactory.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/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java index 7229a39bc..d70e7f01e 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-server/src/main/java/org/apache/maven/archiva/web/xmlrpc/server/ArchivaRequestProcessorFactoryFactory.java @@ -23,30 +23,49 @@ import java.util.HashMap; */ import java.util.List; import org.apache.xmlrpc.XmlRpcException; +import org.apache.xmlrpc.XmlRpcRequest; import org.apache.xmlrpc.server.RequestProcessorFactoryFactory; -import org.apache.xmlrpc.server.RequestProcessorFactoryFactory.RequestProcessorFactory; public class ArchivaRequestProcessorFactoryFactory implements RequestProcessorFactoryFactory { - private final Map services; + private final Map services; public ArchivaRequestProcessorFactoryFactory(List serviceList) { - services = new HashMap(); + services = new HashMap(); for (Object service : serviceList) { - services.put(service.getClass(), service); + services.put(service.getClass(), new ArchivaRequestProcessorFactory(service.getClass(), service)); } } public RequestProcessorFactory getRequestProcessorFactory(Class pClass) throws XmlRpcException { - Object object = services.get(pClass); - if (object == null) + ArchivaRequestProcessorFactory processorFactory = services.get(pClass); + if (processorFactory == null) { throw new XmlRpcException("Could not find service object instance for type " + pClass.getName()); } - return new ArchivaRequestProcessorFactory(pClass, object); + 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; + } } } -- 2.39.5