scan library
DEPRECATED
This library is now deprecated. It will be removed in a future release.
The problem with dynamically creating pipelines and servers from
annotations is it relies on the dart:mirror
package. Using that
package prevents a program from being compiled into a native binary.
This library also contains the experimental dumpServer
function that
takes a Server and generates Dart code to create the same Server
without using annotations. Unfortunately,
a complicated build process is required to properly use it.
Therefore, this library has now been deprecated.
It is being replaced by a separate woomera_server_gen package.
If there is value in retaining this scan library, please submit an issue and we'll consider moving it to its own package instead of entirely deleting it.
Description
This library contains the annotations scanning functions, which allows
the Server
and ServerPipeline
from the core library to automatically
populated by scanning the application for Handles
annotations.
To use the scanning functions, import woomera.dart
which includes both
the core library and this scanning library. This scanning library requires
the Dart Mirrors package.
Usage
See the core library for details on how to use Woomera.
This library defines two functions to create Server and ServerPipelines from annotations in the code: serverFromAnnotations and serverPipelineFromAnnotations. It also defines extra exceptions that can arise during the scanning operation.
Logging
The Logger package is used for logging. The available logger from this library is named:
- woomera.handles - logs rules created via Handles annotations
Functions
-
dumpServer(
Server server, {String functionName = 'serverBuilder', String libraryName = '', Iterable< String> importedLibraries = const <String>[], bool includeDartVersionComment = false, bool timestamp = true, bool locations = true, bool includeDumpServerStub = true}) → String - Experimental function to dump a server that was created from annotations
-
serverFromAnnotations(
{Iterable< String> ? pipelines, Iterable<String> ? libraries, bool scanAllFileLibraries = true, bool ignoreUnusedAnnotations = false}) → Server - Creates a Server and populates pipelines with rules from annotations.
-
serverPipelineFromAnnotations(
String pipelineName, Iterable< String> ? libraries, {bool scanAllFileLibraries = true}) → ServerPipeline - Creates pipeline and populates it with rules from annotations.
Exceptions / Errors
- BadHandlesPattern
- Indicates the pattern to create a Handles object is invalid.
- DuplicateExceptionHandler
- Indicates a Handles annotation already exists for the exception handler.
- DuplicateRuleWithExistingHandler
- Attempt to register a duplicate rule in a pipeline.
- LibraryNotFound
- Library not found
- NotExceptionHandler
- Indicates an Handles annotation was place on the wrong type of function.
- NotRequestHandler
- Indicates an Handles annotation was place on the wrong type of function.