01: // ProxyDispatcherProp.java
02: // $Id: ProxyDispatcherProp.java,v 1.6 2000/08/16 21:37:43 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1998.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigsaw.proxy;
07:
08: import java.io.File;
09:
10: import org.w3c.tools.resources.Attribute;
11: import org.w3c.tools.resources.AttributeHolder;
12: import org.w3c.tools.resources.AttributeRegistry;
13: import org.w3c.tools.resources.BooleanAttribute;
14: import org.w3c.tools.resources.StringAttribute;
15:
16: import org.w3c.jigsaw.config.PropertySet;
17:
18: import org.w3c.jigsaw.http.httpd;
19:
20: import org.w3c.www.protocol.http.proxy.ProxyDispatcher;
21:
22: /**
23: * @version $Revision: 1.6 $
24: * @author Benoît Mahé (bmahe@w3.org)
25: */
26: public class ProxyDispatcherProp extends PropertySet {
27: private static String title = "Proxy dispatcher properties";
28:
29: protected static int ATTR_RULES = -1;
30:
31: protected static int ATTR_DEBUG = -1;
32:
33: static {
34: Class c = null;
35: Attribute a = null;
36:
37: try {
38: c = Class
39: .forName("org.w3c.jigsaw.proxy.ProxyDispatcherProp");
40: } catch (Exception ex) {
41: ex.printStackTrace();
42: System.exit(1);
43: }
44:
45: //Our proxy rules attribute:
46: a = new StringAttribute(ProxyDispatcher.RULE_P, null,
47: Attribute.EDITABLE);
48: ATTR_RULES = AttributeRegistry.registerAttribute(c, a);
49: //Our debug Attribute
50: a = new BooleanAttribute(ProxyDispatcher.DEBUG_P,
51: Boolean.FALSE, Attribute.EDITABLE);
52: ATTR_DEBUG = AttributeRegistry.registerAttribute(c, a);
53: //Our debug Attribute
54: a = new BooleanAttribute(
55: ProxyDispatcher.CHECK_RULES_LAST_MODIFIED_P,
56: Boolean.FALSE, Attribute.EDITABLE);
57: AttributeRegistry.registerAttribute(c, a);
58: }
59:
60: /**
61: * Get this property set title.
62: * @return A String encoded title.
63: */
64: public String getTitle() {
65: return title;
66: }
67:
68: private String getDefaultRulesLocation() {
69: File config = server.getConfigDirectory();
70: String loc = config.getAbsolutePath() + "/proxy.rls";
71: return loc;
72: }
73:
74: public String getRulesLocation() {
75: return (String) getValue(ATTR_RULES, null);
76: }
77:
78: public boolean getDegugFlag() {
79: return getBoolean(ATTR_DEBUG, false);
80: }
81:
82: public ProxyDispatcherProp(String name, httpd server) {
83: super(name, server);
84: if (getRulesLocation() == null)
85: setValue(ATTR_RULES, getDefaultRulesLocation());
86: }
87: }
|