DreamFeature

Usage: [DreamFeature(PATH, SIGNATURE, VERB, DESCRIPTION, INFO]


Usage: [DreamFeature(PATTERN, DESCRIPTION)]



This attribute is applied to feature methods (protection level does not matter).  It provides meta-information about the feature, such as its relative path, a pattern signature, a HTTP verb, a description, and a URI pointing to additional documentation.  The verb, path, and signature elements can also be provided in a compact


Parameter Type Description
PATH string A valid relative URI path.  Maybe be empty to denote service root.
SIGNATURE string Pattern for matching suffixes.
VERB string Any HTTP verb such as GET, PUT, POST, DELETE, etc. or * as a wild-card for any HTTP verb.
DESCRIPTION string A human readable short description of the feature.
INFO string (URI) A URI string pointing to online documentation of the feature.
PATTERN
string
The combined VERB, PATH, and SIGNATURE elements.


The verb can be any non-empty string.  It is also allowed to use "*" as the verb for a feature.  In this case, the feature is invoked regardless of the verb used by the requestor.


The signature uses a simple syntax to describe the pattern of valid suffixes.  The following table provides examples of suffixes and their meaning.

Signature Meaning
/ no suffixes
/? zero or one suffix
/* one suffix
/*/? one or two suffixes
/*/?/? one, two, or three suffixes
/*/*/* three suffixes
//* zero or more suffixes
/*/*//* two or more suffixes
/*/*/?//* two or more suffixes (same as /*/*//*)


Let's illustrate the above with an example. Assume we have a service feature defined as GET:item/* and that we instantiated our service at http://localhost/service.  Then, the following would be true:

  1. http://localhost:8081/service/item/myItem succeeds since it provides exactly one suffix to our feature
  2. http://localhost:8081/service/item failes since it is missing a suffix for our feature
  3. http://localhost:8081/service/item/myItem/extra fails since it provides too many suffixes to our feature

Features can be overloaded, thus GET:item/ and GET:item/* are two distinct features.  However, if we were to add GET:item/? as a new feature, we would introduce non-determinism as to which feature gets invoked.

DreamFeatureParam

Usage: [DreamFeatureParam(NAME, TYPE, DESCRIPTION)]


This attribute is applied to feature methods.  It provides meta-information about a feature parameter that may be specified when invoking the feature.


Parameter Type Description
NAME string The name of the feature parameter.
TYPE string The feature parameter type (usually int or string).  Can be followed by a question mark (?) to denote that the parameter is optional.
DESCRIPTION string A human readable short description of the feature parameter.


Feature parameters are specified as query parameters in the uri.  For example, count is a feature parameter in http://localhost:8081/service/item/book?count=10.

DreamService

Usage: [DreamService(NAME, COPYRIGHT, INFO)]


Usage: [DreamService(NAME, COPYRIGHT)]



This attribute is applied to a service class definition.  It provides meta-information about the service, such as its human readable name, a copyright notice, and a URI pointing to additional documentation. This information is embedded into the blueprint when it is generated.


Parameter Type Description
NAME string The human readable name of the service.
COPYRIGHT string The copyright notice for the service.
INFO string (URI) A URI string pointing to online documentation of the service.

DreamServiceConfig

Usage: [DreamServiceConfig(NAME, TYPE, DESCRIPTION)]




This attribute is applied to a service class definition.  It provides configuration information about the service.  This information is embedded into the blueprint when it is generated.


Parameter Type Description
NAME string The name of the config parameter.
TYPE string The config parameter type.  Can be followed by a question mark (?) to denote that the parameter is optional.
DESCRIPTION string A human readable short description of the config parameter.

DreamState

Usage: [DreamState]


This attribute can be applied to an instance fields of a service class definition or to the service class definition itself.

  • When applied to an instance field, it marks that field as being part of the service's state.  The Dream runtime will automatically restore and store it upon service instantiation and shutdown.
  • When applied to a service class definition, it indicates that the Dream runtime should invoke the RestoreState and StoreState methods when the service is instantiated or shutdown.  However, no fields will be automatically included in the state management.
Tag page
You must login to post a comment.