KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > synchronize > CmsSynchronizeList


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/synchronize/CmsSynchronizeList.java,v $
3  * Date : $Date: 2005/07/03 09:41:53 $
4  * Version: $Revision: 1.12 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.synchronize;
33
34 import org.opencms.util.CmsDateUtil;
35
36 import java.io.Serializable JavaDoc;
37
38 /**
39  * Defines the CmsSynchronizeList object, used to store synchronisation data
40  * required to synchronize the VFS and the server FS.<p>
41  *
42  * @author Edna Falkenhan
43  * @author Michael Emmerich
44  *
45  * @version $Revision: 1.12 $
46  *
47  * @since 6.0.0
48  */

49 public class CmsSynchronizeList implements Serializable JavaDoc {
50
51     /** Serial version UID required for safe serialization. */
52     private static final long serialVersionUID = -4460686435282590290L;
53
54     /**
55      * Last modification data of this resource in the FS.
56      */

57     private long m_modifiedFs;
58
59     /**
60      * Last modification date of this resouce in the VFS.
61      */

62     private long m_modifiedVfs;
63
64     /**
65      * Name of the resource stored in the sync list.
66      */

67     private String JavaDoc m_resName;
68
69     /**
70      * Name of the translated resource stored in the sync list.
71      * Its nescessary to translate the resource name, since the server FS does
72      * allow different
73      * naming conventions than the VFS.
74      */

75     private String JavaDoc m_transResName;
76
77     /**
78      * Constructor, creates a new CmsSynchronizeList object.
79      *
80      * @param resName The name of the resource
81      * @param transResName The name of the resource
82      * @param modifiedVfs last modification date in the Vfs
83      * @param modifiedFs last modification date in the Fs
84      */

85     public CmsSynchronizeList(String JavaDoc resName, String JavaDoc transResName, long modifiedVfs, long modifiedFs) {
86
87         m_resName = resName;
88         m_transResName = transResName;
89         m_modifiedVfs = modifiedVfs;
90         m_modifiedFs = modifiedFs;
91     }
92
93     /**
94      * Returns a format description of the sync-list file on the server FS.<p>
95      *
96      * @return format description
97      */

98     public static String JavaDoc getFormatDescription() {
99
100         String JavaDoc output = "[original filename FS]:[translated filename VFS]";
101         output += ":[timestamp VFS]:[timestamp FS]";
102         output += ":[VFS=readable timestamp VFS]:[FS=readable timestamp FS]";
103         return output;
104     }
105
106     /**
107      * Returns the last modification date in the Fs.
108      * @return last modification date in the Fs
109      */

110     public long getModifiedFs() {
111
112         return m_modifiedFs;
113     }
114
115     /**
116      * Returns the last modification date in the Vfs.
117      * @return last modification date in the Vfs
118      */

119     public long getModifiedVfs() {
120
121         return m_modifiedVfs;
122     }
123
124     /**
125      * Returns the name of the resource.
126      * @return name of the resource
127      */

128     public String JavaDoc getResName() {
129
130         return m_resName;
131     }
132
133     /**
134      * Returns the translated name of the resource.
135      * @return name of the resource
136      */

137     public String JavaDoc getTransResName() {
138
139         return m_transResName;
140     }
141
142     /**
143      * Returns a string-representation for this object. <p>
144      *
145      * This is used to create the sync list entries in the server FS
146      *
147      * @return string-representation for this object.
148      */

149     public String JavaDoc toString() {
150
151         String JavaDoc output = m_resName + ":" + m_transResName + ":" + m_modifiedVfs + ":" + m_modifiedFs;
152         output += ":VFS=" + CmsDateUtil.getDateTimeShort(m_modifiedVfs);
153         output += ":FS=" + CmsDateUtil.getDateTimeShort(m_modifiedFs);
154         return output;
155     }
156
157 }
158
Popular Tags