DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.autoform
Class AutoForm

java.lang.Object
  extended by org.dlese.dpc.schemedit.autoform.AutoForm
Direct Known Subclasses:
DcsViewRecord

public class AutoForm
extends Object

Class to automatically generate jsp pages (using a Renderer class such as DleseEditorRenderer) for editing and viewing of schemedit-based xml documents.

Called from command line for debugging as well as from MetaDataFramework at start-up time and after run-time reconfiguration.

Author:
ostwald

Field Summary
protected  DocumentFactory df
          NOT YET DOCUMENTED
protected  String formBeanName
          NOT YET DOCUMENTED
protected  MetaDataFramework framework
          NOT YET DOCUMENTED
protected  Document instanceDocument
          NOT YET DOCUMENTED
protected  File schemaFile
          NOT YET DOCUMENTED
protected  SchemaHelper sh
          NOT YET DOCUMENTED
protected  XMLWriter writer
          NOT YET DOCUMENTED
 
Constructor Summary
AutoForm(MetaDataFramework framework)
          Constructor for the AutoForm object
AutoForm(String xmlFormat)
          Constructor for the Stand-along AutoForm object, meaning it is created from command line rather than via schemedit.
 
Method Summary
 void batchRenderAndWrite()
          Create a jsp file for each top-level element of the schema
static String elementToJsp(Element e)
          Perform any modifications to the XML to create legal JSP.
protected  File getBatchJspDest(String pageName)
          Path for writing component jsp pages.
protected  String getComponentJspHeader()
          JSP code to insert at the top of component jsp files.
protected  File getJspDest(String pageName)
          Path for writing master jsp files.
protected  String getMasterJspHeader()
          JSP code to insert at the top of master jsp files.
protected  String getRendererClassName()
          Gets the rendererClassName attribute of the AutoForm object
static void main(String[] args)
          The main program for the AutoForm class.
protected static void prtlnErr(String s)
          NOT YET DOCUMENTED
 Element render()
          NOT YET DOCUMENTED
 Element render(String xpath)
          Produce a Element representing an editor for the node at xpath.
 void renderAndWrite(String xpath)
          Description of the Method
 void renderAndWrite(String xpath, File dest)
          NOT YET DOCUMENTED
static void setLogging(boolean verbose)
          Sets the logging attribute of the AutoForm class
static void setVerbose(boolean verbosity)
           
protected  boolean writeJsp(Element element, File dest, String jspHeader)
          Writes Element to disk as JSP page to be included in a master page at run time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instanceDocument

protected Document instanceDocument
NOT YET DOCUMENTED


writer

protected XMLWriter writer
NOT YET DOCUMENTED


df

protected DocumentFactory df
NOT YET DOCUMENTED


sh

protected SchemaHelper sh
NOT YET DOCUMENTED


schemaFile

protected File schemaFile
NOT YET DOCUMENTED


framework

protected MetaDataFramework framework
NOT YET DOCUMENTED


formBeanName

protected String formBeanName
NOT YET DOCUMENTED

Constructor Detail

AutoForm

public AutoForm(MetaDataFramework framework)
Constructor for the AutoForm object

Parameters:
framework - Description of the Parameter

AutoForm

public AutoForm(String xmlFormat)
         throws Exception,
                SchemaHelperException
Constructor for the Stand-along AutoForm object, meaning it is created from command line rather than via schemedit.

Parameters:
xmlFormat - Description of the Parameter
Throws:
SchemaHelperException - Description of the Exception
Exception - NOT YET DOCUMENTED
Method Detail

main

public static void main(String[] args)
                 throws Exception
The main program for the AutoForm class. The first argument is command, the second is arg (if nec);

Parameters:
args - The command line arguments
Throws:
Exception - NOT YET DOCUMENTED

renderAndWrite

public void renderAndWrite(String xpath)
                    throws Exception
Description of the Method

Parameters:
xpath - Description of the Parameter
Throws:
Exception - NOT YET DOCUMENTED

renderAndWrite

public void renderAndWrite(String xpath,
                           File dest)
                    throws Exception
NOT YET DOCUMENTED

Parameters:
xpath - NOT YET DOCUMENTED
dest - NOT YET DOCUMENTED
Throws:
Exception - NOT YET DOCUMENTED

batchRenderAndWrite

public void batchRenderAndWrite()
                         throws Exception
Create a jsp file for each top-level element of the schema

Throws:
Exception - NOT YET DOCUMENTED

getRendererClassName

protected String getRendererClassName()
Gets the rendererClassName attribute of the AutoForm object

Returns:
The rendererClassName value

render

public Element render()
NOT YET DOCUMENTED

Returns:
NOT YET DOCUMENTED

render

public Element render(String xpath)
Produce a Element representing an editor for the node at xpath. The Element returned by render is eventually converted to JSP.

Parameters:
xpath - XPath to a Node in the Schema
Returns:
An Element representing an editor for the given schema node

elementToJsp

public static String elementToJsp(Element e)
Perform any modifications to the XML to create legal JSP. Some strings, such as tag-like notation (e.g., "c:set") are not convenient in XML processing, since they are interpreted as namespaces, so they are encoded by the renderer using a convention (e.g., "c__set") and then decoded here to convert to JSP

Parameters:
e - Element produced by renderer
Returns:
JSP representation of Element

getBatchJspDest

protected File getBatchJspDest(String pageName)
                        throws Exception
Path for writing component jsp pages.

Parameters:
pageName - NOT YET DOCUMENTED
Returns:
The batchJspDest value
Throws:
Exception - NOT YET DOCUMENTED

getJspDest

protected File getJspDest(String pageName)
                   throws Exception
Path for writing master jsp files.

Parameters:
pageName - NOT YET DOCUMENTED
Returns:
The jspDest value
Throws:
Exception - NOT YET DOCUMENTED

getMasterJspHeader

protected String getMasterJspHeader()
JSP code to insert at the top of master jsp files.

Returns:
The masterJspHeader value

getComponentJspHeader

protected String getComponentJspHeader()
JSP code to insert at the top of component jsp files. In the case of AutoForm, where the components are on separate JSP pages, the component and master headers are the same. In subclasses, the component JSP pages maybe included (via jsp:include) in the master, and therefore they may require a different header.

Returns:
The componentJspHeader value

writeJsp

protected boolean writeJsp(Element element,
                           File dest,
                           String jspHeader)
Writes Element to disk as JSP page to be included in a master page at run time.

Parameters:
element - Element representing editor page
dest - NOT YET DOCUMENTED
jspHeader - NOT YET DOCUMENTED
Returns:
true if JSP was successfully written

setLogging

public static void setLogging(boolean verbose)
Sets the logging attribute of the AutoForm class

Parameters:
verbose - The new logging value

prtlnErr

protected static void prtlnErr(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED

setVerbose

public static void setVerbose(boolean verbosity)

DLESE Tools
v1.6.0