org.sandev.generator
Class NodeClassGenerator

java.lang.Object
  extended byorg.sandev.generator.GeneratorCommon
      extended byorg.sandev.generator.FileGeneratorBase
          extended byorg.sandev.generator.InstanceGeneratorBase
              extended byorg.sandev.generator.NodeClassGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class NodeClassGenerator
extends InstanceGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Create the node base class from the node declaration. In other words, using the SandDecl generated from XxxNodeDecl.java, create XxxNodeBase.java (or clean it up).


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
NodeClassGenerator()
           
 
Method Summary
 void delete(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Delete the NodeBase source file.
protected  java.lang.String getGenFileName(org.sandev.sandbuild.SandDecl sd)
          Return the name of the file we are generating from this declaration.
 void write(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Write the NodeBase source file.
protected  void writeClass(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the node base class file.
 void writeClassComment(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
           
 void writeControllable(java.io.PrintStream out)
          Write Controllable interface implementation
 void writeDeliver(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the deliver and onDelivery methods
 void writeGeneralDeliveryMethod(java.io.PrintStream out, NodeTagSubscribe[] ntss)
           
 void writeGeneralReceiveMethod(java.io.PrintStream out, NodeTagReceive[] ntrs)
           
protected  void writeGetIDCache(java.io.PrintStream out)
           
 void writeImports(java.io.PrintStream out)
          Write the import statements we need
 void writeInstanceAccess(java.io.PrintStream out, java.lang.String classname)
          Write convenience accessor methods to wrap our node instance.
 void writeLog(java.io.PrintStream out)
          Write the log methods
 void writeMessageable(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the Messageable interface implementation
 void writeQuery(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the query methods.
 void writeReceive(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the receive and onReceive methods
 void writeSend(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the send methods
 void writeSetupSecureReceive(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the secure receive registration setup calls
 void writeSetupSubscriptions(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the messaging subscription setup calls
 void writeStandardAccMut(java.io.PrintStream out, java.lang.String fieldName, java.lang.String fieldType)
          Override the superclass impl to special-case the setLogLevel and setLogger methods.
 
Methods inherited from class org.sandev.generator.InstanceGeneratorBase
getInstanceName, writeAccMut, writeArrayAccMut, writeArrayAppend, writeArrayClear, writeArrayContains, writeArrayGet, writeArrayInsert, writeArrayRemove, writeArrayRemoveIndex, writeArraySet, writeArraySize, writeCloneMessage, writeConstantsAndConversions, writeCoreValidityCheck, writeCtorAndInit, writeDebugDump, writeDecimalAccMut, writeDefaultValueAccessor, writeDisplayCode, writeEnumintBools, writeEnumintConsts, writeEnumintTrans, writeEquivalenceCheck, writeField, writeFieldFiltering, writeFieldsAndAccess, writeFlagAccessor, writeGenAccess, writeGenDeref, writeGenMod, writeInvalidValueAccessor, writeIsEquivalent, writeLengthAccessors, writeLongRefResolution, writeMetatypeAccess, writePrintValueAccessor, writeRangeRetrieval, writeReferenceResolution, writeSandInstanceMessageImpl, writeSandMessageImpl, writeStackOperations, writeStringRefResolution, writeSuperstructConversion, writeTreeAccessors, writeValidation, writeValidityCheck, writeVerbFormAccessors
 
Methods inherited from class org.sandev.generator.FileGeneratorBase
cleanup, generate, trackFileWrite
 
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, 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
 
Methods inherited from interface org.sandev.sandbuild.SandGenerator
cleanup, generate
 

Constructor Detail

NodeClassGenerator

public NodeClassGenerator()
Method Detail

write

public void write(org.sandev.sandbuild.SandDecl sd,
                  java.io.File baseDir,
                  java.lang.String extra)
           throws org.sandev.sandbuild.SandGeneratorException
Write the NodeBase source file.

Overrides:
write in class FileGeneratorBase
Throws:
org.sandev.sandbuild.SandGeneratorException

delete

public void delete(org.sandev.sandbuild.SandDecl sd,
                   java.io.File baseDir,
                   java.lang.String extra)
            throws org.sandev.sandbuild.SandGeneratorException
Delete the NodeBase source file.

Overrides:
delete in class FileGeneratorBase
Throws:
org.sandev.sandbuild.SandGeneratorException

writeStandardAccMut

public void writeStandardAccMut(java.io.PrintStream out,
                                java.lang.String fieldName,
                                java.lang.String fieldType)
Override the superclass impl to special-case the setLogLevel and setLogger methods. LogLevel needs to be passed on to the node's logger impl, so we do that here instead of having the logger call back into the node for the logLevel each time it needs to log a message. We can get away with this because nodes always have loggers; this approach should not be used for tracking generic configuration changes.

Overrides:
writeStandardAccMut in class InstanceGeneratorBase

getGenFileName

protected java.lang.String getGenFileName(org.sandev.sandbuild.SandDecl sd)
Return the name of the file we are generating from this declaration.


writeClass

protected void writeClass(java.io.PrintStream out,
                          com.sun.javadoc.ClassDoc cd)
                   throws org.sandev.sandbuild.SandGeneratorException
Write the node base class file.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeImports

public void writeImports(java.io.PrintStream out)
Write the import statements we need


writeClassComment

public void writeClassComment(java.io.PrintStream out,
                              com.sun.javadoc.ClassDoc cd)

writeInstanceAccess

public void writeInstanceAccess(java.io.PrintStream out,
                                java.lang.String classname)
Write convenience accessor methods to wrap our node instance.


writeLog

public void writeLog(java.io.PrintStream out)
Write the log methods


writeGetIDCache

protected void writeGetIDCache(java.io.PrintStream out)

writeControllable

public void writeControllable(java.io.PrintStream out)
Write Controllable interface implementation


writeSetupSubscriptions

public void writeSetupSubscriptions(java.io.PrintStream out,
                                    com.sun.javadoc.ClassDoc cd)
Write the messaging subscription setup calls


writeSetupSecureReceive

public void writeSetupSecureReceive(java.io.PrintStream out,
                                    com.sun.javadoc.ClassDoc cd)
Write the secure receive registration setup calls


writeMessageable

public void writeMessageable(java.io.PrintStream out,
                             com.sun.javadoc.ClassDoc cd)
Write the Messageable interface implementation


writeReceive

public void writeReceive(java.io.PrintStream out,
                         com.sun.javadoc.ClassDoc cd)
Write the receive and onReceive methods


writeGeneralReceiveMethod

public void writeGeneralReceiveMethod(java.io.PrintStream out,
                                      NodeTagReceive[] ntrs)

writeDeliver

public void writeDeliver(java.io.PrintStream out,
                         com.sun.javadoc.ClassDoc cd)
Write the deliver and onDelivery methods


writeGeneralDeliveryMethod

public void writeGeneralDeliveryMethod(java.io.PrintStream out,
                                       NodeTagSubscribe[] ntss)

writeQuery

public void writeQuery(java.io.PrintStream out,
                       com.sun.javadoc.ClassDoc cd)
Write the query methods. We have to allow queries on startup to do things like get initialization data, but we don't want to allow queries if a node has been shut down or suspended.


writeSend

public void writeSend(java.io.PrintStream out,
                      com.sun.javadoc.ClassDoc cd)
Write the send methods