A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

package org.glassfish.comms.api.telurl

Souce Code of org.glassfish.comms.api.telurl.TelUrlResolver


/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
 * Copyright (c) Ericsson AB, 2004-2008. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License. You can obtain
 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
 * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
 * Sun designates this particular file as subject to the "Classpath" exception
 * as provided by Sun in the GPL Version 2 section of the License file that
 * accompanied this code.  If applicable, add the following below the License
 * Header, with the fields enclosed by brackets [] replaced by your own
 * identifying information: "Portions Copyrighted [year]
 * [name of copyright owner]"
 *
 * Contributor(s):
 *
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */
package org.glassfish.comms.api.telurl;

import java.io.IOException;

import javax.servlet.sip.SipURI;
import javax.servlet.sip.URI;


/**
 * The purpose of this interface is for applications to retrieve TelURL mappings from dns.
 * The interface is implemented by the EAS SIP Container and is made
 * available for applications through a ServletContext attribute via the
 * string identifier CONTEXT_ATTRIBUTE_NAME.
 *
 * @since EAS 3.1
 */
public interface TelUrlResolver {
    /**
     * The identifier to be used when the TelUrlResolver interface is retrieved from the ServletContext.
     */
    public final String CONTEXT_ATTRIBUTE_NAME = "TelUrlResolver";

    /**
     * This method is used to retrieve the SipURI which is the result of applying TelUrl dns lookup procedure.
     * The lookup procedure is described in rfc3761 and its references.
     * @param uri
     *        The URI object representing the telephone number to be retrieved in dns. It should either be a TelUrl object or a SipURI with user=phone parameter.
     * @return The corresponding SipURI found in after applying the dns lookup procedure. Null is returned if no mapping exists.
     * @throws IOException If the dns server is not available for dns (e.g. the lookup is timed out)
     * @throws TelUrlResolverException <ul><li>
     *  If there is a loop detected when applying the lookup procedure using the matching dns server resource records.
     * </li><li>
     * The uri given as argument to this method does not represent a telephone number.
     * </li><li>
     * The uri given as argument to this method represents a local telephone number.
     * </li><li>
     * Other problems with dns resource records.
     *</li></ul>
     */
    SipURI lookupSipURI(URI uri) throws IOException, TelUrlResolverException;

    /**
     * This method checks whether a given URI parameter is valid to be used for TelUrl dns lookup.
     * @param uri
     *        The URI object to be checked if it represents a telephone number.
     * @return true if URI is a TelURL or a SipURI with user=phone parameter.
     *
     */
    boolean isTelephoneNumber(URI uri);

    /**
     * Normalizes the local number, i.e., translates the specified local phone number
     * in the specified phone-context to a global number.
     *
     * @param phoneContext the phone context
     * @param localPhoneNumber the local phone number
     * @return the resulting global number or <code>null</null> (if the local number could not be translated)
     */
    String normalize(String localPhoneNumber, String phoneContext);
}

TOP

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

TOP