From 9c0bce139077a7b063c72421abf02fed40682a1e Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Sun, 22 Nov 2009 12:23:00 +0000 Subject: [PATCH] [MRM-1228] Ping service in not working o changed from TestService to PingService o fixed bean config in applicationContext in webapp o added service object annotation for xmlrpc binder git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@883066 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/WEB-INF/applicationContext.xml | 6 ++++-- .../web/xmlrpc/api/{TestService.java => PingService.java} | 4 ++-- .../xmlrpc/security/ServiceMethodsPermissionsMapping.java | 3 ++- .../archiva/web/xmlrpc/security/XmlRpcAuthenticator.java | 6 +++++- .../apache/archiva/web/xmlrpc/services/PingServiceImpl.java | 4 ++-- 5 files changed, 15 insertions(+), 8 deletions(-) rename archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/{TestService.java => PingService.java} (94%) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml index f640639d8..6f4a80950 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml @@ -30,14 +30,15 @@ - - + + + @@ -64,6 +65,7 @@ + diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/TestService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java similarity index 94% rename from archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/TestService.java rename to archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java index 5eba5144d..492f655fe 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/TestService.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/PingService.java @@ -21,8 +21,8 @@ package org.apache.archiva.web.xmlrpc.api; import com.atlassian.xmlrpc.ServiceObject; -@ServiceObject("Test") -public interface TestService +@ServiceObject("PingService") +public interface PingService { public String ping(); } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java index b7119e067..97fe32990 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java @@ -49,5 +49,6 @@ public class ServiceMethodsPermissionsMapping "SearchService.getArtifactVersions", "SearchService.getArtifactVersionsByDate", "SearchService.getDependencies", "SearchService.getDependencyTree", "SearchService.getDependees" ); - + + public static final String PING = "PingService.ping"; } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java index 19f854461..663a37e09 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java @@ -132,7 +132,11 @@ public class XmlRpcAuthenticator { throw new XmlRpcException( 401, e.getMessage() ); } - } + } + else if ( methodName.equals( ServiceMethodsPermissionsMapping.PING ) ) + { + return new AuthorizationResult( true, username, null ); + } else { return securitySystem.authorize( session, ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE ); diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java index aa47f5f0e..14b0d2870 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/PingServiceImpl.java @@ -19,9 +19,9 @@ package org.apache.archiva.web.xmlrpc.services; * under the License. */ -import org.apache.archiva.web.xmlrpc.api.TestService; +import org.apache.archiva.web.xmlrpc.api.PingService; -public class PingServiceImpl implements TestService +public class PingServiceImpl implements PingService { public String ping() {