A couple of different ways to consume the RHPAM API using REST.
|
3 年之前 | |
---|---|---|
src | 3 年之前 | |
.gitignore | 3 年之前 | |
COPYING | 3 年之前 | |
README.md | 3 年之前 | |
curl-client.conf | 3 年之前 | |
curl-client.sh | 3 年之前 | |
pom.xml | 3 年之前 |
This project contains essentially two completely different things:
The first one is called curl-client.sh
and (optionally) loads its
configuration from curl-client.conf
(or some other file, as might be
specified by command-line options. Run with --help
to learn more about it.
The other are three implementations RHPAM clients, each of which exposes two
endpoints, one that will start a process, and one that will send a process a
signal. They are all designed to work with the StartStopStart
process model
from the pam-simple-process
project.
They all use CDI to inject an instance of a corresponding WS-client into the
implementation class, using CDI qualifier annotations to tell the CDI
container which of the producer methods in WebTargetProducer
need to be
invoked to instantiate the client.
In turn, the CDI producer class uses ConfigProducer
to get access to
configuration settings from rhpam-rest-client.properties
that tell it what
endpoint to use when talking to RHPAM and how to authenticate.
More detail on the implementations:
ManualInvocationClient
is much like the UseRestEasyManualClient
class from kie-rules-processes
project; it talks to the RHPAM REST
endpoints using an instance of WebTarget
and does the response
"unmarshalling" with the help of a simple class called
ManualRhpamResponse
ProxyInvocationClient
is alike to UseRestEasyProxyClient
from
the kie-rules-processes
project, and uses a made-up JAX-RS interface
defined in RhpamEndpoints
to generate the RestEasy proxy client
SwaggerInvocationClient
uses Java code generated by the
swagger-codegen
Maven plugin, which is still configured in
pom.xml
, but disabled (that is, disconnected from Maven lifecycle);
only the minimum amount of code needed to perform basic
ProcessInstanceApi
operations was added to the project, and some of
the low-level ApiClient
and ProcessInstanceApi
code had to be
modified to support basic HTTP authentication (see comments), thanks to the
missing authentication data in swagger.json
from RHPAM
The exposed endpoints just forward the various parameters to the actual JAX-RS clients:
See the code for more information in the comments.