KickJava   Java API By Example, From Geeks To Geeks.

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


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 <PX> interior node in the management tree
27  *
28  * @author Stefano Nichele @ Funambol
29  *
30  * @version $Id: PX.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
31  */

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

36     public static final String JavaDoc PX_PORT_NBR = "/PortNbr";
37     public static final String JavaDoc PX_ADDR_TYPE = "/AddrType";
38     public static final String JavaDoc PX_ADDR = "/Addr";
39     public static final String JavaDoc PX_AUTH = "/Auth";
40
41     // ------------------------------------------------------------ Private data
42
private String JavaDoc portNbr;
43     private String JavaDoc address;
44     private String JavaDoc addressType;
45
46     // contains all the pairs id/secret for each authentication methods
47
private Map JavaDoc auths;
48
49     // ------------------------------------------------------------ Constructors
50
/** For serialization purposes */
51     public PX() {
52         this.auths = new Hashtable JavaDoc();
53     }
54
55     /**
56      * Creates a new ConPX object with the given parameters
57      * @param portNbr the port number to use
58      * @param address the server address
59      * @param addressType the type of the server address
60      * @param auth the authentication
61      *
62      */

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

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

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

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

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

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

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

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

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

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

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

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