KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > MetInf


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 package sync4j.framework.core;
19
20 import java.util.*;
21
22 /**
23  * This class represents the <MetInf> tag as defined by the SyncML
24  * representation specifications.
25  *
26  * @author Stefano Fornari @ Funambol
27  *
28  * @version $Id: MetInf.java,v 1.5 2005/02/23 12:02:59 luigiafassina Exp $
29  *
30  */

31 public final class MetInf
32 implements java.io.Serializable JavaDoc {
33
34     // ------------------------------------------------------------ Private data
35
private String JavaDoc format ;
36     private String JavaDoc type ;
37     private String JavaDoc mark ;
38     private Anchor anchor ;
39     private String JavaDoc version ;
40     private NextNonce nextNonce ;
41     private Long JavaDoc maxMsgSize;
42     private Long JavaDoc maxObjSize;
43     private Long JavaDoc size ;
44     private ArrayList emi = new ArrayList();
45     private Mem mem ;
46     // ------------------------------------------------------------ Constructors
47

48     /**
49      * For serialization purposes
50      */

51     public MetInf() {
52         set(
53             null,
54             null,
55             null,
56             null,
57             null,
58             null,
59             null,
60             null,
61             null,
62             null,
63             null
64         );
65     }
66
67     /**
68      * Creates a new MetInf object with the given info.
69      *
70      * @param format the encoding format
71      * @param type usually a MIME type
72      * @param mark the mark element
73      * @param size the data size in bytes
74      * @param anchor the Anchor
75      * @param version the data version
76      * @param nonce the next nonce value
77      * @param maxMsgSize the maximum message size in bytes
78      * @param maxObjSize the maximum object size in bytes
79      * @param emi experimental meta info
80      * @param mem the memory information
81      *
82      */

83     public MetInf(final String JavaDoc format ,
84                   final String JavaDoc type ,
85                   final String JavaDoc mark ,
86                   final Long JavaDoc size ,
87                   final Anchor anchor ,
88                   final String JavaDoc version ,
89                   final NextNonce nonce ,
90                   final Long JavaDoc maxMsgSize,
91                   final Long JavaDoc maxObjSize,
92                   final EMI[] emi ,
93                   final Mem mem ) {
94
95         set(
96             format,
97             type ,
98             mark ,
99             size ,
100             anchor ,
101             version ,
102             nonce ,
103             maxMsgSize ,
104             maxObjSize ,
105             emi ,
106             mem
107         );
108     }
109
110     // ---------------------------------------------------------- Public methods
111

112     /**
113      * Returns dateSize (in bytes)
114      *
115      * @return size
116      */

117     public Long JavaDoc getSize() {
118         return size;
119     }
120
121     /**
122      * Sets size
123      *
124      * @param size the new size value
125      */

126     public void setSize(Long JavaDoc size) {
127         this.size = size;
128     }
129
130     /**
131      * Returns format
132      *
133      * @return format
134      */

135     public String JavaDoc getFormat() {
136         return format;
137     }
138
139     /**
140      * Sets format
141      *
142      * @param format the new format value
143      */

144     public void setFormat(String JavaDoc format) {
145         this.format = format;
146     }
147
148     /**
149      * Returns type
150      *
151      * @return type
152      */

153     public String JavaDoc getType() {
154         return type;
155     }
156
157     /**
158      * Sets type
159      *
160      * @param type the new type value
161      */

162     public void setType(String JavaDoc type) {
163         this.type = type;
164     }
165
166     /**
167      * Returns mark
168      *
169      * @return mark
170      */

171     public String JavaDoc getMark() {
172         return mark;
173     }
174
175     /**
176      * Sets mark
177      *
178      * @param mark the new mark value
179      */

180     public void setMark(String JavaDoc mark) {
181         this.mark = mark;
182     }
183
184     /**
185      * Returns anchor
186      *
187      * @return anchor
188      */

189     public Anchor getAnchor() {
190         return anchor;
191     }
192
193     /**
194      * Sets anchor
195      *
196      * @param anchor the new anchor value
197      */

198     public void setAnchor(Anchor anchor) {
199         this.anchor = anchor;
200     }
201
202     /**
203      * Returns version
204      *
205      * @return version
206      */

207     public String JavaDoc getVersion() {
208         return version;
209     }
210
211     /**
212      * Sets version
213      *
214      * @param version the new version value
215      */

216     public void setVersion(String JavaDoc version) {
217         this.version = version;
218     }
219
220     /**
221      * Returns nextNonce
222      *
223      * @return nextNonce
224      */

225     public NextNonce getNextNonce() {
226         return nextNonce;
227     }
228
229     /**
230      * Sets nextNonce
231      *
232      * @param nextNonce the new nextNonce value
233      */

234     public void setNextNonce(NextNonce nextNonce) {
235         this.nextNonce = nextNonce;
236     }
237
238     /**
239      * Returns maxMsgSize
240      *
241      * @return maxMsgSize
242      */

243     public Long JavaDoc getMaxMsgSize() {
244         return maxMsgSize;
245     }
246
247     /**
248      * Sets maxMsgSize
249      *
250      * @param maxMsgSize the new maxMsgSize value
251      */

252     public void setMaxMsgSize(Long JavaDoc maxMsgSize) {
253         this.maxMsgSize = maxMsgSize;
254     }
255
256     /**
257      * Returns maxObjSize
258      *
259      * @return maxObjSize
260      */

261     public Long JavaDoc getMaxObjSize() {
262         return maxObjSize;
263     }
264
265     /**
266      * Sets maObjSize
267      *
268      * @param maxObjSize the new maxObjSize value
269      */

270     public void setMaxObjSize(Long JavaDoc maxObjSize) {
271         this.maxObjSize = maxObjSize;
272     }
273
274     /**
275      * Returns emi
276      *
277      * @return emi
278      */

279     public ArrayList getEMI() {
280         return emi;
281     }
282
283     /**
284      * Sets emi
285      *
286      * @param emi the new emi value
287      */

288     public void setEMI(EMI[] emi) {
289         if (emi != null) {
290             this.emi.clear();
291             this.emi.addAll(Arrays.asList(emi));
292         } else {
293             this.emi = new ArrayList();
294         }
295     }
296
297     /**
298      * Returns mem
299      *
300      * @return mem
301      */

302     public Mem getMem() {
303         return mem;
304     }
305
306     /**
307      * Sets mem
308      *
309      * @param mem the new mem value
310      */

311     public void setMem(Mem mem) {
312         this.mem = mem;
313     }
314
315     // --------------------------------------------------------- Private methods
316

317     /**
318      * Sets all properties in once.
319      *
320      * @param format the encoding format
321      * @param type usually a MIME type
322      * @param mark the mark element
323      * @param sizeInBytes the data size in bytes
324      * @param anchor the Anchor
325      * @param version the data version
326      * @param nonce the next nonce value
327      * @param maxMsgSize the maximum message size in bytes
328      * @param emi experimental meta info
329      * @param memoryInfo memory information
330      *
331      */

332     private void set(final String JavaDoc format ,
333                      final String JavaDoc type ,
334                      final String JavaDoc mark ,
335                      final Long JavaDoc size ,
336                      final Anchor anchor ,
337                      final String JavaDoc version ,
338                      final NextNonce nonce ,
339                      final Long JavaDoc maxMsgSize,
340                      final Long JavaDoc maxObjSize,
341                      final EMI[] emi ,
342                      final Mem mem ) {
343         this.format = format;
344         this.type = type;
345         this.mark = mark;
346         this.anchor = anchor;
347         this.size = size;
348         this.version = version;
349         this.nextNonce = nonce;
350         this.maxMsgSize = maxMsgSize;
351         this.maxObjSize = maxObjSize;
352         this.mem = mem;
353         this.setEMI(emi);
354     }
355 }
356
Popular Tags