1 package org.apache.turbine.services.xmlrpc.util; 2 3 18 19 import java.util.Vector ; 20 21 import org.apache.turbine.om.security.User; 22 import org.apache.turbine.services.security.TurbineSecurity; 23 import org.apache.turbine.util.TurbineException; 24 25 import org.apache.xmlrpc.AuthenticatedXmlRpcHandler; 26 27 43 public class AuthenticatedFileHandler 44 extends FileHandler 45 implements AuthenticatedXmlRpcHandler 46 { 47 50 public AuthenticatedFileHandler() 51 { 52 } 53 54 57 public Object execute(String method, Vector params, String username, String password) 58 throws TurbineException 59 { 60 Object obj = null; 61 62 User user = null; 64 user = TurbineSecurity.getAuthenticatedUser(username, password); 65 66 if (user != null) 67 { 68 if (method.equals("send")) 69 { 70 obj = new Boolean (this.send((String ) params.elementAt(0), 71 (String ) params.elementAt(1), 72 (String ) params.elementAt(2))); 73 } 74 75 if (method.equals("get")) 76 { 77 obj = this.get((String ) params.elementAt(0), 78 (String ) params.elementAt(1)); 79 } 80 81 if (method.equals("remove")) 82 { 83 AuthenticatedFileHandler.remove((String ) params.elementAt(0), 84 (String ) params.elementAt(1)); 85 obj = new Boolean ("true"); 86 } 87 } 88 else 89 { 90 obj = new Boolean ("false"); 91 } 92 93 return (Object ) obj; 94 } 95 } 96 | Popular Tags |