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
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
/* 
 * $Id$ 
 * 
 */ 
 
package com.roxen.roxen; 
 
/** 
 * A class representing the configuration of a virtual server in 
 * the Roxen server. 
 * 
 * @version     $Version$ 
 * @author      marcus 
 */ 
 
public class RoxenConfiguration { 
  /** 
   * Get the real path of a virtual file 
   * 
   * @param name The virtual file name 
   */ 
  public native String getRealPath(String filename, RoxenRequest id); 
 
  /** 
   * Gets the contents of a file 
   * 
   * @param name The name of the file 
   * @return File contents, or null if the file could not be read 
   */ 
  public native String getFileContents(String filename, RoxenRequest id); 
 
  /** 
   * Gets the mime type of a file 
   * 
   * @param name The name of the file 
   * @return The mime type of the file 
   */ 
  public native String getMimeType(String filename); 
 
  /** 
   * Get the current value of a global configuration variable 
   * 
   * @param  name  the internal name of the variable 
   * @return       the value of the variable 
   */ 
  public native Object query(String name); 
 
  /** 
   * Returns the URL path of the internal mount point 
   * for a specified module 
   * 
   * @param  m  the module 
   * @return    the URL path for the module's internal mount point 
   */ 
  public native String queryInternalLocation(Module m); 
 
  /** 
   * Get the current value of a string typed 
   * global configuration variable 
   * 
   * @param  name  the internal name of the variable 
   * @return       the value of the variable 
   */ 
  public String queryString(String name) 
  { 
    return (String)query(name); 
  } 
 
  /** 
   * Returns the URL path of the base for all 
   * internal mount points 
   * 
   * @return    the URL path for the base internal mount point 
   */ 
  public String queryInternalLocation() 
  { 
    return queryInternalLocation(null); 
  } 
 
  /** 
   * Returns a list of modules providing a particular service 
   * 
   * @return    the modules that provide this service 
   */ 
  public native Module[] getProviders(String provides); 
 
  /** 
   * Returns any module providing a particular service 
   * 
   * @return    the module that provide this service, or null 
   */ 
  public Module getProvider(String provides) 
  { 
    Module[] modules = getProviders(provides); 
    return (modules.length>0? modules[0] : null); 
  } 
 
}