org.sandev.generator
Class WebAppShellGenerator

java.lang.Object
  extended byorg.sandev.generator.GeneratorCommon
      extended byorg.sandev.generator.WebShellGeneratorBase
          extended byorg.sandev.generator.WebAppShellGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class WebAppShellGenerator
extends WebShellGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Create the webapp shell servlet that bridges to the SandUIAdaptor implementation. Specifically, this generator creates (as needed)

  1. the webapp directory
  2. webapp/images, copying default files from apps/ui as needed
  3. webapp/sandui copying the sandui XML into here from env
  4. webapp/src with the shell servlet code
  5. webapp/WEB-INF with the web.xml file

      The webapp directory is not removed on cleanup since it usually will contain things like transformation templates and other custom info. The link images are also left alone, since they are usually customized. The dedicated sandui directory and the copy of the SandUI XML file is removed. The shell source is cleaned up, but not the associated directory structure since there may be other custom webapp source. The WEB-INF directory and the web.xml file are removed since they need to match the servlet source.


      Field Summary
       
      Fields inherited from class org.sandev.generator.GeneratorCommon
      CONTEXT_CONFIGURATION, CONTEXT_CONTROL, CONTEXT_FRAMEWORK, CONTEXT_MESSAGING, CONTEXT_PERSISTENCE, CONTEXT_UI, DEFAULT_LINE_LENGTH, MESSAGE_INTERFACES
       
      Constructor Summary
      WebAppShellGenerator()
                 
       
      Method Summary
       void cleanup(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.lang.String extra)
                SandGenerator interface implementation, see the class comments for details on what this does.
       void generate(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.util.Collection dirtyFiles, java.lang.String extra)
                SandGenerator interface implementation, see the class comments for details on what this does.
      protected  org.sandev.sandbuild.SandUIDeployment getWebappDeployment(org.sandev.sandbuild.SandProject proj)
                Return the webapp SandUIDeployment or null if not found.
      protected  void removeSandUIDirAndFile(java.io.File projDir)
                Remove the sandui directory and the SandUI XML file that was copied into it.
      protected  void verifyLinkImages(java.io.File projDir)
                Verify that the images subdirectory off the webapp dir exists, and that it contains the link images needed for form navigation.
      protected  void verifySandUIDirAndFile(java.io.File projDir)
                Make sure the sandui directory exists and copy the SandUI XML file into it.
       
      Methods inherited from class org.sandev.generator.WebShellGeneratorBase
      buildFileChanged, removeWebInf, removeWebShellSrc, verifySubProjectDir, verifyWebInf, verifyWebShellSrc
       
      Methods inherited from class org.sandev.generator.GeneratorCommon
      capitalize, copyfile, deletefile, filterHTMLLine, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, isBasic, isLongReferenceArray, isMessageInterface, isParentAbstract, isPrimitive, isRootStruct, isVowel, log, nextToken, pluralize, rangeEscape, removePlatformDecls, trackFileDelete, trackFileWrite, uncapitalize, writeDefaultCtor, writeDescription, writeHTMLContents, writeMessageImports, writeSectionName, writeStandardCommentID, writeXHTMLFooter, writeXHTMLFooter, writeXHTMLHeader, writeXHTMLHeader
       
      Methods inherited from class java.lang.Object
      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
       

      Constructor Detail

      WebAppShellGenerator

      public WebAppShellGenerator()
      Method Detail

      generate

      public void generate(org.sandev.sandbuild.SandDecl[] decls,
                           java.io.File baseDir,
                           boolean changed,
                           java.util.Collection dirtyFiles,
                           java.lang.String extra)
                    throws org.sandev.sandbuild.SandGeneratorException
      SandGenerator interface implementation, see the class comments for details on what this does.

      Specified by:
      generate in interface org.sandev.sandbuild.SandGenerator
      Throws:
      org.sandev.sandbuild.SandGeneratorException

      cleanup

      public void cleanup(org.sandev.sandbuild.SandDecl[] decls,
                          java.io.File baseDir,
                          boolean changed,
                          java.lang.String extra)
                   throws org.sandev.sandbuild.SandGeneratorException
      SandGenerator interface implementation, see the class comments for details on what this does.

      Specified by:
      cleanup in interface org.sandev.sandbuild.SandGenerator
      Throws:
      org.sandev.sandbuild.SandGeneratorException

      getWebappDeployment

      protected org.sandev.sandbuild.SandUIDeployment getWebappDeployment(org.sandev.sandbuild.SandProject proj)
                                                                   throws org.sandev.sandbuild.SandGeneratorException
      Return the webapp SandUIDeployment or null if not found.

      Throws:
      org.sandev.sandbuild.SandGeneratorException

      verifyLinkImages

      protected void verifyLinkImages(java.io.File projDir)
                               throws org.sandev.sandbuild.SandGeneratorException
      Verify that the images subdirectory off the webapp dir exists, and that it contains the link images needed for form navigation. If no images are found, then copy the default images from the apps/ui/docs/images directory.

      Throws:
      org.sandev.sandbuild.SandGeneratorException

      verifySandUIDirAndFile

      protected void verifySandUIDirAndFile(java.io.File projDir)
                                     throws org.sandev.sandbuild.SandGeneratorException
      Make sure the sandui directory exists and copy the SandUI XML file into it. If there is no SandUI XML file yet, then we just keep going. If the app is run without a UI definition, then the shell will complain, so there's no need to flag an error here.

      Throws:
      org.sandev.sandbuild.SandGeneratorException

      removeSandUIDirAndFile

      protected void removeSandUIDirAndFile(java.io.File projDir)
                                     throws org.sandev.sandbuild.SandGeneratorException
      Remove the sandui directory and the SandUI XML file that was copied into it.

      Throws:
      org.sandev.sandbuild.SandGeneratorException