|
|||||||||
| Home >> All >> com >> opencms >> [ file overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.opencms.file
Class CmsSynchronize

java.lang.Objectcom.opencms.file.CmsSynchronize
- All Implemented Interfaces:
- com.opencms.core.I_CmsConstants
- public class CmsSynchronize
- extends java.lang.Object
- implements com.opencms.core.I_CmsConstants
- extends java.lang.Object
Holds the functionality to synchronize resources from the filesystem into the cms and back.
- Version:
- $Revision: 1.16 $ $Date: 2003/04/01 15:20:18 $
| Field Summary | |
(package private) static int |
C_SYNC_NONE
flag to synchronize no filesystem, |
(package private) static int |
C_SYNC_SFS
flag to synchronize the server filesystem |
(package private) static int |
C_SYNC_SFSNEW
flag to synchronize the server filesystem, rename the old file and copy the new file from VFS |
(package private) static int |
C_SYNC_VFS
flag to synchronize the virtual filesystem |
private CmsObject |
m_cms
the CmsObject |
private CmsSynchronizeList |
m_synchronizeList
the CmsSynchronizeList |
private java.lang.String |
m_synchronizePath
the path in the server filesystem where the resource has to be synchronized |
private java.util.Hashtable |
m_vfsFiles
|
private java.util.Hashtable |
m_vfsFolders
Hashtables for folders and files of the resource in the virtual filesystem is needed to compare with folders and files in server filesystem |
| Constructor Summary | |
CmsSynchronize(CmsObject cms,
java.lang.String resourceName)
This constructs a new CmsImport-object which imports the resources. |
|
| Method Summary | |
private int |
compareDate(java.lang.String resourceName,
long vfsDate,
long sfsDate)
Compares the date of the resource in the virtual and the server filesystem with the date in the synchronize list |
private boolean |
copyServerFile(java.io.File fromFile,
java.io.File toFile)
this copies a file on the server filesystem |
private void |
createNewLocalFile(java.io.File newFile)
Creates the new file on the SFS |
private boolean |
deleteDirectory(java.io.File delFolder)
Deletes the folder and all subresources from SFS The folder has to be empty before it can be deleted |
private byte[] |
getFileBytes(java.io.File file)
Returns a byte array containing the content of the file. |
private java.lang.String |
getFileType(java.lang.String filename)
Gets the file type for the filename. |
private void |
synchronizeFile(CmsFile vfsFile)
Synchronizes a file in the virtual or the server filesystem. |
private void |
synchronizeServer(java.lang.String resourceName)
starts the synchronisation of the given resource |
private void |
synchronizeVirtual(java.lang.String resourceName)
Read all resources from the server filesystem and compare it with the virtual filesystem. |
private void |
writeFileByte(byte[] content,
java.io.File file)
This writes the byte content of a resource to the file on the server filesystem |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
C_SYNC_NONE
static final int C_SYNC_NONE
- flag to synchronize no filesystem,
- See Also:
- Constant Field Values
C_SYNC_SFS
static final int C_SYNC_SFS
- flag to synchronize the server filesystem
- See Also:
- Constant Field Values
C_SYNC_VFS
static final int C_SYNC_VFS
- flag to synchronize the virtual filesystem
- See Also:
- Constant Field Values
C_SYNC_SFSNEW
static final int C_SYNC_SFSNEW
- flag to synchronize the server filesystem,
rename the old file and copy the new file from VFS
- See Also:
- Constant Field Values
m_synchronizePath
private java.lang.String m_synchronizePath
- the path in the server filesystem where the resource has to be synchronized
m_cms
private CmsObject m_cms
- the CmsObject
m_synchronizeList
private CmsSynchronizeList m_synchronizeList
- the CmsSynchronizeList
m_vfsFolders
private java.util.Hashtable m_vfsFolders
- Hashtables for folders and files of the resource in the virtual filesystem
is needed to compare with folders and files in server filesystem
m_vfsFiles
private java.util.Hashtable m_vfsFiles
| Constructor Detail |
CmsSynchronize
public CmsSynchronize(CmsObject cms, java.lang.String resourceName) throws com.opencms.core.CmsException
- This constructs a new CmsImport-object which imports the resources.
| Method Detail |
synchronizeServer
private void synchronizeServer(java.lang.String resourceName) throws com.opencms.core.CmsException
- starts the synchronisation of the given resource
synchronizeVirtual
private void synchronizeVirtual(java.lang.String resourceName) throws com.opencms.core.CmsException
- Read all resources from the server filesystem and compare it with the
virtual filesystem. Add folders and files that does not exist in VFS
synchronizeFile
private void synchronizeFile(CmsFile vfsFile) throws com.opencms.core.CmsException
- Synchronizes a file in the virtual or the server filesystem.
compareDate
private int compareDate(java.lang.String resourceName, long vfsDate, long sfsDate) throws com.opencms.core.CmsException
- Compares the date of the resource in the virtual and the server filesystem
with the date in the synchronize list
createNewLocalFile
private void createNewLocalFile(java.io.File newFile) throws com.opencms.core.CmsException
- Creates the new file on the SFS
copyServerFile
private boolean copyServerFile(java.io.File fromFile, java.io.File toFile)
- this copies a file on the server filesystem
deleteDirectory
private boolean deleteDirectory(java.io.File delFolder)
- Deletes the folder and all subresources from SFS
The folder has to be empty before it can be deleted
getFileBytes
private byte[] getFileBytes(java.io.File file) throws java.lang.Exception
- Returns a byte array containing the content of the file.
getFileType
private java.lang.String getFileType(java.lang.String filename) throws com.opencms.core.CmsException
- Gets the file type for the filename.
writeFileByte
private void writeFileByte(byte[] content,
java.io.File file)
throws java.lang.Exception
- This writes the byte content of a resource to the file on the server filesystem
|
|||||||||
| Home >> All >> com >> opencms >> [ file overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.opencms.file.CmsSynchronize