1600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/*
2600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Conditions Of Use
3600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
4600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software was developed by employees of the National Institute of
5600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Standards and Technology (NIST), an agency of the Federal Government.
6600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Pursuant to title 15 Untied States Code Section 105, works of NIST
7600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* employees are not subject to copyright protection in the United States
8600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* and are considered to be in the public domain.  As a result, a formal
9600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* license is not needed to use the software.
10600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
11600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software is provided by NIST as a service and is expressly
12600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* AND DATA ACCURACY.  NIST does not warrant or make any representations
16600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* regarding the use of the software or the results thereof, including but
17600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* not limited to the correctness, accuracy, reliability or usefulness of
18600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* the software.
19600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
20600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Permission to use this software is contingent upon your acceptance
21600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* of the terms of this agreement
22600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
23600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* .
24600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*
25600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*/
26600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/*******************************************************************************
27600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
28600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*******************************************************************************/
29600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
30600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpackage gov.nist.javax.sip.header;
31600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
32600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport java.text.ParseException;
33600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport javax.sip.header.*;
34600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/**
35600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Require SIP Header.
36600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
37600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @version 1.2 $Revision: 1.5 $ $Date: 2009/07/17 18:57:36 $
38600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
39600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @author M. Ranganathan   <br/>
40600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @author Olivier Deruelle <br/>
41600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
42600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
43600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */
44600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpublic class Require extends SIPHeader implements RequireHeader {
45600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
46600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
47600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Comment for <code>serialVersionUID</code>
48600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
49600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    private static final long serialVersionUID = -3743425404884053281L;
50600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /** optionTag field
51600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
52600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    protected String optionTag;
53600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
54600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
55600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Default constructor
56600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
57600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public Require() {
58600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        super(REQUIRE);
59600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    }
60600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
61600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /** constructor
62600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @param s String to set
63600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
64600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public Require(String s) {
65600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        super(REQUIRE);
66600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        optionTag = s;
67600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    }
68600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
69600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
70600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Encode in canonical form.
71600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @return String
72600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
73600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public String encodeBody() {
74600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        return optionTag;
75600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    }
76600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
77600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
78600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Sets the option tag value to the new supplied <var>optionTag</var>
79600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * parameter.
80600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     *
81600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @param optionTag - the new string value of the option tag.
82600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @throws ParseException which signals that an error has been reached
83600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * unexpectedly while parsing the optionTag value.
84600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
85600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public void setOptionTag(String optionTag) throws ParseException {
86600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        if (optionTag == null)
87600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang            throw new NullPointerException(
88600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang                "JAIN-SIP Exception, Require, "
89600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang                    + "setOptionTag(), the optionTag parameter is null");
90600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        this.optionTag = optionTag;
91600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    }
92600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang
93600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    /**
94600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * Gets the option tag of this OptionTag class.
95600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     *
96600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     * @return the string that identifies the option tag value.
97600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang     */
98600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    public String getOptionTag() {
99600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang        return optionTag;
100600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang    }
101600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang}
102600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/*
103600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * $Log: Require.java,v $
104600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.5  2009/07/17 18:57:36  emcho
105600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
106600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
107600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.4  2006/07/13 09:01:22  mranga
108600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Issue number:
109600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Obtained from:
110600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Submitted by:  jeroen van bemmel
111600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Reviewed by:   mranga
112600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Moved some changes from jain-sip-1.2 to java.net
113600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
114600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: ----------------------------------------------------------------------
115600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Issue number:
116600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this change addresses one or more issues,
117600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   then enter the issue number(s) here.
118600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Obtained from:
119600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this change has been taken from another system,
120600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   then name the system in this line, otherwise delete it.
121600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Submitted by:
122600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this code has been contributed to the project by someone else; i.e.,
123600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   they sent us a patch or a set of diffs, then include their name/email
124600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   address here. If this is your work then delete this line.
125600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Reviewed by:
126600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If we are doing pre-commit code reviews and someone else has
127600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   reviewed your changes, include their name(s) here.
128600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If you have not had it reviewed then delete this line.
129600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
130600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.3  2006/06/19 06:47:26  mranga
131600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * javadoc fixups
132600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
133600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.2  2006/06/16 15:26:28  mranga
134600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
135600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
136600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
137600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
138600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Import
139600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
140600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
141600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Revision 1.2  2004/01/22 13:26:29  sverker
142600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Issue number:
143600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Obtained from:
144600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Submitted by:  sverker
145600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Reviewed by:   mranga
146600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
147600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
148600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
149600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: ----------------------------------------------------------------------
150600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Issue number:
151600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this change addresses one or more issues,
152600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   then enter the issue number(s) here.
153600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Obtained from:
154600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this change has been taken from another system,
155600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   then name the system in this line, otherwise delete it.
156600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Submitted by:
157600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If this code has been contributed to the project by someone else; i.e.,
158600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   they sent us a patch or a set of diffs, then include their name/email
159600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   address here. If this is your work then delete this line.
160600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS: Reviewed by:
161600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If we are doing pre-commit code reviews and someone else has
162600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   reviewed your changes, include their name(s) here.
163600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * CVS:   If you have not had it reviewed then delete this line.
164600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *
165600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */
166