org.sandev.generator
Class NodeClassGenerator

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.FileGeneratorBase
          extended by org.sandev.generator.InstanceGeneratorBase
              extended by org.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.
static boolean isIDLookup(com.sun.javadoc.ClassDoc cd)
          Return true if the given class implements UIFormOwner, false otherwise
 void write(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Write the NodeBase source file.
protected  void writeAuthUserPeer(java.io.PrintStream out)
          Write the AuthUserPeer implementation.
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, NodeTagImplement nti, com.sun.javadoc.ClassDoc cd)
          Write Controllable interface implementation
protected  void writeDeclaredImpls(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write out the interface implementations declared for this class.
 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 writeIDLookup(java.io.PrintStream out, NodeTagCall[] ntcs)
          Write the IDLookup implementation.
protected  void writeIDLookupPeer(java.io.PrintStream out)
          Write the IDLookupPeer implementation.
protected  void writeImplementationUtils(java.io.PrintStream out, NodeTagCall[] ntcs)
          Write the implementation utility methods.
 void writeImports(java.io.PrintStream out, NodeTagImplement nti, com.sun.javadoc.ClassDoc cd)
          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
protected  void writeMailSender(java.io.PrintStream out)
          Write the MailSender implementation.
 void writeMessageable(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the Messageable interface implementation
protected  void writeNodeSetCalls(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd, java.lang.String indent, java.lang.String instvar)
          Write the calls to set our config param member data variables from the node instance.
 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, getPrintnameForField, writeAccMut, writeArrayAccMut, writeArrayAppend, writeArrayClear, writeArrayContains, writeArrayGet, writeArrayInsert, writeArrayRemove, writeArrayRemoveIndex, writeArraySet, writeArraySize, writeCloneMessage, writeConstantsAndConversions, writeCoreValidityCheck, writeCtorAndInit, writeDebugDump, writeDecimalAccMut, writeDefaultValueAccessor, writeDisplayCode, writeEnumintBools, writeEnumintConsts, writeEnumintTrans, writeEquivalenceCheck, writeExtraMethods, writeField, writeFieldFiltering, writeFieldFlagAccess, writeFieldsAndAccess, writeFlagAccessor, writeGenAccess, writeGenDeref, writeGenMod, writeInvalidValueAccessor, writeIsEquivalent, writeLengthAccessors, writeLongRefResolution, writeMemSize, writeMetatypeAccess, writeOffsetDateAccess, writeOtherUtils, writePrintValueAccessor, writeRangeRetrieval, writeReferenceResolution, writeSandInstanceMessageImpl, writeSandMessageImpl, writeStackOperations, writeStandardAccMut, 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, findStructDeclByShortname, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, hasSubStructs, isArray, 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.


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,
                         NodeTagImplement nti,
                         com.sun.javadoc.ClassDoc cd)
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


writeControllable

public void writeControllable(java.io.PrintStream out,
                              NodeTagImplement nti,
                              com.sun.javadoc.ClassDoc cd)
Write Controllable interface implementation


writeNodeSetCalls

protected void writeNodeSetCalls(java.io.PrintStream out,
                                 com.sun.javadoc.ClassDoc cd,
                                 java.lang.String indent,
                                 java.lang.String instvar)
Write the calls to set our config param member data variables from the node instance.


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)

isIDLookup

public static boolean isIDLookup(com.sun.javadoc.ClassDoc cd)
Return true if the given class implements UIFormOwner, false otherwise


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


writeDeclaredImpls

protected void writeDeclaredImpls(java.io.PrintStream out,
                                  com.sun.javadoc.ClassDoc cd)
                           throws org.sandev.sandbuild.SandGeneratorException
Write out the interface implementations declared for this class. Implementations are declared via the implements tag.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeMailSender

protected void writeMailSender(java.io.PrintStream out)
                        throws org.sandev.sandbuild.SandGeneratorException
Write the MailSender implementation.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeAuthUserPeer

protected void writeAuthUserPeer(java.io.PrintStream out)
                          throws org.sandev.sandbuild.SandGeneratorException
Write the AuthUserPeer implementation.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeIDLookup

protected void writeIDLookup(java.io.PrintStream out,
                             NodeTagCall[] ntcs)
                      throws org.sandev.sandbuild.SandGeneratorException
Write the IDLookup implementation.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeIDLookupPeer

protected void writeIDLookupPeer(java.io.PrintStream out)
                          throws org.sandev.sandbuild.SandGeneratorException
Write the IDLookupPeer implementation.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeImplementationUtils

protected void writeImplementationUtils(java.io.PrintStream out,
                                        NodeTagCall[] ntcs)
                                 throws org.sandev.sandbuild.SandGeneratorException
Write the implementation utility methods.

Throws:
org.sandev.sandbuild.SandGeneratorException