org.jmonks.dms.versioncontrol.ri
Class DefaultDirectoryEntry

java.lang.Object
  extended byorg.jmonks.dms.versioncontrol.ri.DefaultRepositoryEntry
      extended byorg.jmonks.dms.versioncontrol.ri.DefaultDirectoryEntry
All Implemented Interfaces:
java.lang.Comparable, DirectoryEntry, RepositoryEntry
Direct Known Subclasses:
DefaultRepository

public class DefaultDirectoryEntry
extends DefaultRepositoryEntry
implements DirectoryEntry

This represents Directory entry in repository. It lets the users to create directory entries and file entries. This expects entry details in "entryID.vc" configuration file. Following is the format in the file.

 124.vc:

 entry.id=1133921622742
 entry.name=stu
 entry.type=0

 


Field Summary
protected  java.lang.String absoluteDirectoryName
           
private static org.apache.log4j.Logger logger
           
 
Fields inherited from class org.jmonks.dms.versioncontrol.ri.DefaultRepositoryEntry
absoluteConfigFilePath, deletedDate, ENTRY_DELETE_KEY_NAME, ENTRY_DELETED_DATE_KEY_NAME, ENTRY_ID_KEY_NAME, ENTRY_NAME_KEY_NAME, ENTRY_PARENT_ENTRY_ID_KEY_NAME, ENTRY_TYPE_DIRECTORY, ENTRY_TYPE_FILE, ENTRY_TYPE_KEY_NAME, entryID, entryName, isDeleted, parentEntryID
 
Constructor Summary
protected DefaultDirectoryEntry()
          Default constructor to support the creation on singleton Default Repository object.
protected DefaultDirectoryEntry(java.io.File configFile, java.util.ResourceBundle configBundle)
          Create the instance of DirectoryEntry from configuration file to load existing directory entry in repository.
protected DefaultDirectoryEntry(java.lang.Object parent, java.lang.String directoryName, java.lang.String parentName)
          Create the instance of DirectoryEntry to create new Directory Entry in repository.
 
Method Summary
 DirectoryEntry createDirectoryEntry(java.lang.String directoryName)
          Let users create a directory entry in the system.
 FileEntry createFileEntry(java.lang.String fileName, java.lang.String authorName, java.lang.String description, java.util.Date versionDate, java.io.InputStream inputStream)
          Let users create a file entry in the system.
(package private)  java.lang.String getAbosluteConfigFileName()
           
(package private)  java.lang.String getAbsoluteDirectoryEntryName()
           
 java.util.List getAllEntries()
          Gets all repository entries available under this entry.
 boolean isExistingEntry(java.lang.String entryName, java.lang.String entryType)
          To find out the is the entry already exist in repository.
(package private)  boolean moveEntry(DefaultRepositoryEntry sourceEntry)
          This moves the entry specified in sourceEntry onto itself.
 boolean remove()
          This process actually permanently delete the entry from repository.
 java.lang.String toString()
           
 
Methods inherited from class org.jmonks.dms.versioncontrol.ri.DefaultRepositoryEntry
cancelDelete, compareTo, delete, getDeletedDate, getEntryID, getEntryName, getEntryType, getParentEntryID, getParentRepositoryEntry, getRepositoryEntry, isDeleted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jmonks.dms.versioncontrol.api.RepositoryEntry
cancelDelete, delete, getDeletedDate, getEntryID, getEntryName, getEntryType, getParentEntryID, getParentRepositoryEntry, isDeleted
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

absoluteDirectoryName

protected java.lang.String absoluteDirectoryName
Constructor Detail

DefaultDirectoryEntry

protected DefaultDirectoryEntry()
Default constructor to support the creation on singleton Default Repository object.


DefaultDirectoryEntry

protected DefaultDirectoryEntry(java.io.File configFile,
                                java.util.ResourceBundle configBundle)
Create the instance of DirectoryEntry from configuration file to load existing directory entry in repository.

Parameters:
configFile - File to find out the absolute paths.
configBundle - Resource bundle to read the properties in configuration file.

DefaultDirectoryEntry

protected DefaultDirectoryEntry(java.lang.Object parent,
                                java.lang.String directoryName,
                                java.lang.String parentName)
Create the instance of DirectoryEntry to create new Directory Entry in repository.

Parameters:
directoryName - name of the entry needs to be created.
parentName - Location where the directory needs to be created.
Method Detail

getAllEntries

public java.util.List getAllEntries()
Description copied from interface: DirectoryEntry
Gets all repository entries available under this entry.

Specified by:
getAllEntries in interface DirectoryEntry
Returns:
Returns the list of RepositoryEntry objects. If not exists, it returns the list of size 0.
See Also:
DirectoryEntry.getAllEntries()

createFileEntry

public FileEntry createFileEntry(java.lang.String fileName,
                                 java.lang.String authorName,
                                 java.lang.String description,
                                 java.util.Date versionDate,
                                 java.io.InputStream inputStream)
Description copied from interface: DirectoryEntry
Let users create a file entry in the system.

Specified by:
createFileEntry in interface DirectoryEntry
Parameters:
fileName - Entry name with which the file entry needs to be created.
authorName - Authro name to be stored with meta info of the first version of the file.
description - Description to be stored with meta info of the first version of the file.
versionDate - Version Date to be stored with meta info of the first version of the file.
inputStream - InputStream of the information to be checked-in as the first version of the file.
Returns:
Returns newly created File Entry.
See Also:
org.jmonks.dms.versioncontrol.api.DirectoryEntry#createFileEntry()

createDirectoryEntry

public DirectoryEntry createDirectoryEntry(java.lang.String directoryName)
Description copied from interface: DirectoryEntry
Let users create a directory entry in the system.

Specified by:
createDirectoryEntry in interface DirectoryEntry
Parameters:
directoryName - Name with which the directory entry needs to be created.
Returns:
Returns newly created Directory Entry.
See Also:
org.jmonks.dms.versioncontrol.api.DirectoryEntry#createDirectoryEntry()

isExistingEntry

public boolean isExistingEntry(java.lang.String entryName,
                               java.lang.String entryType)
To find out the is the entry already exist in repository. Though operating system doesnt allow us to create file and folder with the same name, since we are creating file entries along with the version name, there wont be any conflicts.

Specified by:
isExistingEntry in interface DirectoryEntry
Parameters:
entryName - Entry name to create.
entryType - Type of the entry to find out.
Returns:
Returns true if the entry exists, false otherwise.

getAbsoluteDirectoryEntryName

java.lang.String getAbsoluteDirectoryEntryName()

getAbosluteConfigFileName

java.lang.String getAbosluteConfigFileName()

remove

public boolean remove()
Description copied from interface: RepositoryEntry
This process actually permanently delete the entry from repository. After this operation entry will not be available in the repository.

Specified by:
remove in interface RepositoryEntry
Returns:
Returns true if entry got deleted permanently, false otherwise.
See Also:
RepositoryEntry.remove()

toString

public java.lang.String toString()
Overrides:
toString in class DefaultRepositoryEntry
See Also:
Object.toString()

moveEntry

boolean moveEntry(DefaultRepositoryEntry sourceEntry)
This moves the entry specified in sourceEntry onto itself.