Copyright 2002 by aragost

com.aragost.araspect
Class Inspector

java.lang.Object
  |
  +--com.aragost.araspect.Inspector

public class Inspector
extends java.lang.Object


Field Summary
static java.lang.String ARG_ABOUT
          Name of url argument to show about page
static java.lang.String ARG_DEBUG
          Name of url argument to go to debug mode
static java.lang.String ARG_EXECUTE
          Reqeust parameter name for property to execute
static java.lang.String ARG_IS_ERROR_PAGE
          Name of url argument work as JSP error page
static java.lang.String ARG_NEWVALUE
          Reqeust parameter name for the new value of the property updated
static java.lang.String ARG_NULL
          Reqeust parameter if present indicates that property should be set to null
static java.lang.String ARG_PATH
          Name of url argument specifying the path
static java.lang.String ARG_SHOW_FULL_TO_STRING
          Name of url argument to display full toString of object
static java.lang.String ARG_UPDATE
          Reqeust parameter name for property to update
static java.lang.String EXCEPTION_KEY
          Name of request attribute where a Throwable can be stored.
 
Constructor Summary
Inspector()
           
 
Method Summary
 void addError(java.lang.Exception e)
           
 void addParameter(java.lang.String name, java.lang.String value)
          Add a parameter that will be added to all links, and as a hidden field on forms.
protected  Handler createHandlerForClassNamed(java.lang.String id)
          Create a new handler instance with the specified id, and initialized with the given arguemnts.
 Link createLink(Element label, Path path)
          Create a URL link to the variable represented by the specified path.
 Link createLink(java.lang.String text, Path path)
          Create a URL link to the variable represented by the specified path.
 Element displayElement(Path path, boolean showFullToString)
          Return a html Element, corresponding to a String representation of the specified Object
 Element exceptionElement(java.lang.Exception e)
           
static Evaluator getEvaluator(java.lang.String id)
           
 HandlerFacade getHandlerForClass(java.lang.Class clazz)
           
 HandlerFacade getHandlerForPath(Path path)
           
static java.util.Map getHandlers()
           
 java.lang.String getHeaderColor()
           
 java.lang.String getInspectJsp()
          Return the URI of the jsp that is used to launch araSpect.
 boolean getIsErrorPage()
           
static ExceptionInfo getJspException()
           
static Element getNullElement()
          Return the html Element to respresent null
 java.util.Collection getParameters(Path path)
          Return an Collection with all parameters needed in the request.
 Path getPath()
          Getter for property path.
 java.lang.Object getRoot()
          Getter for property root.
 InspectorSettings getSettings()
           
 boolean getShowFullToString()
           
 void htmlInspect(HtmlWriter out)
          Write inspector output to the specified writer
 boolean isDebug()
          Getter for property debug.
 boolean isDemo()
           
static void log(java.lang.String s)
           
 java.lang.String prettyPrint(PathElement elm)
          Pretty print the specified PathElement.
static void process(javax.servlet.http.HttpServletRequest request, java.lang.Object root, java.io.Writer out)
           
static void process(javax.servlet.http.HttpServletRequest request, java.lang.Throwable exception, java.lang.Object root, java.io.Writer out)
           
static void process(javax.servlet.jsp.PageContext pc, java.lang.Object root)
           
 void process(java.io.Writer writer)
           
static void registerArrayHandler(java.lang.Class handlerClass)
          Register the handler for array objects
static void registerHandler(java.lang.Class clazz, java.lang.Class handlerClass)
          Registre a handler class for a given object class
static void registerHandler(java.lang.String className, java.lang.String handlerClassName)
          Register a handler class for a given object class.
 void remove(PathElement elm)
           
 void remove(java.lang.String s)
           
 void setDebug(boolean debug)
          Setter for property debug.
 void setIsErrorPage(boolean flag)
           
static void setJspException(ExceptionInfo e)
           
 void setPath(Path path)
          Setter for property path.
 void setRoot(java.lang.Object root)
          Setter for property root.
 void setShowFullToString(boolean sfts)
           
 java.lang.String toString(java.lang.Object object)
           
 java.lang.String typeName(java.lang.Object obj)
           
 java.lang.String typeName(java.lang.Object obj, java.lang.Class c)
          Return the type as a String for the specified Class
 void update(PathElement elm, java.lang.String newValue)
           
 void update(java.lang.String key, java.lang.String newValue)
           
 void writeAbout(HtmlWriter out)
          Write the about text to the specified writer
 void writeHeader(HtmlWriter out)
          Write the header that is on all pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXCEPTION_KEY

public static final java.lang.String EXCEPTION_KEY
Name of request attribute where a Throwable can be stored. If it is araSpect will work as an error page.

See Also:
Constant Field Values

ARG_SHOW_FULL_TO_STRING

public static final java.lang.String ARG_SHOW_FULL_TO_STRING
Name of url argument to display full toString of object

See Also:
Constant Field Values

ARG_IS_ERROR_PAGE

public static final java.lang.String ARG_IS_ERROR_PAGE
Name of url argument work as JSP error page

See Also:
Constant Field Values

ARG_PATH

public static final java.lang.String ARG_PATH
Name of url argument specifying the path

See Also:
Constant Field Values

ARG_ABOUT

public static final java.lang.String ARG_ABOUT
Name of url argument to show about page

See Also:
Constant Field Values

ARG_DEBUG

public static final java.lang.String ARG_DEBUG
Name of url argument to go to debug mode

See Also:
Constant Field Values

ARG_UPDATE

public static final java.lang.String ARG_UPDATE
Reqeust parameter name for property to update

See Also:
Constant Field Values

ARG_EXECUTE

public static final java.lang.String ARG_EXECUTE
Reqeust parameter name for property to execute

See Also:
Constant Field Values

ARG_NEWVALUE

public static final java.lang.String ARG_NEWVALUE
Reqeust parameter name for the new value of the property updated

See Also:
Constant Field Values

ARG_NULL

public static final java.lang.String ARG_NULL
Reqeust parameter if present indicates that property should be set to null

See Also:
Constant Field Values
Constructor Detail

Inspector

public Inspector()
Method Detail

process

public static void process(javax.servlet.http.HttpServletRequest request,
                           java.lang.Throwable exception,
                           java.lang.Object root,
                           java.io.Writer out)

process

public static void process(javax.servlet.jsp.PageContext pc,
                           java.lang.Object root)

process

public static void process(javax.servlet.http.HttpServletRequest request,
                           java.lang.Object root,
                           java.io.Writer out)

getNullElement

public static Element getNullElement()
Return the html Element to respresent null


getHeaderColor

public java.lang.String getHeaderColor()

remove

public void remove(java.lang.String s)

remove

public void remove(PathElement elm)
            throws EvaluationException
EvaluationException

update

public void update(java.lang.String key,
                   java.lang.String newValue)

update

public void update(PathElement elm,
                   java.lang.String newValue)
            throws EvaluationException
EvaluationException

prettyPrint

public java.lang.String prettyPrint(PathElement elm)
Pretty print the specified PathElement. Forward to the corresponding Evaluator for the actual pretty printing


addError

public void addError(java.lang.Exception e)

exceptionElement

public Element exceptionElement(java.lang.Exception e)

createLink

public Link createLink(java.lang.String text,
                       Path path)
Create a URL link to the variable represented by the specified path.

Parameters:
text - The label of the link
path - The path to create a link to

createLink

public Link createLink(Element label,
                       Path path)
Create a URL link to the variable represented by the specified path. Use the specified html element as the label.

Parameters:
label - The label as an html element
path - The path to create a link to

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Add a parameter that will be added to all links, and as a hidden field on forms.


getParameters

public java.util.Collection getParameters(Path path)
Return an Collection with all parameters needed in the request. The elements in the Iterator is an Array of length 2. The First entry is the name, and the second is the value.


htmlInspect

public void htmlInspect(HtmlWriter out)
Write inspector output to the specified writer


registerHandler

public static void registerHandler(java.lang.Class clazz,
                                   java.lang.Class handlerClass)
Registre a handler class for a given object class


registerHandler

public static void registerHandler(java.lang.String className,
                                   java.lang.String handlerClassName)
Register a handler class for a given object class. Both arguments are String, if the classes is not in the classpath, nothing is registered.


registerArrayHandler

public static void registerArrayHandler(java.lang.Class handlerClass)
Register the handler for array objects


typeName

public java.lang.String typeName(java.lang.Object obj,
                                 java.lang.Class c)
Return the type as a String for the specified Class


typeName

public java.lang.String typeName(java.lang.Object obj)

displayElement

public Element displayElement(Path path,
                              boolean showFullToString)
Return a html Element, corresponding to a String representation of the specified Object

Parameters:
path - The path to the specified object
showFullToString - If true the length is not limited

getSettings

public InspectorSettings getSettings()

toString

public java.lang.String toString(java.lang.Object object)

log

public static void log(java.lang.String s)

getHandlers

public static java.util.Map getHandlers()

createHandlerForClassNamed

protected Handler createHandlerForClassNamed(java.lang.String id)
Create a new handler instance with the specified id, and initialized with the given arguemnts. If the is no registered Handler class return null


getEvaluator

public static Evaluator getEvaluator(java.lang.String id)

getHandlerForPath

public HandlerFacade getHandlerForPath(Path path)

getHandlerForClass

public HandlerFacade getHandlerForClass(java.lang.Class clazz)

getRoot

public java.lang.Object getRoot()
Getter for property root.

Returns:
Value of property root.

setRoot

public void setRoot(java.lang.Object root)
Setter for property root.

Parameters:
root - New value of property root.

getPath

public Path getPath()
Getter for property path.

Returns:
Value of property path.

setPath

public void setPath(Path path)
Setter for property path.

Parameters:
path - New value of property path.

process

public void process(java.io.Writer writer)

writeHeader

public void writeHeader(HtmlWriter out)
Write the header that is on all pages.


writeAbout

public void writeAbout(HtmlWriter out)
Write the about text to the specified writer


getJspException

public static ExceptionInfo getJspException()

setJspException

public static void setJspException(ExceptionInfo e)

isDebug

public boolean isDebug()
Getter for property debug.

Returns:
Value of property debug.

isDemo

public boolean isDemo()

setDebug

public void setDebug(boolean debug)
Setter for property debug.

Parameters:
debug - New value of property debug.

getIsErrorPage

public boolean getIsErrorPage()

setIsErrorPage

public void setIsErrorPage(boolean flag)

getShowFullToString

public boolean getShowFullToString()

setShowFullToString

public void setShowFullToString(boolean sfts)

getInspectJsp

public java.lang.String getInspectJsp()
Return the URI of the jsp that is used to launch araSpect. With this method the araspect.jsp can be name to any think you like.

Returns:
String URI of the araSpect jsp

Copyright 2002 by aragost