Package org.hpccsystems.ws.client
Class BaseHPCCWsClient
- java.lang.Object
-
- java.util.Observable
-
- org.hpccsystems.ws.client.utils.DataSingleton
-
- org.hpccsystems.ws.client.BaseHPCCWsClient
-
- Direct Known Subclasses:
HPCCFileSprayClient,HPCCWsAttributesClient,HPCCWsCloudClient,HPCCWsCodeSignClient,HPCCWsDFUClient,HPCCWsDFUXRefClient,HPCCWsFileIOClient,HPCCWsPackageProcessClient,HPCCWsResourcesClient,HPCCWsSMCClient,HPCCWsSQLClient,HPCCWsStoreClient,HPCCWsTopologyClient,HPCCWsWorkUnitsClient
public abstract class BaseHPCCWsClient extends DataSingleton
Defines functionality common to all HPCC Systmes web service clients. Typically implemented by specialized HPCC Web service clients.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEAFULTECLWATCHPORTConstantDEAFULTECLWATCHPORT="8010"static StringDEFAULTECLWATCHTLSPORTConstantDEFAULTECLWATCHTLSPORT="18010"static StringDEFAULTSERVICEPORTConstantDEFAULTSERVICEPORT="DEAFULTECLWATCHPORT"protected StringinitErrMessageprotected static org.apache.logging.log4j.LoggerlogConstantlogprotected org.apache.axis2.client.Stubstubprotected DoubletargetESPInterfaceVerprotected VersiontargetHPCCBuildVersionprotected BooleantargetsContainerizedHPCCprotected booleanverboseprotected Connectionwsconn
-
Constructor Summary
Constructors Constructor Description BaseHPCCWsClient()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancompatibilityCheck(int major, int minor, int point)Determine if target HPCC's build version is compatible with a given version.protected booleancompatibilityCheck(Version input)Determine if target HPCC's build version is compatible with a given version.booleanequals(Object aThat)protected voidfastRefresh()protected voidfullRefresh()URLgetConnectionURL()Gets the connection URL.abstract org.apache.axis2.client.StubgetDefaultStub()Gets the default stub.StringgetInitError()Returns error message encountered during initialization of wsdfuclient.abstract StringgetServiceURI()All implementations must provide the target web service URIstatic StringgetServiceVersion(org.apache.axis2.client.Stub stub)Gets the service version.static StringgetServiceVersion(BaseHPCCWsClient client)Gets the service version.static intgetServiceWSDLPort(org.apache.axis2.client.Stub stub)Gets the service WSDL port.static StringgetServiceWSDLURL(org.apache.axis2.client.Stub stub)Gets the service WSDLURL.protected IntegergetStubConnectionTO()Gets the stub connection TO.doublegetTargetESPInterfaceVersion()Provides the target ESP Interface versionVersiongetTargetHPCCBuildVersion()Gets the target HPCC build versionbooleangetVerbose()Gets the verbose.protected voidhandleECLExceptions(ArrayOfECLExceptionWrapper eclexceptions)Logs and throws arrayofeclexceptionwrapper without localized message response from WS client.protected voidhandleECLExceptions(ArrayOfECLExceptionWrapper eclExceptions, String message)Logs and throws arrayofeclexceptionwrapper with localized message response from WS client.protected voidhandleEspExceptions(ArrayOfEspExceptionWrapper exp)Handle esp exceptions.protected voidhandleEspExceptions(ArrayOfEspExceptionWrapper exp, String message)Handle esp exceptions.protected voidhandleEspSoapFaults(EspSoapFaultWrapper e)Logs and throws EspSoapFaultWrapper.protected voidhandleEspSoapFaults(EspSoapFaultWrapper e, String message)Logs and throws EspSoapFaultWrapper, if local message provided, added as wsclientmessage.inthashCode()booleanhasInitError()Should be called after instantiation to confirm Successful initialization.protected booleaninitBaseWsClient(Connection connection, boolean fetchVersionAndContainerMode)All instances of HPCCWsXYZClient should utilize this init function Attempts to establish the target HPCC build version and its container mode Populates initErrMessage if any issues are encountered.protected booleanisComplete()booleanisTargetHPCCContainerized()protected voidloadESPRuntimeInterfaceVer()Attempts to retrieve the default WSDL version of the target runtime ESP service Appends the target ESP service path and the "version_" literal to the connection's base URLprotected voidsetActiveConnectionInfo(Connection conn)Stores active connection information for post-initialization usestatic org.apache.axis2.client.OptionssetClientAuth(String user, String pass, org.apache.axis2.client.Options opt)Sets the client auth.protected voidsetStubConnectionTO(int millis)Sets the stub connection TO.static org.apache.axis2.client.StubsetStubOptions(org.apache.axis2.client.Stub thestub, Connection connection)Sets the stub options defaults preemptiveauth to 'true;protected voidsetUpBuildVersionParser()protected voidsetUpContainerizedParser()protected voidsetUpversionParser()voidsetVerbose(boolean verbose)Sets the verbose.protected org.apache.axis2.client.StubverifyStub()Provides Stub object if available, otherwise throws Object can be used to access the web service methods directly.-
Methods inherited from class org.hpccsystems.ws.client.utils.DataSingleton
monitor
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
Constantlog
-
DEAFULTECLWATCHPORT
public static final String DEAFULTECLWATCHPORT
ConstantDEAFULTECLWATCHPORT="8010"- See Also:
- Constant Field Values
-
DEFAULTECLWATCHTLSPORT
public static final String DEFAULTECLWATCHTLSPORT
ConstantDEFAULTECLWATCHTLSPORT="18010"- See Also:
- Constant Field Values
-
DEFAULTSERVICEPORT
public static String DEFAULTSERVICEPORT
ConstantDEFAULTSERVICEPORT="DEAFULTECLWATCHPORT"
-
wsconn
protected Connection wsconn
-
verbose
protected boolean verbose
-
initErrMessage
protected String initErrMessage
-
targetHPCCBuildVersion
protected Version targetHPCCBuildVersion
-
targetESPInterfaceVer
protected Double targetESPInterfaceVer
-
targetsContainerizedHPCC
protected Boolean targetsContainerizedHPCC
-
stub
protected org.apache.axis2.client.Stub stub
-
-
Method Detail
-
isTargetHPCCContainerized
public boolean isTargetHPCCContainerized() throws Exception- Throws:
Exception
-
getTargetHPCCBuildVersion
public Version getTargetHPCCBuildVersion()
Gets the target HPCC build version- Returns:
- the HPCC version
-
initBaseWsClient
protected boolean initBaseWsClient(Connection connection, boolean fetchVersionAndContainerMode)
All instances of HPCCWsXYZClient should utilize this init function Attempts to establish the target HPCC build version and its container mode Populates initErrMessage if any issues are encountered.- Parameters:
connection- the WsClient connectionfetchVersionAndContainerMode- services can choose not to fetch build version/containerized mode- Returns:
- true if target HPCC cluster is Containerized, otherwise false
-
getDefaultStub
public abstract org.apache.axis2.client.Stub getDefaultStub() throws org.apache.axis2.AxisFaultGets the default stub.- Returns:
- the default stub
- Throws:
org.apache.axis2.AxisFault- the axis fault
-
getServiceVersion
public static String getServiceVersion(BaseHPCCWsClient client)
Gets the service version.- Parameters:
client- the client- Returns:
- the service version
-
getServiceVersion
public static String getServiceVersion(org.apache.axis2.client.Stub stub)
Gets the service version.- Parameters:
stub- the stub- Returns:
- the service version
-
getServiceWSDLURL
public static String getServiceWSDLURL(org.apache.axis2.client.Stub stub)
Gets the service WSDLURL.- Parameters:
stub- the stub- Returns:
- the service WSDLURL
-
getServiceWSDLPort
public static int getServiceWSDLPort(org.apache.axis2.client.Stub stub) throws MalformedURLExceptionGets the service WSDL port.- Parameters:
stub- the stub- Returns:
- the service WSDL port
- Throws:
MalformedURLException- the malformed URL exception
-
getConnectionURL
public URL getConnectionURL() throws Exception
Gets the connection URL.- Returns:
- the connection URL
- Throws:
Exception- the exception
-
setVerbose
public void setVerbose(boolean verbose)
Sets the verbose.- Parameters:
verbose- - sets verbose mode
-
getVerbose
public boolean getVerbose()
Gets the verbose.- Returns:
- the verbose
-
hasInitError
public boolean hasInitError()
Should be called after instantiation to confirm Successful initialization. The client init can fail due to many different types of issues including invalid connectivity options, invalid credentials, etc- Returns:
- true, if successful
-
getInitError
public String getInitError()
Returns error message encountered during initialization of wsdfuclient. Empty string if no error encountered- Returns:
- the inits the error
-
verifyStub
protected org.apache.axis2.client.Stub verifyStub() throws ExceptionProvides Stub object if available, otherwise throws Object can be used to access the web service methods directly.- Returns:
- the stub
- Throws:
Exception- the exception
-
equals
public boolean equals(Object aThat)
- Specified by:
equalsin classDataSingleton
-
hashCode
public int hashCode()
- Specified by:
hashCodein classDataSingleton
-
isComplete
protected boolean isComplete()
- Specified by:
isCompletein classDataSingleton
-
fastRefresh
protected void fastRefresh()
- Specified by:
fastRefreshin classDataSingleton
-
fullRefresh
protected void fullRefresh()
- Specified by:
fullRefreshin classDataSingleton
-
setStubConnectionTO
protected void setStubConnectionTO(int millis) throws org.apache.axis2.AxisFaultSets the stub connection TO.- Parameters:
millis- the new stub connection TO- Throws:
org.apache.axis2.AxisFault- the axis fault
-
getStubConnectionTO
protected Integer getStubConnectionTO() throws org.apache.axis2.AxisFault
Gets the stub connection TO.- Returns:
- the stub connection TO
- Throws:
org.apache.axis2.AxisFault- the axis fault
-
setStubOptions
public static org.apache.axis2.client.Stub setStubOptions(org.apache.axis2.client.Stub thestub, Connection connection) throws org.apache.axis2.AxisFaultSets the stub options defaults preemptiveauth to 'true;- Parameters:
thestub- The Axis generated service stubconnection- The connection- Returns:
- the stub
- Throws:
org.apache.axis2.AxisFault- the axis fault
-
setClientAuth
public static org.apache.axis2.client.Options setClientAuth(String user, String pass, org.apache.axis2.client.Options opt)
Sets the client auth.- Parameters:
user- the userpass- the passopt- the opt- Returns:
- the options
-
handleEspSoapFaults
protected void handleEspSoapFaults(EspSoapFaultWrapper e) throws EspSoapFaultWrapper
Logs and throws EspSoapFaultWrapper.- Parameters:
e- the e- Throws:
EspSoapFaultWrapper- the esp soap fault wrapper
-
handleEspSoapFaults
protected void handleEspSoapFaults(EspSoapFaultWrapper e, String message) throws EspSoapFaultWrapper
Logs and throws EspSoapFaultWrapper, if local message provided, added as wsclientmessage.- Parameters:
e- the emessage- the message- Throws:
EspSoapFaultWrapper- the esp soap fault wrapper
-
handleEspExceptions
protected void handleEspExceptions(ArrayOfEspExceptionWrapper exp, String message) throws ArrayOfEspExceptionWrapper
Handle esp exceptions.- Parameters:
exp- the expmessage- the message- Throws:
ArrayOfEspExceptionWrapper- the array of esp exception wrapper
-
handleEspExceptions
protected void handleEspExceptions(ArrayOfEspExceptionWrapper exp) throws ArrayOfEspExceptionWrapper
Handle esp exceptions.- Parameters:
exp- the exp- Throws:
ArrayOfEspExceptionWrapper- the array of esp exception wrapper
-
handleECLExceptions
protected void handleECLExceptions(ArrayOfECLExceptionWrapper eclexceptions) throws Exception, ArrayOfECLExceptionWrapper
Logs and throws arrayofeclexceptionwrapper without localized message response from WS client.- Parameters:
eclexceptions- the eclexceptions- Throws:
Exception- the exceptionArrayOfECLExceptionWrapper- the array of ECL exception wrapper
-
handleECLExceptions
protected void handleECLExceptions(ArrayOfECLExceptionWrapper eclExceptions, String message) throws Exception, ArrayOfECLExceptionWrapper
Logs and throws arrayofeclexceptionwrapper with localized message response from WS client.- Parameters:
eclExceptions- - the array of ECLException objects to throwmessage- - the prefix message- Throws:
Exception- the exceptionArrayOfECLExceptionWrapper- the array of ECL exception wrapper
-
getTargetESPInterfaceVersion
public double getTargetESPInterfaceVersion()
Provides the target ESP Interface version- Returns:
- The runtime ESP interface default version
-
setActiveConnectionInfo
protected void setActiveConnectionInfo(Connection conn)
Stores active connection information for post-initialization use- Parameters:
conn- Connection object
-
getServiceURI
public abstract String getServiceURI()
All implementations must provide the target web service URI- Returns:
- a
Stringobject.
-
setUpBuildVersionParser
protected void setUpBuildVersionParser() throws ParserConfigurationException, XPathExpressionException
-
setUpContainerizedParser
protected void setUpContainerizedParser() throws ParserConfigurationException, XPathExpressionException
-
setUpversionParser
protected void setUpversionParser() throws ParserConfigurationException, XPathExpressionException
-
loadESPRuntimeInterfaceVer
protected void loadESPRuntimeInterfaceVer()
Attempts to retrieve the default WSDL version of the target runtime ESP service Appends the target ESP service path and the "version_" literal to the connection's base URL
-
compatibilityCheck
protected boolean compatibilityCheck(int major, int minor, int point)Determine if target HPCC's build version is compatible with a given version.- Parameters:
major- a int.minor- a int.point- a int.- Returns:
- boolean true if server build version >= input version
-
compatibilityCheck
protected boolean compatibilityCheck(Version input)
Determine if target HPCC's build version is compatible with a given version.- Parameters:
input- the input- Returns:
- boolean true if server build version >= input version
-
-