org.sandev.generator
Class NodeStdMBeanGenerator

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.FileGeneratorBase
          extended by org.sandev.generator.NodeStdMBeanGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class NodeStdMBeanGenerator
extends org.sandev.generator.FileGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Writ a standard MBean for this node so we can control it at runtime.


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
NodeStdMBeanGenerator()
           
 
Method Summary
 void delete(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Delete the standard MBean source files.
protected  boolean filterField(com.sun.javadoc.FieldDoc fd)
          Return true if the control interface should ignore this field.
protected  java.lang.String getStdMBeanClass(com.sun.javadoc.ClassDoc cd)
          Return the name of the standard MBean class
protected  java.lang.String getStdMBeanClassFile(org.sandev.sandbuild.SandDecl sd)
          Return the name of the standard MBean class source file
protected  java.lang.String getStdMBeanInterface(com.sun.javadoc.ClassDoc cd)
          Return the name of the standard MBean interface
protected  java.lang.String getStdMBeanInterfaceFile(org.sandev.sandbuild.SandDecl sd)
          Return the name of the standard MBean interface source file
 void write(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Write the standard MBean source files.
 void writeClass(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the standard MBean class implementation
 void writeClassCtors(java.io.PrintStream out, java.lang.String beanclass, java.lang.String nodeclass)
          Write constructors for the message
 void writeContainedNode(java.io.PrintStream out, java.lang.String nodeclass)
          Write the contained node.
protected  void writeControlAccMut(java.io.PrintStream out, com.sun.javadoc.FieldDoc[] fields, java.lang.String nodeclass, boolean withcode)
          Write the control access to the node.
protected  void writeControlAccMut(java.io.PrintStream out, com.sun.javadoc.FieldDoc fd, java.lang.String nodeclass, boolean withcode)
          Workhorse method to write the access for a single field.
protected  void writeControlWrapperImpl(java.io.PrintStream out, java.lang.String nodeclass)
           
protected  void writeInterface(java.io.PrintStream out, com.sun.javadoc.ClassDoc cd)
          Write the standard MBean interface
 void writeLogUtility(java.io.PrintStream out, java.lang.String beanclass, java.lang.String nodeclass)
          Write the log utility method.
protected  void writeServiceOverrides(java.io.PrintStream out)
           
 
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

NodeStdMBeanGenerator

public NodeStdMBeanGenerator()
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 standard MBean source files.

Overrides:
write in class org.sandev.generator.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 standard MBean source files.

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

getStdMBeanClassFile

protected java.lang.String getStdMBeanClassFile(org.sandev.sandbuild.SandDecl sd)
Return the name of the standard MBean class source file


getStdMBeanClass

protected java.lang.String getStdMBeanClass(com.sun.javadoc.ClassDoc cd)
Return the name of the standard MBean class


getStdMBeanInterfaceFile

protected java.lang.String getStdMBeanInterfaceFile(org.sandev.sandbuild.SandDecl sd)
Return the name of the standard MBean interface source file


getStdMBeanInterface

protected java.lang.String getStdMBeanInterface(com.sun.javadoc.ClassDoc cd)
Return the name of the standard MBean interface


writeClass

public void writeClass(java.io.PrintStream out,
                       com.sun.javadoc.ClassDoc cd)
Write the standard MBean class implementation


writeLogUtility

public void writeLogUtility(java.io.PrintStream out,
                            java.lang.String beanclass,
                            java.lang.String nodeclass)
Write the log utility method.


writeClassCtors

public void writeClassCtors(java.io.PrintStream out,
                            java.lang.String beanclass,
                            java.lang.String nodeclass)
Write constructors for the message


writeContainedNode

public void writeContainedNode(java.io.PrintStream out,
                               java.lang.String nodeclass)
Write the contained node.


writeControlWrapperImpl

protected void writeControlWrapperImpl(java.io.PrintStream out,
                                       java.lang.String nodeclass)

writeServiceOverrides

protected void writeServiceOverrides(java.io.PrintStream out)

writeInterface

protected void writeInterface(java.io.PrintStream out,
                              com.sun.javadoc.ClassDoc cd)
Write the standard MBean interface


writeControlAccMut

protected void writeControlAccMut(java.io.PrintStream out,
                                  com.sun.javadoc.FieldDoc[] fields,
                                  java.lang.String nodeclass,
                                  boolean withcode)
Write the control access to the node. If withcode is false, then just write the interface declaration.

The control interface is a view of the nodes in the configuration while they are running. Things like the Logger and Messager are set for all the nodes in a config using the top level config settings which are part of the configuration rather than runtime control. The same is true for runtime access to the messaging configuration, which is left to the messaging technology implementation. The control interface is focused on the state of data elements in each node.

All declared config parameters have read/write access, and so do some generated fields like the log level. We want to provide the best information we can to make the resulting control panel useful, including some indication of enumeration values. This will change to adapt to the capabilities of the container control panel.

The line between control and configuration has some room for interpretation. Clearly things like a node logLevel (or other logging config parameters or some application-specific parameters) are meant to be modified while the app is running. And clearly things like messaging are best handled as a configuration update, even if this also happens at runtime. Updates to complex config structures like arrays or contained objects fall somewhere in the middle.

The current known requirements are starting/stopping nodes, viewing current node state information at a basic level, bumping log levels, and changing config flags in some apps. We are postponing arrays and other advanced control access until there is a compelling use case.


writeControlAccMut

protected void writeControlAccMut(java.io.PrintStream out,
                                  com.sun.javadoc.FieldDoc fd,
                                  java.lang.String nodeclass,
                                  boolean withcode)
Workhorse method to write the access for a single field.


filterField

protected boolean filterField(com.sun.javadoc.FieldDoc fd)
Return true if the control interface should ignore this field. We're more restrictive than we theoretically have to be so the resulting control panel interface comes out legible. See the comments in the writeControlAccMut for details.