You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/10/03 00:09:37 UTC

svn commit: r1629084 - /manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java

Author: kwright
Date: Thu Oct  2 22:09:37 2014
New Revision: 1629084

URL: http://svn.apache.org/r1629084
Log:
Bring authority connector up to coding standards for ManifoldCF inclusion

Modified:
    manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java

Modified: manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java?rev=1629084&r1=1629083&r2=1629084&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java (original)
+++ manifoldcf/branches/CONNECTORS-1037/connectors/alfresco-webscript/connector/src/main/java/org/apache/manifoldcf/authorities/alfresco/AlfrescoAuthorityConnector.java Thu Oct  2 22:09:37 2014
@@ -31,13 +31,9 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.IPostParameters;
 import org.apache.manifoldcf.core.interfaces.IThreadContext;
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
+import org.apache.manifoldcf.authorities.system.Logging;
 
 public class AlfrescoAuthorityConnector extends BaseAuthorityConnector {
-  private static final Logger logger = LoggerFactory.getLogger(AlfrescoAuthorityConnector.class);
-  
   
   private AlfrescoClient alfrescoClient;
   
@@ -78,13 +74,13 @@ public class AlfrescoAuthorityConnector 
    */
   @Override
   public String check() throws ManifoldCFException {
-	  try{
-		  alfrescoClient.fetchUserAuthorities("admin");
-		  return "Connection Working!";
-	  }catch(AlfrescoDownException e){
-		  logger.error(e.getMessage());
-		  return "Connection not Working!. Check the configuration";
-	  }
+    try{
+      alfrescoClient.fetchUserAuthorities("admin");
+      return super.check();
+    }catch(AlfrescoDownException e){
+      Logging.authorityConnectors.warn(e.getMessage(),e);
+      return "Connection failed: "+e.getMessage();
+    }
   }
 
   /*
@@ -103,7 +99,7 @@ public class AlfrescoAuthorityConnector 
   @Override
   public AuthorizationResponse getDefaultAuthorizationResponse(String userName)
   {
-      return denied;
+    return denied;
   }
   
   /*
@@ -113,19 +109,20 @@ public class AlfrescoAuthorityConnector 
   @Override
   public AuthorizationResponse getAuthorizationResponse(String userName)
     throws ManifoldCFException {
-	  try{
-		  AlfrescoUser permissions = alfrescoClient.fetchUserAuthorities(userName);
-		  if(permissions.getUsername() == null 
+    try{
+      AlfrescoUser permissions = alfrescoClient.fetchUserAuthorities(userName);
+      if(permissions.getUsername() == null 
 				  || permissions.getUsername().isEmpty()
 				  || permissions.getAuthorities().isEmpty())
-			  return new AuthorizationResponse(null, AuthorizationResponse.RESPONSE_USERNOTFOUND);
-		  else
-			  return new AuthorizationResponse(
+        return new AuthorizationResponse(null, AuthorizationResponse.RESPONSE_USERNOTFOUND);
+      else
+        return new AuthorizationResponse(
 					  permissions.getAuthorities().toArray(new String[permissions.getAuthorities().size()]), 
 					  AuthorizationResponse.RESPONSE_OK);
-	  }catch(AlfrescoDownException e){
-		  return new AuthorizationResponse(null, AuthorizationResponse.RESPONSE_UNREACHABLE);
-	  }
+    }catch(AlfrescoDownException e){
+      Logging.authorityConnectors.warn(e.getMessage(),e);
+      return new AuthorizationResponse(null, AuthorizationResponse.RESPONSE_UNREACHABLE);
+    }
   }
 
   @Override