KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > spds > SyncManager


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.syncclient.spds;
20
21 import java.util.Hashtable JavaDoc;
22
23 /**
24  * This is a wrapper to create a istance of SyncManagerImpl
25  *
26  * @author Fabio Maggi @ Funambol
27  * @version $Id: SyncManager.java,v 1.1 2004/07/19 13:17:23 fabius Exp
28  */

29 public class SyncManager {
30
31     //---------------------------------------------------------------- Constants
32

33     private static final String JavaDoc KEY_LOGIN = "login" ;
34     private static final String JavaDoc KEY_SERVER_URL = "serverUrl" ;
35     final private static String JavaDoc KEY_GATEWAYAPN = "gatewayApn" ;
36     final private static String JavaDoc KEY_GATEWAYIP = "gatewayIp" ;
37     final private static String JavaDoc KEY_GATEWAYPORT = "gatewayPort" ;
38
39     //---------------------------------------------------------------- Private data
40

41     SyncManagerImpl syncManagerImpl = null;
42
43     //---------------------------------------------------------------- Constructors
44

45     /**
46      * Creates a SyncManager.
47      * The datastore is identified by the dataStoreName parameter
48      *
49      * @param dataStoreName The dataStore to Sync
50      *
51      */

52     public SyncManager (String JavaDoc dataStoreName,
53                         String JavaDoc sourceType,
54                         String JavaDoc sourceName,
55                         Hashtable JavaDoc properties) {
56
57         this.syncManagerImpl = new SyncManagerImpl(dataStoreName, sourceType, sourceName);
58
59         this.syncManagerImpl.setLogin ((String JavaDoc) properties.get(KEY_LOGIN ) );
60         this.syncManagerImpl.setServerUrl ((String JavaDoc) properties.get(KEY_SERVER_URL ) );
61         this.syncManagerImpl.setGatewayApn ((String JavaDoc) properties.get(KEY_GATEWAYAPN ) );
62         this.syncManagerImpl.setGatewayIp ((String JavaDoc) properties.get(KEY_GATEWAYIP ) );
63         this.syncManagerImpl.setGatewayPort ((String JavaDoc) properties.get(KEY_GATEWAYPORT ) );
64
65     }
66
67     //----------------------------------------------------------- Public methods
68
/**
69      * Synchronize data.
70      * @throws SyncException if an error occurs during synchronization
71      * @throws AuthenticationException if the server responded with "non authorized" return code
72      */

73     public void sync() throws SyncException, AuthenticationException, UpdateException {
74
75         this.syncManagerImpl.sync();
76
77     }
78
79 }
Popular Tags