KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > dm > ddf > NAP


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.framework.core.dm.ddf;
20
21 import java.util.Hashtable JavaDoc;
22 import java.util.Map JavaDoc;
23
24
25 /**
26  * Corresponds to the <NAP> interior node in the management tree
27  *
28  * @author Stefano Nichele @ Funambol
29  *
30  * @version $Id: NAP.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
31  */

32 public class NAP {
33
34     // --------------------------------------------------------------- Constants
35

36     public static final String JavaDoc NAP_BEARER = "/Bearer";
37     public static final String JavaDoc NAP_ADDR_TYPE = "/AddrType";
38     public static final String JavaDoc NAP_ADDR = "/Addr";
39     public static final String JavaDoc NAP_AUTH = "/Auth";
40
41     // ------------------------------------------------------------ Private data
42
private String JavaDoc bearer;
43     private String JavaDoc address;
44     private String JavaDoc addressType;
45
46     // contains all the pair id/secret for each authentication methods
47
private Map JavaDoc auths;
48
49     // ------------------------------------------------------------ Constructors
50
/** For serialization purposes */
51     public NAP() {
52         this.auths = new Hashtable JavaDoc();
53     }
54
55     /**
56      * Creates a new ConNAP object with the given parameters
57      *
58      * @param bearer the bearer type of the connection information
59      * @param address the server address
60      * @param addressType the type of the server address
61      *
62      */

63     public NAP(final String JavaDoc bearer,
64                final String JavaDoc address,
65                final String JavaDoc addressType) {
66         this();
67         this.bearer = bearer;
68         this.address = address;
69         this.addressType = addressType;
70
71     }
72
73     // ---------------------------------------------------------- Public methods
74

75     /**
76      * Gets the bearer
77      *
78      * @return the bearer
79      */

80     public String JavaDoc getBearer() {
81         return bearer;
82     }
83
84     /**
85      * Sets the bearer
86      *
87      * @param the bearer
88      */

89     public void setBearer(String JavaDoc bearer) {
90         this.bearer = bearer;
91     }
92
93
94     /**
95      * Gets the address
96      *
97      * @return the address
98      */

99     public String JavaDoc getAddress() {
100         return address;
101     }
102
103     /**
104      * Sets the address
105      *
106      * @param the address
107      */

108     public void setAddress(String JavaDoc address) {
109         this.address = address;
110     }
111
112     /**
113      * Gets the addressType
114      *
115      * @return the addressType
116      */

117     public String JavaDoc getAddressType() {
118         return addressType;
119     }
120
121     /**
122      * Sets the addressType
123      *
124      * @param the addressType
125      */

126     public void setAddressType(String JavaDoc addressType) {
127         this.addressType = addressType;
128     }
129
130     /**
131      * Gets the <code>ConAuth</code> with the given name
132      *
133      * @return the auth with the given name
134      */

135     public Auth getAuth(String JavaDoc authenticationName) {
136         return (Auth)auths.get(authenticationName);
137     }
138
139     /*
140      * Gets the authentications available
141      *
142      * @return the authentications available
143      */

144     public Map JavaDoc getAuths() {
145         return auths;
146     }
147
148     /*
149      * Sets the auth
150      *
151      * @param the auth
152      */

153     public void setAuths(Map JavaDoc auths) {
154         this.auths = auths;
155     }
156
157
158     /**
159      * Adds the auth
160      *
161      * @param the auth to add
162      */

163     public void addAuth(Auth auth, String JavaDoc authenticationName) {
164         auths.put(authenticationName, auth);
165     }
166
167 }
Popular Tags