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 String
DEAFULTECLWATCHPORT
ConstantDEAFULTECLWATCHPORT="8010"
static String
DEFAULTECLWATCHTLSPORT
ConstantDEFAULTECLWATCHTLSPORT="18010"
static String
DEFAULTSERVICEPORT
ConstantDEFAULTSERVICEPORT="DEAFULTECLWATCHPORT"
protected String
initErrMessage
protected static org.apache.logging.log4j.Logger
log
Constantlog
protected org.apache.axis2.client.Stub
stub
protected Double
targetESPInterfaceVer
protected Version
targetHPCCBuildVersion
protected Boolean
targetsContainerizedHPCC
protected boolean
verbose
protected Connection
wsconn
-
Constructor Summary
Constructors Constructor Description BaseHPCCWsClient()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
compatibilityCheck(int major, int minor, int point)
Determine if target HPCC's build version is compatible with a given version.protected boolean
compatibilityCheck(Version input)
Determine if target HPCC's build version is compatible with a given version.boolean
equals(Object aThat)
protected void
fastRefresh()
protected void
fullRefresh()
URL
getConnectionURL()
Gets the connection URL.abstract org.apache.axis2.client.Stub
getDefaultStub()
Gets the default stub.String
getInitError()
Returns error message encountered during initialization of wsdfuclient.abstract String
getServiceURI()
All implementations must provide the target web service URIstatic String
getServiceVersion(org.apache.axis2.client.Stub stub)
Gets the service version.static String
getServiceVersion(BaseHPCCWsClient client)
Gets the service version.static int
getServiceWSDLPort(org.apache.axis2.client.Stub stub)
Gets the service WSDL port.static String
getServiceWSDLURL(org.apache.axis2.client.Stub stub)
Gets the service WSDLURL.protected Integer
getStubConnectionTO()
Gets the stub connection TO.double
getTargetESPInterfaceVersion()
Provides the target ESP Interface versionVersion
getTargetHPCCBuildVersion()
Gets the target HPCC build versionboolean
getVerbose()
Gets the verbose.protected void
handleECLExceptions(ArrayOfECLExceptionWrapper eclexceptions)
Logs and throws arrayofeclexceptionwrapper without localized message response from WS client.protected void
handleECLExceptions(ArrayOfECLExceptionWrapper eclExceptions, String message)
Logs and throws arrayofeclexceptionwrapper with localized message response from WS client.protected void
handleEspExceptions(ArrayOfEspExceptionWrapper exp)
Handle esp exceptions.protected void
handleEspExceptions(ArrayOfEspExceptionWrapper exp, String message)
Handle esp exceptions.protected void
handleEspSoapFaults(EspSoapFaultWrapper e)
Logs and throws EspSoapFaultWrapper.protected void
handleEspSoapFaults(EspSoapFaultWrapper e, String message)
Logs and throws EspSoapFaultWrapper, if local message provided, added as wsclientmessage.int
hashCode()
boolean
hasInitError()
Should be called after instantiation to confirm Successful initialization.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.protected boolean
isComplete()
boolean
isTargetHPCCContainerized()
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 URLprotected void
setActiveConnectionInfo(Connection conn)
Stores active connection information for post-initialization usestatic org.apache.axis2.client.Options
setClientAuth(String user, String pass, org.apache.axis2.client.Options opt)
Sets the client auth.protected void
setStubConnectionTO(int millis)
Sets the stub connection TO.static org.apache.axis2.client.Stub
setStubOptions(org.apache.axis2.client.Stub thestub, Connection connection)
Sets the stub options defaults preemptiveauth to 'true;protected void
setUpBuildVersionParser()
protected void
setUpContainerizedParser()
protected void
setUpversionParser()
void
setVerbose(boolean verbose)
Sets the verbose.protected org.apache.axis2.client.Stub
verifyStub()
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.AxisFault
Gets 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 MalformedURLException
Gets 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 Exception
Provides 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:
equals
in classDataSingleton
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classDataSingleton
-
isComplete
protected boolean isComplete()
- Specified by:
isComplete
in classDataSingleton
-
fastRefresh
protected void fastRefresh()
- Specified by:
fastRefresh
in classDataSingleton
-
fullRefresh
protected void fullRefresh()
- Specified by:
fullRefresh
in classDataSingleton
-
setStubConnectionTO
protected void setStubConnectionTO(int millis) throws org.apache.axis2.AxisFault
Sets 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.AxisFault
Sets 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
String
object.
-
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
-
-