001: // GeneralProp.java
002: // $Id: GeneralProp.java,v 1.20 2003/02/20 17:33:08 ylafon Exp $
003: // (c) COPYRIGHT MIT and INRIA, 1996.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.jigsaw.http;
007:
008: import org.w3c.tools.resources.Attribute;
009: import org.w3c.tools.resources.AttributeRegistry;
010: import org.w3c.tools.resources.BooleanAttribute;
011: import org.w3c.tools.resources.FileAttribute;
012: import org.w3c.tools.resources.IntegerAttribute;
013: import org.w3c.tools.resources.StringArrayAttribute;
014: import org.w3c.tools.resources.StringAttribute;
015:
016: import org.w3c.jigsaw.config.PropertySet;
017:
018: /**
019: * A wrapper class to give access to editable properties through a resource.
020: * This class allows to reuse entirely the generic resource editor to
021: * edit the properties of the server.
022: */
023:
024: class GeneralProp extends PropertySet {
025: private static final String title = "General properties";
026:
027: /*
028: * Attribute index - the URL rewriting patterns
029: */
030: protected static int ATTR_PORT = -1;
031:
032: static {
033: Class c = null;
034: Attribute a = null;
035:
036: try {
037: c = Class.forName("org.w3c.jigsaw.http.GeneralProp");
038: } catch (Exception ex) {
039: ex.printStackTrace();
040: System.exit(1);
041: }
042: // The server name:
043: a = new StringAttribute(httpd.SERVER_SOFTWARE_P, null,
044: Attribute.EDITABLE);
045: AttributeRegistry.registerAttribute(c, a);
046: // Is the file system case sensitive ?
047: a = new BooleanAttribute(httpd.FS_SENSITIVITY, null,
048: Attribute.EDITABLE);
049: AttributeRegistry.registerAttribute(c, a);
050: // The server root directory:
051: a = new FileAttribute(httpd.ROOT_P, null, Attribute.EDITABLE);
052: AttributeRegistry.registerAttribute(c, a);
053: // The full host name:
054: a = new StringAttribute(httpd.HOST_P, null, Attribute.EDITABLE);
055: AttributeRegistry.registerAttribute(c, a);
056: // The port number:
057: a = new IntegerAttribute(httpd.PORT_P, null, Attribute.EDITABLE);
058: ATTR_PORT = AttributeRegistry.registerAttribute(c, a);
059: // The root resource identifier:
060: a = new StringAttribute(httpd.ROOT_NAME_P, null,
061: Attribute.EDITABLE);
062: AttributeRegistry.registerAttribute(c, a);
063: // The list of public methods:
064: a = new StringArrayAttribute(httpd.PUBLIC_P, null,
065: Attribute.EDITABLE);
066: AttributeRegistry.registerAttribute(c, a);
067: // The trace flag:
068: a = new BooleanAttribute(httpd.TRACE_P, null,
069: Attribute.EDITABLE);
070: AttributeRegistry.registerAttribute(c, a);
071: // The documentation path:
072: a = new StringAttribute(httpd.DOCURL_P, null,
073: Attribute.EDITABLE);
074: AttributeRegistry.registerAttribute(c, a);
075: // The Chekpoint Resource URL:
076: a = new StringAttribute(httpd.CHECKURL_P, null,
077: Attribute.EDITABLE);
078: AttributeRegistry.registerAttribute(c, a);
079: //The Trash directory
080: a = new StringAttribute(httpd.TRASHDIR_P, null,
081: Attribute.EDITABLE);
082: AttributeRegistry.registerAttribute(c, a);
083: //The serializer class
084: a = new StringAttribute(httpd.SERIALIZER_CLASS_P, null,
085: Attribute.EDITABLE);
086: AttributeRegistry.registerAttribute(c, a);
087: // The URI display toggle when an error occur
088: a = new BooleanAttribute(httpd.DISPLAY_URL_ON_ERROR_P,
089: new Boolean(false), Attribute.EDITABLE);
090: AttributeRegistry.registerAttribute(c, a);
091: // The URI display toggle when an error occur
092: a = new BooleanAttribute(httpd.LENIENT_P, new Boolean(true),
093: Attribute.EDITABLE);
094: AttributeRegistry.registerAttribute(c, a);
095: }
096:
097: /**
098: * This property set's title.
099: * @return A String encoded title.
100: */
101:
102: public String getTitle() {
103: return title;
104: }
105:
106: /**
107: * Set value forwards the effectation to the properties.
108: * @param idx The attribute (property in that case) being set.
109: * @param value The new value for that property.
110: */
111:
112: public synchronized void setValue(int idx, Object value) {
113: // Check access (we don't care about side effects)
114: super .setValue(idx, value);
115: }
116:
117: GeneralProp(String name, httpd server) {
118: super(name, server);
119: }
120: }
|