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                 //clientConfig stores the client cap
00058         DeviceConfig clientConfig;
00059                 //serverConfig stores the server cap
00060                 DeviceConfig serverConfig;
00061         SyncSourceConfig* sourceConfigs;
00062 
00063         unsigned int sourceConfigsCount;
00064 
00065         virtual bool addSyncSourceConfig(SyncSourceConfig& sc);
00066 
00067     public:
00068 
00069         SyncManagerConfig();
00070         virtual ~SyncManagerConfig();
00071 
00072         // implementation of AbstractSyncConfig (required because of different return type)
00073         virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(const char* name) const {
00074             return getSyncSourceConfig(name);
00075         }
00076 
00077         virtual AbstractSyncSourceConfig* getAbstractSyncSourceConfig(unsigned int i) const {
00078             return getSyncSourceConfig(i);
00079         }
00080 
00081         virtual unsigned int getAbstractSyncSourceConfigsCount() const {
00082             return getSyncSourceConfigsCount();
00083         }
00084 
00085         // additional calls which return the more specific classes used by SyncManagerConfig
00086         virtual unsigned int getSyncSourceConfigsCount() const { return sourceConfigsCount; }
00087         virtual SyncSourceConfig* getSyncSourceConfigs() const { return sourceConfigs; }
00088         virtual SyncSourceConfig* getSyncSourceConfig(const char*  name, bool refresh = false) const;
00089         virtual SyncSourceConfig* getSyncSourceConfig(unsigned int i,    bool refresh = false) const;
00090         virtual bool setSyncSourceConfig(SyncSourceConfig& sc);
00091 
00092         virtual const AccessConfig& getAccessConfig() const { return accessConfig; }
00093         virtual AccessConfig& getAccessConfig() { return accessConfig; }
00094         virtual void setAccessConfig(AccessConfig& ac) { accessConfig.assign(ac); }
00095 
00096 
00097                 //deprecated to remove use getClientConfig
00098         virtual const DeviceConfig& getDeviceConfig() const { return clientConfig; }
00099         virtual DeviceConfig& getDeviceConfig() { return clientConfig; }
00100         virtual void setDeviceConfig(DeviceConfig& dc) { clientConfig.assign(dc); }
00101 
00107                 virtual const DeviceConfig& getClientConfig() const { return clientConfig; }
00108         virtual DeviceConfig& getClientConfig() { return clientConfig; }
00109         virtual void setClientConfig(DeviceConfig& dc) { clientConfig.assign(dc); }
00110 
00111                 /*
00112                  * get the serverConfig that stores the server configurations
00113                  * currently it's up to the clients to fill this object with the right data
00114                  * as soon as the server capabilities will be implemented will be in charge
00115                  * to the api
00116                  *
00117                  * @return DeviceConfig& ref to the clientConfig object
00118                  */
00119                 virtual const DeviceConfig& getServerConfig() const {return serverConfig;}
00120         virtual DeviceConfig& getServerConfig() { return serverConfig; }
00121         virtual void setServerConfig(DeviceConfig& dc) { serverConfig.assign(dc); }
00122 
00123         /* Is this call obsolete? The DeviceConfig does not have a getDirty() calls. */
00124         unsigned int isDirty() const { return accessConfig.getDirty() /* || deviceConfig.getDirty() */; }
00125 
00129         void setClientDefaults();
00130 
00134         void setSourceDefaults(const char* name);
00135 
00136         // glue code which implements AbstractSyncConfig via the
00137         // AccessConfig and DeviceConfig instances
00138         virtual const char*  getUsername() const { return getAccessConfig().getUsername(); }
00139         virtual const char*  getPassword() const { return getAccessConfig().getPassword(); }
00140         virtual bool getUseProxy() const { return getAccessConfig().getUseProxy(); }
00141         virtual const char*  getProxyHost() const { return getAccessConfig().getProxyHost(); }
00142         virtual int getProxyPort() const { return getAccessConfig().getProxyPort(); }
00143         virtual const char* getProxyUsername() const { return getAccessConfig().getProxyUsername(); }
00144         virtual const char* getProxyPassword() const { return getAccessConfig().getProxyPassword(); }
00145         virtual const char*  getSyncURL() const { return getAccessConfig().getSyncURL(); }
00146         virtual void setBeginSync(unsigned long timestamp) { getAccessConfig().setBeginSync(timestamp); }
00147         virtual void setEndSync(unsigned long timestamp) { getAccessConfig().setEndSync(timestamp); }
00148         virtual bool getServerAuthRequired() const { return getAccessConfig().getServerAuthRequired(); }
00149         virtual const char*  getClientAuthType() const { return getAccessConfig().getClientAuthType(); }
00150         virtual const char*  getServerAuthType() const { return getAccessConfig().getServerAuthType(); }
00151         virtual const char*  getServerPWD() const { return getAccessConfig().getServerPWD(); }
00152         virtual const char*  getServerID() const { return getAccessConfig().getServerID(); }
00153         virtual const char*  getServerNonce() const { return getAccessConfig().getServerNonce(); }
00154         virtual void setServerNonce(const char*  v) { getAccessConfig().setServerNonce(v); }
00155         virtual const char*  getClientNonce() const { return getAccessConfig().getClientNonce(); }
00156         virtual void setClientNonce(const char*  v) { getAccessConfig().setClientNonce(v); }
00157         virtual unsigned long getMaxMsgSize() const { return getAccessConfig().getMaxMsgSize(); }
00158         virtual unsigned long getReadBufferSize() const { return getAccessConfig().getReadBufferSize(); }
00159         virtual const char*  getUserAgent() const { return getAccessConfig().getUserAgent(); }
00160         virtual bool  getCompression() const { return getAccessConfig().getCompression(); }
00161         virtual unsigned int getResponseTimeout() const { return getAccessConfig().getResponseTimeout(); }
00162 
00163         virtual const char*  getMan() const { return getClientConfig().getMan(); }
00164         virtual const char*  getMod() const { return getClientConfig().getMod(); }
00165         virtual const char*  getOem() const { return getClientConfig().getOem(); }
00166         virtual const char*  getFwv() const { return getClientConfig().getFwv(); }
00167         virtual const char*  getSwv() const { return getClientConfig().getSwv(); }
00168         virtual const char*  getHwv() const { return getClientConfig().getHwv(); }
00169         virtual const char*  getDevID() const { return getClientConfig().getDevID(); }
00170         virtual const char*  getDevType() const { return getClientConfig().getDevType(); }
00171         virtual const char*  getDsV() const { return getClientConfig().getDsV(); }
00172         virtual bool getUtc() const { return getClientConfig().getUtc(); }
00173         virtual bool getLoSupport() const { return getClientConfig().getLoSupport(); }
00174         virtual bool getNocSupport() const { return getClientConfig().getNocSupport(); }
00175         virtual unsigned int getMaxObjSize() const { return getClientConfig().getMaxObjSize(); }
00176         virtual const char*  getDevInfHash() const { return getClientConfig().getDevInfHash(); }
00177         virtual void setDevInfHash(const char *hash) { getClientConfig().setDevInfHash(hash); }
00178 };
00179 
00180 
00181 END_NAMESPACE
00182 
00185 #endif

Generated on Wed Jan 14 17:15:36 2009 for Funambol C++ Client Library by  doxygen 1.5.2