1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
/* 
 * $Id$ 
 * 
 */ 
 
package com.roxen.roxen; 
 
/** 
 * An abstract adaptor class that provides default implementations for 
 * most methods in the <code>LocationModule</code> interface. 
 * <P> 
 * A module inheriting this class must either create a module variable 
 * <code>location</code> using <code>defvar</code>, or provide a different 
 * implementation of the <code>queryLocation</code> method. 
 * 
 * @see LocationModule 
 * @see Module 
 * 
 * @version     $Version$ 
 * @author      marcus 
 */ 
 
public abstract class AbstractLocationModule extends Module implements LocationModule { 
  /** 
   * Returns the URL path handled by this module. 
   * Per default, this is the contents of the module variable <code>location</code>. 
   * 
   * @return the path name 
   */ 
  public String queryLocation() 
  { 
    return queryString("location"); 
  } 
 
  /** 
   * List the contents of a directory. 
   * 
   * @param  f   the path of the directory relative to the location of 
   *             this module 
   * @param  id  the request object 
   * @return     a list of filenames, or <code>null</code> if no such 
   *             directory exists. 
   */ 
  public String[] findDir(String f, RoxenRequest id) 
  { 
    return null; 
  } 
 
  /** 
   * Get the real filename of a file. 
   * 
   * @param  f   the path of the file relative to the location of 
   *             this module 
   * @param  id  the request object 
   * @return     the path of the file in the host filesystem, or 
   *             <code>null</code> if this resource is not a real 
   *             file. 
   */ 
  public String realFile(String f, RoxenRequest id) 
  { 
    return null; 
  } 
 
  /** 
   * Get the attributes of a file or directory. 
   * The attributes are a set of 7 integers.  These are: <code>mode</code>, 
   * <code>size</code>, <code>atime</code>, <code>mtime</code>, 
   * <code>ctime</code>, <code>uid</code>, <code>gid</code>. 
   *  
   * @param  f   the path of the file or directory relative to the 
   *             location of this module 
   * @param  id  the request object 
   * @return     the attributes of this file or directory, or 
   *             <code>null</code> if this information is not available. 
   */ 
  public int[] statFile(String f, RoxenRequest id) 
  { 
    return null; 
  } 
 
}