public abstract class AsyncRatingServiceClient
extends java.lang.Object
implements com.highdeal.barbus.ISSLContextProvider
abstract Java class provides common methods to open, close a connection, and send rating messages.| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_TRANSACTION
Constant to return all the usage transactions
|
static int |
ALL_TRANSACTION_AND_RECURRING
Constant to return all the usage transactions and all the recurring/one-shot transactions
|
static int |
CANCELLED
Constant to set up the resolution used when the time to live (TTL) is expired as canceled
|
static int |
CONFIRMED
Constant to set up the resolution used when the time to live (TTL) is expired as confirmed
|
static int |
MASTER_TRANSACTION
Constant to return the master usage transaction
|
static int |
NONE_TRANSACTION
Constant to return no usage transaction
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAuthenticationListener(IAuthenticationListener listener)
Add a listener which will be triggered by authentication events.
|
void |
close()
Closes the connection with the connected SAP CC system; This
method allows to release all the resources
attached (sockets and buffers) in the charging client. |
void |
connect(InstanceMap imap,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config)
Connects this charging client with the SAP CC system by using an
instance map;
A timeout must be specified. |
void |
connect(java.lang.String systemName,
java.net.InetSocketAddress... bootDispatcherAddresses)
Connects this
charging client to the
distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape. |
void |
connect(java.lang.String systemName,
com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses)
Connects this charging client with the Rating Instances.
|
void |
connect(java.lang.String hostname,
int hostport)
Connects this
charging client to 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. |
void |
connect(java.lang.String hostname,
int port,
boolean secure,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config)
Connects this message client with the Rating Instances.
|
void |
connect(java.lang.String hostname,
int hostport,
FoundLostRatingListener ratingListener)
Connects this
charging client to 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. |
void |
connect(java.lang.String systemName,
int lookupDuration,
java.net.InetSocketAddress discoveryAddress,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config,
java.net.InetSocketAddress... bootDispatcherAddresses)
Connects this message client with the Rating Instances.
|
void |
connect(java.lang.String systemName,
int lookupDuration,
java.net.InetSocketAddress discoveryAddress,
java.lang.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.
|
void |
connect(java.lang.String hostname,
int hostport,
int timeout)
Connects this
charging client to 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. |
void |
connect(java.lang.String hostname,
int hostport,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener)
Connects this
charging client to the
distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape. |
void |
connect(java.lang.String hostname,
int port,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config)
Connects this message client with the Rating Instances.
|
BootMode |
getBootMode()
Returns which API is used to retrieve from the remote instances, the Instance Map needed for the connection.
|
ClientOpEventListener |
getClientOpEventListener(ClientOpEventTopic topic)
Gets the
client operation event listener used by the client for the specified topic. |
ConnectionStatus |
getConnectionStatus()
Returns the
connection status of the client. |
javax.net.ssl.SSLContext |
getSslContext()
Gets the SSL context used with secure connections.
|
int |
getTimeout()
Returns the client communication timeout in milliseconds for each request (or
-1 to wait indefinitely). |
boolean |
isAtLeastOneConnectionIsRegistered()
Return true if at least one of the connection to the dispatchers is registered, false otherwise.
|
boolean |
isConnected()
Gets the connected connection status.
|
boolean |
isNoTimeout()
Checks if this charging client handles timeout.
|
void |
setBootMode(BootMode mode)
Deprecated.
|
void |
setClientOpEventListener(ClientOpEventTopic topic,
ClientOpEventListener listener)
Sets the
client operation event listener to the specified topics;
It will be notified each time an event corresponding to the registered topics. |
void |
setHAEventListener(HAEventListener listener)
Deprecated.
Deprecated since version 0.0 of SAP CC
Sets the |
void |
setNoTimeout(boolean noTimeout)
Sets that this charging client handles timeout.
|
void |
setSslContext(javax.net.ssl.SSLContext sslContext)
Sets the SSL context used with secure connections.
|
void |
setUserCredentials(java.lang.String userId,
java.lang.String userPassword)
Set the credentials that will be used to authenticate the client.
|
public static final int NONE_TRANSACTION
public static final int MASTER_TRANSACTION
public static final int ALL_TRANSACTION
public static final int ALL_TRANSACTION_AND_RECURRING
public static final int CANCELLED
public static final int CONFIRMED
public javax.net.ssl.SSLContext getSslContext()
getSslContext in interface com.highdeal.barbus.ISSLContextProviderpublic void setSslContext(javax.net.ssl.SSLContext sslContext)
sslContext - The SSL context used with secure connectionspublic final void connect(java.lang.String hostname,
int hostport)
throws java.io.IOException
charging client to 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);.
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 interfacejava.io.IOException - if the client cannot connect to the distant SAP CC system (if the server system is not running, for example).public final void connect(java.lang.String hostname,
int hostport,
int timeout)
throws java.io.IOException
charging client to 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);.
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 -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending the operation request.java.io.IOException - if the client cannot connect to the distant SAP CC system (if the server system is not running for example)public final void connect(java.lang.String hostname,
int hostport,
FoundLostRatingListener ratingListener)
throws java.io.IOException
charging client to 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.hostname - The host name of the serverhostport - The port on which the server waits for requestratingListener - The FoundLostRatingListener that will be notified each time a rating instance will be found or lostjava.io.IOException - if the client cannot connect to the distant SAP CC system (if server is not running, for example)public final void connect(java.lang.String hostname,
int hostport,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener)
throws java.io.IOException
charging client to the
distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.hostname - The host name of the serverhostport - The port on which the server waits for requestbindAddress - The address to bind to, can be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending the request.ratingListener - The FoundLostRatingListener that will be notified each time a rating instance will be found or lost.java.io.IOException - if the client cannot connect to the distant SAP CC system (if server is not running, for example)java.lang.IllegalArgumentException - if hostname is null or if the port is out of rangepublic final void connect(java.lang.String hostname,
int port,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config)
throws java.io.IOException
First of all, this client contacts the boot instance defined by the arguments
hostname - The host name of the serverport - The port on which the server waits for requestbindAddress - The address to bind to, can be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending the request.ratingListener - The FoundLostRatingListener that will be notified each time a rating instance will be found or lostconfig - The service tuning configurationjava.io.IOException - if the client cannot connect to the distant SAP CC system (if server is not running, for example).java.lang.IllegalArgumentException - if hostname is null or if the port is out of range.public final void connect(java.lang.String hostname,
int port,
boolean secure,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config)
throws java.io.IOException
First of all, this client contacts the boot instance defined by the arguments
hostname - The host name of the serverport - The port on which the server waits for requestsecure - true if the connection to the server is securebindAddress - The address to bind to, can be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.ratingListener - The FoundLostRatingListener that will be notified each time a Rating
Instance will be found or lost.config - The service tuning configurationjava.io.IOException - if the client cannot connect to the server (if server is not running, for example).java.lang.IllegalArgumentException - if hostname is null or if the port is out if range.public final void connect(java.lang.String systemName,
java.net.InetSocketAddress... bootDispatcherAddresses)
throws java.io.IOException
charging client to the
distant SAP CC system that is the Online Charging System (OCS) or Offline Charging System (OFCS) in your SAP system landscape.
If systemName is not null, this charging client looks up
for an SAP CC system named systemName during 2 seconds
to discover some rating boot instances registered to the distant system. The charging client uses the
IPv4 multicast address 234.5.6.7:8910.
If some instances have been found, your charging client opens connections with the discovered rater instances.
If the provided systemName is null or empty, or if preceding discovery has failed,
this client will use bootDispatcherAddresses as a boot rating instance address list to connect to the SAP CC system.
Again, the client opens connections with the discovered rater instances.
Prerequisites: At least systemName or bootDispatcherAddresses must be provided.
systemName - The SAP CC system namebootDispatcherAddresses - A backup rating instance boot dispatcher list, provided only if for some reasonsjava.io.IOException - if the client cannot connect to the server (if server is not running, for example)java.lang.IllegalArgumentException - if some arguments are badly providedpublic final void connect(java.lang.String systemName,
int lookupDuration,
java.net.InetSocketAddress discoveryAddress,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config,
java.net.InetSocketAddress... bootDispatcherAddresses)
throws java.io.IOException
If systemName is not null, this client lookups
for a rating system named systemName during lookupDuration milliseconds
in order to discover some rating boot instances registered to the system.
If some instances have been found, this client opens connections with the discovered rating instances.
If provided systemName is null or empty, or if preceding discovery has failed,
this client will use bootDispatcherAddresses as a boot rating instance address list to connect to the rating system.
Again, the client opens connections with the discovered rating instances.
At least systemName or bootDispatcherAddresses must be provided.
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 be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.ratingListener - The FoundLostRatingListener that will be notified each time a Rating
Instance will be found or lost.config - The service tuning configurationbootDispatcherAddresses - A backup rating instance boot dispatcher list, provided only if for some reasonsjava.io.IOException - if the client cannot connect to the server (if server is not running, for example).java.lang.IllegalArgumentException - if some arguments are badly providedpublic final void connect(java.lang.String systemName,
com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses)
throws java.io.IOException
If systemName is not null, this client lookups
for a rating system named systemName during 2 seconds
in order to discover some rating boot instances registered to the system. This client will use
IPv4 multicast address 234.5.6.7:8910.
If some instances have been found, this charging client opens connections with the discovered rating instances.
If provided systemName is null or empty, or if preceding discovery has failed,
this client will use bootDispatcherAddresses as a boot rating instance address list to connect to the rating system.
Again, the client opens connections with the discovered rating instances.
At least systemName or bootDispatcherAddresses must be provided.
systemName - The SAP CC system namebootDispatcherAddresses - a backup rating instance boot dispatcher list, provided only if for some reasonsjava.io.IOException - if the client cannot connect to the server (if server is not running, for example).java.lang.IllegalArgumentException - if some arguments are badly providedpublic final void connect(java.lang.String systemName,
int lookupDuration,
java.net.InetSocketAddress discoveryAddress,
java.lang.String bindAddress,
int timeout,
FoundLostRatingListener ratingListener,
ServiceClientTuning config,
com.highdeal.barbus.InstanceAddress... bootDispatcherAddresses)
throws java.io.IOException
If systemName is not null, this client looks up
for a rating system named systemName during lookupDuration milliseconds
in order to discover some rating boot instances registered to the system.
If some instances have been found, this client opens connections with the discovered rating instances.
If provided systemName is null or empty, or if preceding discovery has failed,
this client will use bootDispatcherAddresses as a boot rating instance address list to connect to the rating system.
Again, the client opens connections with the discovered rating instances.
At least systemName or bootDispatcherAddresses must be provided.
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 be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending the request.ratingListener - The FoundLostRatingListener that will be notified each time a Rating
Instance will be found or lost.config - The service tuning configurationbootDispatcherAddresses - A backup rating instance boot dispatcher list, provided only if for some reasonsjava.io.IOException - if the client cannot connect to the server (if server is not running, for example)java.lang.IllegalArgumentException - if some arguments are badly providedpublic final void connect(InstanceMap imap, java.lang.String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) throws java.io.IOException
instance map;
A timeout must be specified.imap - The instance map that describes the SAP CC system to connect to; Cannot be null.bindAddress - The address to bind to, can be nulltimeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending the request.ratingListener - The FoundLostRatingListener that will be notified each time a rater instance will be found or lost.config - The service tuning configurationjava.io.IOException - if the client cannot connect to the distant SAP CC system (if the server system is not running, for example).public ConnectionStatus getConnectionStatus()
connection status of the client.connection status of the clientpublic boolean isAtLeastOneConnectionIsRegistered()
public void setUserCredentials(java.lang.String userId,
java.lang.String userPassword)
userId - the user identifieruserPassword - the user passwordpublic final boolean isNoTimeout()
true if the charging client handles timeoutpublic final void setNoTimeout(boolean noTimeout)
noTimeout - true if your client handles timeoutpublic final void setClientOpEventListener(ClientOpEventTopic topic, ClientOpEventListener listener)
client operation event listener to the specified topics;
It will be notified each time an event corresponding to the registered topics.
null for the default topic.
null, then the default listener is set (@link ClientOpEventTopic#DEFAULT).
topic - The topic to plug the client operation event listener tolistener - The client operation event listenerpublic final ClientOpEventListener getClientOpEventListener(ClientOpEventTopic topic)
client operation event listener used by the client for the specified topic.
If the topic is null the default topic listener is returned ( getClientOpEventListener(ClientOpEventTopic.DEFAULT) ).
There is always a default listener for a specific topic.topic - The topic plugged the client operation event listenerpublic final int getTimeout()
-1 to wait indefinitely).-1 if no timeout has been definedpublic final boolean isConnected()
true if the charging client is connected and false otherwise.public final void close()
method allows to release all the resources
attached (sockets and buffers) in the charging client.@Deprecated public final void setBootMode(BootMode mode)
BootMode.HTTP_BOOT_MODE and BootMode.HTTPS_BOOT_MODE are deprecated, this method is deprecated too.
mode - Is this method is deprecated and to use the Message TCP communication or is
HTTP_BOOT_MODE to use the HTTP communication.public final BootMode getBootMode()
MESSAGE_BOOT_MODE because BootMode.HTTP_BOOT_MODE and BootMode.HTTPS_BOOT_MODE are deprecated.@Deprecated public final void setHAEventListener(HAEventListener listener)
Sets 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.
listener - The listener for High Availability eventspublic void addAuthenticationListener(IAuthenticationListener listener)
listener - the listener which will be triggered by authentication events