KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > spds > engine > SyncItem


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.engine;
20
21 import java.util.Hashtable JavaDoc;
22
23
24 /**
25  * <i>SyncItem</i> is the indivisible entity that can be exchanged in a
26  * synchronization process. It is similar to a <i>sync4j.framework.core.Item</i>,
27  * but this one is more generic, not related to any protocol.<br>
28  * A <i>SyncItem</i> is uniquely identified by its <i>SyncItemKey</i>, whilst
29  * item data is stored in properties, which can be retrieved calling
30  * <i>getProperty()</i>, <i>getProperties()</i> and <i>getPropertyValue()</i>.
31  * Properties can be set by calling <i>setProperties()</i>, <i>setProperty()</i>
32  * and <i>setPropertyValue()</i>.<br>
33  * A <i>SyncItem</i> is also associated with a state, which can be one of the
34  * values defined in <i>SyncItemState</i>.
35  * <p>
36  * The following properties are standard properties:
37  * <table>
38  * <tr>
39  * <td>BINARY_CONTENT</td><td>A row bynary representation of the item content</td>
40  * </tr>
41  * <tr>
42  * </td>TIMSTAMP</td><td>The creation/modification/deletion timestamp for the item</td>
43  * </tr>
44  * </table>
45  *
46  * @author Fabio Maggi
47  *
48  * @version $Id: SyncItem.java,v 1.2 2005/01/19 11:18:36 fabius Exp $
49  *
50  */

51 public interface SyncItem {
52
53     // --------------------------------------------------------------- Constants
54

55     public static final String JavaDoc PROPERTY_BINARY_CONTENT = "BINARY_CONTENT";
56     public static final String JavaDoc PROPERTY_TIMESTAMP = "TIMESTAMP" ;
57
58     // -------------------------------------------------------------------------
59

60     /**
61      * @return the SyncItem's uique identifier
62      */

63     public SyncItemKey getKey();
64
65     public char getState();
66
67     public void setState(char state);
68
69     /**
70      * Returns the <i>properties</i> property. A cloned copy of the internal map
71      * is returned.
72      *
73      * @return the <i>properties</i> property.
74      */

75     public Hashtable JavaDoc getProperties();
76
77     /**
78      * Sets the <i>properties</i> property. All items in the given map are added
79      * to the internal map.
80      *
81      * @param properties the new values
82      */

83     public void setProperties(Hashtable JavaDoc properties);
84
85     /** Sets/adds the given property to this <i>SyncItem</i>
86      *
87      * @param property The property to set/add
88      */

89     public void setProperty(SyncItemProperty property);
90
91     /** Returns the property with the given name
92      *
93      * @param propertyName The property name
94      *
95      * @return the property with the given name if exists or null if not
96      */

97     public SyncItemProperty getProperty(String JavaDoc propertyName);
98
99
100     /** Sets the value of the property with the given name.
101      *
102      * @param propertyName The property's name
103      * @param propertyValue The new value
104      */

105     public void setPropertyValue(String JavaDoc propertyName, String JavaDoc propertyValue);
106
107     /** Returns the value of the property with the given name.
108      *
109      * @param propertyName The property's name
110      *
111      * @return the property value if this <i>SyncItem</i> has the given
112      * property or null otherwise.
113      */

114     public Object JavaDoc getPropertyValue(String JavaDoc propertyName);
115
116     /** Getter for property syncSource.
117      * @return Value of property syncSource.
118      *
119      */

120     public SyncSource getSyncSource();
121
122 }
Popular Tags