Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jreceiver/common/rpc/xmlrpc/MfilesImpl.java


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