001/**
002 *
003 * Copyright © 2014 Florian Schmaus
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jxmpp.stringprep;
018
019/**
020 * Interface for commonly used Stringprep operations used in XMPP.
021 * <p>
022 * The relevant RFCs are:
023 * <ul>
024 * <li><a href="http://tools.ietf.org/html/rfc6122">RFC 6122</a></li>
025 * <li><a href="https://tools.ietf.org/html/draft-ietf-xmpp-6122bis-14">draft-ietf-xmpp-6122bis-14</a></li>
026 * </ul>
027 *
028 */
029public interface XmppStringprep {
030
031        /**
032         * Performs String preparation on the localpart String of a JID. In RFC 6122 terms this means applying the
033         * <i>nodeprep</i> profile of Stringprep.
034         * 
035         * @param string the String to transform.
036         * @return the prepared String.
037         * @throws XmppStringprepException if there is an error.
038         */
039        String localprep(String string) throws XmppStringprepException;
040
041        /**
042         * Performs String preparation on the domainpart String of a JID. In RFC 61ss terms, this means applying the
043         * <i>nameprep</i> profile of Stringprep.
044         * 
045         * @param string the String to transform.
046         * @return the prepared String.
047         * @throws XmppStringprepException if there is an error.
048         */
049        String domainprep(String string) throws XmppStringprepException;
050
051        /**
052         * Performs String preparation on the resourcepart String of a JID. In RFC 6122 terms this means applying the <i>resourceprep</i> profile of Stringprep.
053         * @param string the String to transform.
054         * @return the prepared String.
055         * @throws XmppStringprepException if there is an error.
056         */
057        String resourceprep(String string) throws XmppStringprepException;
058}