Class AsyncRatingServiceClient
- All Implemented Interfaces:
com.highdeal.barbus.ISSLContextProvider
- Direct Known Subclasses:
AsyncBatchServiceClient,AsyncStatefulServiceClient,StatelessServiceClient
abstract Java class provides common methods to open, close a connection, and send rating messages.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant to return all the usage transactionsstatic final intConstant to return all the usage transactions and all the recurring/one-shot transactionsstatic final intConstant to set up the resolution used when the time to live (TTL) is expired as canceledstatic final intConstant to return usage charging result (when used in a Java client).static final intConstant to return usage charging result (when used in a REST Web Service).static final intConstant to return usage charging result (when used in a SOAP Web Service).static final intConstant to set up the resolution used when the time to live (TTL) is expired as confirmedstatic final intConstant to return the master usage transactionstatic final intConstant to return no usage transaction -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener which will be triggered by authentication events.final voidclose()Closes the connection with the connected SAP CC system; Thismethodallows to release all the resources attached (sockets and buffers) in the charging client.final voidconnect(InstanceMap imap, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) Connects this charging client with the SAP CC system by using aninstance map; A timeout must be specified.final voidConnects thischarging clientto the distant SAP CC Core Server system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; No client timeout is specified.final voidconnect(String hostname, int port, boolean secure, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) Connects this message client with the Rating Instances.final voidConnects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; A client timeout must be specified.final voidconnect(String hostname, int hostport, FoundLostRatingListener ratingListener) Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; No client timeout is specified.final voidconnect(String hostname, int hostport, String bindAddress, int timeout, FoundLostRatingListener ratingListener) Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.final voidconnect(String hostname, int port, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) Connects this message client with the Rating Instances.final voidconnect(String systemName, int lookupDuration, InetSocketAddress discoveryAddress, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config, com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses) Connects this charging client with the SAP CC system by using the UDP discovery function.final voidconnect(String systemName, int lookupDuration, InetSocketAddress discoveryAddress, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config, InetSocketAddress... bootDispatcherAddresses) Connects this message client with the Rating Instances.final voidConnects this charging client with the Rating Instances.final voidconnect(String systemName, InetSocketAddress... bootDispatcherAddresses) Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.final BootModeReturns which API is used to retrieve from the remote instances, the Instance Map needed for the connection.final ClientOpEventListenerGets theclient operation event listenerused by the client for the specifiedtopic.Returns theconnection statusof the client.Gets the SSL context used with secure connections.final intReturns the client communication timeout in milliseconds for each request (or-1to wait indefinitely).booleanReturn true if at least one of the connection to the dispatchers is registered, false otherwise.final booleanGets the connected connection status.final booleanChecks if this charging client handles timeout.final voidsetBootMode(BootMode mode) Deprecated.final voidsetClientOpEventListener(ClientOpEventTopic topic, ClientOpEventListener listener) Sets theclient operation event listenerto the specifiedtopics; It will be notified each time an event corresponding to the registered topics.final voidsetHAEventListener(HAEventListener listener) Deprecated.Deprecated since version 0.0 of SAP CCfinal voidsetNoTimeout(boolean noTimeout) Sets that this charging client handles timeout.voidsetSslContext(SSLContext sslContext) Sets the SSL context used with secure connections.voidsetUserCredentials(String userId, String userPassword) Set the credentials that will be used to authenticate the client.voidsetUserCredentials(String userId, String userPassword, int authTimeout) Set the credentials that will be used to authenticate the client.
-
Field Details
-
NONE_TRANSACTION
public static final int NONE_TRANSACTIONConstant to return no usage transaction- See Also:
-
MASTER_TRANSACTION
public static final int MASTER_TRANSACTIONConstant to return the master usage transaction- See Also:
-
ALL_TRANSACTION
public static final int ALL_TRANSACTIONConstant to return all the usage transactions- See Also:
-
ALL_TRANSACTION_AND_RECURRING
public static final int ALL_TRANSACTION_AND_RECURRINGConstant to return all the usage transactions and all the recurring/one-shot transactions- See Also:
-
CHARGING_RESULT_WS
public static final int CHARGING_RESULT_WSConstant to return usage charging result (when used in a SOAP Web Service).- See Also:
-
CHARGING_RESULT_MSG
public static final int CHARGING_RESULT_MSGConstant to return usage charging result (when used in a Java client).- See Also:
-
CHARGING_RESULT_REST
public static final int CHARGING_RESULT_RESTConstant to return usage charging result (when used in a REST Web Service).- See Also:
-
CANCELLED
public static final int CANCELLEDConstant to set up the resolution used when the time to live (TTL) is expired as canceled- See Also:
-
CONFIRMED
public static final int CONFIRMEDConstant to set up the resolution used when the time to live (TTL) is expired as confirmed- See Also:
-
-
Method Details
-
getSslContext
Gets the SSL context used with secure connections.- Specified by:
getSslContextin interfacecom.highdeal.barbus.ISSLContextProvider- Returns:
- The SSL context used with secure connections
-
setSslContext
Sets the SSL context used with secure connections.- Parameters:
sslContext- The SSL context used with secure connections
-
connect
Connects thischarging clientto the distant SAP CC Core Server system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; No client timeout is specified.This method is equivalent to:
connect(hostname, hostport, -1, null);.- Parameters:
hostname- The name of the machine that hosts a dispatcher instance of the SAP CC Core Server systemhostport- The communication port on which the server system waits for requests on TCP/IP channel used by the Message TCP/IP technical interface- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if the server system is not running, for example).
-
connect
Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; A client timeout must be specified.This method is equivalent to:
connect(hostname, hostport, null, timeout);.- Parameters:
hostname- The name of the machine that hosts a dispatcher instance of the SAP CC Core Server systemhostport- The port on which the server waits for requeststimeout- The timeout in milliseconds for each operation request (or-1to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending the operation request.- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if the server system is not running for example)
-
connect
public final void connect(String hostname, int hostport, FoundLostRatingListener ratingListener) throws IOException Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape; No client timeout is specified.- Parameters:
hostname- The host name of the serverhostport- The port on which the server waits for requestratingListener- TheFoundLostRatingListenerthat will be notified each time a rating instance will be found or lost- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if server is not running, for example)
-
connect
public final void connect(String hostname, int hostport, String bindAddress, int timeout, FoundLostRatingListener ratingListener) throws IOException Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.- Parameters:
hostname- The host name of the serverhostport- The port on which the server waits for requestbindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or-1to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending the request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a rating instance will be found or lost.- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if server is not running, for example)IllegalArgumentException- ifhostnameisnullor if the port is out of range
-
connect
public final void connect(String hostname, int port, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) throws IOException Connects this message client with the Rating Instances.First of all, this client contacts the boot instance defined by the arguments
hostname andport to get its instance map. Then this client opens connections with all the rating instances defined in the instance map.- Parameters:
hostname- The host name of the serverport- The port on which the server waits for requestbindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or -1 to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending the request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a rating instance will be found or lostconfig- Theservice tuning configuration- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if server is not running, for example).IllegalArgumentException- ifhostnameisnullor if the port is out of range.
-
connect
public final void connect(String hostname, int port, boolean secure, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) throws IOException Connects this message client with the Rating Instances.First of all, this client contacts the boot instance defined by the arguments
hostname andport to get its instance map. Then this client opens connections with all the rating instances defined in the instance map.- Parameters:
hostname- The host name of the serverport- The port on which the server waits for requestsecure-trueif the connection to the server is securebindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or -1 to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a Rating Instance will be found or lost.config- Theservice tuning configuration- Throws:
IOException- if the client cannot connect to the server (if server is not running, for example).IllegalArgumentException- if hostname is null or if the port is out if range.
-
connect
public final void connect(@Deprecated String systemName, InetSocketAddress... bootDispatcherAddresses) throws IOException Connects thischarging clientto the distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.The use of the parameter
systemNameis deprecated since SAP Convergent Charging 2023.0. This client will usebootDispatcherAddressesas a boot rating instance address list to connect to the SAP CC system. The client opens connections with the discovered rater instances.Prerequisites: At least
bootDispatcherAddressesmust be provided.- Parameters:
systemName- The SAP CC system namebootDispatcherAddresses- A backup rating instance boot dispatcher list, provided only if for some reasons- Throws:
IOException- if the client cannot connect to the server (if server is not running, for example)IllegalArgumentException- if some arguments are badly provided
-
connect
public final void connect(@Deprecated String systemName, @Deprecated int lookupDuration, @Deprecated InetSocketAddress discoveryAddress, @Deprecated String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config, InetSocketAddress... bootDispatcherAddresses) throws IOException Connects this message client with the Rating Instances.The use of the parameters
systemName,lookupDuration,discoveryAddress,bindAddressis deprecated since SAP Convergent Charging 2023.0. At leastbootDispatcherAddressesmust be provided.- Parameters:
systemName- The SAP CC system namelookupDuration- The system discovery lookup durationdiscoveryAddress- The lookup discovery address, which must be an IPv4 multicast addressbindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or -1 to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a Rating Instance will be found or lost.config- Theservice tuning configurationbootDispatcherAddresses- A backup rating instance boot dispatcher list, provided only if for some reasons- Throws:
IOException- if the client cannot connect to the server (if server is not running, for example).IllegalArgumentException- if some arguments are badly provided
-
connect
public final void connect(@Deprecated String systemName, com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses) throws IOException Connects this charging client with the Rating Instances.The use of the parameter
systemNameis deprecated since SAP Convergent Charging 2023.0. This client will usebootDispatcherAddressesas a boot rating instance address list to connect to the rating system. The client opens connections with the discovered rating instances.At least
bootDispatcherAddressesmust be provided.- Parameters:
systemName- The SAP CC system namebootDispatcherAddresses- a backup rating instance boot dispatcher list, provided only if for some reasons- Throws:
IOException- if the client cannot connect to the server (if server is not running, for example).IllegalArgumentException- if some arguments are badly provided
-
connect
public final void connect(@Deprecated String systemName, @Deprecated int lookupDuration, @Deprecated InetSocketAddress discoveryAddress, @Deprecated String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config, com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses) throws IOException Connects this charging client with the SAP CC system by using the UDP discovery function.The use of the parameters
systemName,lookupDuration,discoveryAddress,bindAddressis deprecated since SAP Convergent Charging 2023.0. This client will usebootDispatcherAddressesas a boot rating instance address list to connect to the rating system. The client opens connections with the discovered rating instances. At leastsystemNameorbootDispatcherAddressesmust be provided.- Parameters:
systemName- The Rating system namelookupDuration- The system discovery lookup durationdiscoveryAddress- The lookup discovery address, which must be an IPv4 multicast addressbindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or-1to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending the request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a Rating Instance will be found or lost.config- Theservice tuning configurationbootDispatcherAddresses- A backup rating instance boot dispatcher list, provided only if for some reasons- Throws:
IOException- if the client cannot connect to the server (if server is not running, for example)IllegalArgumentException- if some arguments are badly provided
-
connect
public final void connect(InstanceMap imap, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) throws IOException Connects this charging client with the SAP CC system by using aninstance map; A timeout must be specified.- Parameters:
imap- Theinstance mapthat describes the SAP CC system to connect to; Cannot benull.bindAddress- The address to bind to, can benulltimeout- The timeout in milliseconds for each request (or-1to wait indefinitely). If you use zero and acknowledgments are requested then aCommunicationFailureExceptionwill be thrown without sending the request.ratingListener- TheFoundLostRatingListenerthat will be notified each time a rater instance will be found or lost.config- Theservice tuning configuration- Throws:
IOException- if the client cannot connect to the distant SAP CC system (if the server system is not running, for example).
-
getConnectionStatus
Returns theconnection statusof the client.- Returns:
- the
connection statusof the client
-
isAtLeastOneConnectionIsRegistered
public boolean isAtLeastOneConnectionIsRegistered()Return true if at least one of the connection to the dispatchers is registered, false otherwise.- Returns:
- true if at least one of the connection to the dispatchers is registered, false otherwise
-
setUserCredentials
Set the credentials that will be used to authenticate the client.- Parameters:
userId- the user identifieruserPassword- the user password
-
setUserCredentials
Set the credentials that will be used to authenticate the client.- Parameters:
userId- the user identifieruserPassword- the user passwordauthTimeout- the user authentication timeout
-
isNoTimeout
public final boolean isNoTimeout()Checks if this charging client handles timeout.- Returns:
trueif the charging client handles timeout
-
setNoTimeout
public final void setNoTimeout(boolean noTimeout) Sets that this charging client handles timeout.- Parameters:
noTimeout-if your client handles timeouttrue
-
setClientOpEventListener
public final void setClientOpEventListener(ClientOpEventTopic topic, ClientOpEventListener listener) Sets theclient operation event listenerto the specifiedtopics; It will be notified each time an event corresponding to the registered topics.- It is not possible to set
nullfor the default topic. - If the listener is
null, then the default listener is set (@link ClientOpEventTopic#DEFAULT).
- Parameters:
topic- The topic to plug the client operation event listener tolistener- The client operation event listener
- It is not possible to set
-
getClientOpEventListener
Gets theclient operation event listenerused by the client for the specifiedtopic. If the topic is null the default topic listener is returned ( getClientOpEventListener(ClientOpEventTopic.DEFAULT) ). There is always a default listener for a specific topic.- Parameters:
topic- The topic plugged the client operation event listener- Returns:
- not null
-
getTimeout
public final int getTimeout()Returns the client communication timeout in milliseconds for each request (or-1to wait indefinitely).- Returns:
- The timeout in milliseconds, or
-1if no timeout has been defined
-
isConnected
public final boolean isConnected()Gets the connected connection status.- Returns:
trueif the charging client is connected andfalseotherwise.
-
close
public final void close()Closes the connection with the connected SAP CC system; Thismethodallows to release all the resources attached (sockets and buffers) in the charging client. -
setBootMode
Deprecated.Defines which API will be used to retrieve from the remote instances, the Instance Map needed for the connection. AsBootMode.HTTP_BOOT_MODEandBootMode.HTTPS_BOOT_MODEare deprecated, this method is deprecated too.- Parameters:
mode- Is this method is deprecated and to use the Message TCP communication or isHTTP_BOOT_MODEto use the HTTP communication.
-
getBootMode
Returns which API is used to retrieve from the remote instances, the Instance Map needed for the connection.- Returns:
MESSAGE_BOOT_MODEbecauseBootMode.HTTP_BOOT_MODEandBootMode.HTTPS_BOOT_MODEare deprecated.
-
setHAEventListener
Deprecated.Deprecated since version 0.0 of SAP CCSets the
HA listener dedicated to High Availability events; It will be notified each time the status of an instance of the connected SAP CC system has changed.- Parameters:
listener- Thelistener for High Availability events
-
addAuthenticationListener
Add a listener which will be triggered by authentication events.- Parameters:
listener- the listener which will be triggered by authentication events
-