You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/06/14 16:52:56 UTC
svn commit: r190601 - in /struts/sandbox/trunk/overdrive/Nexus: Core/
Core/Helpers/ Core/Tables/ Core/Validators/ Extras/Spring/ Test/
Test/Commands/ Web/
Author: husted
Date: Tue Jun 14 07:52:55 2005
New Revision: 190601
URL: http://svn.apache.org/viewcvs?rev=190601&view=rev
Log:
OVR-15
* XML Doc formatting.
* Remove FieldSet from IRequesstContext. This list is part of the Helper, not the Context.
* No other code changes.
Modified:
struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs
struts/sandbox/trunk/overdrive/Nexus/Core/IRequestCommand.cs
struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs
struts/sandbox/trunk/overdrive/Nexus/Core/RequestCommand.cs
struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldContext.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Tokens.cs
struts/sandbox/trunk/overdrive/Nexus/Core/Validators/IValidatorContext.cs
struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Controller.cs
struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs
struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/Commands/ListAll.cs
struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs
struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs
struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs
struts/sandbox/trunk/overdrive/Nexus/Web/WebViewHelper.cs
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs Tue Jun 14 07:52:55 2005
@@ -20,20 +20,27 @@
namespace Nexus.Core.Helpers
{
/// <summary>
- /// A facade for use by a code-behind to simplify access to the IRequestContext and IRequestCommand.
+ /// A facade for use by a code-behind to simplify access to the
+ /// IRequestContext and IRequestCommand.
/// </summary>
/// <remarks><p>
- /// The controller for a helper may also act as a "front controller" to ensure routine tasks are carried out.
- /// These tasks can include input validation, data conversion, text formatting, command logging, and so forth.
+ /// The controller for a helper may also act as a "front controller"
+ /// to ensure routine tasks are carried out.
+ /// These tasks can include input validation, data conversion,
+ /// text formatting, command logging, and so forth.
/// </p></remarks>
+ ///
public interface IViewHelper
{
/// <summary>
- /// Invoke the helper's command and bind the output to controls in the given collection.
+ /// Invoke the helper's command and bind the output to
+ /// controls in the given collection.
/// </summary>
/// <remarks><p>
- /// Most code behinds will call either ExecuteBind or ReadExecute by passing in the collection of controls from a panel control.
+ /// Most code behinds will call either ExecuteBind or
+ /// ReadExecute by passing in the collection of controls
+ /// from a panel control.
/// </p></remarks>
/// <param name="controls">Collection of controls to populate.</param>
///
@@ -41,20 +48,26 @@
/// <summary>
- /// Read input from the controls in the given collection, and invoke the helper's command.
+ /// Read input from the controls in the given collection,
+ /// and invoke the helper's command.
/// </summary>
- /// <param name="controls">Collection of controls to populate.</param>
+ /// <param name="controls">Collection of controls to
+ /// populate.</param>
/// <remarks><p>
- /// Most code behinds will call either ExecuteBind or ReadExecute by passing in the collection of controls from a panel control.
+ /// Most code behinds will call either ExecuteBind or
+ /// ReadExecute by passing in the collection of controls
+ /// from a panel control.
/// </p></remarks>
///
void ReadExecute (ICollection controls);
/// <summary>
- /// Bind the output of the helper's command to controls in the given collection.
+ /// Bind the output of the helper's command to controls in the
+ /// given collection.
/// </summary>
- /// <param name="controls">Collection of controls to populate.</param>
+ /// <param name="controls">Collection of controls to
+ /// populate.</param>
///
void Bind (ICollection controls);
@@ -77,7 +90,8 @@
// ----
/// <summary>
- /// A list of error messages, keyed by the field causing the error, or to a magic global key.
+ /// A list of error messages, keyed by the field causing the
+ /// error, or to a magic global key.
/// </summary>
///
IDictionary Errors { get; }
@@ -87,18 +101,21 @@
/// Return true if errors are queued.
/// </summary>
/// <returns>True if errors are queued.</returns>
+ ///
bool HasErrors { get; }
/// <summary>
/// An Exception, if thrown.
/// </summary>
+ ///
Exception Fault { get; }
/// <summary>
/// Return true if an exception is caught.
/// </summary>
/// <returns>True if an exception is caught.</returns>
+ ///
bool HasFault { get; }
@@ -106,11 +123,13 @@
/// Return true if there are no errors or exception pending.
/// </summary>
/// <returns>True if all is well.</returns>
+ ///
bool IsNominal { get; }
/// <summary>
- /// A list of text messages, keyed by a field or other identifier, or to a magic global key.
+ /// A list of text messages, keyed by a field or other
+ /// identifier, or to a magic global key.
/// </summary>
///
IDictionary Messages { get; }
@@ -126,26 +145,32 @@
// ----
/// <summary>
- /// Set of IFieldContext definitions available to the application, usually set by the controller.
+ /// Set of IFieldContext definitions available to the application,
+ /// usually set by the controller.
/// </summary>
/// <remarks><p>
- /// The FieldTable can be used to convert display strings to native types on input,
+ /// The FieldTable can be used to convert display strings to native
+ /// types on input,
/// and from native types to display strings on output.
/// The FieldTable can also be used to generate UI controls.
/// </p></remarks>
+ ///
IFieldTable FieldTable { get;}
/// <summary>
- /// Set of IFieldContext definitions to be used with this helper, usually set by dependency injection.
+ /// Set of IFieldContext definitions to be used with this helper,
+ /// usually set by dependency injection.
/// </summary>
/// <remarks><p>
- /// Some helpers generate DataGrids or DataForms based on the FieldDefinitions
+ /// Some helpers generate DataGrids or DataForms based on the
+ /// FieldDefinitions
/// </p></remarks>
+ ///
IList FieldSet {get;}
/*
- // TODO:
+ // TODO: Messengers
string Text(string key);
string TextIndex {get;}
ITextTable TextTable {get;}
@@ -155,10 +180,12 @@
// ----
/// <summary>
- /// Prefix to trim from the id of a control during Read and Bind.
+ /// Prefix to trim from the id of a control during Read and
+ /// Bind.
/// </summary>
/// <remarks><p>
- /// The Prefix is needed when a single page uses a control more than once
+ /// The Prefix is needed when a single page uses a control
+ /// more than once
/// often in separate panels.
/// </p></remarks>
///
@@ -166,14 +193,17 @@
/// <summary>
- /// Suffix to truncate from a list control id in order to set a corresponding value field ["_list"].
+ /// Suffix to truncate from a list control id in order to set a
+ /// corresponding value field ["_list"].
/// </summary>
/// <remark><p>
- /// When processing a single-value list control, if the id ends with the list suffix,
- /// the suffix is removed, and a field with the remaining name is set to the selected item value.
+ /// When processing a single-value list control, if the id ends with
+ /// the list suffix,
+ /// the suffix is removed, and a field with the remaining name is set
+ /// to the selected item value.
/// </p><P>
- /// So, the selected item from a list control with the id "facility_key_list" will be
- /// set to a field named "facility_key".
+ /// So, the selected item from a list control with the id
+ /// "facility_key_list" will be set to a field named "facility_key".
/// </P></remark>
///
string ListSuffix {get; set;}
@@ -187,7 +217,8 @@
/// <summary>
- /// If a control value is an empty string, set the value to null instead [TRUE].
+ /// If a control value is an empty string, set the value to null
+ /// instead [TRUE].
/// </summary>
///
bool NullIfEmpty {get; set;}
@@ -206,14 +237,16 @@
// ----
/// <summary>
- /// The controller for this helper, usually set by dependency injection.
+ /// The controller for this helper, usually set by dependency
+ /// injection.
/// </summary>
///
IController Controller { get; set; }
/// <summary>
- /// The command (or chain of commands) for this helper, usually set by dependency injection.
+ /// The command (or chain of commands) for this helper, usually set
+ /// by dependency injection.
/// </summary>
///
IRequestCommand Command { get; set; }
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs Tue Jun 14 07:52:55 2005
@@ -22,6 +22,7 @@
/// <summary>
/// Standard implementation of IViewHelper.
/// </summary>
+ ///
public abstract class ViewHelper : IViewHelper
{
#region private
@@ -41,7 +42,7 @@
#endregion
- #region Read and Bind
+ #region Read and Bind (abstract)
public abstract void ExecuteBind (ICollection controls);
@@ -106,7 +107,7 @@
public IList FieldSet
{
- get { return Context.FieldSet; }
+ get { throw new NotImplementedException (); }
}
public string Prefix
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/IController.cs Tue Jun 14 07:52:55 2005
@@ -22,20 +22,23 @@
/// </summary>
/// <remarks><p>
/// The caller should only need to know the name of a Command
- /// to be able to acquire the appropriate Context, and then execute the request.
+ /// to be able to acquire the appropriate Context,
+ /// and then execute the request.
/// </p></remarks>
+ ///
public interface IController
{
/// <summary>
/// Obtain object instance for name.
/// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
+ /// <param name="name">ID for object to return</param>
+ /// <returns>Instantiated object corresonding to name</returns>
///
object GetObject (string name);
/// <summary>
- /// Obtain new NexusContext for command, including embedded resources.
+ /// Obtain new NexusContext for command,
+ /// including embedded resources.
/// </summary>
/// <param name="command">Our command</param>
/// <returns>NexusContext with embedded resources.</returns>
@@ -57,7 +60,7 @@
/// <remarks><p>
/// Among other things, the View layer chain may transfer
/// data between the FieldState and the root Context.
- /// The View layer chain acts as a Front Controller.
+ /// The View layer chain acts as a Front Controller.
/// </p></remarks>
/// <param name="context">Context to execute</param>
///
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/IRequestCommand.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/IRequestCommand.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/IRequestCommand.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/IRequestCommand.cs Tue Jun 14 07:52:55 2005
@@ -20,12 +20,12 @@
/// <summary>
/// Use an IRequestContext to process a Command [OVR-9]
/// </summary>
- /// <remarks>
- /// <p>
- /// Rather than have each command cast its context to an IRequestContext,
+ /// <remarks><p>
+ /// Rather than have each command cast its context to an
+ /// IRequestContext,
/// provide a IRequestCommand with an alternative signature.
- /// </p>
- /// </remarks>
+ /// </p></remarks>
+ ///
public interface IRequestCommand : ICommand
{
/// <summary>
@@ -35,12 +35,15 @@
/// Corresponds to the Command property of IHelperContext.
/// </remarks>
/// <returns>An identifier for this Command.</returns>
+ ///
string ID { get; set; }
/// <summary>
- /// Factory method to provide an empty context that can be used with the Command instance.
+ /// Factory method to provide an empty context that can be used
+ /// with the Command instance.
/// </summary>
/// <returns>Context instance with Command ID set.</returns>
+ ///
IRequestContext NewContext ();
/// <summary>
@@ -50,6 +53,7 @@
/// Expected to be called from Execute as a casting convenience.
/// </p></remarks>
/// <param name="context">Context to process.</param>
+ ///
bool RequestExecute (IRequestContext context);
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/IRequestContext.cs Tue Jun 14 07:52:55 2005
@@ -21,32 +21,35 @@
namespace Nexus.Core
{
/// <summary>
- /// Exchange data between business and presentation layers per [OVR-7].
+ /// Exchange data between business and presentation layers [OVR-7].
/// </summary>
- /// <remarks>
- /// <p>
- /// An IRequestContext can predefine whatever properties we need for storing input,
- /// output, messages, and other common attributes, including Locale (or Culture)
- /// and user credentials.
- /// </p>
- /// </remarks>
+ /// <remarks><p>
+ /// An IRequestContext can predefine whatever properties we need for
+ /// storing input, output, messages, and other common attributes,
+ /// including Locale (or Culture) and user credentials.
+ /// </p></remarks>
+ ///
public interface IRequestContext : IContext
{
/// <summary>
- /// Identifier for the top-level Command (or Chain) processing this Context.
+ /// Identifier for the top-level Command (or Chain) processing
+ /// this Context.
/// </summary>
- /// <remarks>
- /// Corresponds to ID of INexusCommand for the initial Command or Chain.
- /// </remarks>
+ /// <remarks><P>
+ /// Corresponds to ID of INexusCommand for the initial Command
+ /// or Chain.
+ /// </P></remarks>
///
string Command { get; set; }
/// <summary>
- /// Instance of the top-level Command (or Chain) processing this Context.
+ /// Instance of the top-level Command (or Chain) processing this
+ /// Context.
/// </summary>
- /// <remarks>
- /// Corresponds to ID of INexusCommand for the initial Command or Chain.
- /// </remarks>
+ /// <remarks><p>
+ /// Corresponds to ID of INexusCommand for the initial Command
+ /// or Chain.
+ /// </p></remarks>
///
IRequestCommand CommandBin { get; set; }
@@ -54,20 +57,15 @@
/// <summary>
/// Instance of the global Field Table for this application.
/// </summary>
- /// <remarks>
- /// Corresponds to ID of INexusCommand for the initial Command or Chain.
- /// </remarks>
+ /// <remarks><p>
+ /// Corresponds to ID of INexusCommand for the initial Command or
+ /// Chain.
+ /// </p></remarks>
///
IFieldTable FieldTable { get; set; }
/// <summary>
- ///
- /// </summary>
- IList FieldSet { get; set; }
-
-
- /// <summary>
/// Return true if an Outcome object is present.
/// </summary>
/// <returns>True if an Outcome context is present.</returns>
@@ -77,29 +75,25 @@
/// <summary>
/// Return a IList stored under the Command ID, if any.
/// </summary>
- /// <remarks>
- /// <p>
+ /// <remarks><p>
/// Some Commands returns List of values.
/// So that Commands can work together as part of a Chain,
/// list-based Commands are expected to store the
/// list under their own Command ID.
- /// Outcome is a convenient method to access the
+ /// Outcome is a convenience method to access the
/// initial or "outermost" Command or Chain ID.
- /// </p>
- /// <p>
+ /// </p><p>
/// To allow use as subcommands in a Chain,
- /// INexusCommand implementations should prefer the idiom
+ /// IRequestCommand implementations should prefer the idiom
/// <code>Context[ID] = object</code>
/// to using the Outcome directly.
/// Since they might not be the initial Command,
/// but rather a subcommand, or link, in a Chain.
- /// </p>
- /// <p>
+ /// </p><p>
/// Outcome is more convenient to presentation layer clients,
/// who are looking for the top-level output,
/// rather than output of a particular subcommand.
- /// </p>
- /// <p>
+ /// </p><p>
/// As mentioned, both Outcome and the context[ID] idiom
/// can be used by Command that return lists of values.
/// Commands that return a single set of fields
@@ -107,23 +101,23 @@
/// This strategy allows one Command to obtain field values
/// to be used by another Command
/// (like piping output between Unix shell commands.)
- /// </p>
- /// <p>
+ /// </p><p>
/// Note that "Outcome" is an "alias" to an entry in
/// this context.
/// Unlike FieldState, Outcome is not a subcontext
/// in its own right.
- /// </p>
- /// </remarks>
+ /// </p></remarks>
///
object Outcome { get; set; }
/// <summary>
- /// A list of error messages, keyed by the field causing the error, or to a magic global key.
+ /// A list of error messages,
+ /// keyed by the field causing the error,
+ /// or to a magic global key.
/// </summary>
- /// <remark>
+ /// <remark><p>
/// TODO: Refactor as NameValueCollection ?
- /// </remark>
+ /// </p></remark>
///
IDictionary Errors { get; set; }
@@ -137,7 +131,7 @@
/// <summary>
/// Indicate whether errors exist.
/// </summary>
- /// <returns>True if there are errors. False otherwise.</returns>
+ /// <returns>True if there are errors.</returns>
///
bool HasErrors { get; }
@@ -146,7 +140,8 @@
/// </summary>
/// <remark>
/// A IViewContext is readonly,
- /// but another interface (e.g. IHelperContext) may extend to add a setter, if needed.
+ /// but another interface (e.g. IHelperContext) may extend to add a
+ /// setter, if needed.
/// </remark>
///
Exception Fault { get; set; }
@@ -159,37 +154,44 @@
bool HasFault { get; }
/// <summary>
- /// Indicate whether context is free of faults and errors.
+ /// Indicate whether context is free of fault and errors.
/// </summary>
- /// <returns>True if there are no faults or errors.</returns>
+ /// <returns>True if there are no fault or errors.</returns>
///
bool IsNominal { get; }
/// <summary>
- /// A list of error messages, keyed by the field causing the error, or to a magic global key.
+ /// A list of advisory or warning messages (!errors),
+ /// keyed by the field causing the message,
+ /// or to a magic global key.
/// </summary>
+ ///
IDictionary Messages { get; set; }
/// <summary>
/// Add a message, creating the context if needed.
/// </summary>
- /// <remarks>
- /// Multiple messages can be added for a key and retrieved as a List.
- /// </remarks>
+ /// <remarks><p>
+ /// Multiple messages can be added for a key and
+ /// retrieved as a List.
+ /// </p></remarks>
/// <param name="template">Message template.</param>
/// <param name="message">Message key.</param>
+ ///
void AddMessage (string template, string message);
/// <summary>
/// Add a message under the "global" key.
/// </summary>
/// <param name="template">Message template.</param>
+ ///
void AddMessage (string template);
/// <summary>
/// Indicate whether messages exist.
/// </summary>
- /// <returns>True if there are messages. False otherwise.</returns>
+ /// <returns>True if there are messages.</returns>
+ ///
bool HasMessages {get;}
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/RequestCommand.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/RequestCommand.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/RequestCommand.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/RequestCommand.cs Tue Jun 14 07:52:55 2005
@@ -20,16 +20,20 @@
/// <summary>
/// Abstract IRequestCommand; subclass must implement RequestExecute.
/// </summary>
+ ///
public abstract class RequestCommand : IRequestCommand
{
/// <summary>
- /// Return STOP if a Command is part of a Chain.
+ /// Execute should return STOP if problem occurs,
+ /// so that a Chain can exit processing on error.
/// </summary>
+ ///
public const bool STOP = true;
/// <summary>
- /// Return CONTINUE if another Command can run.
+ /// Return CONTINUE if another Command could run.
/// </summary>
+ ///
public const bool CONTINUE = false;
private string _ID = null;
@@ -42,6 +46,7 @@
public virtual IRequestContext NewContext ()
{
// Return a new instance on each call.
+ // ISSUE: Spring?
return new RequestContext (ID);
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/RequestContext.cs Tue Jun 14 07:52:55 2005
@@ -23,12 +23,14 @@
/// <summary>
/// Concrete IRequestContext implementation.
/// </summary>
+ ///
public class RequestContext : Context, IRequestContext
{
/// <summary>
/// Convenience constructor to set Command on instantiation.
/// </summary>
/// <param name="command">Name of Command processing this Context.</param>
+ ///
public RequestContext (string command)
{
Command = command;
@@ -37,6 +39,7 @@
/// <summary>
/// Default, no argument constructor.
/// </summary>
+ ///
public RequestContext ()
{
}
@@ -80,14 +83,16 @@
/// Convenience method to lazily instantiate a message store.
/// </summary>
/// <param name="template">Message template to add to the queue.</param>
- /// <param name="queue">Token for queue of messages within the store.</param>
+ /// <param name="queue">Token for queue of messages within the
+ /// store.</param>
/// <param name="key">Token for message store.</param>
+ ///
private void AddStore (string template, string queue, string key)
{
IContext store = this [key] as IContext;
if (null == store)
{
- store = new Context (); // FIXME: Spring?
+ store = new Context (); // ISSUE: Spring?
this [key] = store;
}
IList list;
@@ -95,7 +100,7 @@
list = store [queue] as IList;
else
{
- list = new ArrayList (); // FIXME: Spring?
+ list = new ArrayList (); // ISSUE: Spring?
store [queue] = list;
}
list.Add (template);
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldContext.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldContext.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldContext.cs Tue Jun 14 07:52:55 2005
@@ -4,52 +4,65 @@
namespace Nexus.Core.Tables
{
/// <summary>
- /// Properties common to controls, including Alert, Constraints, ControlType, and DataType.
+ /// Properties common to controls, including Alert, Constraints,
+ /// ControlType, and DataType.
/// </summary>
/// <remark><p>
- /// Validation commands can use the FieldContext properties to verify input.
+ /// Validation commands can use the FieldContext properties to verify
+ /// input.
/// The FieldContext entries are made available through a FieldTable.
/// </p></remark>
+ ///
public interface IFieldContext : ISerializable
{
/// <summary>
/// Intitial error message to display when Constraints fail.
/// </summary>
+ ///
string Alert { get; set; }
/// <summary>
/// Cannonical name of the Control Type (input, select, et al.).
/// </summary>
+ ///
string ControlTypeName { get; set; }
/// <summary>
/// Formatting instructions for the value, according to DateType.
/// </summary>
+ ///
string DataFormat { get; set; }
/// <summary>
- /// Type of native data - Boolean, Byte Char, DateTime, Decimal, Double, Int16, Int32, Int64, SByte, Single, String, TimeSpan, UInt16, UInt32, UInt64.
+ /// Type of native data - Boolean, Byte Char, DateTime, Decimal,
+ /// Double, Int16, Int32, Int64, SByte, Single, String, TimeSpan,
+ /// UInt16, UInt32, UInt64.
/// </summary>
+ ///
Type DataType { get; set; }
/// <summary>
/// Cannonical name of the DataType.
/// </summary>
+ ///
string DataTypeName { get; set; }
/// <summary>
/// Hint - Gets or sets an onscreen or hover hint.
/// </summary>
+ ///
string Hint { get; set; }
/// <summary>
/// Name of the control (also dictionary key).
/// </summary>
+ ///
string ID { get; set; }
/// <summary>
/// the label for the control.
/// </summary>
+ ///
string Label { get; set; }
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Tables/IFieldTable.cs Tue Jun 14 07:52:55 2005
@@ -8,22 +8,27 @@
/// <summary>
/// Inventory of fields used by the application.
/// </summary>
+ ///
public interface IFieldTable : IContext, ISerializable
{
/// <summary>
/// Add a field to the set.
/// </summary>
+ ///
IFieldContext AddField { set; }
/// <summary>
/// Add a list of fields to the set.
/// </summary>
+ ///
IList AddFields { set; }
/// <summary>
- /// If true, requires that all fields, including strings fields, be specified [FALSE].
+ /// If true, requires that all fields, including strings fields,
+ /// be specified [FALSE].
/// </summary>
+ ///
bool Strict { set; get; }
/// <summary>
@@ -31,27 +36,35 @@
/// </summary>
/// <param name="id">FieldContext ID</param>
/// <returns>Alert mesasge for FieldContext ID</returns>
+ ///
string Alert (string id);
/// <summary>
- /// Utilitizing the FieldContext settings, convert and copy values from the Criteria into the main Context.
+ /// Utilitizing the FieldContext settings, convert and copy values
+ /// from the Criteria into the main Context.
/// </summary>
- /// <param name="context"></param>
- /// <returns></returns>
+ /// <param name="context">Context to process (including Criteria)</param>
+ /// <returns>True if nominal</returns>
+ ///
bool Convert (IValidatorContext context);
/// <summary>
- /// Utilizing the FieldContext settings, format and copy values from the main Context into the Criteria.
+ /// Utilizing the FieldContext settings, format and copy values from
+ /// the main Context into the Criteria.
/// </summary>
- /// <param name="context"></param>
- /// <returns></returns>
+ /// <param name="context">Context to process (including Criteria)</param>
+ /// <returns>True if nominal</returns>
+ ///
bool Format (IValidatorContext context);
/// <summary>
- /// Determine if the control is a simple value or a rich control, like a drop down list.
+ /// Determine if the control is a simple value or a rich
+ /// control, like a drop down list.
/// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
+ /// <param name="name">ID for Control</param>
+ /// <returns>True if control is a multivalue control,
+ /// like a list</returns>
+ ///
bool IsRichControl (string name);
/// <summary>
@@ -59,6 +72,7 @@
/// </summary>
/// <param name="id">FieldContext ID</param>
/// <returns>FieldContext for ID</returns>
+ ///
IFieldContext Get (string id);
}
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Tokens.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Tokens.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Tokens.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Tokens.cs Tue Jun 14 07:52:55 2005
@@ -19,6 +19,7 @@
/// <summary>
/// Tokens representing context keys.
/// </summary>
+ ///
public class Tokens
{
private Tokens ()
@@ -29,16 +30,19 @@
/// <summary>
/// Token for Command property.
/// </summary>
+ ///
public const string COMMAND = "__COMMAND";
/// <summary>
/// Token for CommandBin property.
/// </summary>
+ ///
public const string COMMAND_BIN = "__COMMAND_BIN";
/// <summary>
/// Token for Errors property.
/// </summary>
+ ///
public const string ERRORS = "__ERRORS";
/// <summary>
@@ -49,6 +53,7 @@
/// <summary>
/// Token for FieldTable property.
/// </summary>
+ ///
public const string FIELD_TABLE = "__FIELD_TABLE";
/// <summary>
@@ -59,26 +64,31 @@
/// <summary>
/// Token for FieldSet property.
/// </summary>
+ ///
public const string FIELD_SET = "__FIELD_SET";
/// <summary>
/// Token for a generic message.
/// </summary>
+ ///
public const string GENERIC_MESSAGE = "__GENERIC_MESSAGE";
/// <summary>
/// Token for Fault property.
/// </summary>
+ ///
public const string FAULT = "__FAULT";
/// <summary>
/// Token for pre-op command.
/// </summary>
+ ///
public const string PRE_OP = "pre-op";
/// <summary>
/// Token for post-op command.
/// </summary>
+ ///
public const string POST_OP = "post-op";
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Validators/IValidatorContext.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Validators/IValidatorContext.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Validators/IValidatorContext.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Validators/IValidatorContext.cs Tue Jun 14 07:52:55 2005
@@ -3,23 +3,27 @@
namespace Nexus.Validators
{
/// <summary>
- /// Encapsulate values needed by standard IValidatorCommands.
+ /// Encapsulate values needed by standard IValidatorCommands [OVR-13].
/// </summary>
+ ///
public interface IValidatorContext : IContext
{
/// <summary>
/// The identifer for the field under validation.
/// </summary>
+ ///
string FieldKey { get; set; }
/// <summary>
/// The source value that we to process.
/// </summary>
+ ///
object Source { get; set; }
/// <summary>
/// The target value after conversion or formatting.
/// </summary>
+ ///
object Target { get; set; }
}
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Controller.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Controller.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Controller.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Controller.cs Tue Jun 14 07:52:55 2005
@@ -22,8 +22,10 @@
namespace Nexus.Extras.Spring
{
/// <summary>
- /// Concrete IController implementation using Spring as an IOC container.
+ /// Concrete IController implementation using Spring as an IOC
+ /// container [OVR-8].
/// </summary>
+ ///
public class Controller : IController, IApplicationContextAware
{
private IApplicationContext _Factory = null;
@@ -48,10 +50,15 @@
return _Factory;
}
+ static string msg_NAME = "name";
+ static string msg_NULL = "Command name cannot be null.";
+ static string msg_MISSING = "Object is not found in Factory.";
+ string msg_TYPE = "Command is not a IRequestCommand or IRequestChain.";
+
public object GetObject (string name)
{
if (null == name)
- throw new ArgumentNullException ("name", "IController.GetObject");
+ throw new ArgumentNullException (msg_NAME, "IController.GetObject");
return Factory ().GetObject (name);
}
@@ -59,19 +66,19 @@
{
if (null == name)
{
- Exception e = new Exception ("Command name cannot be null.");
+ Exception e = new Exception (msg_NULL);
throw(e);
}
object o = GetObject (name);
if (o == null)
{
- Exception e = new Exception ("Object is not found in Factory.");
+ Exception e = new Exception (msg_MISSING);
throw(e);
}
IRequestCommand command = o as IRequestCommand;
if (command == null)
{
- Exception e = new Exception ("Command is not a IRequestCommand or IRequestChain.");
+ Exception e = new Exception (msg_TYPE);
throw(e);
}
return command;
@@ -90,8 +97,8 @@
{
context = new RequestContext ();
context.Fault = e;
- // TODO: Log exception(faults) (Log all errors in verbose mode?)
- // TODO: Provide an alternate location on fault? -- Declarative exception handing
+ // ISSUE: Log exception(faults) (Log all errors in verbose mode?)
+ // ISSUE: Provide an alternate location on fault? -- Declarative exception handing
}
return context;
@@ -110,8 +117,8 @@
{
context = new RequestContext ();
context.Fault = e;
- // TODO: Log exception(faults) (Log all errors in verbose mode?)
- // TODO: Provide an alternate location on fault? -- Declarative exception handing
+ // ISSUE: Log exception(faults) (Log all errors in verbose mode?)
+ // ISSUE: Provide an alternate location on fault? -- Declarative exception handing
}
return context;
}
@@ -119,12 +126,14 @@
/// <summary>
/// Field for GetFieldTable method.
/// </summary>
+ ///
private IFieldTable _FieldTable = null;
/// <summary>
/// Access method for the Controller's FieldTable.
/// </summary>
- /// <returns></returns>
+ /// <returns>FieldTable for this Controller</returns></returns>
+ ///
public IFieldTable GetFieldTable ()
{
if (_FieldTable == null)
@@ -137,14 +146,14 @@
if (null == context)
{
context = new RequestContext ();
- // TODO: Add a message about null context
+ // ISSUE: Add a message about null context
}
IRequestCommand command = context [Tokens.COMMAND_BIN] as IRequestCommand;
if (null == command)
{
- // TODO: Add a message about null command.
+ // ISSUE: Add a message about null command.
// (A null context with then have two messages.)
}
else
@@ -158,8 +167,8 @@
context.Fault = e;
}
}
- // TODO: Log exception(faults) (Log all errors in verbose mode?)
- // TODO: Provide an alternate location on fault? -- Declarative exception handing?
+ // ISSUE: Log exception(faults) (Log all errors in verbose mode?)
+ // ISSUE: Provide an alternate location on fault? -- Declarative exception handing?
}
public IRequestContext ExecuteContext (string command)
Modified: struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs Tue Jun 14 07:52:55 2005
@@ -9,19 +9,16 @@
/// A singleton implementation of the IHelper protocol,
/// using static methods and the Spring object factory.
/// </summary>
- /// <remarks>
- /// <p>
+ /// <remarks><p>
/// Since static methods are used here, as a convenience,
/// it is not possible to implement IHelper.
/// However, the same method signatures are otherwise used.
- /// </p>
- /// <p>
+ /// </p><p>
/// Of course, an alternative is to provide the Factory
/// method a singlton, and then obtain the Helpers
/// class from the Factory, but implementing the
/// IHelpers interface as a singleton seems simpler.
- /// </p>
- /// </remarks>
+ /// </p></remarks>
public class Objects
{
private static string FILE = "/Objects.xml";
@@ -31,6 +28,7 @@
// private constructor prevents instantiation.
}
+ // ISSUE: Remove this kludge and adopt latest iBATIS approach.
private static string _rootDirectory =
AppDomain.CurrentDomain.BaseDirectory.Replace (@"\bin", "").Replace (@"\Debug", "").Replace (@"\Release", "");
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs Tue Jun 14 07:52:55 2005
@@ -25,6 +25,7 @@
/// <summary>
/// Provide base SetUp method and convenience methods.
/// </summary>
+ ///
[TestFixture]
public class BaseNexusTest
{
@@ -33,6 +34,7 @@
/// <summary>
/// Setup controller between tests.
/// </summary>
+ ///
[SetUp]
public virtual void SetUp ()
{
@@ -42,8 +44,9 @@
}
/// <summary>
- /// Exercise SetuP method.
+ /// Exercise Setup method.
/// </summary>
+ ///
[Test]
public void AssertSetUp ()
{
@@ -54,6 +57,7 @@
/// Convenience method to confirm that no Exception was caught.
/// </summary>
/// <param name="context">Context under test</param>
+ ///
public void AssertNoFault (IRequestContext context)
{
bool hasFault = context.HasFault;
@@ -62,15 +66,18 @@
}
/// <summary>
- /// Convenience method to confirm that there are no errors or Exception.
+ /// Convenience method to confirm
+ /// that there are no errors or Exception.
/// </summary>
/// <param name="context">Context under test</param>
+ ///
public void AssertNominal (IRequestContext context)
{
AssertNoFault (context);
bool hasErrors = context.HasErrors;
if (hasErrors)
{
+ // TODO: Use new TextOnly method here.
StringBuilder outer = new StringBuilder ();
IDictionary store = context.Errors;
ICollection keys = store.Keys;
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/Commands/ListAll.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Commands/ListAll.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Commands/ListAll.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Commands/ListAll.cs Tue Jun 14 07:52:55 2005
@@ -20,14 +20,27 @@
/// <summary>
/// Return a list as the outcome.
/// </summary>
+ ///
public class ListAll : RequestCommand
{
+ /// <summary>
+ /// Test ID for Command.
+ /// </summary>
+ ///
+ public const string LIST_ALL = "ListAll";
+
+ /// <summary>
+ /// Fake name for test data.
+ /// </summary>
+ ///
+ const string DATA = "data";
+
public override bool RequestExecute (IRequestContext context)
{
// IList list = Mapper.Get ().QueryForList (ID, context);
// Fake it:
IList list = new ArrayList ();
- list.Add ("data");
+ list.Add (DATA);
context.Outcome = list;
return CONTINUE;
}
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/ControllerTest.cs Tue Jun 14 07:52:55 2005
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+using Nexus.Core.Commands;
using NUnit.Framework;
namespace Nexus.Core
@@ -20,16 +21,18 @@
/// <summary>
/// Exercise IController per [OVR-8].
/// </summary>
+ ///
[TestFixture]
public class ControllerTest : BaseNexusTest
{
/// <summary>
/// A simple "list all" command should return nominal with an outcome.
/// </summary>
+ ///
[Test]
public void ExecuteContext ()
{
- IRequestContext context = controller.ExecuteContext ("list_all");
+ IRequestContext context = controller.ExecuteContext (ListAll.LIST_ALL);
AssertNominal (context);
Assert.IsTrue (context.IsNominal, "Expected nominal result.");
Assert.IsTrue (context.HasOutcome, "Expected outcome from command.");
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs Tue Jun 14 07:52:55 2005
@@ -21,6 +21,7 @@
/// <summary>
/// Exercise methods of standard IRequestCommand implementation [OVR-9].
/// </summary>
+ ///
[TestFixture]
public class RequestCommandTest
{
@@ -29,6 +30,7 @@
/// <summary>
/// Create a default command between test runs.
/// </summary>
+ ///
[SetUp]
public void SetUp ()
{
@@ -38,6 +40,7 @@
/// <summary>
/// A NewContext is not null.
/// </summary>
+ ///
[Test]
public void NewRequestContext ()
{
@@ -48,6 +51,7 @@
/// <summary>
/// A successful command returns a nominal result.
/// </summary>
+ ///
public void RequestExecute ()
{
IRequestContext context = command.NewContext ();
Modified: struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/RequestContextTest.cs Tue Jun 14 07:52:55 2005
@@ -23,6 +23,7 @@
/// <summary>
/// Exercise IRequestContext per [OVR-7].
/// </summary>
+ ///
[TestFixture]
public class RequestContextTest
{
@@ -33,6 +34,7 @@
/// <summary>
/// Initialize private fields.
/// </summary>
+ ///
[SetUp]
public void SetUp ()
{
@@ -50,6 +52,7 @@
/// <summary>
/// A IRequestContext is not nominal if an error is added.
/// </summary>
+ ///
[Test]
public void IsNominal_Error ()
{
@@ -60,28 +63,34 @@
/// <summary>
/// A IRequestContext is not nominal is an Exception is set.
/// </summary>
+ ///
[Test]
public void IsNominal_Fault ()
{
context.Fault = fault;
- Assert.IsFalse (context.IsNominal, "Expected non-nominal state after setting Exception.");
+ Assert.IsFalse (context.IsNominal,
+ "Expected non-nominal state after setting Exception.");
}
/// <summary>
- /// A IRequestContext is not nominal if multiple errors are added and an Exception is set.
+ /// A IRequestContext is not nominal if multiple errors are added
+ /// and an Exception is set.
/// </summary>
+ ///
[Test]
public void IsNominal_Errors_and_Fault ()
{
context.AddError ("Business logic error");
context.AddError ("Business logic error 2");
context.Fault = fault;
- Assert.IsFalse (context.IsNominal, "Expected non-nominal state after adding errors and Exception.");
+ Assert.IsFalse (context.IsNominal,
+ "Expected non-nominal state after adding errors and Exception.");
}
/// <summary>
/// If data is set to the Outcome property, HasOutcome is true.
/// </summary>
+ ///
[Test]
public void HasOutcome ()
{
Modified: struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/WebHelper.cs Tue Jun 14 07:52:55 2005
@@ -5,6 +5,7 @@
/// <summary>
/// Summary description for WebHelper.
/// </summary>
+ ///
public class WebHelper
{
public WebHelper()
Modified: struts/sandbox/trunk/overdrive/Nexus/Web/WebViewHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Web/WebViewHelper.cs?rev=190601&r1=190600&r2=190601&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Web/WebViewHelper.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Web/WebViewHelper.cs Tue Jun 14 07:52:55 2005
@@ -6,8 +6,9 @@
namespace Nexus.Web.Helpers
{
/// <summary>
- /// Summary description for WebViewHelper.
+ /// Default implementation of IWebViewHelper [OVR-14].
/// </summary>
+ ///
public class WebViewHelper : ViewHelper
{
@@ -18,6 +19,7 @@
/// </summary>
/// <param name="errors">A list of error messages</param>
/// <returns>HTML markup presenting the errors.</returns>
+ ///
public static string HtmlErrorList (IList errors)
{
StringBuilder sb = new StringBuilder ("<ul>");
@@ -38,6 +40,7 @@
/// <param name="fault">An exception instance, if any</param>
/// <param name="store">A context listing errors, if any</param>
/// <returns>HTML markup presenting the errors.</returns>
+ ///
public string HtmlErrorBuilder (Exception fault, IDictionary store)
{
string errorMarkup = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org