tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/xml XmlMapper.java
Date Sun, 13 Feb 2000 06:22:49 GMT
akv         00/02/12 22:22:49

  Modified:    src/share/org/apache/tomcat/util/xml XmlMapper.java
  Log:
  changes to use the logger.
  
  Revision  Changes    Path
  1.3       +34 -61    jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java
  
  Index: XmlMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/xml/XmlMapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlMapper.java	2000/02/13 04:03:44	1.2
  +++ XmlMapper.java	2000/02/13 06:22:49	1.3
  @@ -13,7 +13,11 @@
   import org.xml.sax.helpers.*;
   import org.w3c.dom.*;
   
  -/** SAX Handler - it will read the XML and construct java objects
  +import org.apache.tomcat.logging.Logger;
  +
  +/** 
  + * SAX Handler - it will read the XML and construct java objects
  + *
    * @author costin@dnt.ro
    */
   public class XmlMapper implements DocumentHandler, SaxContext, EntityResolver, DTDHandler
 {
  @@ -139,8 +143,8 @@
   	return debug;
       }
       
  -    public void log( String msg ) {
  -	System.out.println("SH: " + msg );
  +    public void log(String msg) {
  +	Logger.log("STARTUP_LOG", msg);
       }
   
       /** read an XML file, construct and return the object hierarchy
  @@ -341,77 +345,46 @@
   
   //-------------------- "Core" actions --------------------
   
  -/**
  - * Create a new object.
  +/** Create an object
    */
   class ObjectCreate extends XmlAction {
       String className;
  -    String attribute;
  +    String attrib;
       
  -    /**
  -     * Create a new object of the specified class only.
  -     *
  -     * @param className Class name of the object to be created
  -     */
  -    public ObjectCreate(String className) {
  -	this.className = className;
  +    public ObjectCreate(String classN) {
  +	className=classN;
       }
   
  -    /**
  -     * Create an object of a class whose name is stored in the specified
  -     * attribute (if present), or defaults to the specified class name.
  -     *
  -     * @param className Default class name to use
  -     * @param attribute Name of the attribute containing the override class
  -     */
  -    public ObjectCreate(String className, String attribute) {
  -	this.className=className;
  -	this.attribute=attribute;
  +    /** Create an object based on an attribute of the current
  +	tag
  +    */
  +    public ObjectCreate(String classN, String attrib) {
  +	className=classN;
  +	this.attrib=attrib;
       }
       
  -    /**
  -     * Create an object of the specified (or override) class.
  -     *
  -     * @param ctx Context in which this action takes place
  -     */
       public void start( SaxContext ctx) throws Exception {
  -
  -	// Initialize our local environment
  -	Stack st = ctx.getObjectStack();
  -	int top = ctx.getTagCount()-1;
  -	String tag = ctx.getTag(top);
  -	String className = this.className;
  -
  -	// Override the default class name if specified
  -	if (attribute != null) {
  -	    AttributeList attributes = ctx.getAttributeList(top);
  -	    String value = attributes.getValue(attribute);
  -	    if (value != null)
  -		className = value;
  -	}
  -
  -	// Create a new instance and push it on the stack
  -	Class c = Class.forName( className );
  -	Object o = c.newInstance();
  +	Stack st=ctx.getObjectStack();
  +	int top=ctx.getTagCount()-1;
  +	String tag=ctx.getTag(top);
  +	String classN=className;
  +	
  +	if( attrib!=null) {
  +	    AttributeList attributes = ctx.getAttributeList( top );
  +	    classN= attributes.getValue(attrib);
  +	}
  +	Class c=Class.forName( classN );
  +	Object o=c.newInstance();
   	st.push(o);
  -	if (ctx.getDebug() > 0)
  -	    ctx.log("new "  + attribute + " " + className + " "  + tag  +
  -		    " " + o);
  +	if( ctx.getDebug() > 0 ) ctx.log("new "  + attrib + " " + classN + " "  + tag  + "
" + o);
       }
       
  -    /**
  -     * Clean up by popping the object we created off of the stack.
  -     *
  -     * @param ctx Context in which this action takes place
  -     */
       public void cleanup( SaxContext ctx) {
  -	Stack st = ctx.getObjectStack();
  -	String tag = ctx.getTag(ctx.getTagCount()-1);
  -	Object o = st.pop();
  -	if (ctx.getDebug() > 0)
  -	    ctx.log("pop " + tag + " " + o.getClass().getName() + ": " + o);
  +	Stack st=ctx.getObjectStack();
  +	String tag=ctx.getTag(ctx.getTagCount()-1);
  +	Object o=st.pop();
  +	if( ctx.getDebug() > 0 ) ctx.log("pop " + tag + " " + o.getClass().getName() + ": "
+ o);
       }
  -
   }
   
   
  @@ -487,7 +460,7 @@
   	st.push( obj ); // put it back
   
   	String parentC=parent.getClass().getName();
  -	if( ctx.getDebug() > 0 ) ctx.log("Calling " + parentC + "." + parentM  +" " + obj 
);
  +	ctx.log("Calling " + parentC + "." + parentM  +" " + obj  );
   
   	Class params[]=new Class[1];
   	if( paramT==null) {
  
  
  

Mime
View raw message