Class QueryExecutorImpl
java.lang.Object
com.graphql_java_generator.client.QueryExecutorImpl
- All Implemented Interfaces:
QueryExecutor
@Deprecated public class QueryExecutorImpl extends java.lang.Object implements QueryExecutor
Deprecated.
This class is deprecated since version v1.12. It is based on the Jersey
This class is the query executor : a generic class, reponsible for calling the GraphQL server, for query, mutation and subscription.
It has one major parameter: the GraphQL endpoint. See the
Client
, but this client has a hard to
use the OAuth implementation. The default implementation of this implementation is now based on SpringThis class is the query executor : a generic class, reponsible for calling the GraphQL server, for query, mutation and subscription.
It has one major parameter: the GraphQL endpoint. See the
QueryExecutorImpl(String)
for more information.- Author:
- etienne-sf
-
Field Summary
Fields inherited from interface com.graphql_java_generator.client.QueryExecutor
GRAPHQL_MARKER, GRAPHQL_MUTATION_MARKER, GRAPHQL_QUERY_MARKER, GRAPHQL_SUBSCRIPTION_MARKER
-
Constructor Summary
Constructors Constructor Description QueryExecutorImpl(java.lang.String graphqlEndpoint)
Deprecated.This constructor expects the URI of the GraphQL server
For example: http://my.server.com/graphql or https://my.server.com/graphqlQueryExecutorImpl(java.lang.String graphqlEndpoint, javax.net.ssl.SSLContext sslContext, javax.net.ssl.HostnameVerifier hostnameVerifier)
Deprecated.This method is deprecated since version v1.12.QueryExecutorImpl(java.lang.String graphqlEndpoint, javax.ws.rs.client.Client client)
Deprecated. -
Method Summary
Modifier and Type Method Description <R, T> SubscriptionClient
execute(AbstractGraphQLRequest graphQLRequest, java.util.Map<java.lang.String,java.lang.Object> parameters, SubscriptionCallback<T> subscriptionCallback, java.lang.Class<R> subscriptionType, java.lang.Class<T> messageType)
Deprecated.Executes the given subscription GraphQL request, and returns the relevantWebSocketClient
.<R extends GraphQLRequestObject>
Rexecute(AbstractGraphQLRequest graphQLRequest, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Class<R> dataResponseType)
Deprecated.Execution of the given query or mutation GraphQL request, and return its response mapped in the relevant POJO.
-
Constructor Details
-
QueryExecutorImpl
public QueryExecutorImpl(java.lang.String graphqlEndpoint)Deprecated.This constructor expects the URI of the GraphQL server
For example: http://my.server.com/graphql or https://my.server.com/graphql- Parameters:
graphqlEndpoint
- the http URI for the GraphQL endpoint
-
QueryExecutorImpl
public QueryExecutorImpl(java.lang.String graphqlEndpoint, javax.net.ssl.SSLContext sslContext, javax.net.ssl.HostnameVerifier hostnameVerifier)Deprecated.This method is deprecated since version v1.12. It is based on the JerseyClient
, but this client has a hard to use the OAuth implementation. The default implementation of this implementation is now based on Spring
This constructor expects the URI of the GraphQL server. This constructor works only for https servers, not for http ones.
For example: https://my.server.com/graphql
It allows to specify the SSLContext and the HostnameVerifier. It is used in the integration test... to remove most of the control on https protocol, and allow connection to an https with a self-signed certificate.- Parameters:
graphqlEndpoint
- the https URI for the GraphQL endpointsslContext
-hostnameVerifier
-
-
QueryExecutorImpl
@Deprecated public QueryExecutorImpl(java.lang.String graphqlEndpoint, javax.ws.rs.client.Client client)Deprecated.This method is deprecated since version v1.12. It is based on the JerseyClient
, but this client has a hard to use the OAuth implementation. The default implementation of this implementation is now based on Spring
This constructor expects the URI of the GraphQL server and a configured JAX-RS client that gives the opportunity to customize the REST request
For example: http://my.server.com/graphql- Parameters:
graphqlEndpoint
- the http URI for the GraphQL endpointclient
-Client
javax.ws.rs.client.Client to support customization of the rest request
-
-
Method Details
-
execute
public <R extends GraphQLRequestObject> R execute(AbstractGraphQLRequest graphQLRequest, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.Class<R> dataResponseType) throws GraphQLRequestExecutionExceptionDeprecated.Execution of the given query or mutation GraphQL request, and return its response mapped in the relevant POJO. This method executes a partial GraphQL query, or a full GraphQL request.- Specified by:
execute
in interfaceQueryExecutor
- Type Parameters:
R
- The class that is generated from the query or the mutation definition in the GraphQL schema- Parameters:
graphQLRequest
- Defines what response is expected from the server.parameters
- the input parameters for this query. If the query has no parameters, it may be null or an empty list.dataResponseType
- The class generated for the query or the mutation type. The data tag of the GraphQL server response will be mapped into an instance of this class.- Returns:
- The response mapped to the code, generated from the GraphQl server. Or a wrapper for composite responses.
- Throws:
GraphQLRequestExecutionException
- When an error occurs during the request execution, typically a network error, an error from the GraphQL server or if the server response can't be parsed
-
execute
public <R, T> SubscriptionClient execute(AbstractGraphQLRequest graphQLRequest, java.util.Map<java.lang.String,java.lang.Object> parameters, SubscriptionCallback<T> subscriptionCallback, java.lang.Class<R> subscriptionType, java.lang.Class<T> messageType) throws GraphQLRequestExecutionExceptionDeprecated.Executes the given subscription GraphQL request, and returns the relevantWebSocketClient
. The given subscriptionCallback will receive the notifications that have been subscribed by this subscription. Only one Subscription may be executed at a time: it may be a partial Request (always limited to one query), or a full request that contains only one subscription.
Note: Don't forget to free the server's resources by calling theAbstractLifeCycle.stop()
method of the returned object.- Specified by:
execute
in interfaceQueryExecutor
- Type Parameters:
R
- The class that is generated from the subscription definition in the GraphQL schema. It contains one attribute, for each available subscription. The data tag of the GraphQL server response will be mapped into an instance of this class.T
- The type that must be returned by the query or mutation: it's the class that maps to the GraphQL type returned by this subscription.- Parameters:
graphQLRequest
- Defines what response is expected from the server.parameters
- The input parameters for this subscription. If the query has no parameters, it may be null or an empty list.subscriptionCallback
- The object that will be called each time a message is received, or an error on the subscription occurs. This object is provided by the application.subscriptionType
- The R classmessageType
- The T class- Returns:
- The Subscription client. It allows to stop the subscription, by executing its
SubscriptionClient.unsubscribe()
method. This will stop the incoming notification flow, and will free resources on both the client and the server. - Throws:
GraphQLRequestExecutionException
- When an error occurs during the request execution, typically a network error, an error from the GraphQL server or if the server response can't be parsed
-