com.ibm.twss.common.siputils
Class URIComparison

java.lang.Object
  extended by com.ibm.twss.common.siputils.URIComparison

public class URIComparison
extends java.lang.Object

Provides SIP, SIPS, and TEL URI normalization and comparison functions. Functionality originated in the CallNotification_IMS service.


Method Summary
static boolean areEquivalent(java.lang.String uriString1, java.lang.String uriString2, javax.servlet.sip.SipFactory sipFactory)
          Checks if two String URI representations are equivalent using a robust comparison algorithm.
static java.lang.String convertToSipURIString(javax.servlet.sip.TelURL telURL)
          Convert a TelURL to a String representing a semantically equivalent SIP URI.
static java.lang.String normalizeURIForSQLSelect(java.lang.String uriToNormalize, javax.servlet.sip.SipFactory sipFactory)
          Normalize the given URI according to section 5.2.1 of the CallNotification CDD.
static boolean startsWithTelScheme(java.lang.String uriString)
          Returns true if the input begins with the TEL URI scheme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

normalizeURIForSQLSelect

public static java.lang.String normalizeURIForSQLSelect(java.lang.String uriToNormalize,
                                                        javax.servlet.sip.SipFactory sipFactory)
                                                 throws InvalidNormalizationInputException,
                                                        java.lang.NullPointerException
Normalize the given URI according to section 5.2.1 of the CallNotification CDD. For a SIP or SIPS URI, normalization will leave only scheme:userinfo. For a TEL URI, normalization will leave only tel:global-number-digits or tel:local-number-digits with any visual separators removed from the digit portions. The normalization process is designed so that normalized URIs, once stored in a database, can be quickly scanned for potential equality matches using traditional SQL SELECTs. Usually the normalized form and the non-normalized form will be stored in the same table. Once a candidate set of URIs is found via SQL SELECT WHERE clauses against the normalized form, a final equality checks should be performed against the non-normalized version using the areEquivalent(String, String, SipFactory) method to handle full comparison details.

Parameters:
uriToNormalize - to normalize for database INSERT and SELECT
sipFactory - to use during the normalization process.
Returns:
a normalized URI suitable for database storage.
Throws:
InvalidNormalizationInputException - if uriToNormalize is not a valid SIP, SIPS, or TEL URI.
java.lang.NullPointerException - if sipFactory is null.
See Also:
areEquivalent(String, String, SipFactory)

areEquivalent

public static boolean areEquivalent(java.lang.String uriString1,
                                    java.lang.String uriString2,
                                    javax.servlet.sip.SipFactory sipFactory)
                             throws ComparisonParsingException,
                                    UnsupportedComparisonSchemeException,
                                    CompactHeaderExpansionException
Checks if two String URI representations are equivalent using a robust comparison algorithm. Algorithm accounts for many features of SIP and TEL URIs that can be problematic, e.g. TEL visual separators.

Parameters:
uriString1 - to compare.
uriString2 - to compare.
sipFactory - to use during the normalization process.
Returns:
true if the two URIs are equivalent. False otherwise.
Throws:
ComparisonParsingException - if either URI cannot be parsed.
UnsupportedComparisonSchemeException - if either URI uses an unsupported scheme.
CompactHeaderExpansionException - if the compact header expansion process encounters unrecoverable errors.

startsWithTelScheme

public static boolean startsWithTelScheme(java.lang.String uriString)
Returns true if the input begins with the TEL URI scheme.

Parameters:
uriString - to check.
Returns:
True if the string begins with "tel:", ignoring case. False otherwise.

convertToSipURIString

public static java.lang.String convertToSipURIString(javax.servlet.sip.TelURL telURL)
Convert a TelURL to a String representing a semantically equivalent SIP URI.

Parameters:
telURL - to convert.
Returns:
String representing a semantically equivalent SIP URI.
Throws:
java.lang.NullPointerException - if telURl is null.


Copyright © 2003 IBM Corp. All Rights Reserved.