// LoggingProp.java
// $Id: LoggingProp.java,v 1.10 2000/02/25 10:19:07 ylafon Exp $
// (c) COPYRIGHT MIT and INRIA, 1996.
// Please first read the full copyright statement in file COPYRIGHT.html

package org.w3c.jigsaw.http;

import java.io.* ;
import java.util.* ;

import org.w3c.jigsaw.config.*;
import org.w3c.tools.resources.*;

/**
 * A wrapper class to give access to editable properties through a resource.
 * This class allows to reuse entirely the generic resource editor to
 * edit the properties of the server.
 */

class LoggingProp extends PropertySet {
    private static String title = "Logging properties";

    static {
	Class     c = null;
	Attribute a = null;

	try {
	    c = Class.forName("org.w3c.jigsaw.http.LoggingProp");
	} catch (Exception ex) {
	    ex.printStackTrace();
	    System.exit(1);
	}
	// The class of the logger:
	a = new ClassAttribute(httpd.LOGGER_P
			       , null
			       , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
	// The error log file:
	a = new FileAttribute(CommonLogger.ERRLOGNAME_P
			      , null
			      , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
	// The normal log:
	a = new FileAttribute(CommonLogger.LOGNAME_P
			      , null
			      , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
	// The trace log:
	a = new FileAttribute(CommonLogger.TRACELOGNAME_P
			      , null
			      , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
	// The log dir:
	a = new FileAttribute(CommonLogger.LOGDIRNAME_P
			      , null
			      , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
	// The rotation level
	a = new IntegerAttribute(CommonLogger.ROTATE_LEVEL_P
				 , new Integer(0)
				 , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
    	// The log buffer size:
	a = new IntegerAttribute(CommonLogger.BUFSIZE_P
				 , new Integer(8192)
				 , Attribute.EDITABLE);
	AttributeRegistry.registerAttribute(c, a);
    }

    /**
     * Get this property set title.
     * @return A String encoded title.
     */

    public String getTitle() {
	return title;
    }

    LoggingProp(String name, httpd server) {
	super(name, server);
    }
}

