Source code: jreceiver/common/rpc/xmlrpc/MethodsImpl.java
1 /* $Header: /cvsroot/jreceiver/jreceiver/src/jreceiver/common/rpc/xmlrpc/MethodsImpl.java,v 1.2 2002/07/31 11:29:42 reedesau Exp $ */
2
3 package jreceiver.common.rpc.xmlrpc;
4
5 import java.util.Hashtable;
6 import java.util.Vector;
7 import java.net.URL;
8
9 //import org.apache.commons.logging.*;
10
11 import jreceiver.common.rec.Key;
12 import jreceiver.common.rec.Rec;
13 import jreceiver.common.rec.RecException;
14 import jreceiver.common.rec.security.*;
15 import jreceiver.common.rpc.Methods;
16 import jreceiver.common.rpc.RpcException;
17
18 /**
19 * Method-definition queries and updates via XML-RPC
20 * <p>
21 *
22 * @author Reed Esau
23 * @version $Revision: 1.2 $ $Date: 2002/07/31 11:29:42 $
24 */
25 public class MethodsImpl extends ServerTableImpl implements Methods {
26
27 /**
28 * ctor for this implementation
29 */
30 public MethodsImpl(URL remote_host, User user)
31 throws RpcException {
32 super(HANDLER_NAME, remote_host, user);
33 }
34
35
36 /**
37 * restore a rec object from hashtable form
38 */
39 public Rec reconstituteRec(Hashtable hash) throws RecException {
40 return new MethodRec(hash);
41 }
42
43 /**
44 * restore a key object from hashtable form
45 */
46 public Key reconstituteKey(Hashtable hash) {
47 return new MethodKey(hash);
48 }
49
50 /**
51 * Obtain an ordered range of keys available for assignment to the specified role
52 */
53 public Vector getKeysAvailable(String role_id, String order_by, int rec_offset, int rec_count)
54 throws RpcException {
55 if (log.isDebugEnabled())
56 log.debug("getKeysAvailable");
57 Vector params = new Vector();
58 params.add( role_id != null ? role_id : "");
59 params.add( order_by != null ? order_by : "");
60 params.add( new Integer(rec_offset) );
61 params.add( new Integer(rec_count) );
62 Vector keys = (Vector)execute(GET_KEYS_AVAILABLE, params);
63 return reconstituteKeys(keys);
64 }
65
66 /**
67 * logging sink
68 */
69 //protected static Log log = LogFactory.getLog(Methods.class);
70 }
71 /*
72 JRECEIVER MODIFIED BSD LICENSE
73
74 Copyright (c) 2002, Reed Esau (reed.esau@pobox.com) All rights reserved.
75
76 Redistribution and use in source and binary forms, with or without
77 modification, are permitted provided that the following conditions are
78 met:
79
80 Redistributions of source code must retain the above copyright notice,
81 this list of conditions and the following disclaimer.
82
83 Redistributions in binary form must reproduce the above copyright notice,
84 this list of conditions and the following disclaimer in the documentation
85 and/or other materials provided with the distribution.
86
87 Neither the name of the JReceiver Project
88 (http://jreceiver.sourceforge.net) nor the names of its contributors may
89 be used to endorse or promote products derived from this software without
90 specific prior written permission.
91
92 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
93 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
94 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
96 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
97 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
98 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
99 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
100 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
101 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
102 POSSIBILITY OF SUCH DAMAGE.
103 */
104