KickJava   Java API By Example, From Geeks To Geeks.

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


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
20 package sync4j.framework.core;
21
22 import java.util.*;
23
24
25 /**
26  * This class represents the synchronization capabilities of a datastore and
27  * corresponds to the <SyncCap> tag in the SyncML devinf DTD
28  *
29  * @see DataStore
30  * @author Stefano Fornari @ Funambol
31  *
32  * @version $Id: SyncCap.java,v 1.4 2005/06/07 16:51:07 luigiafassina Exp $
33  */

34 public final class SyncCap
35 implements java.io.Serializable JavaDoc {
36     
37     // --------------------------------------------------------------- Constants
38
private ArrayList syncTypes = new ArrayList();
39     
40     // ------------------------------------------------------------ Constructors
41
/**
42      * In order to expose the server configuration like WS this constructor
43      * must be public
44      */

45     public SyncCap(){}
46
47     /**
48      * Creates a new SyncCap object that specifies the synchronization
49      * capabilities of the given datastore
50      *
51      * @param syncTypes an array of type of the supported
52      * synchronization - NOT NULL
53      *
54      */

55     public SyncCap(final SyncType[] syncTypes) {
56         setSyncType(syncTypes);
57     }
58
59     // ---------------------------------------------------------- Public methods
60

61     /**
62      *
63      * @return The return value is guaranteed to be non-null.
64      * Also, the array's elements are guaranteed to
65      * be non-null.
66      *
67      */

68     public ArrayList getSyncType() {
69         return syncTypes;
70     }
71
72     public void setSyncType(SyncType[] syncTypes) {
73         if (syncTypes == null || syncTypes.length == 0) {
74             throw new IllegalArgumentException JavaDoc(
75                                            "syncTypes cannot be null or empty");
76         }
77         this.syncTypes.clear();
78         this.syncTypes.addAll(Arrays.asList(syncTypes));
79     }
80 }
Popular Tags