-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlugin.java
65 lines (56 loc) · 2.03 KB
/
Plugin.java
1
2
3
4
5
6
7
8
9
10
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
62
63
64
65
package org.gusdb.wsf.plugin;
import javax.ws.rs.core.HttpHeaders;
import org.gusdb.fgputil.Tuples.TwoTuple;
/**
* @author Jerric
* @since Feb 10, 2006
*/
public interface Plugin {
/**
* Invoke a plugin, using the parameters in the request, and save the result
* into response.
*
* @return the signal set by the plugin
*/
int invoke(PluginRequest request, PluginResponse response)
throws PluginModelException, PluginUserException, DelayedResultException;
/**
* The Plugin needs to provide a list of required parameter names; the base
* class will use this template method in the input validation process.
*
* @return returns an array the names of the required parameters
*/
String[] getRequiredParameterNames();
/**
* The Plugin needs to provides a list of the columns expected in the result;
* the base class will use this template method in the input validation
* process.
* @param request
*
* @return returns an array the columns expected in the result
* @throws PluginModelException
*/
String[] getColumns(PluginRequest request) throws PluginModelException;
/**
* Initialize the plugin instance.
*
* @param request that spurred creation of this plugin
*/
void initialize(PluginRequest request) throws PluginModelException;
/**
* Validate the parameters passed by the service. This validation confirms
* that the service (the wdk model) has parameter options that agree with this
* plugin's API.
*/
void validateParameters(PluginRequest request)
throws PluginModelException, PluginUserException;
/**
* Returns a bearer token authorization header given a bearer token value
*
* @param bearerTokenValue value of the bearer token
* @return header pair for use with authenticated HTTP services
*/
static TwoTuple<String, String> getServiceAuthorizationHeader(String bearerTokenValue) {
return new TwoTuple<>(HttpHeaders.AUTHORIZATION, "Bearer " + bearerTokenValue);
}
}