An SMD based service library.
In practice, this subsystem will contain several other components in order to provide strong project decoupling, validation capabilities, and runtime flexibility. The components of the service subsystem are described below.
The service factory is responsible for using a schema to instantiate Service instance wrappers that handle the actual Ajax calls. The service factory is also where global configuration is specified, in order to make the component usable by any project and allow for test-specific setup. ## SMDReader SMD Readers are the processors of specific SMD schema types. The only one we currently support out-of-the-box is the Zyp format. Services will use public methods readers to request any information they need from the underlying document to construct a request. ## Service The service object is an instance sent from the factory, containing methods corresponding to every service method defined in a given SMD. This object also has additional helper methods for managing and configuring the invocation of each method as needed. ## ServiceMethod Instances of a ServiceMethod are created for each method defined on the SMD, and attached to a Service. These methods are where the actual Ajax request happens under the hood. ## Request The Request is a container that is returned from all asynchronous method invocations. This container includes the original service parameters so they can be inspected upon return, as well as a cancel mechanism in order to discard superseded calls. ## Plugin A plugin is a function that is applied at some stage in the request/response process in order to provide modification or override of specific phases. In fact, all operations will be constructed using plugin chains, in order to ensure high configurability of the system. The “type” of a plugin indicates what phase it is applied within. Plugins can be specified globally (all services and all methods), at service level (all methods on an individual service), and method-specific (only one named method on one service). All plugins are applied in the order received, and can be added or removed at runtime as needed. Plugin types supported:
Special plugin types (not strictly part of the cycle)
Each plugin object has a name for identification, a type as described above, the function to execute, and a pointcut regular expression string or pattern regular expression string indicating what services and methods it is applied to (in the spirit of aspect-oriented programming). Circuits-js includes many plugins out of the box to meet common needs.
This software is licensed under the Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0).