This chapter introduces the Reply Timeout, a feature unique to the Blocking API.
The chapter also lists all the operations of the Blocking API, and provides code examples.
Note If you need to develop only an automatic integration, skip this chapter and go directly to Chapter4, “Nonblocking API”
The Blocking API supports an unlimited number of threads calling its methods simultaneously.
Note In a multithreaded scenario for the Blocking API, the order of invocation is not guaranteed.
Thread-0 calls operation-0 at time-0, and thread-1 calls operation-1 at time-1, where time-1 is later than time-0. In this example, it is possible that operation-1 might be performed before operation-0, as shown in Figure 3-1 (the vertical scale is time):
Figure 3-1 Multithreading Support
The Cisco Service Control Subscriber Manager allocates five threads to manage each API instance. Develop a multithreaded application that uses the API with several threads in the order of the five threads. Implementing with more threads might result in longer delays for the calling threads.
A blocking operation returns only when the operation result is retrieved from the Cisco Service Control Subscriber Manager. If a networking malfunction or other error prevents the operation result from being retrieved, the caller waits indefinitely. The Cisco Service Control Subscriber Manager API provides a means of working around this situation.
The reply timeout feature (the setReplyTimeout method) enables the caller to set a timeout. It will generate com.pcube.management.framework.rpc.OperationTimeoutException when a reply does not return within the timeout period.
Calling the setReplyTimeout method with a long value sets a reply timeout. The reply timeout is interpreted in milliseconds. A zero value indicates that the operation should wait (freeze, stop responding) until a result arrives—or indefinitely, if no result arrives.
There is an alternative way to release a method call that is blocking the caller, who is waiting for a result to arrive. Call the interrupt method of the calling thread; java.lang.InterruptedException will then be returned to the caller.
This section lists the methods of the Cisco Service Control Subscriber Manager Blocking API. The description of each method includes its syntax, input parameters, and return values.
The Blocking API is a superset of the Nonblocking API. Except for differences in return values and result handling, identical operations in both APIs have the same functions and syntax structure. All the methods generate java.lang.IllegalStateException when called before the API establishes a connection with the Cisco Service Control Subscriber Manager.
The Blocking API methods are classified as follows:
– login
– getNumberOfSubscribersInDomain
– getSubscriberNames (filter by property)
– getSubscriberNamesWithPrefix
– getSubscriberNamesWithSuffix
You can mix methods from different categories in a single application. The classification is presented only for clarity.
The following sections provide information about the login operation:
The login syntax is as follows:
The login method adds or modifies a domain, mappings, and possibly properties of a subscriber that already exists in the Cisco Service Control Subscriber Manager database. The login method can be called with partial data; for example, it might provide mappings or properties only, and put NULL ++++ in the unchanged fields.
If another subscriber with the same (or conflicting) mappings already exists in the same domain, the conflicting mappings are removed from the other subscriber and assigned to the new subscriber.
If the subscriber does not exist in the Cisco Service Control Subscriber Manager database, the login method creates it with the data provided.
The parameters of the login method are as follows:
If domain is NULL, but the subscriber already has a domain, the existing domain is retained.
If the domain is different from the domain that was previously assigned to the subscriber, the subscriber is removed automatically from the Cisco SCEs of the previous domain and moved to the SCEs of the new domain.
– TRUE—Adds the mappings provided by this call to the subscriber record.
– FALSE—Overrides the mappings provided by this call with mappings that already exist in the subscriber record.
– Positive value ( N)—Automatically logs out the mappings (similar to calling a logout method) after N seconds.
– 0 value—Maintains the current expiration time for the given mappings.
– Negative value—Disables any expiration time set for the given mappings.
The following list presents the error codes the login method might return:
This error can be caused by the following parameter settings:
– NULL value for the domain parameter for the subscriber that does not exist or does not have a domain
– Invalid values for the propertyValues parameter
For a description of error codes, see Appendix A, “List of Error Codes” .
To add the IP address 192.168.12.5 to an existing subscriber named alpha without affecting existing mappings:
To add the IP address 192.168.12.5 overriding previous mappings:
To extend the auto logout time of 192.168.12.5, which was previously assigned to alpha:
To modify a dynamic property of alpha (for example, package ID):
To add the IP address 192.168.12.5 to an existing subscriber named alpha without affecting existing mappings and to modify a dynamic property of alpha (for example, package ID):
To add the IPv6 address 2000:2001:2002:abcd::/64 to an existing subscriber named alpha without affecting existing mappings:
To add the IPv6 address 2000:2001:2002:abcd::/64 overriding previous mappings:
To extend the auto logout time of 2000:2001:2002:abcd::/64 that was previously assigned to alpha:
To add the IPv6 address 2000:2001:2002:abcd::/64 to an existing subscriber named alpha without affecting the existing mappings, and to modify a dynamic property of alpha, for example, package ID:
The following sections provide information about the logoutByName operation:
The logoutByName syntax is as follows:
The logoutByName method locates the subscriber in the database and removes mappings from it. If the subscriber does not exist, the logoutByName operation does not do anything.
The parameters of the logoutByName method are as follows:
The following list presents the error codes the logoutByName method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
To remove IP address 192.168.12.5 of subscriber alpha:
To remove all IP addresses of subscriber alpha:
The following sections provide information about the logoutByNameFromDomain operation:
The logoutByNameFromDomain syntax is as follows:
The logoutByNameFromDomain similar to logoutByName, but this method also enables the caller to provide the name of the domain to which the subscriber belongs. When the subscriber domain is known, use this method to improve performance.
The parameters of the logoutByNameFromDomain method are as follows:
The operation fails if either of the following conditions exists:
The following list presents error codes the logoutByNameFromDomain method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
To remove IP address 192.168.12.5 of subscriber alpha from domain subscribers:
The following sections provide information about the logoutByMapping operation:
The logoutByMapping syntax is as follows:
The logoutByMapping locates a subscriber based on domain and mapping, and removes the mapping (the subscriber stays in the database).
The parameters of the logoutByMapping method are as follows:
The following list presents error codes the logoutByMapping method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
To remove IP address 192.168.12.5 from domain subscribers:
To remove IPv6 address 2001:db8:85a3::8a2e:370:7334/64 from domain subscribers:
The following sections provide information about the loginCable operation:
The loginCable syntax is as follows:
The loginCable method is an operation adapted for the cable environment; it calls the cable support module in the Cisco Service Control Subscriber Manager. This method is designed to log in the customer premise equipment (CPE) and content managers to the Cisco Service Control Subscriber Manager. To log in a CPE, specify its cable modem (CM) MAC in the CM argument and the CPE MAC in the CPE argument. To log in a cable modem, specify the cable modem MAC address in both CPE and CM arguments. Note that the login of a CPE whose CM does not exist in the Cisco Service Control Subscriber Manager database is ignored—the CM has to exist in the database, either by import or by a CM login operation. For additional information, see the CPE as Subscriber in Cable Environment chapter of Cisco Service Control Management Suite Subscriber Manager User Guide.
Note The name of the CPE in the Cisco Service Control Subscriber Manager database is the concatenation of the CPE and CM values with two underscore characters (“_”) between them. The caller must ensure that the lengths of CPE and CM add up to no more than 38 characters.
The parameters of the loginCable method are as follows:
Note Domain aliases must be set on the Cisco Service Control Subscriber Manager so that the cable modem termination system (CMTS) IP is correctly interpreted as a domain name. For information about configuring aliases, see the Default Domains Configuration section of Cisco SCMS Subscriber Manager User Guide.
If the CPE is provided with partial or no application properties, the values for the missing application properties are copied from the application properties of the cable modem to which this CPE belongs. Each cable modem application property thus serves as a default for the CPE with which it is associated.
To add the IP address 192.168.12.5 to a cable modem called CM1 with two hours of lease time:
To add the IP address 192.168.12.50 to a CPE called CPE1, which is behind CM1 with a lease time of one hour:
To add the IPv6 address 2001:db8:85a3::8a2e:370:7334/64 to a cable modem called CM1 with two hours of lease time:
The following sections provide information about the logoutCable operation:
The logoutCable syntax is as follows:
The logoutCable method indicates to the Cisco Service Control Subscriber Manager cable support module that a logout event has happened.
The parameters of the logoutCable method are as follows:
To remove the IP address 192.168.12.5 from CPE1, which is associated with CM1:
The following sections provide information about the addSubscriber operation:
The addSubscriber syntax is as follows:
The addSubscriber method creates a new subscriber record according to the method parameters and adds the record to the Cisco Service Control Subscriber Manager database.
When adding a new subscriber name, if the name already exists in Cisco Service Control Subscriber Manager database, the first instance of the name is removed before the new one is added. In contrast to login method, which modifies fields and leaves unspecified fields unchanged, the addSubscriber method sets the subscriber exactly as specified by the parameters passed to it.
Note Use the call login method for existing subscribers, instead of the addSubscriber command. You should set dynamic mappings and properties by using the login command. Set static mappings and properties the first time the subscriber is created by using the addSubscriber command.
Note With the addSubscriber command, the autologout feature is always disabled. To enable autologout, use the login command.
Subscriber AB, already set up in the subscriber database, has a single IP mapping ( IP1).
If an addSubscriber operation for AB is called with no mappings specified (NULL in both the mappings and mappingTypes fields), AB is left with no mappings.
However, calling the login operation with these NULL-value parameters does not change the subscriber mappings of AB; AB retains its previous IP mapping of IP1.
The parameters of the addSubscriber method are as follows:
A NULL value indicates that the subscriber has no domain. If domain is NULL, but the subscriber already has a domain, the existing domain is retained.
The following list presents error codes that the addSubscriber method might return:
This error code might indicate invalid values that were supplied for the propertyValues parameter.
For a description of error codes, see Appendix A, “List of Error Codes” .
The following example code adds a new subscriber, alpha, with some custom properties:
The following sections provide information about the removeSubscriber operation:
The removeSubscriber syntax is as follows:
The removeSubscriber method removes a subscriber completely from the Cisco Service Control Subscriber Manager database.
The only parameter of the removeSubscriber method is as follows:
The following list presents error codes that the removeSubscriber method method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following example code removes subscriber alpha entirely from the database:
The following sections provide information about the removeAllSubscribers operation:
The removeAllSubscribers syntax is as follows:
The removeAllSubscribers method removes all subscribers from the Cisco Service Control Subscriber Manager, leaving the database with no subscribers.
Note This method might take time to execute. To avoid operation timeout exceptions, set a high operation timeout (up to 5 minutes) before calling this method.
The following sections provide information about the getNumberOfSubscribers operation:
The getNumberOfSubscribers syntax is as follows:
The getNumberOfSubscribers method retrieves the total number of subscribers in the Cisco Service Control Subscriber Manager database.
The number of subscribers in the Cisco Service Control Subscriber Manager.
The following sections provide information about the getNumberOfSubscribersInDomain operation:
The getNumberOfSubscribersInDomain syntax is as follows:
The getNumberOfSubscribersInDomain method retrieves the number of subscribers in a subscriber domain.
The only parameter of the getNumberOfSubscribersInDomain method is as follows:
The following list presents the error codes that the getNumberOfSubscribersInDomain method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriber operation:
The getSubscriber syntax is as follows:
The getSubscriber method retrieves a subscriber record. Each field is formatted as an integer, string, or string array.
If the subscriber does not exist in the Cisco Service Control Subscriber Manager database, the operation returns an exception.
The only parameter of the getSubscriber method is as follows:
An object array with nine elements. Table 3-1 lists the index values and descriptions. No array element has a NULL value.
|
|
---|---|
Autologout time, in seconds from the present time, or -1 if not set (long[]) |
The following list presents error codes that the getSubscriber method method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following example code retrieves the subscriber record of alpha:
The following sections provide information about the subscriberExists operation:
The subscriberExists syntax is as follows:
The subscriberExists method verifies that a subscriber exists in the Cisco Service Control Subscriber Manager database.
The only parameter of the subscriberExists method is as follows:
subscriberName—See the description in the “Subscriber Name Format” section.
The following sections provide information about the subscriberLoggedIn operation:
The subscriberLoggedIn syntax is as follows:
The subscriberLoggedIn method checks whether a subscriber that already exists in the Cisco Service Control Subscriber Manager database is logged in, that is, if the subscriber also exists in a Cisco SCE database.
When the Cisco Service Control Subscriber Manager is configured to work in Pull mode, a TRUE value returned by this method does not guarantee that the subscriber actually exists in an SCE database; but rather, the subscriber is available to be pulled by an SCE if needed.
If the subscriber does not exist in the Cisco Service Control Subscriber Manager database, an exception is generated.
The only parameter of the subscriberLoggedIn method is as follows:
subscriberName —See the description in the “Subscriber Name Format” section.
The following list presents error codes that the subscriberLoggedIn method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriberNameByMapping operation:
The getSubscriberNameByMapping syntax is as follows:
The getSubscriberNameByMapping method finds a subscriber name according to a mapping and a domain.
The parameters of the getSubscriberNameByMapping method are as follows:
– Domain is NULL, but the subscriber exists in the database and belongs to a domain.
The following list presents error codes that the getSubscriberNameByMapping method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriberNames (all) operation:
The getSubscriberNames (all) syntax is as follows:
The getSubscriberNames (all) method retrieves a bulk of subscriber names from the Cisco Service Control Subscriber Manager database, starting with lastBulkEnd followed by numOfSubscribers (in alphabetical order).
If lastBulkEnd is NULL, the first subscriber name (alphabetically) that exists in the Cisco Service Control Subscriber Manager database is retrieved.
Note There is no guarantee that the total number of subscribers (in all the bulks) will equal the value returned from getNumOfSubscribers at any time. The values might differ if some subscribers are added or removed when the bulks are being retrieved.
The parameters of the getSubscriberNames (all) method are as follows:
Note Do not provide a value of more than 500 subscribers.
An array of subscriber names, alphabetically ordered.
The getSubscriberNames (all) method returns as many subscribers as are found in the Cisco Service Control Subscriber Manager database, starting at the requested subscriber. The array size is limited by the smaller of these values—numOfSubscribers or the Cisco Service Control Subscriber Manager limit (1000).
The following list presents error codes that the getSubscriberNames (all) method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following example code returns an array of subscriber names:
The following sections provide information about the getSubscriberNames (filter by property) operation:
The getSubscriberNames (filter by property) method syntax is as follows:
The getSubscriberNames (filter by property) method retrieves a bulk of subscriber names from the Cisco Service Control Subscriber Manager database, starting with lastBulkEnd followed by numOfSubscribers (in alphabetical order), and based on the property name and property value.
If lastBulkEnd is NULL, the first subscriber name (alphabetically) that exists in the Cisco Service Control Subscriber Manager database is retrieved.
Note There is no guarantee that the total number of subscribers (in all the bulks) will equal the value returned from getNumOfSubscribers at any time. The values might differ if some subscribers are added or removed when the bulks are being retrieved.
The parameters of the getSubscriberNames (filter by property) method are as follows:
Note Do not provide a value of more than 500 subscribers.
An array of alphabetically ordered subscriber names that matches the property name and its given value. The method returns as many subscribers as are found in the Cisco Service Control Subscriber Manager database, starting at the requested subscriber. The array size is limited by the smaller of these values—numOfSubscribers or the Cisco Service Control Subscriber Manager limit (1000).
The following list presents error codes that the getSubscriberNames (filter by property) method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriberNamesInDomain operation:
The getSubscriberNamesInDomain syntax is as follows:
The getSubscriberNamesInDomain method retrieves subscribers in the Cisco Service Control Subscriber Manager database that are associated with the specified domain.
The semantics of this operation are the same as that of the getSubscriberNames operation described in the “getSubscriberNames (all)” section.
The parameters of the getSubscriberNamesInDomain method are as follows:
An alphabetically ordered array of subscriber names that belong to the domain provided.
See the “Return Value” section (the getSubscriberNames (all) operation).
The following list presents the error codes that the getSubscriberNamesInDomain method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriberNamesWithPrefix operation:
The getSubscriberNamesWithPrefix syntax is as follows:
The getSubscriberNamesWithPrefix method retrieves subscribers in the Cisco Service Control Subscriber Manager database whose name begins with a specified prefix.
The semantics of this operation are the same as that of the getSubscriberNames operation described in the “getSubscriberNames (all)” section.
The parameters of the getSubscriberNamesWithPrefix method are as follows:
An alphabetically ordered array of subscriber names that begin with the required prefix.
See, the “Return Value” section.
The following list presents error codes that the getSubscriberNamesWithPrefix method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getSubscriberNamesWithSuffix operation:
The getSubscriberNamesWithSuffix syntax is as follows:
The getSubscriberNamesWithSuffix method retrieves subscribers in the Cisco Service Control Subscriber Manager database whose names end with the specified suffix.
The semantics of this operation are the same as that of the getSubscriberNames (all) operation described in the “getSubscriberNames (all)” section.
The parameters of the getSubscriberNamesWithSuffix method are as follows:
An alphabetically ordered array of subscriber names that end with the required suffix.
See, the “Return Value” section (the getSubscriberNames (all) operation).
The following list presents error codes that the getSubscriberNamesWithSuffix method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the getDomains operation:
The getDomains syntax is as follows:
The getDomains method provides the list of current subscriber domains in the Cisco Service Control Subscriber Manager domain repository.
A complete list of subscriber domain names in the Cisco Service Control Subscriber Manager.
The following sections provide information about the setPropertiesToDefault operation:
The setPropertiesToDefault syntax is as follows:
The setPropertiesToDefault method resets the specified application properties of a subscriber. If an application is installed, the relevant application properties are set to the default values of the properties according to the currently loaded application information. If an application is not installed, the operation returns java.lang.IllegalStateException.
The parameters of the setPropertiesToDefault method are as follows:
The following list presents error codes that the setPropertiesToDefault method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
The following sections provide information about the removeCustomProperties operation:
The removeCustomProperties syntax is as follows:
The removeCustomProperties method resets the specified custom properties of a subscriber.
The parameters of the removeCustomProperties method are as follows:
The following list presents error codes that the removeCustomProperties method might return:
For a description of error codes, see Appendix A, “List of Error Codes” .
This section lists the methods of the Quota Manager (QM) Blocking API. The description of each method includes the syntax, input parameters, and return values.
– getSubscriberQuotaInformation
The following sections provide information about the addSubscriberQuota operation:
The addSubscriberQuota syntax is as follows:
The addSubscriberQuota method adds the quota for the given bucket ID of a subscriber.
The parameters of the addSubscriberQuota method are as follows:
The following list presents error codes that the addSubscriberQuota method might return:
The following sections provide information about the setSubscriberQuota operation:
The setSubscriberQuota syntax is as follows:
The setSubscriberQuota method updates the quota for the given bucket ID of a subscriber.
The parameters of the setSubscriberQuota method are as follows:
The following list presents error codes that the setSubscriberQuota method might return:
The following sections provide information about the replenishSubscriberQuota operation:
The replenishSubscriberQuota syntax is as follows:
The replenishSubscriberQuota method replenishes the quota for the given subscriber.
The only parameter of the replenishSubscriberQuota method is as follows:
The following list presents error codes that the replenishSubscriberQuota method might return:
The following sections provide information about the getSubscriberQuotaInformation operation:
The getSubscriberQuotaInformation syntax is as follows:
The getSubscriberQuotaInformation method gets a bulk of quota information for a specified subscriber.
The only parameter of the getSubscriberQuotaInformation method is as follows:
An object array with five elements. Table 3-2 lists the index values and descriptions. None of the array elements have a NULL value.
The following list presents error codes that the getSubscriberQuotaInformation method might return:
The following sections provide information about the getSubscriberQuotaProfileId operation:
The getSubscriberQuotaProfileId syntax is as follows:
The getSubscriberQuotaProfileId method returns the quota profile ID for the specified subscriber.
The only parameter of the getSubscriberQuotaProfileId method is as follows:
The following list presents error codes that the getSubscriberQuotaProfileId method might return:
The following sections provide information about the getBreachedSubscriberNames operation:
The getBreachedSubscriberNames syntax is as follows:
The getBreachedSubscriberNames method retrieves the breached subscriber names.
The parameters of the getBreachedSubscriberNames method are as follows:
An array of alphabetically ordered subscriber names that belong to a breached state. This method returns all the subscribers found in the Cisco Service Control Subscriber Manager database starting with the requested subscriber. The array size is limited by the smaller of these values—numOfSubscribers or the Cisco Service Control Subscriber Manager limit (1000).
The getBreachedSubscriberNames method might return the
ERROR_CODE _DATABASE_EXCEPTION error code.
The following sections provide information about the getPenaltySubscriberNames operation:
The getPenaltySubscriberNames syntax is as follows:
The getPenaltySubscriberNames method retrieves the subscriber names in a penalty state.
The parameters of the getPenaltySubscriberNames method are as follows:
An array of alphabetically ordered subscriber names that belong to a penalty state. This method returns all the subscribers found in the Cisco Service Control Subscriber Manager database starting with the requested subscriber. The array size is limited by the smaller of these values—numOfSubscribers or the Cisco Service Control Subscriber Manager limit (1000).
The getPenaltySubscriberNames method might return the
ERROR_CODE _DATABASE_EXCEPTION error code.
This section includes the following code examples:
The following example prints to stdout the total number of subscribers in the Cisco Service Control Subscriber Manager database and the number of subscribers in each subscriber domain:
The following program adds a subscriber to the subscriber database. It then gets its information and prints it to stdout. Finally, the program removes the subscriber from the subscriber database:
The following example gets subscriber quota information, sets subscriber quota, and lists subscribers in the breached state: