Class SyncServiceClientFactoryCxf
- java.lang.Object
-
- com.devonfw.module.cxf.common.impl.client.SyncServiceClientFactoryCxf
-
- All Implemented Interfaces:
SyncServiceClientFactory
public abstract class SyncServiceClientFactoryCxf extends Object implements SyncServiceClientFactory
Abstract base implementation ofSyncServiceClientFactoryfor service clients using Apache CXF.- Since:
- 3.0.0
-
-
Constructor Summary
Constructors Constructor Description SyncServiceClientFactoryCxf()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <S> voidapplyAspects(ServiceContext<S> context, S serviceClient, String serviceName)Implementations should call the following methods:applyInterceptors(ServiceContext, InterceptorProvider, String)applyClientPolicy(ServiceContext, HTTPConduit)applyHeaders(ServiceContext, Object)protected voidapplyClientPolicy(ServiceContext<?> context, org.apache.cxf.transport.http.HTTPConduit conduit)protected abstract voidapplyHeaders(ServiceContext<?> context, Object serviceClient)Applies headers to the givenserviceClient.protected voidapplyInterceptors(ServiceContext<?> context, org.apache.cxf.interceptor.InterceptorProvider client, String serviceName)Applies CXF interceptors to the givenserviceClient.<S> Screate(ServiceContext<S> context)protected org.apache.cxf.transports.http.configuration.HTTPClientPolicycreateClientPolicy(ServiceContext<?> context)protected abstract <S> ScreateService(ServiceContext<S> context, String url, String serviceName)protected StringcreateServiceName(ServiceContext<?> context)protected abstract StringgetServiceTypeFolderName()protected StringgetUrl(ServiceContext<?> context)protected abstract booleanisResponsibleForService(ServiceContext<?> context)
-
-
-
Method Detail
-
create
public <S> S create(ServiceContext<S> context)
- Specified by:
createin interfaceSyncServiceClientFactory
-
createService
protected abstract <S> S createService(ServiceContext<S> context, String url, String serviceName)
- Type Parameters:
S- the generic type of theservice API.- Parameters:
context- theServiceContext.url- the resolved end-point URL of the service to invoke.serviceName- theservice name.- Returns:
- a new client stub for the service. See
create(ServiceContext)for further details.
-
getUrl
protected String getUrl(ServiceContext<?> context)
- Parameters:
context- theServiceContext.- Returns:
- the
URLwith additional post-processing such as resolving variables.
-
applyAspects
protected abstract <S> void applyAspects(ServiceContext<S> context, S serviceClient, String serviceName)
Implementations should call the following methods:- Type Parameters:
S- the generic type of theservice API.- Parameters:
context- theServiceContext.serviceClient- thecreated service client stub.serviceName- theservice name.
-
getServiceTypeFolderName
protected abstract String getServiceTypeFolderName()
- Returns:
- the resolved value for
ServiceConstants.VARIABLE_TYPEsuch as e.g.ServiceConstants.URL_FOLDER_REST.
-
createClientPolicy
protected org.apache.cxf.transports.http.configuration.HTTPClientPolicy createClientPolicy(ServiceContext<?> context)
- Parameters:
context- theServiceContext.- Returns:
- the
HTTPClientPolicyfor theconfigurationornullto use defaults.
-
createServiceName
protected String createServiceName(ServiceContext<?> context)
- Parameters:
context- theServiceContext.- Returns:
- the display name of the service for exception or log messages.
-
applyInterceptors
protected void applyInterceptors(ServiceContext<?> context, org.apache.cxf.interceptor.InterceptorProvider client, String serviceName)
Applies CXF interceptors to the givenserviceClient.- Parameters:
context- theServiceContext.client- theInterceptorProvider.serviceName- theservice name.
-
applyClientPolicy
protected void applyClientPolicy(ServiceContext<?> context, org.apache.cxf.transport.http.HTTPConduit conduit)
- Parameters:
context- theServiceContext.conduit- theHTTPConduitwhere to apply theHTTPClientPolicyto.
-
applyHeaders
protected abstract void applyHeaders(ServiceContext<?> context, Object serviceClient)
Applies headers to the givenserviceClient.- Parameters:
context- theServiceContext.serviceClient- the service client instance.
-
isResponsibleForService
protected abstract boolean isResponsibleForService(ServiceContext<?> context)
- Parameters:
context- theServiceContext.- Returns:
trueif this implementation is responsibe for creating a service client corresponding to the givenServiceContext,falseotherwise.
-
-