%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.xmlrpc.util.AuthenticatedFileHandler |
|
|
1 | package org.apache.turbine.services.xmlrpc.util; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
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 | /** |
|
28 | * An authenticated Handler for use with the XML-RPC service that will deal |
|
29 | * with clients sending file to the server (Turbine application) |
|
30 | * and clients getting files from the server (Turbine application). |
|
31 | * |
|
32 | * usage in TurbineResources.properties is: |
|
33 | * services.XmlRpcService.handler.file = org.apache.turbine.services.xmlrpc.util.AuthenticatedFileHandler |
|
34 | * |
|
35 | * See the FileHandler class for further documentation. |
|
36 | * |
|
37 | * @author <a href="mailto:john@zenplex.com">John Thorhauer</a> |
|
38 | * @version $Id: AuthenticatedFileHandler.java 280284 2005-09-12 07:57:42Z henning $ |
|
39 | * @deprecated This is not scope of the Service itself but of an |
|
40 | * application which uses the service. This class shouldn't |
|
41 | * be part of Turbine but of an addon application. |
|
42 | */ |
|
43 | public class AuthenticatedFileHandler |
|
44 | extends FileHandler |
|
45 | implements AuthenticatedXmlRpcHandler |
|
46 | { |
|
47 | /** |
|
48 | * Default Constructor |
|
49 | */ |
|
50 | public AuthenticatedFileHandler() |
|
51 | 0 | { |
52 | 0 | } |
53 | ||
54 | /** |
|
55 | * Handles all requests for an Authenticated file transfer. |
|
56 | */ |
|
57 | public Object execute(String method, Vector params, String username, String password) |
|
58 | throws TurbineException |
|
59 | { |
|
60 | 0 | Object obj = null; |
61 | ||
62 | // Authenticate the user and get the object. |
|
63 | 0 | User user = null; |
64 | 0 | user = TurbineSecurity.getAuthenticatedUser(username, password); |
65 | ||
66 | 0 | if (user != null) |
67 | { |
|
68 | 0 | if (method.equals("send")) |
69 | { |
|
70 | // JDK 1.3 has no Boolean.valueOf(boolean) |
|
71 | 0 | obj = new Boolean(this.send((String) params.elementAt(0), |
72 | (String) params.elementAt(1), |
|
73 | (String) params.elementAt(2))); |
|
74 | } |
|
75 | ||
76 | 0 | if (method.equals("get")) |
77 | { |
|
78 | 0 | obj = this.get((String) params.elementAt(0), |
79 | (String) params.elementAt(1)); |
|
80 | } |
|
81 | ||
82 | 0 | if (method.equals("remove")) |
83 | { |
|
84 | 0 | AuthenticatedFileHandler.remove((String) params.elementAt(0), |
85 | (String) params.elementAt(1)); |
|
86 | 0 | obj = Boolean.TRUE; |
87 | } |
|
88 | } |
|
89 | else |
|
90 | { |
|
91 | 0 | obj = Boolean.FALSE; |
92 | } |
|
93 | ||
94 | 0 | return (Object) obj; |
95 | } |
|
96 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |