src/include/common/spds/SyncManagerConfig.h

00001 /*
00002  * Funambol is a mobile platform developed by Funambol, Inc. 
00003  * Copyright (C) 2003 - 2007 Funambol, Inc.
00004  * 
00005  * This program is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Affero General Public License version 3 as published by
00007  * the Free Software Foundation with the addition of the following permission 
00008  * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
00009  * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 
00010  * WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  * 
00017  * You should have received a copy of the GNU Affero General Public License 
00018  * along with this program; if not, see http://www.gnu.org/licenses or write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00020  * MA 02110-1301 USA.
00021  * 
00022  * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 
00023  * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
00024  * 
00025  * The interactive user interfaces in modified source and object code versions
00026  * of this program must display Appropriate Legal Notices, as required under
00027  * Section 5 of the GNU Affero General Public License version 3.
00028  * 
00029  * In accordance with Section 7(b) of the GNU Affero General Public License
00030  * version 3, these Appropriate Legal Notices must retain the display of the
00031  * "Powered by Funambol" logo. If the display of the logo is not reasonably 
00032  * feasible for technical reasons, the Appropriate Legal Notices must display
00033  * the words "Powered by Funambol".
00034  */
00035 #ifndef INCL_SYNC_CONFIG
00036 #define INCL_SYNC_CONFIG
00037 
00041 #include "spds/AbstractSyncConfig.h"
00042 #include "spds/AccessConfig.h"
00043 #include "spds/DeviceConfig.h"
00044 #include "spds/SyncSourceConfig.h"
00045 #include "base/globalsdef.h"
00046 
00047 BEGIN_NAMESPACE
00048 
00053 class SyncManagerConfig : public AbstractSyncConfig {
00054     protected:
00055 
00056         AccessConfig accessConfig;
00057         DeviceConfig deviceConfig;
00058         SyncSourceConfig* sourceConfigs;
00059 
00060         unsigned int sourceConfigsCount;
00061 
00062         virtual bool addSyncSourceConfig(SyncSourceConfig& sc);
00063 
00064     public:
00065 
00066         SyncManagerConfig();
00067         virtual ~SyncManagerConfig();
00068 
00069         // implementation of AbstractSyncConfig (required because of different return type)
00070         virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(const char* name) const {
00071             return getSyncSourceConfig(name);
00072         }
00073 
00074         virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(unsigned int i) const {
00075             return getSyncSourceConfig(i);
00076         }
00077 
00078         virtual unsigned int getAbstractSyncSourceConfigsCount() const {
00079             return getSyncSourceConfigsCount();
00080         }
00081 
00082         // additional calls which return the more specific classes used by SyncManagerConfig
00083         virtual unsigned int getSyncSourceConfigsCount() const { return sourceConfigsCount; }
00084         virtual SyncSourceConfig* getSyncSourceConfigs() const { return sourceConfigs; }
00085         virtual SyncSourceConfig* getSyncSourceConfig(const char*  name, bool refresh = false) const;
00086         virtual SyncSourceConfig* getSyncSourceConfig(unsigned int i,    bool refresh = false) const;
00087         virtual bool setSyncSourceConfig(SyncSourceConfig& sc);
00088 
00089         virtual const AccessConfig& getAccessConfig() const { return accessConfig; }
00090         virtual AccessConfig& getAccessConfig() { return accessConfig; }
00091         virtual void setAccessConfig(AccessConfig& ac) { accessConfig.assign(ac); }
00092 
00093         virtual const DeviceConfig& getDeviceConfig() const { return deviceConfig; }
00094         virtual DeviceConfig& getDeviceConfig() { return deviceConfig; }
00095         virtual void setDeviceConfig(DeviceConfig& dc) { deviceConfig.assign(dc); }
00096 
00097         /* Is this call obsolete? The DeviceConfig does not have a getDirty() calls. */
00098         unsigned int isDirty() const { return accessConfig.getDirty() /* || deviceConfig.getDirty() */; }
00099 
00103         void setClientDefaults();
00104 
00108         void setSourceDefaults(const char* name);
00109 
00110         // glue code which implements AbstractSyncConfig via the
00111         // AccessConfig and DeviceConfig instances
00112         virtual const char*  getUsername() const { return getAccessConfig().getUsername(); }
00113         virtual const char*  getPassword() const { return getAccessConfig().getPassword(); }
00114         virtual bool getUseProxy() const { return getAccessConfig().getUseProxy(); }
00115         virtual const char*  getProxyHost() const { return getAccessConfig().getProxyHost(); }
00116         virtual int getProxyPort() const { return getAccessConfig().getProxyPort(); }
00117         virtual const char* getProxyUsername() const { return getAccessConfig().getProxyUsername(); }
00118         virtual const char* getProxyPassword() const { return getAccessConfig().getProxyPassword(); }
00119         virtual const char*  getSyncURL() const { return getAccessConfig().getSyncURL(); }
00120         virtual void setBeginSync(unsigned long timestamp) { getAccessConfig().setBeginSync(timestamp); }
00121         virtual void setEndSync(unsigned long timestamp) { getAccessConfig().setEndSync(timestamp); }
00122         virtual bool getServerAuthRequired() const { return getAccessConfig().getServerAuthRequired(); }
00123         virtual const char*  getClientAuthType() const { return getAccessConfig().getClientAuthType(); }
00124         virtual const char*  getServerAuthType() const { return getAccessConfig().getServerAuthType(); }
00125         virtual const char*  getServerPWD() const { return getAccessConfig().getServerPWD(); }
00126         virtual const char*  getServerID() const { return getAccessConfig().getServerID(); }
00127         virtual const char*  getServerNonce() const { return getAccessConfig().getServerNonce(); }
00128         virtual void setServerNonce(const char*  v) { getAccessConfig().setServerNonce(v); }
00129         virtual const char*  getClientNonce() const { return getAccessConfig().getClientNonce(); }
00130         virtual void setClientNonce(const char*  v) { getAccessConfig().setClientNonce(v); }
00131         virtual unsigned long getMaxMsgSize() const { return getAccessConfig().getMaxMsgSize(); }
00132         virtual unsigned long getReadBufferSize() const { return getAccessConfig().getReadBufferSize(); }
00133         virtual const char*  getUserAgent() const { return getAccessConfig().getUserAgent(); }
00134         virtual bool  getCompression() const { return getAccessConfig().getCompression(); }
00135         virtual unsigned int getResponseTimeout() const { return getAccessConfig().getResponseTimeout(); }
00136 
00137         virtual const char*  getMan() const { return getDeviceConfig().getMan(); }
00138         virtual const char*  getMod() const { return getDeviceConfig().getMod(); }
00139         virtual const char*  getOem() const { return getDeviceConfig().getOem(); }
00140         virtual const char*  getFwv() const { return getDeviceConfig().getFwv(); }
00141         virtual const char*  getSwv() const { return getDeviceConfig().getSwv(); }
00142         virtual const char*  getHwv() const { return getDeviceConfig().getHwv(); }
00143         virtual const char*  getDevID() const { return getDeviceConfig().getDevID(); }
00144         virtual const char*  getDevType() const { return getDeviceConfig().getDevType(); }
00145         virtual const char*  getDsV() const { return getDeviceConfig().getDsV(); }
00146         virtual bool getUtc() const { return getDeviceConfig().getUtc(); }
00147         virtual bool getLoSupport() const { return getDeviceConfig().getLoSupport(); }
00148         virtual bool getNocSupport() const { return getDeviceConfig().getNocSupport(); }
00149         virtual unsigned int getMaxObjSize() const { return getDeviceConfig().getMaxObjSize(); }
00150         virtual const char*  getDevInfHash() const { return getDeviceConfig().getDevInfHash(); }
00151         virtual void setDevInfHash(const char *hash) { getDeviceConfig().setDevInfHash(hash); }
00152 };
00153 
00154 
00155 END_NAMESPACE
00156 
00159 #endif

Generated on Fri Jul 25 15:04:15 2008 for Funambol C++ Client Library by  doxygen 1.5.1