1 |
|
2 | import { IOpenable } from 'pip-services3-commons-node';
|
3 | import { IConfigurable } from 'pip-services3-commons-node';
|
4 | import { IReferenceable } from 'pip-services3-commons-node';
|
5 | import { IReferences } from 'pip-services3-commons-node';
|
6 | import { DependencyResolver } from 'pip-services3-commons-node';
|
7 | import { CompositeLogger } from 'pip-services3-components-node';
|
8 | import { CompositeCounters } from 'pip-services3-components-node';
|
9 | import { ConfigParams } from 'pip-services3-commons-node';
|
10 | import { CounterTiming } from 'pip-services3-components-node';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | export declare abstract class DirectClient<T> implements IConfigurable, IReferenceable, IOpenable {
|
62 | |
63 |
|
64 |
|
65 | protected _controller: T;
|
66 | |
67 |
|
68 |
|
69 | protected _opened: boolean;
|
70 | |
71 |
|
72 |
|
73 | protected _logger: CompositeLogger;
|
74 | |
75 |
|
76 |
|
77 | protected _counters: CompositeCounters;
|
78 | |
79 |
|
80 |
|
81 | protected _dependencyResolver: DependencyResolver;
|
82 | |
83 |
|
84 |
|
85 | constructor();
|
86 | /**
|
87 | * Configures component by passing configuration parameters.
|
88 | *
|
89 | * @param config configuration parameters to be set.
|
90 | */
|
91 | configure(config: ConfigParams): void;
|
92 | /**
|
93 | * Sets references to dependent components.
|
94 | *
|
95 | * @param references references to locate the component dependencies.
|
96 | */
|
97 | setReferences(references: IReferences): void;
|
98 | /**
|
99 | * Adds instrumentation to log calls and measure call time.
|
100 | * It returns a CounterTiming object that is used to end the time measurement.
|
101 | *
|
102 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
103 | * @param name a method name.
|
104 | * @returns CounterTiming object to end the time measurement.
|
105 | */
|
106 | protected instrument(correlationId: string, name: string): CounterTiming;
|
107 | /**
|
108 | * Adds instrumentation to error handling.
|
109 | *
|
110 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
111 | * @param name a method name.
|
112 | * @param err an occured error
|
113 | * @param result (optional) an execution result
|
114 | * @param callback (optional) an execution callback
|
115 | */
|
116 | protected instrumentError(correlationId: string, name: string, err: any, result?: any, callback?: (err: any, result: any) => void): void;
|
117 | /**
|
118 | * Checks if the component is opened.
|
119 | *
|
120 | * @returns true if the component has been opened and false otherwise.
|
121 | */
|
122 | isOpen(): boolean;
|
123 | /**
|
124 | * Opens the component.
|
125 | *
|
126 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
127 | * @param callback callback function that receives error or null no errors occured.
|
128 | */
|
129 | open(correlationId: string, callback?: (err: any) => void): void;
|
130 | /**
|
131 | * Closes component and frees used resources.
|
132 | *
|
133 | * @param correlationId (optional) transaction id to trace execution through call chain.
|
134 | * @param callback callback function that receives error or null no errors occured.
|
135 | */
|
136 | close(correlationId: string, callback?: (err: any) => void): void;
|
137 | }
|