org.jmonks.dms.versioncontrol.ri
Class DefaultRepositoryEntry

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

public abstract class DefaultRepositoryEntry
extends java.lang.Object
implements java.lang.Comparable, RepositoryEntry

Author:
Suresh Pragada This represents the any entry in Repository. This supports the factory method to create repository entries from configuration files.

Field Summary
protected  java.lang.String absoluteConfigFilePath
          Holds the absolute path of configuration file.
protected  java.util.Date deletedDate
           
static java.lang.String ENTRY_DELETE_KEY_NAME
           
static java.lang.String ENTRY_DELETED_DATE_KEY_NAME
           
static java.lang.String ENTRY_ID_KEY_NAME
           
static java.lang.String ENTRY_NAME_KEY_NAME
           
static java.lang.String ENTRY_PARENT_ENTRY_ID_KEY_NAME
           
static java.lang.String ENTRY_TYPE_DIRECTORY
           
static java.lang.String ENTRY_TYPE_FILE
           
static java.lang.String ENTRY_TYPE_KEY_NAME
           
protected  long entryID
           
protected  java.lang.String entryName
           
protected  boolean isDeleted
           
private static org.apache.log4j.Logger logger
           
protected  long parentEntryID
           
 
Constructor Summary
protected DefaultRepositoryEntry()
          Restrict the instantiaon of Repository Entry.
 
Method Summary
 boolean cancelDelete()
          This actually takes off the delete mark on the entry.
 int compareTo(java.lang.Object object)
           
 boolean delete()
          This marks the entry for delete.
 java.util.Date getDeletedDate()
          Gets the deleted date of this entry.
 long getEntryID()
          This returns the unique ID of the entry.
 java.lang.String getEntryName()
          This returns name of the entry.
 int getEntryType()
          Returns the entry type.
 long getParentEntryID()
          Returns the parent entry ID.
 RepositoryEntry getParentRepositoryEntry()
          Gets the parent repository entry.
static DefaultRepositoryEntry getRepositoryEntry(java.io.File configFile)
          This method will act as a factory method to create the instances of RepositoryEntries based on the configuration file.
 boolean isDeleted()
          Returns the deleted status of the entry.
 java.lang.String toString()
           
private  boolean updateConfigFileForDelete(boolean delete)
           
 
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
remove
 

Field Detail

entryID

protected long entryID

entryName

protected java.lang.String entryName

parentEntryID

protected long parentEntryID

isDeleted

protected boolean isDeleted

deletedDate

protected java.util.Date deletedDate

absoluteConfigFilePath

protected java.lang.String absoluteConfigFilePath
Holds the absolute path of configuration file. absoluteConfigFilePath="c:\repository\xyz\124.vc"


ENTRY_TYPE_KEY_NAME

public static final java.lang.String ENTRY_TYPE_KEY_NAME
See Also:
Constant Field Values

ENTRY_ID_KEY_NAME

public static final java.lang.String ENTRY_ID_KEY_NAME
See Also:
Constant Field Values

ENTRY_NAME_KEY_NAME

public static final java.lang.String ENTRY_NAME_KEY_NAME
See Also:
Constant Field Values

ENTRY_PARENT_ENTRY_ID_KEY_NAME

public static final java.lang.String ENTRY_PARENT_ENTRY_ID_KEY_NAME
See Also:
Constant Field Values

ENTRY_DELETE_KEY_NAME

public static final java.lang.String ENTRY_DELETE_KEY_NAME
See Also:
Constant Field Values

ENTRY_DELETED_DATE_KEY_NAME

public static final java.lang.String ENTRY_DELETED_DATE_KEY_NAME
See Also:
Constant Field Values

ENTRY_TYPE_FILE

public static final java.lang.String ENTRY_TYPE_FILE
See Also:
Constant Field Values

ENTRY_TYPE_DIRECTORY

public static final java.lang.String ENTRY_TYPE_DIRECTORY
See Also:
Constant Field Values

logger

private static final org.apache.log4j.Logger logger
Constructor Detail

DefaultRepositoryEntry

protected DefaultRepositoryEntry()
Restrict the instantiaon of Repository Entry.

Method Detail

getRepositoryEntry

public static DefaultRepositoryEntry getRepositoryEntry(java.io.File configFile)
This method will act as a factory method to create the instances of RepositoryEntries based on the configuration file.

Returns:
Returns the implementation classes of Repository entries from configuration file.

getParentRepositoryEntry

public RepositoryEntry getParentRepositoryEntry()
Description copied from interface: RepositoryEntry
Gets the parent repository entry.

Specified by:
getParentRepositoryEntry in interface RepositoryEntry
Returns:
Returns the parent repository entry, null if parent doesnt exist.
See Also:
org.jmonks.dms.versioncontrol.api.ReposiotryEntry#getParentRespositoryEntry()

getEntryID

public long getEntryID()
Description copied from interface: RepositoryEntry
This returns the unique ID of the entry. Every entry in repository will have a unique ID.

Specified by:
getEntryID in interface RepositoryEntry
Returns:
Returns unique ID of the entry in repository.
See Also:
RepositoryEntry.getEntryID()

getEntryName

public java.lang.String getEntryName()
Description copied from interface: RepositoryEntry
This returns name of the entry.

Specified by:
getEntryName in interface RepositoryEntry
Returns:
Returns the entry name.
See Also:
RepositoryEntry.getEntryName()

getParentEntryID

public long getParentEntryID()
Returns the parent entry ID.

Specified by:
getParentEntryID in interface RepositoryEntry
Returns:
Returns the entry ID of the parent.

getEntryType

public int getEntryType()
Returns the entry type.

Specified by:
getEntryType in interface RepositoryEntry
Returns:
Returns the "1" if the entry type is file, "0" it entry type is directory.

toString

public java.lang.String toString()
See Also:
Object.toString()

compareTo

public int compareTo(java.lang.Object object)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
java.util.Comparable#comapreTo(java.lang.Object)

delete

public boolean delete()
Description copied from interface: RepositoryEntry
This marks the entry for delete. It is not actually physicall delete the entry from the repository. Later point of time, admin can go and recover this entry. These kind of entries will be stay in repository for sepcified period and delete completely when batch job runs on periodically based.

Specified by:
delete in interface RepositoryEntry
Returns:
Return true if it could mark delete the entry, false otherwise.

isDeleted

public boolean isDeleted()
Description copied from interface: RepositoryEntry
Returns the deleted status of the entry.

Specified by:
isDeleted in interface RepositoryEntry
Returns:
Return true if entry is deleted, false otherwise.

updateConfigFileForDelete

private boolean updateConfigFileForDelete(boolean delete)

cancelDelete

public boolean cancelDelete()
Description copied from interface: RepositoryEntry
This actually takes off the delete mark on the entry. When there is request to delete an entry, it simply marks the entry for delete. This takes off that mark on entry.

Specified by:
cancelDelete in interface RepositoryEntry
Returns:
Return true if delete mark has been cancelled, false otherwise.

getDeletedDate

public java.util.Date getDeletedDate()
Description copied from interface: RepositoryEntry
Gets the deleted date of this entry.

Specified by:
getDeletedDate in interface RepositoryEntry
Returns:
Returns date of the entry got deleted.