Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv6675/src/org/webmacro Modified Files: Broker.java Context.java ContextException.java ContextTool.java FastWriter.java Filter.java FilterTool.java Flags.java InitException.java InvalidContextException.java InvalidTypeException.java Log.java Macro.java NotFoundException.java PropertyException.java Provider.java ResourceException.java RethrowableException.java RethrowableRuntimeException.java Template.java TemplateException.java TemplateVisitor.java UnsettableException.java Visitable.java WM.java WMConstants.java WebMacro.java WebMacroException.java WebMacroRuntimeException.java Log Message: If this doesn't drive our SF "activity" stats through the roof, I don't know what will. Mass re-formatting of all code, following (to the best of my interpertation) the Sun (w/ jakarta tweaks) coding style guidelines defined here: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html and here: http://jakarta.apache.org/turbine/common/code-standards.html I did this reformatting with IDEA 3.0.5, and I am going to commit the style configuration for IDEA (if I can find it). Index: Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Broker.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Broker.java 3 Apr 2003 18:11:19 -0000 1.34 --- Broker.java 12 Jun 2003 00:47:43 -0000 1.35 *************** *** 20,23 **** --- 20,29 ---- package org.webmacro; + import org.webmacro.engine.*; + import org.webmacro.profile.Profile; + import org.webmacro.profile.ProfileCategory; + import org.webmacro.profile.ProfileSystem; + import org.webmacro.util.*; + import java.io.*; [...1690 lines suppressed...] ! String line; ! while ((line = in.readLine()) != null) ! { ! int space = line.indexOf(' '); ! String type = line.substring(0, space); ! String name = line.substring(space + 1); ! System.out.println("broker.get(\"" + type + "\", \"" ! + name + "\"):"); ! Object o = broker.get(type, name); ! System.out.println("RESULT:"); ! System.out.println(o.toString()); ! } ! } ! catch (Exception e) ! { ! e.printStackTrace(); ! } ! } } Index: Context.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Context.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Context.java 21 May 2003 23:01:46 -0000 1.60 --- Context.java 12 Jun 2003 00:47:43 -0000 1.61 *************** *** 24,32 **** package org.webmacro; import java.util.*; - import java.lang.reflect.*; - import org.webmacro.util.*; - import org.webmacro.profile.*; - import org.webmacro.engine.*; /** --- 24,36 ---- [...1588 lines suppressed...] ! public final void put (Object o, char c) ! { ! put(o, new Character(c)); ! } ! ! public final void put (Object o, float f) ! { ! put(o, new Float(f)); ! } ! ! public final void put (Object o, double d) ! { ! put(o, new Double(d)); ! } ! ! public final void put (Object o, boolean b) ! { ! put(o, new Boolean(b)); ! } } Index: ContextException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/ContextException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ContextException.java 11 Jun 2002 17:43:20 -0000 1.5 --- ContextException.java 12 Jun 2003 00:47:44 -0000 1.6 *************** *** 29,45 **** * was some problem with the way the Context was used. */ ! public class ContextException extends WebMacroException { ! public ContextException() { ! super(); ! } ! public ContextException(String reason) { ! super(reason); ! } ! public ContextException(String reason, Throwable e) { ! super(reason, e); ! } } --- 29,49 ---- * was some problem with the way the Context was used. */ ! public class ContextException extends WebMacroException ! { ! public ContextException () ! { ! super(); ! } ! public ContextException (String reason) ! { ! super(reason); ! } ! public ContextException (String reason, Throwable e) ! { ! super(reason, e); ! } } Index: ContextTool.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/ContextTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ContextTool.java 11 Jun 2002 17:43:20 -0000 1.7 --- ContextTool.java 12 Jun 2003 00:47:44 -0000 1.8 *************** *** 28,48 **** * with the generation of views. */ ! public interface ContextTool { ! /** ! * A new tool object will be instantiated per-request by calling ! * this method. A ContextTool is effectively a factory used to ! * create objects for use in templates. Some tools may simply return ! * themselves from this method; others may instantiate new objects ! * to hold the per-request state. ! */ ! public Object init(Context c) throws PropertyException; ! /** ! * At the end of processing this method will be called to ! * return the object generated by init(), in case it needs ! * to be recycled or otherwise cleaned up. ! */ ! public void destroy(Object o); } --- 28,49 ---- * with the generation of views. */ ! public interface ContextTool ! { ! /** ! * A new tool object will be instantiated per-request by calling ! * this method. A ContextTool is effectively a factory used to ! * create objects for use in templates. Some tools may simply return ! * themselves from this method; others may instantiate new objects ! * to hold the per-request state. ! */ ! public Object init (Context c) throws PropertyException; ! /** ! * At the end of processing this method will be called to ! * return the object generated by init(), in case it needs ! * to be recycled or otherwise cleaned up. ! */ ! public void destroy (Object o); } Index: FastWriter.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/FastWriter.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FastWriter.java 17 Dec 2002 06:45:29 -0000 1.28 --- FastWriter.java 12 Jun 2003 00:47:44 -0000 1.29 *************** *** 24,30 **** package org.webmacro; - import java.io.*; - import java.util.*; - import org.webmacro.util.ByteBufferOutputStream; import org.webmacro.util.Encoder; --- 24,27 ---- *************** *** 32,35 **** [...1073 lines suppressed...] ! { ! obj = _pool.remove(0); ! _size--; ! } ! } ! return obj; ! } ! public void put (Object fw) ! { ! if (_size < _maxSize) ! { // not rqrd to be t.s. perfect ! synchronized (_pool) ! { ! _pool.add(fw); ! _size++; ! } ! } ! } } Index: Filter.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Filter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Filter.java 11 Jun 2002 17:43:20 -0000 1.5 --- Filter.java 12 Jun 2003 00:47:44 -0000 1.6 *************** *** 35,63 **** * then it must determine how $Customer.Name is to be handled. */ ! public interface Filter { ! /** ! * Return the Filter which should be used to handle a ! * sub-property. Three options are available here: return a ! * null to indicate no filtering, return self to indicate ! * the same filtering, or return a different Filter to ! * indicate different handling for the sub-property. ! * @param name the name of the sub-property to be filtered ! * @return the Filter to be used for the sub-property, or null ! */ ! public Filter getFilter(String name); ! /** ! * Instantiate a new filter. There are several options for the ! * return value of this method: return null to drop the Macro ! * from the input stream entirely; return the Macro itself to ! * avoid filtering this particular case, or return some new ! * Macro to replace the supplied Macro. The expectation is that ! * the returned Macro will execute the original and apply some ! * post-processing to it. ! * @param source the Macro which this filter will post-process ! * @return the Macro wrapper to be executed in place of source ! */ ! public Macro getMacro(Macro source); } --- 35,64 ---- * then it must determine how $Customer.Name is to be handled. */ ! public interface Filter ! { ! /** ! * Return the Filter which should be used to handle a ! * sub-property. Three options are available here: return a ! * null to indicate no filtering, return self to indicate ! * the same filtering, or return a different Filter to ! * indicate different handling for the sub-property. ! * @param name the name of the sub-property to be filtered ! * @return the Filter to be used for the sub-property, or null ! */ ! public Filter getFilter (String name); ! /** ! * Instantiate a new filter. There are several options for the ! * return value of this method: return null to drop the Macro ! * from the input stream entirely; return the Macro itself to ! * avoid filtering this particular case, or return some new ! * Macro to replace the supplied Macro. The expectation is that ! * the returned Macro will execute the original and apply some ! * post-processing to it. ! * @param source the Macro which this filter will post-process ! * @return the Macro wrapper to be executed in place of source ! */ ! public Macro getMacro (Macro source); } Index: FilterTool.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/FilterTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FilterTool.java 11 Jun 2002 17:43:20 -0000 1.3 --- FilterTool.java 12 Jun 2003 00:47:44 -0000 1.4 *************** *** 35,63 **** * then it must determine how $Customer.Name is to be handled. */ ! public interface FilterTool { ! /** ! * Return the FilterTool which should be used to handle a ! * sub-property. Three options are available here: return a ! * null to indicate no filtering, return self to indicate ! * the same filtering, or return a different FilterTool to ! * indicate different handling for the sub-property. ! * @param name the name of the sub-property to be filtered ! * @return the FilterTool to be used for the sub-property, or null ! */ ! public FilterTool getFilterTool(String name); ! /** ! * Instantiate a new filter. There are several options for the ! * return value of this method: return null to drop the Macro ! * from the input stream entirely; return the Macro itself to ! * avoid filtering this particular case, or return some new ! * Macro to replace the supplied Macro. The expectation is that ! * the returned Macro will execute the original and apply some ! * post-processing to it. ! * @param source the Macro which this filter will post-process ! * @return the Macro wrapper to be executed in place of source ! */ ! public Macro getFilter(Macro source); } --- 35,64 ---- * then it must determine how $Customer.Name is to be handled. */ ! public interface FilterTool ! { ! /** ! * Return the FilterTool which should be used to handle a ! * sub-property. Three options are available here: return a ! * null to indicate no filtering, return self to indicate ! * the same filtering, or return a different FilterTool to ! * indicate different handling for the sub-property. ! * @param name the name of the sub-property to be filtered ! * @return the FilterTool to be used for the sub-property, or null ! */ ! public FilterTool getFilterTool (String name); ! /** ! * Instantiate a new filter. There are several options for the ! * return value of this method: return null to drop the Macro ! * from the input stream entirely; return the Macro itself to ! * avoid filtering this particular case, or return some new ! * Macro to replace the supplied Macro. The expectation is that ! * the returned Macro will execute the original and apply some ! * post-processing to it. ! * @param source the Macro which this filter will post-process ! * @return the Macro wrapper to be executed in place of source ! */ ! public Macro getFilter (Macro source); } Index: Flags.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Flags.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Flags.java 11 Jun 2002 17:43:20 -0000 1.3 --- Flags.java 12 Jun 2003 00:47:44 -0000 1.4 *************** *** 39,59 **** * sources with these constants set to "true" first. */ ! public final class Flags { ! /** ! * Nobody is allowed to create one ! */ ! private Flags() { ! } ! /** ! * Use debug statements in performance critical code? ! */ ! public static final boolean DEBUG = false; ! /** ! * Use in profiling statements in performance critical code? ! */ ! public static final boolean PROFILE = true; } --- 39,61 ---- * sources with these constants set to "true" first. */ ! public final class Flags ! { ! /** ! * Nobody is allowed to create one ! */ ! private Flags () ! { ! } ! /** ! * Use debug statements in performance critical code? ! */ ! public static final boolean DEBUG = false; ! /** ! * Use in profiling statements in performance critical code? ! */ ! public static final boolean PROFILE = true; } Index: InitException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/InitException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** InitException.java 11 Jun 2002 17:43:20 -0000 1.5 --- InitException.java 12 Jun 2003 00:47:44 -0000 1.6 *************** *** 28,39 **** * able to initialize itself. */ ! public class InitException extends WebMacroException { ! public InitException(String reason) { ! super(reason); ! } ! public InitException(String reason, Throwable e) { ! super(reason, e); ! } } --- 28,42 ---- * able to initialize itself. */ ! public class InitException extends WebMacroException ! { ! public InitException (String reason) ! { ! super(reason); ! } ! public InitException (String reason, Throwable e) ! { ! super(reason, e); ! } } Index: InvalidContextException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/InvalidContextException.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** InvalidContextException.java 11 Jun 2002 17:43:20 -0000 1.7 --- InvalidContextException.java 12 Jun 2003 00:47:44 -0000 1.8 *************** *** 28,36 **** * the macro required in order to write or evaluate itself. */ ! public class InvalidContextException extends PropertyException { ! public InvalidContextException(String reason) { ! super(reason); ! } } --- 28,38 ---- * the macro required in order to write or evaluate itself. */ ! public class InvalidContextException extends PropertyException ! { ! public InvalidContextException (String reason) ! { ! super(reason); ! } } Index: InvalidTypeException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/InvalidTypeException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InvalidTypeException.java 11 Jun 2002 17:43:20 -0000 1.3 --- InvalidTypeException.java 12 Jun 2003 00:47:44 -0000 1.4 *************** *** 28,35 **** * or otherwise invalid. */ ! public class InvalidTypeException extends WebMacroException { ! public InvalidTypeException(String reason) { ! super(reason); ! } } --- 28,37 ---- * or otherwise invalid. */ ! public class InvalidTypeException extends WebMacroException ! { ! public InvalidTypeException (String reason) ! { ! super(reason); ! } } Index: Log.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Log.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Log.java 10 Nov 2002 20:35:08 -0000 1.7 --- Log.java 12 Jun 2003 00:47:44 -0000 1.8 *************** *** 31,103 **** * you must ask the Logmanager or a log instance. */ ! public interface Log { ! /** ! * Debug messages are incidental programmer notes which should ! * not be enabled in a production system. They are useful only ! * during development. ! */ ! public void debug(String msg, Throwable e); ! /** ! * A shortform for debug(msg,null) ! */ ! public void debug(String msg); ! /** ! * Info is fairly unimportant information about routine processing ! * within the system. They may be interesting on a production ! * system, but also can typically be ignored. ! */ ! public void info(String msg); ! /** ! * Notices are important information about routine processing ! * within the system. For example, startup and shutdown messages. ! * They are likely interesting to people running a production ! * system since they provide timestamps for important events. ! */ ! public void notice(String msg); ! /** ! * Warnings are messages outlining unexpected non-routine events ! * within the system. They may indicate larger problems, but in ! * and of themselves refer to problems the system is capable of ! * handling on its own. On a correctly functioning production ! * system you would expect to see only a few warnings. ! */ ! public void warning(String msg, Throwable e); ! /** ! * A shortform for debug(msg,null) ! */ ! public void warning(String msg); ! /** ! * A shortform for debug(msg,null) ! */ ! public void error(String msg); ! /** ! * An error is a major failure within the system. Typically it is ! * something which cannot easily be handled by the system. On a ! * correctly functioning production system you would not expect ! * to see any error messages. ! */ ! public void error(String msg, Throwable e); ! /** ! * Ask the log system if it wants these kinds of log messages. ! * This is because the overhead of creating log messages is high, ! * even if we're not going to log them, because it usually involves ! * several string concatenations. */ ! public boolean loggingDebug(); ! public boolean loggingInfo(); ! public boolean loggingNotice(); ! public boolean loggingWarning(); } --- 31,104 ---- * you must ask the Logmanager or a log instance. */ ! public interface Log ! { ! /** ! * Debug messages are incidental programmer notes which should ! * not be enabled in a production system. They are useful only ! * during development. ! */ ! public void debug (String msg, Throwable e); ! /** ! * A shortform for debug(msg,null) ! */ ! public void debug (String msg); ! /** ! * Info is fairly unimportant information about routine processing ! * within the system. They may be interesting on a production ! * system, but also can typically be ignored. ! */ ! public void info (String msg); ! /** ! * Notices are important information about routine processing ! * within the system. For example, startup and shutdown messages. ! * They are likely interesting to people running a production ! * system since they provide timestamps for important events. ! */ ! public void notice (String msg); ! /** ! * Warnings are messages outlining unexpected non-routine events ! * within the system. They may indicate larger problems, but in ! * and of themselves refer to problems the system is capable of ! * handling on its own. On a correctly functioning production ! * system you would expect to see only a few warnings. ! */ ! public void warning (String msg, Throwable e); ! /** ! * A shortform for debug(msg,null) ! */ ! public void warning (String msg); ! /** ! * A shortform for debug(msg,null) ! */ ! public void error (String msg); ! /** ! * An error is a major failure within the system. Typically it is ! * something which cannot easily be handled by the system. On a ! * correctly functioning production system you would not expect ! * to see any error messages. ! */ ! public void error (String msg, Throwable e); ! /** ! * Ask the log system if it wants these kinds of log messages. ! * This is because the overhead of creating log messages is high, ! * even if we're not going to log them, because it usually involves ! * several string concatenations. */ ! public boolean loggingDebug (); ! public boolean loggingInfo (); ! public boolean loggingNotice (); ! public boolean loggingWarning (); } Index: Macro.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Macro.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Macro.java 11 Jun 2002 17:43:20 -0000 1.7 --- Macro.java 12 Jun 2003 00:47:44 -0000 1.8 *************** *** 24,28 **** package org.webmacro; ! import java.io.*; /** --- 24,28 ---- package org.webmacro; ! import java.io.IOException; /** *************** *** 30,52 **** * have this as their supertype. */ ! public interface Macro { ! /** ! * Interpret the directive and write it out, using the values in ! * the supplied context as appropriate. ! * <p> ! * @exception PropertyException if required data was missing from context ! * @exception IOException if we could not successfully write to out ! */ ! public void write(FastWriter out, Context context) ! throws PropertyException, IOException; ! /** ! * same as out but returns a String ! * <p> ! * @exception PropertyException if required data was missing from context ! */ ! public Object evaluate(Context context) ! throws PropertyException; } --- 30,53 ---- * have this as their supertype. */ ! public interface Macro ! { ! /** ! * Interpret the directive and write it out, using the values in ! * the supplied context as appropriate. ! * <p> ! * @exception PropertyException if required data was missing from context ! * @exception IOException if we could not successfully write to out ! */ ! public void write (FastWriter out, Context context) ! throws PropertyException, IOException; ! /** ! * same as out but returns a String ! * <p> ! * @exception PropertyException if required data was missing from context ! */ ! public Object evaluate (Context context) ! throws PropertyException; } Index: NotFoundException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/NotFoundException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NotFoundException.java 11 Jun 2002 17:43:20 -0000 1.5 --- NotFoundException.java 12 Jun 2003 00:47:44 -0000 1.6 *************** *** 27,38 **** * You asked for something that is not currently available. */ ! public class NotFoundException extends ResourceException { ! public NotFoundException(String reason, Exception e) { ! super(reason, e); ! } ! public NotFoundException(String reason) { ! super(reason); ! } } --- 27,41 ---- * You asked for something that is not currently available. */ ! public class NotFoundException extends ResourceException ! { ! public NotFoundException (String reason, Exception e) ! { ! super(reason, e); ! } ! public NotFoundException (String reason) ! { ! super(reason); ! } } Index: PropertyException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/PropertyException.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PropertyException.java 20 Dec 2002 02:25:24 -0000 1.16 --- PropertyException.java 12 Jun 2003 00:47:44 -0000 1.17 *************** *** 39,68 **** * @version 27-07-2002 */ ! public class PropertyException extends ContextException { private String _message = null; ! public PropertyException( String reason ) { ! super( reason ); ! } ! public PropertyException( String reason, Throwable e ) { ! super( reason, e ); ! } ! public PropertyException( String reason, Throwable e, String contextLocation ) { ! super( reason, e ); ! setContextLocation( contextLocation ); ! } ! public void setMessage (String message) { _message = message; } ! public String getMessage() { ! if (_message == null) { return super.getMessage(); ! } else { String msg = _message; ! if ( getContextLocation() != null && msg != null ) { msg += " at " + getContextLocation(); } --- 39,78 ---- * @version 27-07-2002 */ ! public class PropertyException extends ContextException ! { private String _message = null; ! public PropertyException (String reason) ! { ! super(reason); ! } ! public PropertyException (String reason, Throwable e) ! { ! super(reason, e); ! } ! public PropertyException (String reason, Throwable e, String contextLocation) ! { ! super(reason, e); ! setContextLocation(contextLocation); ! } ! public void setMessage (String message) ! { _message = message; } ! public String getMessage () ! { ! if (_message == null) ! { return super.getMessage(); ! } ! else ! { String msg = _message; ! if (getContextLocation() != null && msg != null) ! { msg += " at " + getContextLocation(); } *************** *** 73,290 **** ! /** ! * NoSuchVariableException indicates that a variable did not exist ! * in the context against which it was being evaluated. ! */ ! public static class NoSuchVariableException extends PropertyException { ! public String variableName; ! public NoSuchVariableException( String variableName ) { ! super( "No such variable: $" + variableName ); ! this.variableName = variableName; ! } ! } ! /** ! * NullStringException indicates that a variable exists but its ! * .toString() method returns null ! */ ! public static class NullToStringException extends PropertyException { ! public String variableName; ! public NullToStringException( String variableName ) { ! super( ".toString() returns null: $" + variableName ); ! this.variableName = variableName; ! } ! } ! /** ! * NullValueException indicates that a variable or property ! * exists, but evaluated to null in the context against which it ! * was being evaluated. ! */ ! public static class NullValueException extends PropertyException { ! public String variableName; ! public NullValueException( String variableName ) { ! super( "Value is null: $" + variableName ); ! this.variableName = variableName; ! } ! } ! /** ! * NoSuchMethodException indicates that the variable did not have ! * the requested method. ! */ ! public static class NoSuchMethodException extends PropertyException { ! public String methodName, className, variableName; ! public NoSuchMethodException( String methodName, ! String variableName, ! String className ) { ! super( "No public method " + methodName + " on variable $" ! + variableName + " of class " + className ); ! this.variableName = variableName; ! this.className = className; ! this.methodName = methodName; ! } ! } ! /** ! * NoSuchMethodWithArgumentsException indicates that the variable did not have ! * the a method with the request name and argument list ! */ ! public static class NoSuchMethodWithArgumentsException extends PropertyException { ! public String methodName; ! public String className; ! public String arguments; ! public NoSuchMethodWithArgumentsException( String methodName, ! String className, ! String arguments ) { ! super( "No public method " + methodName + "(" + arguments + ")" ! + " in class " + className ); ! this.className = className; ! this.methodName = methodName; ! this.arguments = arguments; ! } ! } ! /** ! * NoSuchPropertyException indicates that the variable did not have ! * the requested property. ! */ ! public static class NoSuchPropertyException extends PropertyException { ! String _propertyName; ! String _className; ! String _variableName; ! public NoSuchPropertyException( String propertyName, ! String variableName, ! String className ) { ! super( "No public property " + propertyName + " on variable $" ! + variableName + " of class " + className ); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * VoidValueException indicates that someone tried to use the return ! * value of a void method ! */ ! public static class VoidValueException extends PropertyException { ! String _variableName; ! public VoidValueException() { ! super( "Attempt to use void value" ); ! } ! public VoidValueException( String variableName ) { ! super( "Variable $" + variableName + " has a void value " ); ! this._variableName = variableName; ! } ! } ! /** ! * Exception thrown when a Variable isn't of the specified class type. ! */ ! public static class InvalidTypeException extends PropertyException { ! public InvalidTypeException( String variableName, Class clazz ) { ! super( "$" + variableName + " is not a " + clazz.getName() ); ! } ! } ! /** ! * RestrictedPropertyException indicates that the requested property may ! * not be invoked from a template due to security constraints ! */ ! public static class RestrictedPropertyException extends PropertyException { ! String _propertyName; ! String _className; ! String _variableName; ! public RestrictedPropertyException( String propertyName, ! String variableName, ! String className ) { ! super( "The property " + propertyName + " on variable $" ! + variableName + " of class " + className + " may not be accessed from a template." ); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * RestrictedMethodException indicates that the requested method may ! * not be invoked from a template due to security constraints ! */ ! public static class RestrictedMethodException extends PropertyException { ! String _propertyName; ! String _className; ! String _variableName; ! public RestrictedMethodException( String propertyName, ! String variableName, ! String className ) { ! super( "The method " + propertyName + " on variable $" ! + variableName + " of class " + className + " may not be accessed from a template." ); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * UndefinedVariableException indicates that the variable did not have ! * the requested method. ! */ ! public static class UndefinedVariableException extends PropertyException { ! private String _msg = "Attempted to dereference an undefined variable."; ! public UndefinedVariableException() { ! super( null ); ! } ! /** ! * Overloaded to return the <code>reason</code> specified during construction ! * <b>plus</b> the context location, if any. ! */ ! public String getMessage() { ! String msg = _msg; ! String loc = getContextLocation(); ! if ( loc != null ) { ! msg += " at " + loc; ! } ! return msg; ! } ! public void setMessage( String msg ) { ! _msg = msg; ! } ! } } --- 83,326 ---- ! /** ! * NoSuchVariableException indicates that a variable did not exist ! * in the context against which it was being evaluated. ! */ ! public static class NoSuchVariableException extends PropertyException ! { ! public String variableName; ! public NoSuchVariableException (String variableName) ! { ! super("No such variable: $" + variableName); ! this.variableName = variableName; ! } ! } ! /** ! * NullStringException indicates that a variable exists but its ! * .toString() method returns null ! */ ! public static class NullToStringException extends PropertyException ! { ! public String variableName; ! public NullToStringException (String variableName) ! { ! super(".toString() returns null: $" + variableName); ! this.variableName = variableName; ! } ! } ! /** ! * NullValueException indicates that a variable or property ! * exists, but evaluated to null in the context against which it ! * was being evaluated. ! */ ! public static class NullValueException extends PropertyException ! { ! public String variableName; ! public NullValueException (String variableName) ! { ! super("Value is null: $" + variableName); ! this.variableName = variableName; ! } ! } ! /** ! * NoSuchMethodException indicates that the variable did not have ! * the requested method. ! */ ! public static class NoSuchMethodException extends PropertyException ! { ! public String methodName, className, variableName; ! public NoSuchMethodException (String methodName, ! String variableName, ! String className) ! { ! super("No public method " + methodName + " on variable $" ! + variableName + " of class " + className); ! this.variableName = variableName; ! this.className = className; ! this.methodName = methodName; ! } ! } ! /** ! * NoSuchMethodWithArgumentsException indicates that the variable did not have ! * the a method with the request name and argument list ! */ ! public static class NoSuchMethodWithArgumentsException extends PropertyException ! { ! public String methodName; ! public String className; ! public String arguments; ! public NoSuchMethodWithArgumentsException (String methodName, ! String className, ! String arguments) ! { ! super("No public method " + methodName + "(" + arguments + ")" ! + " in class " + className); ! this.className = className; ! this.methodName = methodName; ! this.arguments = arguments; ! } ! } ! /** ! * NoSuchPropertyException indicates that the variable did not have ! * the requested property. ! */ ! public static class NoSuchPropertyException extends PropertyException ! { ! String _propertyName; ! String _className; ! String _variableName; ! public NoSuchPropertyException (String propertyName, ! String variableName, ! String className) ! { ! super("No public property " + propertyName + " on variable $" ! + variableName + " of class " + className); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * VoidValueException indicates that someone tried to use the return ! * value of a void method ! */ ! public static class VoidValueException extends PropertyException ! { ! String _variableName; ! public VoidValueException () ! { ! super("Attempt to use void value"); ! } ! public VoidValueException (String variableName) ! { ! super("Variable $" + variableName + " has a void value "); ! this._variableName = variableName; ! } ! } ! /** ! * Exception thrown when a Variable isn't of the specified class type. ! */ ! public static class InvalidTypeException extends PropertyException ! { ! public InvalidTypeException (String variableName, Class clazz) ! { ! super("$" + variableName + " is not a " + clazz.getName()); ! } ! } ! /** ! * RestrictedPropertyException indicates that the requested property may ! * not be invoked from a template due to security constraints ! */ ! public static class RestrictedPropertyException extends PropertyException ! { ! String _propertyName; ! String _className; ! String _variableName; ! public RestrictedPropertyException (String propertyName, ! String variableName, ! String className) ! { ! super("The property " + propertyName + " on variable $" ! + variableName + " of class " + className + " may not be accessed from a template."); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * RestrictedMethodException indicates that the requested method may ! * not be invoked from a template due to security constraints ! */ ! public static class RestrictedMethodException extends PropertyException ! { ! String _propertyName; ! String _className; ! String _variableName; ! public RestrictedMethodException (String propertyName, ! String variableName, ! String className) ! { ! super("The method " + propertyName + " on variable $" ! + variableName + " of class " + className + " may not be accessed from a template."); ! this._variableName = variableName; ! this._className = className; ! this._propertyName = propertyName; ! } ! } ! /** ! * UndefinedVariableException indicates that the variable did not have ! * the requested method. ! */ ! public static class UndefinedVariableException extends PropertyException ! { ! private String _msg = "Attempted to dereference an undefined variable."; ! public UndefinedVariableException () ! { ! super(null); ! } ! /** ! * Overloaded to return the <code>reason</code> specified during construction ! * <b>plus</b> the context location, if any. ! */ ! public String getMessage () ! { ! String msg = _msg; ! String loc = getContextLocation(); ! if (loc != null) ! { ! msg += " at " + loc; ! } ! return msg; ! } ! public void setMessage (String msg) ! { ! _msg = msg; ! } ! } } Index: Provider.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Provider.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Provider.java 11 Jun 2002 17:43:20 -0000 1.5 --- Provider.java 12 Jun 2003 00:47:44 -0000 1.6 *************** *** 35,64 **** * WebMacro's behavior. */ ! public interface Provider { ! /** ! * Return an array representing the types this provider serves up ! */ ! public String getType(); ! /** ! * Initialize this provider based on the specified config. ! */ ! public void init(Broker b, Settings config) throws InitException; ! /** ! * Clear any cache this provider may be maintaining ! */ ! public void flush(); ! /** ! * Close down this provider, freeing any allocated resources. ! */ ! public void destroy(); ! /** ! * Get the object associated with the specified query ! */ ! public Object get(String query) throws ResourceException; } --- 35,65 ---- * WebMacro's behavior. */ ! public interface Provider ! { ! /** ! * Return an array representing the types this provider serves up ! */ ! public String getType (); ! /** ! * Initialize this provider based on the specified config. ! */ ! public void init (Broker b, Settings config) throws InitException; ! /** ! * Clear any cache this provider may be maintaining ! */ ! public void flush (); ! /** ! * Close down this provider, freeing any allocated resources. ! */ ! public void destroy (); ! /** ! * Get the object associated with the specified query ! */ ! public Object get (String query) throws ResourceException; } Index: ResourceException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/ResourceException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ResourceException.java 11 Jun 2002 17:43:20 -0000 1.3 --- ResourceException.java 12 Jun 2003 00:47:44 -0000 1.4 *************** *** 28,40 **** * @since 0.96 */ ! public class ResourceException extends WebMacroException { ! public ResourceException(String reason, Exception e) { ! super(reason, e); ! } ! public ResourceException(String reason) { ! super(reason); ! } } --- 28,43 ---- * @since 0.96 */ ! public class ResourceException extends WebMacroException ! { ! public ResourceException (String reason, Exception e) ! { ! super(reason, e); ! } ! public ResourceException (String reason) ! { ! super(reason); ! } } Index: RethrowableException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/RethrowableException.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RethrowableException.java 11 Jun 2002 17:43:20 -0000 1.6 --- RethrowableException.java 12 Jun 2003 00:47:44 -0000 1.7 *************** *** 43,120 **** * @since 0.96 */ ! public class RethrowableException extends Exception { ! private Throwable cause; ! private final static String RETHROW_MESSAGE = "-- secondary stack trace --"; ! public RethrowableException() { ! super(); ! } ! public RethrowableException(String s) { ! super(s); ! } ! public RethrowableException(String s, Throwable e) { ! super(s + System.getProperty("line.separator") + e); ! cause = e; ! } ! public void printStackTrace() { ! super.printStackTrace(); ! if (cause != null) { ! System.err.println(RETHROW_MESSAGE); ! cause.printStackTrace(); ! } ! } ! public void printStackTrace(java.io.PrintStream ps) { ! super.printStackTrace(ps); ! if (cause != null) { ! ps.println(RETHROW_MESSAGE); ! cause.printStackTrace(ps); ! } ! } ! public void printStackTrace(java.io.PrintWriter pw) { ! super.printStackTrace(pw); ! if (cause != null) { ! pw.println(RETHROW_MESSAGE); ! cause.printStackTrace(pw); ! } ! } ! /** ! * allow access to underlying exception ! * @deprecated you should use <code>getCause</code> instead ! */ ! public Throwable getCaught() { ! return getCause(); ! } ! /** ! * Return the underlying exception provided at construction time ! * or null if none was provided. ! * @return underlying cause ! * @since 1.1 ! */ ! public Throwable getCause() { ! return cause; ! } ! /** ! * Return the original exception cause. This will recursively ! * extract the cause if cause is a subclass of ! * <code>RethrowableException</code>. ! * @return underlying root cause ! * @since 1.1 ! */ ! public Throwable getRootCause() { ! Throwable t = cause; ! while (t != null && t instanceof RethrowableException) { ! t = ((RethrowableException) t).cause; ! } ! return t; ! } } --- 43,134 ---- * @since 0.96 */ ! public class RethrowableException extends Exception ! { ! private Throwable cause; ! private final static String RETHROW_MESSAGE = "-- secondary stack trace --"; ! public RethrowableException () ! { ! super(); ! } ! public RethrowableException (String s) ! { ! super(s); ! } ! public RethrowableException (String s, Throwable e) ! { ! super(s + System.getProperty("line.separator") + e); ! cause = e; ! } ! public void printStackTrace () ! { ! super.printStackTrace(); ! if (cause != null) ! { ! System.err.println(RETHROW_MESSAGE); ! cause.printStackTrace(); ! } ! } ! public void printStackTrace (java.io.PrintStream ps) ! { ! super.printStackTrace(ps); ! if (cause != null) ! { ! ps.println(RETHROW_MESSAGE); ! cause.printStackTrace(ps); ! } ! } ! public void printStackTrace (java.io.PrintWriter pw) ! { ! super.printStackTrace(pw); ! if (cause != null) ! { ! pw.println(RETHROW_MESSAGE); ! cause.printStackTrace(pw); ! } ! } ! /** ! * allow access to underlying exception ! * @deprecated you should use <code>getCause</code> instead ! */ ! public Throwable getCaught () ! { ! return getCause(); ! } ! /** ! * Return the underlying exception provided at construction time ! * or null if none was provided. ! * @return underlying cause ! * @since 1.1 ! */ ! public Throwable getCause () ! { ! return cause; ! } ! /** ! * Return the original exception cause. This will recursively ! * extract the cause if cause is a subclass of ! * <code>RethrowableException</code>. ! * @return underlying root cause ! * @since 1.1 ! */ ! public Throwable getRootCause () ! { ! Throwable t = cause; ! while (t != null && t instanceof RethrowableException) ! { ! t = ((RethrowableException) t).cause; ! } ! return t; ! } } Index: RethrowableRuntimeException.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/RethrowableRuntimeException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RethrowableRuntimeException.java 11 Jun 2002 17:43:20 -0000 1.3 --- RethrowableRuntimeException.java 12 Jun 2003 00:47:44 -0000 1.4 *************** *** 42,122 **** * @author Brian Goetz (Quiotix Corp) * @since 0.96 */ ! public class RethrowableRuntimeException extends RuntimeException { ! private Throwable cause; ! private final static String RETHROW_MESSAGE = "-- secondary stack trace --"; ! public RethrowableRuntimeException() { ! super(); ! } ! public RethrowableRuntimeException(String s) { ! super(s); ! } ! public RethrowableRuntimeException(String s, Throwable e) { ! super(s + System.getProperty("line.separator") + e); ! cause = e; ! while (cause instanceof RethrowableRuntimeException) { ! cause = ((RethrowableRuntimeException) cause).cause; ! } ! } ! public void printStackTrace() { ! super.printStackTrace(); ! if (cause != null) { ! System.err.println(RETHROW_MESSAGE); ! cause.printStackTrace(); ! } ! } ! public void printStackTrace(java.io.PrintStream ps) { ! super.printStackTrace(ps); ! if (cause != null) { ! ps.println(RETHROW_MESSAGE); ! cause.printStackTrace(ps); ! } ! } ! public void printStackTrace(java.io.PrintWriter pw) { ! super.printStackTrace(pw); ! if (cause != null) { ! pw.println(RETHROW_MESSAGE); ! cause.printStackTrace(pw); ! } ! } ! /** ! * allow access to underlying exception ! * @deprecated you should use <code>getCause</code> instead ! */ ! public Throwable getCaught() { ! return getCause(); ! } ! /** ! * Return the underlying exception provided at construction time ! * or null if none was provided. ! * @return underlying cause ! * @since 1.1 ! */ ! public Throwable getCause() { ! return cause; ! } ! /** ! * Return the original exception cause. This will recursively ! * extract the cause if cause is a subclass of ! * <code>RethrowableException</code>. ! * @return underlying root cause ! * @since 1.1 ! */ ! public Throwable getRootCause() { ! Throwable t = cause; ! while (t != null && t instanceof RethrowableRuntimeException) { ! t = ((RethrowableRuntimeException) t).cause; ! } ! return t; ! } } --- 42,137 ---- * @author Brian Goetz (Quiotix Corp) * @since 0.96 */ ! public class RethrowableRuntimeException extends RuntimeException ! { ! private Throwable cause; ! private final static String RETHROW_MESSAGE = "-- secondary stack trace --"; ! public RethrowableRuntimeException () ! { ! super(); ! } ! public RethrowableRuntimeException (String s) ! { ! super(s); ! } ! public RethrowableRuntimeException (String s, Throwable e) ! { ! super(s + System.getProperty("line.separator") + e); ! cause = e; ! while (cause instanceof RethrowableRuntimeException) ! { ! cause = ((RethrowableRuntimeException) cause).cause; ! } ! } ! public void printStackTrace () ! { ! super.printStackTrace(); ! if (cause != null) ! { ! System.err.println(RETHROW_MESSAGE); ! cause.printStackTrace(); ! } ! } ! public void printStackTrace (java.io.PrintStream ps) ! { ! super.printStackTrace(ps); ! if (cause != null) ! { ! ps.println(RETHROW_MESSAGE); ! cause.printStackTrace(ps); ! } ! } ! public void printStackTrace (java.io.PrintWriter pw) ! { ! super.printStackTrace(pw); ! if (cause != null) ! { ! pw.println(RETHROW_MESSAGE); ! cause.printStackTrace(pw); ! } ! } ! /** ! * allow access to underlying exception ! * @deprecated you should use <code>getCause</code> instead ! */ ! public Throwable getCaught () ! { ! return getCause(); ! } ! /** ! * Return the underlying exception provided at construction time ! * or null if none was provided. ! * @return underlying cause ! * @since 1.1 ! */ ! public Throwable getCause () ! { ! return cause; ! } ! /** ! * Return the original exception cause. This will recursively ! * extract the cause if cause is a subclass of ! * <code>RethrowableException</code>. ! * @return underlying root cause ! * @since 1.1 ! */ ! public Throwable getRootCause () ! { ! Throwable t = cause; ! while (t != null && t instanceof RethrowableRuntimeException) ! { ! t = ((RethrowableRuntimeException) t).cause; ! } ! return t; ! } } Index: Template.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Template.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Template.java 11 Jun 2002 17:43:20 -0000 1.13 --- Template.java 12 Jun 2003 00:47:44 -0000 1.14 *************** *** 24,94 **** package org.webmacro; ! import java.io.*; ! import java.util.*; ! public interface Template extends Macro, Visitable { ! /** ! * Force the template to parse now. Normally the template will not parse ! * the supplied file until the data is actually needed. However if you ! * want to parse all of your templates at the start of the application ! * to avoid incurring this call during an interactive session, you can ! * call the parse() function at an appropriate time. Once a template has ! * been parsed, subsequent calls to this method do not have an effect. If ! * you want to reparse the template, because you know, it has been changed, you ! * have to create a new Template object and leave this one to the garbage collector. ! * <p> ! * @exception TemplateException if the sytax was invalid and we could not recover ! * @exception IOException if we could not successfullly read the parseTool ! */ ! public void parse() throws IOException, TemplateException; ! /** ! * A template may contain parameters, set by the #param directive. ! * These are statically evaluated during the parse phase of the ! * template and shared between all users of the template. They ! * are present so that the template can provide some meta information ! * to its user as to what kind of data it expects to find in the Context, ! * or other information about its use. ! * <p> ! * If the template has not already been parsed, it will be parsed. Thus ! * this method may throw ParseException or IOException if there is some ! * failure in accessing or parsing the template. ! * @exception IOException if an error occurred reading the template ! * @exception TemplateException if an error occurred parsing the template ! */ ! public Object getParam(String name) throws IOException, TemplateException; ! /** ! * This method can be used to get a list of all the parameters ! * that have been set in the template. getParam(Object) can be used ! * to look up any particular parameter. ! */ ! /** ! * set a parameter. Occasinally it's necessary to provide parameters ! * externally. Although these might be considered of a different nature to ! * those set by #param, they can be stored as such. ! * ! * One example might be the output character encoding which is needed ! * when the template is played. ! */ ! public void setParam(String key, Object value); ! public Map getParameters(); ! public String getName(); ! public void setName(String name); ! /** ! * Get a Map containing all #macros defined for this template. ! * The returned Map can be <code>null</code> if this Template ! * does not contain Macros, or if this Template has not been ! * parsed yet. ! * @return ! */ ! public Map getMacros(); } --- 24,95 ---- package org.webmacro; ! import java.io.IOException; ! import java.util.Map; ! public interface Template extends Macro, Visitable ! { ! /** ! * Force the template to parse now. Normally the template will not parse ! * the supplied file until the data is actually needed. However if you ! * want to parse all of your templates at the start of the application ! * to avoid incurring this call during an interactive session, you can ! * call the parse() function at an appropriate time. Once a template has ! * been parsed, subsequent calls to this method do not have an effect. If ! * you want to reparse the template, because you know, it has been changed, you ! * have to create a new Template object and leave this one to the garbage collector. ! * <p> ! * @exception TemplateException if the sytax was invalid and we could not recover ! * @exception IOException if we could not successfullly read the parseTool ! */ ! public void parse () throws IOException, TemplateException; ! /** ! * A template may contain parameters, set by the #param directive. ! * These are statically evaluated during the parse phase of the ! * template and shared between all users of the template. They ! * are present so that the template can provide some meta information ! * to its user as to what kind of data it expects to find in the Context, ! * or other information about its use. ! * <p> ! * If the template has not already been parsed, it will be parsed. Thus ! * this method may throw ParseException or IOException if there is some ! * failure in accessing or parsing the template. ! * @exception IOException if an error occurred reading the template ! * @exception TemplateException if an error occurred parsing the template ! */ ! public Object getParam (String name) throws IOException, TemplateException; ! /** ! * This method can be used to get a list of all the parameters ! * that have been set in the template. getParam(Object) can be used ! * to look up any particular parameter. ! */ ! /** ! * set a parameter. Occasinally it's necessary to provide parameters ! * externally. Although these might be considered of a different nature to ! * those set by #param, they can be stored as such. ! * ! * One example might be the output character encoding which is needed ! * when the template is played. ! */ ! public void setParam (String key, Object value); ! public Map getParameters (); ! public String getName (); ! public void setName (String name); ! /** ! * Get a Map containing all #macros defined for this template. ! * The returned Map can be <code>null</code> if this Template ! * does not contain Macros, or if this Template has not been ! * parsed yet. ! * @return ! */ ! public Map getMacros (); } Index: TemplateException.java =============================================... [truncated message content] |