KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > quercus > module > AbstractQuercusModule


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.quercus.module;
31
32 import com.caucho.quercus.env.StringValue;
33 import com.caucho.quercus.env.StringValueImpl;
34 import com.caucho.quercus.env.Value;
35
36 import java.util.HashMap JavaDoc;
37 import java.util.Map JavaDoc;
38
39 /**
40  * Represents a quercus module.
41  */

42 public class AbstractQuercusModule implements QuercusModule {
43   protected static final int PHP_INI_USER = 1;
44   protected static final int PHP_INI_PERDIR = 2;
45   protected static final int PHP_INI_SYSTEM = 4;
46   protected static final int PHP_INI_ALL = 7;
47
48   private static final HashMap JavaDoc<String JavaDoc,Value> NULL_MAP
49     = new HashMap JavaDoc<String JavaDoc,Value>();
50
51   private static final HashMap JavaDoc<String JavaDoc,StringValue> NULL_INI_MAP
52     = new HashMap JavaDoc<String JavaDoc,StringValue>();
53
54   public Map JavaDoc<String JavaDoc,Value> getConstMap()
55   {
56     return NULL_MAP;
57   }
58
59   /**
60    * Returns the default quercus.ini values.
61    */

62   public Map JavaDoc<String JavaDoc,StringValue> getDefaultIni()
63   {
64     return NULL_INI_MAP;
65   }
66
67   /**
68    * Returns the extensions loaded by the module.
69    */

70   public String JavaDoc []getLoadedExtensions()
71   {
72     return new String JavaDoc[0];
73   }
74
75   /**
76    * Adds a default ini.
77    */

78   protected static void addIni(Map JavaDoc<String JavaDoc,StringValue> map,
79                                String JavaDoc name,
80                                String JavaDoc value,
81                                int code)
82   {
83     if (value != null)
84       map.put(name, new StringValueImpl(value));
85     else
86       map.put(name, null);
87   }
88 }
89
90
Popular Tags