client
Class ShareManager
java.lang.Object
client.ShareManager
- All Implemented Interfaces:
- InfoProvider, StaticValues
public class ShareManager
- extends java.lang.Object
- implements InfoProvider, StaticValues
Method Summary |
void |
addGroup(java.lang.String groupName)
|
void |
addGroupRegisterListener(GroupRegisterListener l)
|
void |
addRegisteredUserListener(RegisteredUserListener l)
|
void |
addToRootFiles(java.io.File f)
|
void |
addToRootFiles(OwnFileDescriptor ofd)
|
void |
addUser(java.lang.String userName,
java.lang.String passwd)
|
void |
associateUserWithGroup(java.lang.String username,
java.lang.String group)
|
boolean |
canDownload(Profile profile,
int fileId)
|
void |
fireGroupRegistered(java.lang.String groupname)
|
void |
fireGroupUnRegistered(java.lang.String groupname)
|
void |
fireUserRegistered(java.lang.String userName)
|
void |
fireUserUnRegistered(java.lang.String userName)
|
java.lang.String |
getFilePath(int file_id)
returns the path of file with this id, if not in db resutl is null |
java.util.ArrayList<java.lang.String> |
getGroups()
|
java.util.ArrayList<java.lang.String> |
getGroups(java.lang.String username,
java.lang.String password)
if not registered returns null |
java.util.ArrayList<java.lang.String> |
getGroupsForUser(java.lang.String userName)
|
java.util.ArrayList<OwnFileDescriptor> |
getRootFiles()
|
long |
getShareAmount()
|
java.util.ArrayList<OwnFileDescriptor> |
getTopLevelFiles()
|
java.util.ArrayList<java.lang.String> |
getUsers()
|
boolean |
isAncSharedAsRoot(java.io.File f)
true if one of the files ancestor is shared; |
boolean |
isRegistered(java.lang.String username)
|
boolean |
isRoot(int id,
boolean dir)
|
boolean |
isRootDir(int dir_id)
|
boolean |
isRootFile(int file_id)
|
boolean |
isSharedFile(java.io.File f)
|
void |
removeFromRoots(OwnFileDescriptor ofd)
|
void |
removeGroup(java.lang.String groupName)
Test what happens when a file is in this group |
void |
removeGroup(java.lang.String groupName,
java.lang.String substituteGroup)
Substitute group must exist in database |
void |
removeGroupRegisterListener(GroupRegisterListener l)
|
void |
removeRegisteredUserListener(RegisteredUserListener l)
|
void |
removeUser(java.lang.String userName)
|
void |
removeUserFromGroup(java.lang.String user,
java.lang.String group)
|
void |
setDirGroup(int dir_id,
java.lang.String group)
|
void |
setDirGroupAccess(int dir_id,
short mode)
|
void |
setDirPublicAccess(int dir_id,
short mode)
|
void |
setFileGroup(int file_id,
java.lang.String group)
|
void |
setFileGroupAccess(int file_id,
short mode)
|
void |
setFilePublicAccess(int file_id,
short mode)
|
void |
setUserPassword(java.lang.String username,
java.lang.String password)
|
void |
shareFile(java.io.File f)
|
void |
shareFile(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
|
void |
shareFileAsRoot(java.io.File f)
|
void |
shareFileAsRoot(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
|
void |
shareFileWithParentAsRoot(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
|
void |
unShare(java.io.File f)
|
void |
unShareDir(int dir_id)
|
void |
unShareFile(int file_id)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STANDARD_GROUP
public static final java.lang.String STANDARD_GROUP
- See Also:
- Constant Field Values
STANDARD_OTHER_MODE
public static final short STANDARD_OTHER_MODE
- See Also:
- Constant Field Values
STANDARD_GROUP_MODE
public static final short STANDARD_GROUP_MODE
- See Also:
- Constant Field Values
ROOT_ID
public static final int ROOT_ID
- See Also:
- Constant Field Values
ShareManager
public ShareManager(java.sql.Connection con)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
addGroup
public void addGroup(java.lang.String groupName)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
addUser
public void addUser(java.lang.String userName,
java.lang.String passwd)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
removeUser
public void removeUser(java.lang.String userName)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
associateUserWithGroup
public void associateUserWithGroup(java.lang.String username,
java.lang.String group)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
removeUserFromGroup
public void removeUserFromGroup(java.lang.String user,
java.lang.String group)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
getUsers
public java.util.ArrayList<java.lang.String> getUsers()
throws java.sql.SQLException
- Throws:
java.sql.SQLException
getGroups
public java.util.ArrayList<java.lang.String> getGroups()
getGroupsForUser
public java.util.ArrayList<java.lang.String> getGroupsForUser(java.lang.String userName)
throws java.sql.SQLException,
UserNotRegisteredException
- Throws:
java.sql.SQLException
UserNotRegisteredException
removeGroup
public void removeGroup(java.lang.String groupName)
throws java.sql.SQLException,
GroupUsedInFilesException
- Test what happens when a file is in this group
- Throws:
java.sql.SQLException
GroupUsedInFilesException
removeGroup
public void removeGroup(java.lang.String groupName,
java.lang.String substituteGroup)
throws java.sql.SQLException
- Substitute group must exist in database
- Throws:
java.sql.SQLException
setUserPassword
public void setUserPassword(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
addToRootFiles
public void addToRootFiles(java.io.File f)
throws java.sql.SQLException,
FileNotSharedException
- Throws:
java.sql.SQLException
FileNotSharedException
addToRootFiles
public void addToRootFiles(OwnFileDescriptor ofd)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
removeFromRoots
public void removeFromRoots(OwnFileDescriptor ofd)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
shareFileAsRoot
public void shareFileAsRoot(java.io.File f)
throws SharingNonExistingFileException,
java.sql.SQLException
- Throws:
SharingNonExistingFileException
java.sql.SQLException
shareFileAsRoot
public void shareFileAsRoot(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
throws SharingNonExistingFileException,
java.sql.SQLException
- Throws:
SharingNonExistingFileException
java.sql.SQLException
shareFileWithParentAsRoot
public void shareFileWithParentAsRoot(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
throws SharingNonExistingFileException,
java.sql.SQLException
- Throws:
SharingNonExistingFileException
java.sql.SQLException
shareFile
public void shareFile(java.io.File f)
throws SharingNonExistingFileException,
java.sql.SQLException
- Throws:
SharingNonExistingFileException
java.sql.SQLException
shareFile
public void shareFile(java.io.File f,
java.lang.String group,
short otherMode,
short groupMod)
throws SharingNonExistingFileException,
java.sql.SQLException
- Throws:
SharingNonExistingFileException
java.sql.SQLException
isSharedFile
public boolean isSharedFile(java.io.File f)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
isAncSharedAsRoot
public boolean isAncSharedAsRoot(java.io.File f)
throws java.sql.SQLException
- true if one of the files ancestor is shared;
- Throws:
java.sql.SQLException
unShare
public void unShare(java.io.File f)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
unShareDir
public void unShareDir(int dir_id)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
unShareFile
public void unShareFile(int file_id)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setFilePublicAccess
public void setFilePublicAccess(int file_id,
short mode)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setDirPublicAccess
public void setDirPublicAccess(int dir_id,
short mode)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setFileGroupAccess
public void setFileGroupAccess(int file_id,
short mode)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setDirGroupAccess
public void setDirGroupAccess(int dir_id,
short mode)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setDirGroup
public void setDirGroup(int dir_id,
java.lang.String group)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
setFileGroup
public void setFileGroup(int file_id,
java.lang.String group)
throws java.sql.SQLException
- Throws:
java.sql.SQLException
fireUserRegistered
public void fireUserRegistered(java.lang.String userName)
fireUserUnRegistered
public void fireUserUnRegistered(java.lang.String userName)
addGroupRegisterListener
public void addGroupRegisterListener(GroupRegisterListener l)
removeGroupRegisterListener
public void removeGroupRegisterListener(GroupRegisterListener l)
fireGroupRegistered
public void fireGroupRegistered(java.lang.String groupname)
fireGroupUnRegistered
public void fireGroupUnRegistered(java.lang.String groupname)
isRootFile
public boolean isRootFile(int file_id)
isRootDir
public boolean isRootDir(int dir_id)
isRoot
public boolean isRoot(int id,
boolean dir)
getTopLevelFiles
public java.util.ArrayList<OwnFileDescriptor> getTopLevelFiles()
- Specified by:
getTopLevelFiles
in interface InfoProvider
getRootFiles
public java.util.ArrayList<OwnFileDescriptor> getRootFiles()
- Specified by:
getRootFiles
in interface InfoProvider
getGroups
public java.util.ArrayList<java.lang.String> getGroups(java.lang.String username,
java.lang.String password)
- if not registered returns null
- Specified by:
getGroups
in interface InfoProvider
isRegistered
public boolean isRegistered(java.lang.String username)
- Specified by:
isRegistered
in interface InfoProvider
canDownload
public boolean canDownload(Profile profile,
int fileId)
- Specified by:
canDownload
in interface InfoProvider
getFilePath
public java.lang.String getFilePath(int file_id)
- returns the path of file with this id, if not in db resutl is null
- Specified by:
getFilePath
in interface InfoProvider
getShareAmount
public long getShareAmount()
- Specified by:
getShareAmount
in interface InfoProvider
addRegisteredUserListener
public void addRegisteredUserListener(RegisteredUserListener l)
removeRegisteredUserListener
public void removeRegisteredUserListener(RegisteredUserListener l)