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 00036 00037 #ifndef INCL_SYNC 00038 #define INCL_SYNC 00039 /** @cond DEV */ 00040 00041 #include "base/fscapi.h" 00042 #include "base/util/ArrayList.h" 00043 #include "syncml/core/AbstractCommand.h" 00044 #include "syncml/core/Source.h" 00045 #include "syncml/core/Target.h" 00046 00047 00048 #define SYNC_COMMAND_NAME "Sync" 00049 #include "base/globalsdef.h" 00050 00051 BEGIN_NAMESPACE 00052 00053 class Sync : public AbstractCommand { 00054 00055 // ------------------------------------------------------------ Private data 00056 private: 00057 char* COMMAND_NAME; 00058 Target* target; 00059 Source* source; 00060 ArrayList* commands; 00061 long numberOfChanges; 00062 00063 public: 00064 00065 Sync(); 00066 ~Sync(); 00067 void initialize(); 00068 /** 00069 * Creates a new Sync object 00070 * 00071 * @param cmdID the command identifier - NOT NULL 00072 * @param noResp is <b>true</b> if no response is required 00073 * @param cred the authentication credential 00074 * @param target the target object 00075 * @param source the source object 00076 * @param meta the meta object 00077 * @param numberOfChanges the number of changes 00078 * @param commands an array of elements that must be of one of the 00079 * following types: {@link Add}, {@link Atomic}, 00080 * {@link Copy}, {@link Delete}, {@link Replace}, 00081 * {@link Sequence} 00082 * 00083 * 00084 */ 00085 Sync(CmdID* cmdID, 00086 bool noResp, 00087 Cred* cred, 00088 Target* target, 00089 Source* source, 00090 Meta* meta, 00091 long numberOfChanges, 00092 ArrayList* commands); 00093 00094 00095 /** 00096 * Gets the Target object property 00097 * 00098 * @return target the Target object property 00099 */ 00100 Target* getTarget(); 00101 00102 /** 00103 * Sets the Target object property 00104 * 00105 * @param target the Target object property 00106 * 00107 */ 00108 void setTarget(Target* target); 00109 00110 /** 00111 * Gets the Source object property 00112 * 00113 * @return source the Source object property 00114 */ 00115 Source* getSource(); 00116 00117 /** 00118 * Gets the Source object property 00119 * 00120 * @param source the Source object property 00121 */ 00122 void setSource(Source* source); 00123 00124 /** 00125 * 00126 * @return The return value is guaranteed to be non-null. 00127 * The array elements are guaranteed to be non-null. 00128 * 00129 */ 00130 ArrayList* getCommands(); 00131 00132 /** 00133 * Sets the sequenced commands. The given commands must be of the allowed 00134 * types. 00135 * 00136 * @param commands the commands - NOT NULL and o the allawed types 00137 * 00138 */ 00139 void setCommands(ArrayList* commands); 00140 00141 /** 00142 * Gets the total number of changes 00143 * 00144 * @return the total number of changes 00145 */ 00146 long getNumberOfChanges(); 00147 00148 00149 /** 00150 * Sets the numberOfChanges property 00151 * 00152 * @param numberOfChanges the total number of changes 00153 */ 00154 void setNumberOfChanges(long numberOfChanges) ; 00155 00156 const char* getName(); 00157 00158 ArrayElement* clone(); 00159 00160 00161 }; 00162 00163 00164 END_NAMESPACE 00165 00166 /** @endcond */ 00167 #endif