org.sandev.tools.ConfigEditor
Class ConfigEditorNode

java.lang.Object
  extended byorg.sandev.tools.ConfigEditor.ConfigEditorNodeDecl
      extended byorg.sandev.tools.ConfigEditor.ConfigEditorNodeBase
          extended byorg.sandev.tools.ConfigEditor.ConfigEditorNode
All Implemented Interfaces:
org.sandev.basics.util.AuthUserLookup, org.sandev.basics.nodecommon.Controllable, org.sandev.basics.util.IDLookup, org.sandev.basics.nodecommon.Loggable, org.sandev.basics.nodecommon.Messageable, org.sandev.basics.util.NameLookup, org.sandev.basics.util.UIFileLocator, org.sandev.basics.util.UIFormAdaptorCallback, org.sandev.basics.util.UIFormOwner

public class ConfigEditorNode
extends ConfigEditorNodeBase
implements org.sandev.basics.util.UIFormOwner

Implementation of ConfigEditorNodeDecl.


Field Summary
protected  ConfigDataCache cache
          IDCache which looks up instances in the initial data specified for the Configuration.
protected  org.sandev.basics.nodecommon.CharSerializer charSerializer
          The CharSerializer we should use when writing data.
protected  java.lang.String configFileName
          The full file specification of the configuration file we are editing.
protected  java.lang.String inboundFilesLink
          The base link specification for inbound files.
protected  java.lang.String outboundFilesLink
          The base link specification for outbound files.
 
Fields inherited from class org.sandev.tools.ConfigEditor.ConfigEditorNodeBase
ctrlwrappers, helperNodes, LOGDEBUG, LOGERROR, LOGFATAL, logger, LOGINFO, logLevel, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_FATAL, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGWARN, messager, nodeInstance, outgoingSyncConfigManagerNodeName, parent, sandNodeErrorMessage, sandNodeState, SANDNODESTATE_FAILED, SANDNODESTATE_FAILING, SANDNODESTATE_RESUMING, SANDNODESTATE_RUNNING, SANDNODESTATE_STARTING, SANDNODESTATE_STOPPED, SANDNODESTATE_STOPPING, SANDNODESTATE_SUSPENDED, SANDNODESTATE_SUSPENDING, SANDNODESTATE_UNDEFINED, sandRoot
 
Fields inherited from interface org.sandev.basics.util.UIFormOwner
ACTION_REFRESH_GLOBAL_DATA
 
Fields inherited from interface org.sandev.basics.nodecommon.Controllable
OPERATION_FAIL, OPERATION_RESUME, OPERATION_SHUTDOWN, OPERATION_STARTUP, OPERATION_STR_FAIL, OPERATION_STR_RESUME, OPERATION_STR_SHUTDOWN, OPERATION_STR_STARTUP, OPERATION_STR_SUSPEND, OPERATION_STR_UNDEFINED, OPERATION_STRINGS, OPERATION_SUSPEND, OPERATION_UNDEFINED, SHUTDOWN_ERROR_RESTART_GLOBAL, SHUTDOWN_ERROR_RESTART_LOCAL, SHUTDOWN_ERROR_TERMINATE, SHUTDOWN_NORMAL, STATE_FAILED, STATE_FAILING, STATE_RESUMING, STATE_RUNNING, STATE_STARTING, STATE_STOPPED, STATE_STOPPING, STATE_STR_FAILED, STATE_STR_FAILING, STATE_STR_RESUMING, STATE_STR_RUNNING, STATE_STR_STARTING, STATE_STR_STOPPED, STATE_STR_STOPPING, STATE_STR_SUSPENDED, STATE_STR_SUSPENDING, STATE_STR_UNDEFINED, STATE_STRINGS, STATE_SUSPENDED, STATE_SUSPENDING, STATE_UNDEFINED
 
Constructor Summary
ConfigEditorNode()
           
 
Method Summary
 org.sandev.basics.util.UIFormContext doAction(java.lang.String actionName, org.sandev.basics.util.UIFormContext uifc, org.sandev.basics.util.UserWorkLog uwl)
          Does nothing.
 void doActionAddHook(org.sandev.basics.util.UIFormContext uifc)
          Given the UIFormContext which will be used to present a new form for the user to fill out, preprocess ad needed before returning control to the UIFormManager.
 void doActionEditHook(org.sandev.basics.util.UIFormContext uifc)
          Given the UIFormContext containing the instance we are editing, preprocess as needed before returning control to the UIFormManager.
 void doActionFindHook(org.sandev.basics.util.UIFormContext uifc)
          Given the UIFormContext reconstructed on an ACTION_FIND, preprocess as needed before returning control to the UIFormManager.
 java.lang.String filterDisplayText(java.lang.String value)
          No filtering of display text is done.
 java.util.Map filterInputParameters(java.lang.String prefix, java.util.Map params, java.lang.StringBuffer outText)
          No remapping of parameters is done.
 java.lang.String forgotPassword(java.lang.String username, java.lang.String secondary)
          Does nothing
 org.sandev.basics.structs.SandCollectionMessage formFind(org.sandev.basics.structs.SandQueryMessage sqm, org.sandev.basics.util.UIFormContext uifc)
          Generate a collection of matching instances for the query.
 void formHelp(org.sandev.basics.util.UIFormContext uifc)
          Pop up the docs for this message.
 void formSave(org.sandev.basics.util.UIFormContext uifc)
          Write the Configuration to file.
 org.sandev.basics.util.AuthFilter getAuthFilter()
          No AuthFilter since authorization is file based.
 ConfigDataCache getCache()
          accessor for cache
 org.sandev.basics.nodecommon.CharSerializer getCharSerializer()
          accessor for charSerializer
 java.lang.String getConfigFileName()
          accessor for configFileName
 java.lang.String getDeploymentPrefix()
          Just returns the empty string.
 java.lang.String getInboundFilesDir()
          The directory where uploaded files should be written to.
 java.lang.String getInboundFilesLink()
          Accessor for inboundFilesLink
 org.sandev.basics.structs.SandPersistMessage getInstance(java.lang.String classname, long id, org.sandev.basics.util.AuthUser user)
          Look up the specified instance in our cache.
 org.sandev.basics.structs.SandInstanceMessage getInstance(java.lang.String classname, java.lang.String fieldname, java.lang.String value, org.sandev.basics.util.AuthUser user)
          Look up the specified instance.
 java.lang.String getOutboundFilesDir()
          The directory where uploaded files should be written to.
 java.lang.String getOutboundFilesLink()
          Accessor for outboundFilesLink
 org.sandev.basics.util.ArrayAssociation getSelectionValues(org.sandev.basics.structs.SandInstanceMessage msg, java.lang.String fieldname, org.sandev.basics.util.AuthUser user)
          Return an appropriate selection list for this field.
 java.lang.String getTechSupportEmailAddress()
          Just returns the empty string.
 org.sandev.basics.util.AuthUser getUserForID(long authID)
          Returns null.
 org.sandev.basics.util.AuthUser getUserFromLogin(java.lang.String username, java.lang.String password)
          Returns null.
 org.sandev.basics.util.UserWorkLog getUserWorkLog()
          No user work log.
 boolean isActive(java.lang.String actionName, org.sandev.basics.util.UIFormContext uifc, boolean defaultValue)
          Returns false.
 void setCache(ConfigDataCache cache)
          mutator for cache
 void setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
          mutator for charSerializer
 void setConfigFileName(java.lang.String name)
          mutator for configFileName
 void setInboundFilesLink(java.lang.String defaultInboundFilesLink)
          Mutator for inboundFilesLink.
 void setOutboundFilesLink(java.lang.String defaultOutboundFilesLink)
          Mutator for outboundFilesLink.
 void trackFormProcessCall(org.sandev.basics.util.UIFormContext uifc)
          Reset our cache with the updated information.
 
Methods inherited from class org.sandev.tools.ConfigEditor.ConfigEditorNodeBase
addWrapper, callConfigManagerNodeName, deliver, fieldHasFlag, getHelperNodes, getIDCache, getLogger, getLoggerDefaultValue, getLoggerFieldPrintValue, getLoggerFlag, getLoggerInvalidValue, getLoggerMetatype, getLoggerPrintValue, getLoggerRange, getLoggerValidityCheck, getLogLevel, getLogLevelActualVals, getLogLevelDefaultValue, getLogLevelEnumSummary, getLogLevelFieldPrintValue, getLogLevelFlag, getLogLevelInvalidValue, getLogLevelKeyVals, getLogLevelMetatype, getLogLevelPrintVals, getLogLevelPrintValue, getLogLevelRange, getLogLevelValidityCheck, getMessager, getMessagerDefaultValue, getMessagerFieldPrintValue, getMessagerFlag, getMessagerInvalidValue, getMessagerMetatype, getMessagerPrintValue, getMessagerRange, getMessagerValidityCheck, getNodeInstance, getNodeInstanceDefaultValue, getNodeInstanceFieldPrintValue, getNodeInstanceFlag, getNodeInstanceInvalidValue, getNodeInstanceMetatype, getNodeInstanceName, getNodeInstancePrintValue, getNodeInstanceRange, getNodeInstanceValidityCheck, getOutgoingSyncConfigManagerNodeName, getOutgoingSyncConfigManagerNodeNameDefaultValue, getOutgoingSyncConfigManagerNodeNameFieldPrintValue, getOutgoingSyncConfigManagerNodeNameFlag, getOutgoingSyncConfigManagerNodeNameInvalidValue, getOutgoingSyncConfigManagerNodeNameMetatype, getOutgoingSyncConfigManagerNodeNamePrintValue, getOutgoingSyncConfigManagerNodeNameRange, getOutgoingSyncConfigManagerNodeNameValidityCheck, getParent, getSandNodeErrorMessage, getSandNodeErrorMessageDefaultValue, getSandNodeErrorMessageFieldPrintValue, getSandNodeErrorMessageFlag, getSandNodeErrorMessageInvalidValue, getSandNodeErrorMessageLengthMax, getSandNodeErrorMessageLengthNorm, getSandNodeErrorMessageMetatype, getSandNodeErrorMessagePrintValue, getSandNodeErrorMessageRange, getSandNodeErrorMessageValidityCheck, getSandNodeState, getSandNodeStateActualVals, getSandNodeStateDefaultValue, getSandNodeStateEnumSummary, getSandNodeStateFieldPrintValue, getSandNodeStateFlag, getSandNodeStateInvalidValue, getSandNodeStateKeyVals, getSandNodeStateMetatype, getSandNodeStatePrintVals, getSandNodeStatePrintValue, getSandNodeStateRange, getSandNodeStateValidityCheck, getSandRoot, getServername, init, log, log, logLevelActual2Print, logLevelLabelToValue, logLevelPrint2Actual, logLevelPrint2Key, logLevelValueToLabel, notifyStateChange, onFailure, onRestart, onResume, onShutdown, onStartup, onSuspend, receive, restart, resume, sandNodeStateActual2Print, sandNodeStateLabelToValue, sandNodeStatePrint2Actual, sandNodeStatePrint2Key, sandNodeStateValueToLabel, setHelperNodes, setLogger, setLogger, setLogLevel, setMessager, setMessager, setNodeInstance, setNodeInstance, setOutgoingSyncConfigManagerNodeName, setOutgoingSyncConfigManagerNodeName, setParent, setSandNodeErrorMessage, setSandNodeErrorMessage, setSandNodeState, setSandRoot, setupSecureReceive, setupSubscriptions, shutdown, startup, suspend, systemwideShutdown, validTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sandev.basics.util.UIFormAdaptorCallback
log
 

Field Detail

cache

protected ConfigDataCache cache
IDCache which looks up instances in the initial data specified for the Configuration. This is updated on each trackFormProcessCall.


configFileName

protected java.lang.String configFileName
The full file specification of the configuration file we are editing.


charSerializer

protected org.sandev.basics.nodecommon.CharSerializer charSerializer
The CharSerializer we should use when writing data. Set by the servlet that uses us as a UIFormOwner.


inboundFilesLink

protected java.lang.String inboundFilesLink
The base link specification for inbound files.


outboundFilesLink

protected java.lang.String outboundFilesLink
The base link specification for outbound files.

Constructor Detail

ConfigEditorNode

public ConfigEditorNode()
Method Detail

getCache

public ConfigDataCache getCache()
accessor for cache


setCache

public void setCache(ConfigDataCache cache)
mutator for cache


getConfigFileName

public java.lang.String getConfigFileName()
accessor for configFileName


setConfigFileName

public void setConfigFileName(java.lang.String name)
mutator for configFileName


getCharSerializer

public org.sandev.basics.nodecommon.CharSerializer getCharSerializer()
accessor for charSerializer


setCharSerializer

public void setCharSerializer(org.sandev.basics.nodecommon.CharSerializer val)
mutator for charSerializer


getInstance

public org.sandev.basics.structs.SandPersistMessage getInstance(java.lang.String classname,
                                                                long id,
                                                                org.sandev.basics.util.AuthUser user)
                                                         throws org.sandev.basics.structs.SandException
Look up the specified instance in our cache. If the reference isn't found there then it doesn't resolve. Unresolved references are allowed, since the config editor doesn't know about application logic related to initial data setup and can't enforce what referential integrity needs to be enforced. Also it needs to allow for null references in the process of setting things up.

Since access to the configuration is determined at the file level (read/write, read-only, no access), the AuthUser is parameter is ignored.

Specified by:
getInstance in interface org.sandev.basics.util.IDLookup
Throws:
org.sandev.basics.structs.SandException

getUserForID

public org.sandev.basics.util.AuthUser getUserForID(long authID)
                                             throws org.sandev.basics.structs.SandException
Returns null. The config editor uses file based authorization.

Specified by:
getUserForID in interface org.sandev.basics.util.AuthUserLookup
Throws:
org.sandev.basics.structs.SandException

getUserFromLogin

public org.sandev.basics.util.AuthUser getUserFromLogin(java.lang.String username,
                                                        java.lang.String password)
                                                 throws org.sandev.basics.structs.SandException
Returns null. The config editor uses file based authorization.

Specified by:
getUserFromLogin in interface org.sandev.basics.util.AuthUserLookup
Throws:
org.sandev.basics.structs.SandException

getInstance

public org.sandev.basics.structs.SandInstanceMessage getInstance(java.lang.String classname,
                                                                 java.lang.String fieldname,
                                                                 java.lang.String value,
                                                                 org.sandev.basics.util.AuthUser user)
                                                          throws org.sandev.basics.structs.SandException
Look up the specified instance. The only string references in a configuration are from the node instances back to the server declarations by name. So that's all we handle here.

Specified by:
getInstance in interface org.sandev.basics.util.NameLookup
Throws:
org.sandev.basics.structs.SandException

setInboundFilesLink

public void setInboundFilesLink(java.lang.String defaultInboundFilesLink)
Mutator for inboundFilesLink.

Specified by:
setInboundFilesLink in interface org.sandev.basics.util.UIFileLocator

getInboundFilesLink

public java.lang.String getInboundFilesLink()
Accessor for inboundFilesLink

Specified by:
getInboundFilesLink in interface org.sandev.basics.util.UIFileLocator

getInboundFilesDir

public java.lang.String getInboundFilesDir()
The directory where uploaded files should be written to.

Specified by:
getInboundFilesDir in interface org.sandev.basics.util.UIFileLocator

setOutboundFilesLink

public void setOutboundFilesLink(java.lang.String defaultOutboundFilesLink)
Mutator for outboundFilesLink.

Specified by:
setOutboundFilesLink in interface org.sandev.basics.util.UIFileLocator

getOutboundFilesLink

public java.lang.String getOutboundFilesLink()
Accessor for outboundFilesLink

Specified by:
getOutboundFilesLink in interface org.sandev.basics.util.UIFileLocator

getOutboundFilesDir

public java.lang.String getOutboundFilesDir()
The directory where uploaded files should be written to.

Specified by:
getOutboundFilesDir in interface org.sandev.basics.util.UIFileLocator

formFind

public org.sandev.basics.structs.SandCollectionMessage formFind(org.sandev.basics.structs.SandQueryMessage sqm,
                                                                org.sandev.basics.util.UIFormContext uifc)
                                                         throws org.sandev.basics.util.UIFormManagerException
Generate a collection of matching instances for the query. Our scope is limited to instances within the Configuration we are currently editing, so if this is a query for something persistent it must be in our initial data. Otherwise we are looking up a server by name.

Specified by:
formFind in interface org.sandev.basics.util.UIFormOwner
Throws:
org.sandev.basics.util.UIFormManagerException

formSave

public void formSave(org.sandev.basics.util.UIFormContext uifc)
              throws org.sandev.basics.util.UIFormManagerException
Write the Configuration to file. This method does not currently currently send a ConfigurationUpdate message. See Deploy.html for details.

Specified by:
formSave in interface org.sandev.basics.util.UIFormOwner
Throws:
org.sandev.basics.util.UIFormManagerException

formHelp

public void formHelp(org.sandev.basics.util.UIFormContext uifc)
Pop up the docs for this message. We leave a marker here in the output text, which is then picked up during form display to trigger a popup with the docs for this message class.

Specified by:
formHelp in interface org.sandev.basics.util.UIFormOwner

trackFormProcessCall

public void trackFormProcessCall(org.sandev.basics.util.UIFormContext uifc)
Reset our cache with the updated information.

Specified by:
trackFormProcessCall in interface org.sandev.basics.util.UIFormOwner

isActive

public boolean isActive(java.lang.String actionName,
                        org.sandev.basics.util.UIFormContext uifc,
                        boolean defaultValue)
Returns false. No actions supported

Specified by:
isActive in interface org.sandev.basics.util.UIFormOwner

doAction

public org.sandev.basics.util.UIFormContext doAction(java.lang.String actionName,
                                                     org.sandev.basics.util.UIFormContext uifc,
                                                     org.sandev.basics.util.UserWorkLog uwl)
                                              throws org.sandev.basics.util.UIFormManagerException
Does nothing. No actions supported.

Specified by:
doAction in interface org.sandev.basics.util.UIFormOwner
Throws:
org.sandev.basics.util.UIFormManagerException

forgotPassword

public java.lang.String forgotPassword(java.lang.String username,
                                       java.lang.String secondary)
                                throws org.sandev.basics.util.UIFormManagerException
Does nothing

Specified by:
forgotPassword in interface org.sandev.basics.util.UIFormOwner
Throws:
org.sandev.basics.util.UIFormManagerException

getAuthFilter

public org.sandev.basics.util.AuthFilter getAuthFilter()
                                                throws org.sandev.basics.util.UIFormManagerException
No AuthFilter since authorization is file based.

Specified by:
getAuthFilter in interface org.sandev.basics.util.UIFormOwner
Throws:
org.sandev.basics.util.UIFormManagerException

getUserWorkLog

public org.sandev.basics.util.UserWorkLog getUserWorkLog()
No user work log.

Specified by:
getUserWorkLog in interface org.sandev.basics.util.UIFormOwner

getSelectionValues

public org.sandev.basics.util.ArrayAssociation getSelectionValues(org.sandev.basics.structs.SandInstanceMessage msg,
                                                                  java.lang.String fieldname,
                                                                  org.sandev.basics.util.AuthUser user)
Return an appropriate selection list for this field.

Specified by:
getSelectionValues in interface org.sandev.basics.util.UIFormAdaptorCallback

doActionFindHook

public void doActionFindHook(org.sandev.basics.util.UIFormContext uifc)
Given the UIFormContext reconstructed on an ACTION_FIND, preprocess as needed before returning control to the UIFormManager.

Specified by:
doActionFindHook in interface org.sandev.basics.util.UIFormAdaptorCallback

doActionAddHook

public void doActionAddHook(org.sandev.basics.util.UIFormContext uifc)
Given the UIFormContext which will be used to present a new form for the user to fill out, preprocess ad needed before returning control to the UIFormManager.

Specified by:
doActionAddHook in interface org.sandev.basics.util.UIFormAdaptorCallback

doActionEditHook

public void doActionEditHook(org.sandev.basics.util.UIFormContext uifc)
Given the UIFormContext containing the instance we are editing, preprocess as needed before returning control to the UIFormManager.

Specified by:
doActionEditHook in interface org.sandev.basics.util.UIFormAdaptorCallback

filterDisplayText

public java.lang.String filterDisplayText(java.lang.String value)
No filtering of display text is done.

Specified by:
filterDisplayText in interface org.sandev.basics.util.UIFormAdaptorCallback

filterInputParameters

public java.util.Map filterInputParameters(java.lang.String prefix,
                                           java.util.Map params,
                                           java.lang.StringBuffer outText)
                                    throws org.sandev.basics.util.UIFormAdaptorException
No remapping of parameters is done.

Specified by:
filterInputParameters in interface org.sandev.basics.util.UIFormAdaptorCallback
Throws:
org.sandev.basics.util.UIFormAdaptorException

getDeploymentPrefix

public java.lang.String getDeploymentPrefix()
Just returns the empty string.

Specified by:
getDeploymentPrefix in interface org.sandev.basics.util.UIFormOwner

getTechSupportEmailAddress

public java.lang.String getTechSupportEmailAddress()
Just returns the empty string.

Specified by:
getTechSupportEmailAddress in interface org.sandev.basics.util.UIFormOwner