src/include/common/client/SyncClient.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef INCL_SYNCCLIENT
00020     #define INCL_SYNCCLIENT
00021 
00025     #include "base/fscapi.h"
00026     #include "base/Log.h"
00027     #include "spds/SyncManagerConfig.h"
00028     #include "spds/SyncSource.h"
00029     #include "spds/constants.h"
00030     #include "spds/SyncReport.h"
00031 
00044     class SyncClient {
00045       public:
00046 
00047         SyncClient();
00048         virtual ~SyncClient();
00049 
00050         /*
00051          * Execute a synchronization on the specified sources.
00052          * The sources will be configured automatically using the
00053          * client configuration set in the constructor.
00054          *
00055          * @param config  - the configuration to be used for this sync
00056          * @param sources - NULL terminated array of sources to sync.
00057          *
00058          * @return - 0 on success, an error otherwise
00059          */
00060         virtual int sync(SyncManagerConfig& config, SyncSource** sources);
00061 
00085         virtual int sync(SyncManagerConfig& config, char** sourceNames = NULL);
00086 
00087         /*
00088          * Returns a pointer to the internal syncReport.
00089          * Used to get detailed results on the executed synchronization.
00090          * Must be called after sync() method.
00091          */
00092         SyncReport* getSyncReport();
00093 
00094 
00095       protected:
00106         virtual int prepareSync(SyncManagerConfig& config) {
00107             return ERR_NONE;
00108         }
00109 
00131         virtual int createSyncSource(const char *name, const int pos,
00132                                      SyncSourceConfig* config,
00133                                      SyncSource **source) {
00134             *source = NULL;
00135             return ERR_UNSPECIFIED;
00136         }
00137 
00143         virtual int beginSync(SyncSource **source) {
00144             return ERR_NONE;
00145         }
00146 
00151         virtual int endSync(SyncSource **source) {
00152             return ERR_NONE;
00153         }
00154 
00160         virtual int continueAfterPrepareSync() {
00161             return ERR_NONE;
00162         }
00163 
00168         virtual int continueAfterSync() {
00169             return ERR_NONE;
00170         }
00171         
00172         // The report of the synchronization process.
00173         // Sources reports are initializated during sync(sources**) call.
00174         SyncReport syncReport;
00175     };
00176 
00179 #endif
00180 

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2