Skip to content

Commit ef60f10

Browse files
committed
Update the plugin interfaces section
1 parent 31c4d53 commit ef60f10

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

source/plugin-arch.rst

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ For the complete list of endpoint addresses implemented please refer to section
1919
Request processing
2020
--------------------
2121

22-
In the course of normal operation, node software receives *HTTP GET* and *HTTP HEAD* requests to the **/TAP/sync**
23-
endpoint and must respond to them with valid XSAMS documents or only response headers respectively.
22+
During normal operation, node software receives *HTTP GET* and *HTTP HEAD* requests to the **/TAP/sync**
23+
endpoint. As a response to a request a valid XSAMS document and/or the HTTP response headers are sent.
2424

25-
The figure below presents a request flow and what components are involved in the request processing.
25+
The figure below presents the request flow, *highlighting* the components involved in the request processing.
2626

2727
.. image:: img/queryProcess.png
2828

@@ -37,7 +37,9 @@ To access the **database**, the Apache Cayenne object-relational mapping framewo
3737
A tree of objects is constructed, representing the logical structure of the query.
3838
For more details please refer to the :ref:`Query` section.
3939

40-
* **Framework** asks **Plugin** to construct the document by calling the :ref:`databasePlug` buildXSAMS() method.
40+
* **Framework** asks **Plugin** to construct the document by calling the :ref:`databasePlug`
41+
buildXSAMS(RequestInterface incomingRequest) method. All the query information is accessible via the
42+
RequestInterface object passed as a parameter.
4143

4244
* **Plugin** maps the incoming query logical tree into one or more **Database** queries,
4345
as described in the :ref:`QueryMap` section.
@@ -60,7 +62,7 @@ Plugin and Framework Interfaces
6062
Interaction between the database plugin and the Java node software is performed through two interfaces:
6163

6264
* :ref: `DatabasePlug`
63-
defined in the **org.vamdc.tapservice.api.DatabasePlug** java interface and implemented by the node developer.
65+
defined in the **org.vamdc.tapservice.api.DatabasePlugin** java interface and implemented by the node developer.
6466
Methods of this interface are called by the node software upon the arrival of a VAMDC-TAP request or during the initial startup and operation checks.
6567

6668
* :ref: `RequestInterface`
@@ -73,34 +75,32 @@ Interaction between the database plugin and the Java node software is performed
7375
DatabasePlugin interface
7476
++++++++++++++++++++++++++++
7577

76-
Each and every node plugin must implement the **org.vamdc.tapservice.api.DatabasePlug**
78+
Each and every node plugin must implement the **org.vamdc.tapservice.api.DatabasePlugin**
7779
interface, defining the following methods:
7880

7981
* **public abstract Collection<Restrictable> getRestrictables();**
8082

81-
get restrictables supported by this node.
82-
Must return a collection of **org.vamdc.dictionary.Restrictable** dictionary elements.
83+
Must return a collection of **org.vamdc.dictionary.Restrictable** dictionary keys that are supported by the node.
8384
This method is called once per each request to the */TAP/sync* and */VOSI/capabilities* endpoints.
8485

8586
* **public abstract void buildXSAMS (RequestInterface userRequest);**
8687

87-
Build XSAMS document tree from the user request.
88+
Build the XSAMS document tree corresponding to the incoming request.
8889
Object implementing :ref:`RequestInterface`
8990
is passed as a parameter. No return is expected.
9091
This method is called every time the node software is receiving an *HTTP GET* request to the */TAP/sync?* endpoint.
9192

92-
**WARNING!** Node plugin object is instantiated only once when the node is started,
93+
**WARNING!** Node plugin class is instantiated only once when the node is started,
9394
all calls to buildXSAMS should be thread-safe to handle concurrent requests correctly.
9495

9596
Implementation details are covered in the :ref:`XSAMSGen` section.
9697

9798
* **public abstract Map<Dictionary.HeaderMetrics,Integer> getMetrics(RequestInterface userRequest);**
9899

99-
Get query metrics. This method is called every time
100-
the node receives the HEAD request to the */TAP/sync?* endpoint.
100+
Get the metrics corresponding to a query. This method is called for every incoming HEAD request to the */TAP/sync?* endpoint.
101101
*RequestInterface userRequest* parameter is identical to the one passed to buildXSAMS method.
102102
This method should return a map of VAMDC-COUNT-* HTTP header names and their estimate values.
103-
For the header names and meaning, see [VAMDC-TAP]_ documentation
103+
For header names and meaning, see the [VAMDC-TAP]_ documentation section DataAccessProtocol.
104104

105105

106106
* **public abstract boolean isAvailable();**
@@ -120,27 +120,28 @@ interface, defining the following methods:
120120
RequestInterface interface
121121
+++++++++++++++++++++++++++++++
122122

123-
Calls to the node database plugin through :ref:`DatabasePlug` get as a parameter an object
124-
implementing the **org.vamdc.tapservice.api.RequestInterface**, providing access to the request information and
125-
node software facilities.
123+
When the incoming request arrives to Java Node Software, methods of the :ref:`DatabasePlug` are called,
124+
as described earlier. Methods of that interface accept as a parameter an object
125+
implementing the **org.vamdc.tapservice.api.RequestInterface**. That interface provides the access
126+
to the request information and the Java Node Software facilities.
126127

127-
Following methods are part of that interface:
128+
Following methods are part of this interface:
128129

129130
* **public abstract boolean isValid();**
130131
this method returns **true** if the incoming request is valid and should be processed.
131-
132-
In case of the **false** return, node plugin should not do any processing. Query string may be saved for logging
133-
purposes.
132+
If the returned value is **false**, the request should be considered as invalid, no processing is required.
133+
Query string may be obtained by calling the getQueryString method and saved by the node plugin for the logging purposes.
134134

135135
* **public abstract Query getQuery();**
136-
This method returns the base object of the QueryParser library. Query interface is described
137-
in the :ref:`query` section of this document. A few shortcut methods are provided.
138-
139-
* **public abstract LogicNode getRestrictsTree();**
140-
The shortcut method to get the logic tree of the incoming query.
136+
This method returns the base object of the QueryParser library, implementing the Query interface.
137+
That interface is described in detail in the :ref:`query` section of this document.
138+
139+
* **public abstract LogicNode getQueryTree();**
140+
This is the shortcut method returning the root element of the logic tree corresponding to the incoming query.
141141

142-
* **public abstract Collection<RestrictExpression> getRestricts();**
143-
The shortcut method to get all the keywords of the query, omitting the keywords relation logic.
142+
* **public abstract Collection<RestrictExpression> getQueryKeywords();**
143+
This is an another shortcut method, allowing to get a collection of the keywords used in the incoming query.
144+
The keywords relation logic is omitted.
144145

145146
**WARNING!** This method should not be used as the main source of data for the query mapping since
146147
it completely looses the query relation logic. Imagine the query::
@@ -169,22 +170,19 @@ Following methods are part of that interface:
169170
the section **Requestables**
170171

171172
* **public abstract ObjectContext getCayenneContext();**
172-
Get Apache Cayenne object context. That is the main endpoint of the Cayenne ORM library.
173+
Returns the Apache Cayenne object context. That is the main endpoint of the Cayenne ORM library.
173174
For more information on using the Apache Cayenne look in the sections :ref:`datamodel` and :ref:`QueryMap`.
174175

175176

176177
* **public abstract XSAMSManager getXsamsManager();**
177-
Get XSAMS tree manager, containing several helper methods.
178-
All XSAMS branches built by the node plugin should be attached to it.
179-
180-
* **public abstract Logger getLogger(Class<?> classname);**
181-
182-
Get the **org.slf4j.Logger** object. All messages/errors reporting should be done with it.
183-
178+
Get an instance of the XSAMS document manager. This manager contains several helper methods for building the XSAMS document.
179+
All XSAMS branches built by the node plugin should be attached to it. Check the :ref:`XSAMSGen` section for more details.
180+
184181
* **public abstract void setLastModified(Date date);**
185182

186-
Set the last-modified header of the response. May be called anywhere during request processing
187-
for any number of times. If called more than once, the last modification date is updated only if
188-
the subsequent date is newer than communicated before.
183+
Sets the last-modified header of the response.
184+
This method may be called several times during the request processing.
185+
If called more than once, the last modification date is updated only if
186+
the subsequent date is newer than the value communicated before.
189187

190188

0 commit comments

Comments
 (0)