Package unlimited.fc.server.api
Class FCServerLite
- java.lang.Object
-
- unlimited.core.util.LiteAPIBase
-
- unlimited.fc.server.api.FCServerLite
-
- All Implemented Interfaces:
FCServerIfc,FCServerIfcExtended
public class FCServerLite extends unlimited.core.util.LiteAPIBase implements FCServerIfcExtended
Title: FileCatalyst Direct Server API
Description: Provides server-side API execute remote administrations calls to a FileCatalyst Server
- - - - - - - - - - - - - - - API USAGE: - - - - - - - - - - - - - - -
Example below is a sample code where the application tries to create a user and wrapps up logic for reconnection attempts should the communication between the ServerAPI and the Server be severed. // Call to setup initial connection to FileCatalyst Server public void init() throws Exception { FCServer fcserver = new FCServer(); // connection parameters fcserver.setHostname("localhost"); fcserver.setPort(12400); fcserver.setUserName("admin"); fcserver.setPassword("system"); // connect fcserver.connect(); } // attempts a reconnection private void reconnect () throws Exception { try { fcserver.disconnect(); } catch (Exception e) { } fcserver.connect(); } // // Method to modify login credentials for a user. If the user does not yet exist, create the // user as well. // @param fcUserName FTP Login name // @param fcPassword Password the user wants to have // @throws Exception If you cannot connect to the server after 3 attempts, or the server is not allowing you to // create/modify the user. // public void createOrModifyUserCredentials(String fcUserName, String fcPassword) throws Exception { // Get the FileCatalyst user. int MAXATTEMPTS = 3; UserContainer fcUser = null; int retryAttempts = 0; while (fcUser == null && retryAttempts < MAXATTEMPTS ) { // try to connect if we've lost the connection if (!fcserver.isConnected()) { reconnect(); } try { fcUser = fcserver.getUser(fcUserName); if (fcUser == null) { // null return indicates user does not exist -- create fcserver.addUser(fcUserName, fcPassword); // test to see if the user is really there fcserver.resynchConfigurationFiles(); fcUser = fcserver.getUser(fcUserName); if (fcUser == null) { throw new Exception("FileCatalyst user could not be created with user name '" + fcUserName + "'"); } return; } else { fcserver.modUserPassword(fcUserName, fcPassword); return; } } catch (Exception e) { // conection foobared. Let's try again retryAttempts++; } } throw new Exception("Cannot connect to FCServer, reached max attempts"); } Other examples are found below: // execute required remote commands (each command invokes a remote call) fcserver.addUser("bob", "12345"); fcserver.setUserEnable("bob", false); fcserver.modUserPassword("bob", "abcde"); // modify several attributes for user (remote call only fired off by modifyUser() method) UserContainer userCon = fcserver.getUser("bob"); userCon.setFileReadPermissions(false); userCon.setFullName("Bobby Joe"); userCon.setPriority(UserContainer.USERPRIORITY_LOW); //high System.out.println("Account will expire: " + userCon.getAccountExpiry()); userCon.setHomeDIR("Z:/data/bob/12345/"); fcserver.modifyUser(userCon); // force a resynch for configuration files and user data to server (instead of waiting for triggered response in 1-2 seconds) fcserver.resynchConfigurationFiles(); // slightly more destructive methods fcserver.killSessionByUserId("bob"); fcserver.delUser("bob"); fcserver.killAllSessions();Copyright: Copyright (c) 2009
Company: Unlimi-Tech Software Inc.
- Since:
- v2.7.1
- Version:
- 1.0
- Author:
- Chris Bailey, Christian Charette
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.logging.Loggerlogger-
Fields inherited from class unlimited.core.util.LiteAPIBase
password, port, server, username, webResourceConnector
-
Fields inherited from interface unlimited.fc.server.api.FCServerIfc
PRODUCT
-
-
Constructor Summary
Constructors Constructor Description FCServerLite()Default Contructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddTemporaryToken(java.lang.String username, java.lang.String token)Add a temporary password token for a user.voidaddTempUser(java.lang.String newusername, java.lang.String newuserpass)Adds a temporary FC web user to the system.voidaddTempUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir)Adds a temporary FC web user to the system.voidaddTempUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir, int userType)Deprecated.Adds a temporary user to the system.voidaddTempUser(UserContainer user, java.lang.String password)Deprecated.voidaddUser(java.lang.String newusername, java.lang.String newuserpass)Creates a new user on the remote FC servervoidaddUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir)Creates a new user on the remote FC server with a home directoryvoidaddUser(UserContainer user, java.lang.String password)Deprecated.voidaddUserGroup(UserGroupContainer group)Add a new UserGroupContainer to the system.java.lang.StringaddVirtualFolder(VirtualFolderContainer virtualFolder)Add a new VirtualFolderContainer to the system.voidclearBlockedUser(java.lang.String username)voidconnect()Default connect.voidconnect(java.lang.String hostname, int port, java.lang.String adminuser, java.lang.String adminpass)Connect with the arguments provided.voidconnect(java.lang.String hostname, int port, java.lang.String adminuser, java.lang.String adminpass, java.lang.String httpScheme)Connect when a particular HTTP scheme is known.voidconnectNoStatus()Connects with no status messagevoidcreateVirtualDownloadLinksForTheUser(CreateVirtualDownloadLinksForUserContainer container, java.lang.String password)Deprecated.voiddeleteTemporaryToken(java.lang.String username, java.lang.String token)Deletes temporary password token for a user.voiddeleteUserGroup(java.lang.String groupName)Deletes the UserGroupContainer with the given name.voiddeleteVirtualFolder(java.lang.String virtualFolderName)deletes the VirtualFolderContainer with the given name.voiddelUser(java.lang.String delusername)Delets a user on the remote FC servervoiddelUser(java.lang.String delusername, boolean deleteHomeDirectory)Delets a user on the remote FC server and the user's home dir.voiddisconnect()Disconnct from the FileCatalyst Direct ServervoidenableUserGroup(java.lang.String groupName)enables the UserGroup with the given name.voidgenerateDiagnostics()Generate a diagnostic on the server.unlimited.fc.rest.shared.model.dataitem.DataItemsModelgetAllConfigData()Returns All Of The Current Server Configurationsjava.util.Collection<UserContainer>getAllUsers()protected java.lang.StringgetAuthorizationPath()java.util.LinkedList<ClientSessionContainer>getClientSessions()Gets the list of sessions currently running on FileCatalyst Server.unlimited.fc.com.configsource.FCServerFileConfigSourcegetConfigSource()java.lang.StringgetConfigValue(java.lang.String configName)Returns a specific configurationintgetDefaultIdleTime()Returns the amount of time that a client session is allowed to be idle when connected to the Serverjava.util.Collection<FolderGroupCanAccess>getFoldersLinkedToGroup(java.lang.String groupname)Return a list view of folders that is linked to a group along with their permissions Each entry contains a specific folder the folder has access to, and includes permissions granted to the group.java.util.Collection<FolderUserCanAccess>getFoldersLinkedToUser(java.lang.String userName)Returns a list view of links connecting a folder to a user.java.util.Collection<ResourceGrantedToFolder>getGroupsLinkedToFolder(java.lang.String virtualFolderName)Return a list of groups that is linked to a folder along with their permissions.java.util.Collection<java.lang.String>getGroupsLinkedToUser(java.lang.String userName)Returns group collection linked to user name.java.lang.StringgetHostname()Returns the host name of the serverjava.net.URIgetHTMLAdminURL(boolean bypassServerConfigs)Returns the current HTML admin URL when called.intgetHTTPPort()Get http port.longgetLastConfigChangeTime()get last time for configuration changelonggetLastUsersChangeTime()get last time for configuration changejava.lang.StringgetLicenseString()Returns the server license stringjava.lang.StringgetPassword()Returns the password of the serverPermissionsContainergetPermissionsForGroupAndFolder(java.lang.String groupname, java.lang.String foldername)Return a permission container that describes the relationship between the group and folder.PermissionsContainergetPermissionsForUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName)Permission list that a user has regarding a folder.intgetReceiveRateKbps()Shows kbps rates (receive) of the serverjava.lang.StringgetRequestString()Returns the server request stringintgetTotalRateKbps()Shows kbps rates (total) of the serverintgetTransmitRateKbps()Shows kbps rates (transmit) of the serverUserContainergetUser(java.lang.String username)Get user information from the FileCatalyst Server.intgetUserCount()Returns the current user count on the serverUserGroupContainergetUserGroup(java.lang.String groupName)UserGroupContainer associated with the entered name.java.util.Collection<UserGroupContainer>getUserGroups()List of UserGroupContainer.java.lang.StringgetUsername()Returns the user name of the serverjava.util.Collection<UserContainer>getUsers()Return a collection of the users on the systemjava.util.Collection<ResourceGrantedToFolder>getUsersLinkedToFolder(java.lang.String virtualFolderName)Return a list of users linked to a folderjava.util.Collection<java.lang.String>getUsersLinkedToGroup(java.lang.String groupname)Returns user names linked to group name.VirtualFolderContainergetVirtualFolder(java.lang.String virtualFolderName)returns the VirtualFolderContainer associated with the entered name.java.util.Collection<VirtualFolderContainer>getVirtualFolders()returns the VirtualFolders.voidinternalAddSpacesUser(unlimited.fc.rest.server.model.SpacesUserAndVirtualFoldersModel model)booleanisConnected()Tests to see if the ServerAPI is connected to the RemoteAdmin.booleanisStatusClientDisabled()Returns true.voidkillAllSessions()Kill all connected user sessions on the systemvoidkillSessionBySessionId(java.lang.String sessionID)Kill specific session connected to the systemvoidkillSessionByUserId(java.lang.String username)Kill specific users connected to the systemvoidlinkGroupAndFolder(java.lang.String groupname, java.lang.String foldername, PermissionsContainer permission)Create access for a group to a virtual folder with a specified permission set.voidlinkUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName, PermissionsContainer permission)Links a user to a virtual folder with given permissionsvoidlinkUserAndGroup(java.lang.String userName, java.lang.String groupName)links the User and the UserGroupContainer with the given names.java.lang.String[]listUserNames()Return user name list on the remote FC serverUserContainer[]listUsers()Return list of UserContainers from the remote FC servervoidmodifyUser(UserContainer modifiedUserContainer)Modify a user on the remote server.voidmodifyUserGroup(UserGroupContainer group)modifies the group with the name group.getName with the values of group.voidmodifyVirtualFolder(VirtualFolderContainer virtualFolder)Modifies the virtual folder with with with the given name.voidmodUserPassword(java.lang.String username, java.lang.String newpassword)Modify a user's password on the remote FC servervoidresetAllOverrides()Resets all bandwidth/priority overrides back to default values.voidsetConfigValue(java.lang.String configName, java.lang.String configValue)Sets a specific configurationvoidsetDefaultIdleTime(int idleTime)Sets the amount of time that a session can be idle forvoidsetHostname(java.lang.String server)Sets the host name of the server to a new valuevoidsetLicenseString(java.lang.String newLicense)Sets the server license keyvoidsetOverrideBandwidth(java.lang.String sessionID, int bandwidthKbps)Sets an override priority for a given client session.voidsetOverridePriority(java.lang.String sessionID, int priority)Sets an override priority for a given client session.voidsetPassword(java.lang.String password)Sets the password of the server to a new valuevoidsetPort(int port)Sets the port of the server to a new valueprotected voidsetSingleDataItem(unlimited.fc.rest.shared.model.dataitem.DataItemModel dim)Sets a new single data itemvoidsetUserEnable(java.lang.String username, boolean enabled)Allows enabling or disabling users on the remote FC servervoidsetUserName(java.lang.String username)Sets the user name of the server to a new valuevoidshutdown()Tell the server to shut down.voidunlinkGroupAndFolder(java.lang.String groupname, java.lang.String foldername)Remove access of a group to a virtual folder.voidunlinkUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName)Unlinks a user to a virtual folder.voidunlinkUserAndGroup(java.lang.String userName, java.lang.String groupname)unlinks the User and the UserGroupContainer with the given names.-
Methods inherited from class unlimited.core.util.LiteAPIBase
convertResponseDataToJavaObject, generateRESTBuilder, getAuthorization, getFailureReasonFromResponse, getPort, getServer, getWebResourceConnector, setWebResourceConnector, validateWebResourceConnector
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface unlimited.fc.server.api.FCServerIfcExtended
addUserSanity, createVirtualDownloadLinksForTheUser, createVirtualLinkForUserOnServer, getHTMLAdminURL, getIP, getWebServerBaseURL, translateToIP, translateToIPLazy, validateUserAdded
-
-
-
-
Method Detail
-
connect
public void connect() throws java.lang.ExceptionDefault connect. Assume the privage variables have already been set.- Specified by:
connectin interfaceFCServerIfc- Throws:
java.lang.Exception
-
connect
public void connect(java.lang.String hostname, int port, java.lang.String adminuser, java.lang.String adminpass) throws java.lang.ExceptionConnect with the arguments provided. This will set the internal values for the WebResourceConnector that is used to communicate with the Server application.- Specified by:
connectin interfaceFCServerIfc- Parameters:
hostname- Hostname or IP of the server you wish to connect toport- HTTP port of the server that you wish to connect toadminuser- Administration username of the serveradminpass- Administration password of the server- Throws:
java.lang.Exception
-
connect
public void connect(java.lang.String hostname, int port, java.lang.String adminuser, java.lang.String adminpass, java.lang.String httpScheme) throws java.lang.ExceptionConnect when a particular HTTP scheme is known.- Parameters:
hostname- Hostname or IP of the server you wish to connect toport- HTTP port of the server that you wish to connect toadminuser- Administration username of the serveradminpass- Administration password of the serverhttpScheme- HTTP scheme used to communicate with the FC Server. Typically HTTP or HTTPS if SSL is enabled- Throws:
java.lang.Exception
-
disconnect
public void disconnect() throws java.lang.ExceptionDisconnct from the FileCatalyst Direct Server- Specified by:
disconnectin interfaceFCServerIfc- Throws:
java.lang.Exception
-
getUsername
public java.lang.String getUsername()
Returns the user name of the server- Specified by:
getUsernamein interfaceFCServerIfc- Overrides:
getUsernamein classunlimited.core.util.LiteAPIBase- Returns:
- String representing the user name
-
getPassword
public java.lang.String getPassword()
Returns the password of the server- Specified by:
getPasswordin interfaceFCServerIfc- Overrides:
getPasswordin classunlimited.core.util.LiteAPIBase- Returns:
- String representing the password
-
getHostname
public java.lang.String getHostname()
Returns the host name of the server- Specified by:
getHostnamein interfaceFCServerIfc- Returns:
- String representing the host name
-
setUserName
public void setUserName(java.lang.String username)
Sets the user name of the server to a new value- Specified by:
setUserNamein interfaceFCServerIfc- Parameters:
username- New user name to set
-
setPassword
public void setPassword(java.lang.String password)
Sets the password of the server to a new value- Specified by:
setPasswordin interfaceFCServerIfc- Parameters:
password- New password to set
-
setHostname
public void setHostname(java.lang.String server)
Sets the host name of the server to a new value- Specified by:
setHostnamein interfaceFCServerIfc- Parameters:
server- New host name to set
-
setPort
public void setPort(int port)
Sets the port of the server to a new value- Specified by:
setPortin interfaceFCServerIfc- Parameters:
port- New port to set
-
isConnected
public boolean isConnected()
Tests to see if the ServerAPI is connected to the RemoteAdmin. The Lite api only connects per command, it is not connected in the background.- Specified by:
isConnectedin interfaceFCServerIfc- Returns:
- true if the connection is setup and works (NOOP command returns reply from server), false if the connection is not currently working.
-
listUserNames
public java.lang.String[] listUserNames() throws java.lang.ExceptionReturn user name list on the remote FC server- Specified by:
listUserNamesin interfaceFCServerIfc- Returns:
- Array of user names found on user list
- Throws:
java.lang.Exception
-
listUsers
public UserContainer[] listUsers() throws java.lang.Exception
Return list of UserContainers from the remote FC server- Specified by:
listUsersin interfaceFCServerIfcExtended- Returns:
- Array of users found on user list
- Throws:
java.lang.Exception- If unable to convert user into user container (user table modified while getting user list)
-
addUser
public void addUser(java.lang.String newusername, java.lang.String newuserpass) throws java.lang.ExceptionCreates a new user on the remote FC server- Specified by:
addUserin interfaceFCServerIfc- Parameters:
newusername- Stringnewuserpass- String- Throws:
java.lang.Exception- If the user cannot be created on the remote system
-
addUser
public void addUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir) throws java.lang.ExceptionCreates a new user on the remote FC server with a home directory- Specified by:
addUserin interfaceFCServerIfc- Parameters:
newusername- Stringnewuserpass- Stringnewhomedir- String- Throws:
java.lang.Exception- If the user cannot be created on the remote system
-
delUser
public void delUser(java.lang.String delusername) throws java.lang.ExceptionDelets a user on the remote FC server- Specified by:
delUserin interfaceFCServerIfc- Parameters:
delusername- String Username that is to be removed from the database.- Throws:
java.lang.Exception- If the user cannot be deleted on the remote system
-
delUser
public void delUser(java.lang.String delusername, boolean deleteHomeDirectory) throws java.lang.ExceptionDelets a user on the remote FC server and the user's home dir.- Specified by:
delUserin interfaceFCServerIfc- Parameters:
delusername- String Username that is to be removed from the database.- Throws:
java.lang.Exception- If the user cannot be deleted on the remote system
-
clearBlockedUser
public void clearBlockedUser(java.lang.String username) throws java.lang.Exception- Throws:
java.lang.Exception
-
setUserEnable
public void setUserEnable(java.lang.String username, boolean enabled) throws java.lang.ExceptionAllows enabling or disabling users on the remote FC server- Specified by:
setUserEnablein interfaceFCServerIfc- Parameters:
username- Stringenabled- boolean- Throws:
java.lang.Exception- If the user cannot be modified on the remote system
-
modUserPassword
public void modUserPassword(java.lang.String username, java.lang.String newpassword) throws java.lang.ExceptionModify a user's password on the remote FC server- Specified by:
modUserPasswordin interfaceFCServerIfc- Parameters:
username- Stringnewpassword- String- Throws:
java.lang.Exception- If the user cannot be modified on the remote system
-
addTemporaryToken
public void addTemporaryToken(java.lang.String username, java.lang.String token) throws java.lang.ExceptionAdd a temporary password token for a user. Allows you to create admin temporary access to login as a user without knowing the full user's credentials. Temporary tokens on the server by default are allowed to login a maximum of 10 times (enough to complete a transfer with somewhat unreliable network) within a span of 30 minutes. Afterwards, the token expires and subsequent logins are disallowed. The default values (10 connection attempts, 30 minute expiry) can be altered on the server by adding in the following values on fcconf.conf file: FCServer.server.config.user.tmp.login.expirytime.minutes=30 FCServer.server.config.user.tmp.login.max.connections=10- Specified by:
addTemporaryTokenin interfaceFCServerIfc- Parameters:
username- Stringnewpassword- String- Throws:
java.lang.Exception- If the user cannot be modified on the remote system
-
deleteTemporaryToken
public void deleteTemporaryToken(java.lang.String username, java.lang.String token) throws java.lang.ExceptionDeletes temporary password token for a user. Allows you to create admin temporary access to login as a user without knowing the full user's credentials.- Specified by:
deleteTemporaryTokenin interfaceFCServerIfc- Parameters:
username- Stringnewpassword- String- Throws:
java.lang.Exception- If the user cannot be modified on the remote system
-
getUser
public UserContainer getUser(java.lang.String username) throws java.lang.Exception
Get user information from the FileCatalyst Server. Used to extract specific information from a user object, or can have values modified and sent back to the server using modifyUser() method. Actually acts like more of a factory, as it queries the inner user management classes to see if an existing user is available with the username defined,- Specified by:
getUserin interfaceFCServerIfc- Parameters:
username- String Unique username.- Returns:
- UserContainer if user exists, null if user does not exist on the server.
- Throws:
java.lang.Exception
-
modifyUser
public void modifyUser(UserContainer modifiedUserContainer) throws InvalidArgumentException, java.lang.Exception
Modify a user on the remote server. Note that the username in the modifiedUserContainer must match an existing user, as it is used to match up the real user stored in the database. Modification of the username is not a permitted action in FileCatalyst Server -- you must create a new user and delete the old user.- Specified by:
modifyUserin interfaceFCServerIfc- Parameters:
data- .user UserContainer User container which has values already modified.- Throws:
InvalidArgumentException- If user does not exist on the serverjava.lang.Exception- if remote procedure call fails between API and the FC Server
-
addUserGroup
public void addUserGroup(UserGroupContainer group) throws java.lang.Exception
Add a new UserGroupContainer to the system. Will throw exceptions if the UserGroupContainer does not exist or if the name is already taken.- Specified by:
addUserGroupin interfaceFCServerIfc- Parameters:
UserGroupContainer- a new user group.- Throws:
java.lang.Exception- *
-
getUserGroup
public UserGroupContainer getUserGroup(java.lang.String groupName) throws java.lang.Exception
UserGroupContainer associated with the entered name. If no such named user group exists, the method returns null.- Specified by:
getUserGroupin interfaceFCServerIfc- Parameters:
groupName-- Returns:
- UserGroupContainer with the given name, or null.
- Throws:
java.lang.Exception
-
getUserGroups
public java.util.Collection<UserGroupContainer> getUserGroups() throws java.lang.Exception
List of UserGroupContainer. If no groups exists, the method returns an empty collection.- Specified by:
getUserGroupsin interfaceFCServerIfc- Returns:
- Collection
with the given name, or null. - Throws:
java.lang.Exception
-
modifyUserGroup
public void modifyUserGroup(UserGroupContainer group) throws java.lang.Exception
modifies the group with the name group.getName with the values of group. Note that modification of the group name is not permitted in FileCatalyst Server.- Specified by:
modifyUserGroupin interfaceFCServerIfc- Parameters:
group-- Throws:
java.lang.Exception
-
deleteUserGroup
public void deleteUserGroup(java.lang.String groupName) throws java.lang.ExceptionDeletes the UserGroupContainer with the given name. all relationships associated with this group will be deleted.- Specified by:
deleteUserGroupin interfaceFCServerIfc- Parameters:
groupName-- Throws:
java.lang.Exception
-
enableUserGroup
public void enableUserGroup(java.lang.String groupName) throws java.lang.Exceptionenables the UserGroup with the given name. all relationships associated with this group will be deleted.- Specified by:
enableUserGroupin interfaceFCServerIfc- Parameters:
groupName-- Throws:
java.lang.Exception
-
linkUserAndGroup
public void linkUserAndGroup(java.lang.String userName, java.lang.String groupName) throws java.lang.Exceptionlinks the User and the UserGroupContainer with the given names.- Specified by:
linkUserAndGroupin interfaceFCServerIfc- Parameters:
userName-groupName-- Throws:
java.lang.Exception
-
unlinkUserAndGroup
public void unlinkUserAndGroup(java.lang.String userName, java.lang.String groupname) throws java.lang.Exceptionunlinks the User and the UserGroupContainer with the given names.- Specified by:
unlinkUserAndGroupin interfaceFCServerIfc- Parameters:
userName-groupName-- Throws:
java.lang.Exception
-
getUsersLinkedToGroup
public java.util.Collection<java.lang.String> getUsersLinkedToGroup(java.lang.String groupname) throws java.lang.ExceptionReturns user names linked to group name.- Specified by:
getUsersLinkedToGroupin interfaceFCServerIfc- Parameters:
groupName-- Throws:
java.lang.Exception
-
getGroupsLinkedToUser
public java.util.Collection<java.lang.String> getGroupsLinkedToUser(java.lang.String userName) throws java.lang.ExceptionReturns group collection linked to user name.- Specified by:
getGroupsLinkedToUserin interfaceFCServerIfc- Parameters:
userName-- Throws:
java.lang.Exception
-
addVirtualFolder
public java.lang.String addVirtualFolder(VirtualFolderContainer virtualFolder) throws java.lang.Exception
Add a new VirtualFolderContainer to the system. Will throw exceptions if the VirtualFolderContainer does not exist or if the name is already taken. *- Specified by:
addVirtualFolderin interfaceFCServerIfc- Parameters:
VirtualFolderContainer- a new virtualFolder.- Throws:
java.lang.Exception- *
-
getVirtualFolder
public VirtualFolderContainer getVirtualFolder(java.lang.String virtualFolderName) throws java.lang.Exception
returns the VirtualFolderContainer associated with the entered name. If no such named VirtualFolderContainer exists, the method returns null.- Specified by:
getVirtualFolderin interfaceFCServerIfc- Parameters:
virtualFolderName-- Returns:
- VirtualFolderContainer with the given name, or null.
- Throws:
java.lang.Exception
-
getVirtualFolders
public java.util.Collection<VirtualFolderContainer> getVirtualFolders() throws java.lang.Exception
returns the VirtualFolders. If no VirtualFolders exists, the method returns an empty collection.- Specified by:
getVirtualFoldersin interfaceFCServerIfc- Returns:
- Collection of VirtualFolders.
- Throws:
java.lang.Exception
-
modifyVirtualFolder
public void modifyVirtualFolder(VirtualFolderContainer virtualFolder) throws java.lang.Exception
Modifies the virtual folder with with with the given name. Note that modification of the VirtualFolder name is not permitted in FileCatalyst Server. The label (which is the value presented to the end user as a sub-directory) may be changed, as well as the description and the physical path the folder maps to.- Specified by:
modifyVirtualFolderin interfaceFCServerIfc- Parameters:
folder-- Throws:
java.lang.Exception
-
deleteVirtualFolder
public void deleteVirtualFolder(java.lang.String virtualFolderName) throws java.lang.Exceptiondeletes the VirtualFolderContainer with the given name. all relationships associated with this VirtualFolderContainer will be deleted.- Specified by:
deleteVirtualFolderin interfaceFCServerIfc- Parameters:
virtualFolderName-- Throws:
java.lang.Exception
-
linkUserAndFolder
public void linkUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName, PermissionsContainer permission) throws java.lang.ExceptionLinks a user to a virtual folder with given permissions- Specified by:
linkUserAndFolderin interfaceFCServerIfc- Parameters:
userName-virtualFolderName-permission-- Throws:
java.lang.Exception
-
unlinkUserAndFolder
public void unlinkUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName) throws java.lang.ExceptionUnlinks a user to a virtual folder.- Specified by:
unlinkUserAndFolderin interfaceFCServerIfc- Parameters:
userName-virtualFolderName-- Throws:
java.lang.Exception
-
getFoldersLinkedToUser
public java.util.Collection<FolderUserCanAccess> getFoldersLinkedToUser(java.lang.String userName) throws java.lang.Exception
Returns a list view of links connecting a folder to a user. Each entry contains a specific folder the user has access to, and includes all access points generated by granting permission directly to the user and the list of groups which a user has access to. Maximum permissions granted to the user is also specified.- Specified by:
getFoldersLinkedToUserin interfaceFCServerIfc- Parameters:
userName-- Returns:
- Collection
- Throws:
java.lang.Exception
-
getUsersLinkedToFolder
public java.util.Collection<ResourceGrantedToFolder> getUsersLinkedToFolder(java.lang.String virtualFolderName) throws java.lang.Exception
Return a list of users linked to a folder- Specified by:
getUsersLinkedToFolderin interfaceFCServerIfc- Parameters:
virtualFolderName-- Returns:
- Collection
- Throws:
java.lang.Exception
-
getPermissionsForUserAndFolder
public PermissionsContainer getPermissionsForUserAndFolder(java.lang.String userName, java.lang.String virtualFolderName) throws java.lang.Exception
Permission list that a user has regarding a folder.- Specified by:
getPermissionsForUserAndFolderin interfaceFCServerIfc- Parameters:
userName-virtualFolderName-- Returns:
- PermissionsContainer, null if no link exists between user and folder
- Throws:
java.lang.Exception
-
linkGroupAndFolder
public void linkGroupAndFolder(java.lang.String groupname, java.lang.String foldername, PermissionsContainer permission) throws java.lang.ExceptionCreate access for a group to a virtual folder with a specified permission set.- Specified by:
linkGroupAndFolderin interfaceFCServerIfc- Parameters:
groupname- Name of the groupfoldername- Folder name (not label), used as PK in the databasepermission- Permission container.- Throws:
java.lang.Exception- Throws exception if group or folder does not exist in FileCatalyst Server
-
unlinkGroupAndFolder
public void unlinkGroupAndFolder(java.lang.String groupname, java.lang.String foldername) throws java.lang.ExceptionRemove access of a group to a virtual folder.- Specified by:
unlinkGroupAndFolderin interfaceFCServerIfc- Parameters:
groupname- Name of the groupfoldername- Folder name (not label), used as PK in the database- Throws:
java.lang.Exception- Throws exception if group or folder does not exist in FileCatalyst Server
-
getFoldersLinkedToGroup
public java.util.Collection<FolderGroupCanAccess> getFoldersLinkedToGroup(java.lang.String groupname) throws java.lang.Exception
Return a list view of folders that is linked to a group along with their permissions Each entry contains a specific folder the folder has access to, and includes permissions granted to the group.- Specified by:
getFoldersLinkedToGroupin interfaceFCServerIfc- Parameters:
groupname- Name of the group to query against- Returns:
- List of folders a group has access to.
- Throws:
java.lang.Exception
-
getGroupsLinkedToFolder
public java.util.Collection<ResourceGrantedToFolder> getGroupsLinkedToFolder(java.lang.String virtualFolderName) throws java.lang.Exception
Return a list of groups that is linked to a folder along with their permissions. Note: Users connected to the folder is not- Specified by:
getGroupsLinkedToFolderin interfaceFCServerIfc- Parameters:
virtualFolderName- Unique name (PK) of the virtual folder used to identify object in database.- Returns:
- List of groups who have access to a folder.
- Throws:
java.lang.Exception
-
getPermissionsForGroupAndFolder
public PermissionsContainer getPermissionsForGroupAndFolder(java.lang.String groupname, java.lang.String foldername) throws java.lang.Exception
Return a permission container that describes the relationship between the group and folder.- Specified by:
getPermissionsForGroupAndFolderin interfaceFCServerIfc- Parameters:
groupname-foldername-- Returns:
- Permission container, null if no link exists between group and folder.
- Throws:
java.lang.Exception
-
killSessionByUserId
public void killSessionByUserId(java.lang.String username) throws java.lang.Exception, java.lang.IllegalStateExceptionKill specific users connected to the system- Specified by:
killSessionByUserIdin interfaceFCServerIfc- Parameters:
username- String Username on the FileCatalyst Direct Server- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
killAllSessions
public void killAllSessions() throws java.lang.Exception, java.lang.IllegalStateExceptionKill all connected user sessions on the system- Specified by:
killAllSessionsin interfaceFCServerIfc- Throws:
java.lang.IllegalStateException- thrown if status client was explictly disabled.java.lang.Exception- thrown if you cannot connect to a remote admin.
-
getClientSessions
public java.util.LinkedList<ClientSessionContainer> getClientSessions() throws java.lang.Exception, java.lang.IllegalStateException
Gets the list of sessions currently running on FileCatalyst Server. Must have StatusClient enabled for this call to work, as this is where the information is stored. When used via command-line call, output looks like the following: START SESSION LIST: sessionID | userName | remoteIP | status | fileName | fileSize | bytesSoFar | elapsedTime | clientType | transmitRateKbps | receiveRateKbps | connectedTimeSec | isTransferring | overrideBandwidth | overridePriority | deliveryTime 1340742540245-129-1339785388230|a|192.168.1.169|27% - Receiving (UDP)...|E:\TESTDATA\FC user data\4GigFilewData0.tst|4294967296|1192510388|201099|FileCatalyst HotFolder v3.0.1|0|48730|229|true|0|0|0 1340742540728-130-1339785388230|b|192.168.1.169|14% - Sending (UDP)...|E:\TESTDATA\FC user data\b\4GigFilewData0.tst|4294967296|627985642|105079|FileCatalyst HotFolder v3.0.1|48693|0|228|true|2000|0|0 END SESSION LIST- Specified by:
getClientSessionsin interfaceFCServerIfc- Returns:
- LinkedList
of sessions currently running on the FileCatalyst Server - Throws:
java.lang.Exception- Thrown if you cannot connect to the FCServer admin service.java.lang.IllegalStateException- Thrown if status client is explicitly disabled in FCServerAPI.
-
setOverridePriority
public void setOverridePriority(java.lang.String sessionID, int priority) throws InvalidArgumentException, java.lang.ExceptionSets an override priority for a given client session.- Specified by:
setOverridePriorityin interfaceFCServerIfc- Parameters:
priority- int value for priority: 1=low, 10=high, 0=no override (default)- Throws:
InvalidArgumentException- Priority value passed in is incorrect (legal values: 0, 1-10)java.lang.Exception- Cannot connect to the remote server
-
setOverrideBandwidth
public void setOverrideBandwidth(java.lang.String sessionID, int bandwidthKbps) throws InvalidArgumentException, java.lang.ExceptionSets an override priority for a given client session.- Specified by:
setOverrideBandwidthin interfaceFCServerIfc- Parameters:
bandwidthKbps- int value for override bandwidth.- Throws:
InvalidArgumentException- BandwidthKbps value passed in is incorrect (legal values: >= 0)java.lang.Exception- Cannot connect to the remote server
-
resetAllOverrides
public void resetAllOverrides() throws java.lang.ExceptionResets all bandwidth/priority overrides back to default values.- Specified by:
resetAllOverridesin interfaceFCServerIfc- Throws:
java.lang.Exception- Cannot connect to the remote server
-
killSessionBySessionId
public void killSessionBySessionId(java.lang.String sessionID) throws java.lang.Exception, java.lang.IllegalStateExceptionKill specific session connected to the system- Specified by:
killSessionBySessionIdin interfaceFCServerIfc- Parameters:
sessionID- String SessionID on the FileCatalyst Direct Server- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getTransmitRateKbps
public int getTransmitRateKbps() throws java.lang.Exception, java.lang.IllegalStateExceptionShows kbps rates (transmit) of the server- Specified by:
getTransmitRateKbpsin interfaceFCServerIfc- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getReceiveRateKbps
public int getReceiveRateKbps() throws java.lang.Exception, java.lang.IllegalStateExceptionShows kbps rates (receive) of the server- Specified by:
getReceiveRateKbpsin interfaceFCServerIfc- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getTotalRateKbps
public int getTotalRateKbps() throws java.lang.Exception, java.lang.IllegalStateExceptionShows kbps rates (total) of the server- Specified by:
getTotalRateKbpsin interfaceFCServerIfc- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getLastConfigChangeTime
public long getLastConfigChangeTime() throws java.lang.Exception, java.lang.IllegalStateExceptionget last time for configuration change- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getLastUsersChangeTime
public long getLastUsersChangeTime() throws java.lang.Exception, java.lang.IllegalStateExceptionget last time for configuration change- Throws:
java.lang.Exception- thrown if you cannot connect to a remote admin.java.lang.IllegalStateException- thrown if status client was explictly disabled.
-
getRequestString
public java.lang.String getRequestString() throws APINotConnectedExceptionReturns the server request string- Specified by:
getRequestStringin interfaceFCServerIfc- Returns:
- String
- Throws:
APINotConnectedException- Thrown if the Server API isn't connected to the Server
-
getAllConfigData
public unlimited.fc.rest.shared.model.dataitem.DataItemsModel getAllConfigData() throws APINotConnectedExceptionReturns All Of The Current Server Configurations- Returns:
- DataItemsModel that contains all of the current configurations
- Throws:
APINotConnectedException- Thrown if the Server API isn't connected to the Server
-
getConfigValue
public java.lang.String getConfigValue(java.lang.String configName) throws APINotConnectedExceptionReturns a specific configuration- Parameters:
configName- Configuration that you would like- Returns:
- String that contains requested configuration
- Throws:
APINotConnectedException- Thrown if the Server API isn't connected to the Server
-
setConfigValue
public void setConfigValue(java.lang.String configName, java.lang.String configValue) throws java.lang.ExceptionSets a specific configuration- Parameters:
configName- Configuration that you would likeconfigValue- Value for the configuration that you are setting- Throws:
java.lang.Exception
-
getLicenseString
public java.lang.String getLicenseString() throws APINotConnectedExceptionReturns the server license string- Specified by:
getLicenseStringin interfaceFCServerIfc- Returns:
- Current license string
- Throws:
APINotConnectedException
-
setLicenseString
public void setLicenseString(java.lang.String newLicense) throws java.lang.ExceptionSets the server license key- Specified by:
setLicenseStringin interfaceFCServerIfc- Parameters:
newLicense- String representing the new license to set- Throws:
java.lang.Exception
-
setSingleDataItem
protected void setSingleDataItem(unlimited.fc.rest.shared.model.dataitem.DataItemModel dim) throws java.lang.ExceptionSets a new single data item- Parameters:
dim- DataItem to set- Throws:
java.lang.Exception
-
isStatusClientDisabled
public boolean isStatusClientDisabled()
Returns true. Status client is always enabled in Server Lite- Returns:
- the statusClientDisabled
-
getUsers
public java.util.Collection<UserContainer> getUsers() throws java.lang.Exception
Return a collection of the users on the system- Returns:
- Collection of the users
- Throws:
java.lang.Exception
-
getAllUsers
public java.util.Collection<UserContainer> getAllUsers() throws java.lang.Exception
- Specified by:
getAllUsersin interfaceFCServerIfc- Throws:
java.lang.Exception
-
getUserCount
public int getUserCount() throws java.lang.ExceptionReturns the current user count on the server- Specified by:
getUserCountin interfaceFCServerIfc- Returns:
- Current user count
- Throws:
java.lang.Exception
-
connectNoStatus
public void connectNoStatus() throws java.lang.ExceptionConnects with no status message- Specified by:
connectNoStatusin interfaceFCServerIfc- Throws:
java.lang.Exception
-
getDefaultIdleTime
public int getDefaultIdleTime() throws APINotConnectedExceptionDescription copied from interface:FCServerIfcReturns the amount of time that a client session is allowed to be idle when connected to the Server- Specified by:
getDefaultIdleTimein interfaceFCServerIfc- Returns:
- Number of seconds that an idle client can be connected
- Throws:
APINotConnectedException
-
setDefaultIdleTime
public void setDefaultIdleTime(int idleTime) throws java.lang.ExceptionDescription copied from interface:FCServerIfcSets the amount of time that a session can be idle for- Specified by:
setDefaultIdleTimein interfaceFCServerIfc- Parameters:
idleTime- Number of seconds before the idle session is terminated- Throws:
java.lang.Exception- Thrown if there is an issue attempting to apply the configuration setting
-
addTempUser
public void addTempUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir) throws java.lang.ExceptionAdds a temporary FC web user to the system. This user has all of the benefits of a normal user, however it will also remove itself from the server when it remains idle for a certain amount of time- Specified by:
addTempUserin interfaceFCServerIfc- Parameters:
newusername- Name of the user to be creatednewuserpass- Password for the user to be created- Throws:
java.lang.Exception
-
addTempUser
public void addTempUser(java.lang.String newusername, java.lang.String newuserpass) throws java.lang.ExceptionAdds a temporary FC web user to the system. This user has all of the benefits of a normal user, however it will also remove itself from the server when it remains idle for a certain amount of time- Specified by:
addTempUserin interfaceFCServerIfc- Parameters:
newusername- Name of the user to be creatednewuserpass- Password for the user to be creatednewhomedir- Home directory of the user to be created- Throws:
java.lang.Exception
-
addTempUser
@Deprecated public void addTempUser(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir, int userType) throws java.lang.ExceptionDeprecated.Adds a temporary user to the system. No setting of any userType will be respected by this method, userType will always default to a temporary FC web user that has remote directory browsing privileges. Method has been solely kept for legacy reasons.- Specified by:
addTempUserin interfaceFCServerIfc- Parameters:
newusername- Name of the user to be creatednewuserpass- Password for the user to be creatednewhomedir- Home directory of the user to be createduserType- Ignored. Value always default to TEMPORARY_FC_WEB_USER (3)- Throws:
java.lang.Exception
-
getHTTPPort
public int getHTTPPort()
Get http port.- Specified by:
getHTTPPortin interfaceFCServerIfc- Returns:
- http port if http enable, otherwise return 0.
-
getHTMLAdminURL
public java.net.URI getHTMLAdminURL(boolean bypassServerConfigs) throws java.lang.ExceptionDescription copied from interface:FCServerIfcExtendedReturns the current HTML admin URL when called. Throws exception if the administration can't be properly used.- Specified by:
getHTMLAdminURLin interfaceFCServerIfcExtended- Parameters:
bypassServerConfigs- - set to true ignores masquerades and bind all interface on the server and returns an URL that can be used to connect to the HTML Admin- Returns:
- URI for the current HTML administration
- Throws:
java.lang.Exception- Thrown if remote admin is disabled, if web access is disabled, or the web server can't be reached.
-
getConfigSource
public unlimited.fc.com.configsource.FCServerFileConfigSource getConfigSource()
- Specified by:
getConfigSourcein interfaceFCServerIfc
-
addTempUser
@Deprecated public void addTempUser(UserContainer user, java.lang.String password) throws AddUserException, ModifyUserException, APINotConnectedException
Deprecated.Description copied from interface:FCServerIfcExtendedFOR INTERNAL USE ONLY ON LEGACY PRODUCTS- Specified by:
addTempUserin interfaceFCServerIfcExtended- Parameters:
user- UserContainer with all the desired settings for the user. the home directory, user name and password must all have values.password- the user's password- Throws:
AddUserException- when failing to add a userModifyUserException- when failing to apply the given settings in the user container to the userAPINotConnectedException
-
addUser
@Deprecated public void addUser(UserContainer user, java.lang.String password) throws AddUserException, ModifyUserException, APINotConnectedException
Deprecated.Description copied from interface:FCServerIfcExtendedFOR INTERNAL USE ONLY ON LEGACY PRODUCTS- Specified by:
addUserin interfaceFCServerIfcExtended- Parameters:
user- UserContainer with all the desired settings for the user. the home directory, user name and password must all have values.password- the user's password- Throws:
AddUserException- when failing to add a userModifyUserException- when failing to apply the given settings in the user container to the userAPINotConnectedException
-
createVirtualDownloadLinksForTheUser
@Deprecated public void createVirtualDownloadLinksForTheUser(CreateVirtualDownloadLinksForUserContainer container, java.lang.String password) throws AddUserException, ModifyUserException, AddVirtualFolderException, LinkUserAndFolderException, APINotConnectedException
Deprecated.Description copied from interface:FCServerIfcExtendedFOR INTERNAL USE ONLY ON LEGACY PRODUCTS This Method will create a temporary user, with the given permissions then create virtual files and link them to that user Delete the user and associated home directory- Specified by:
createVirtualDownloadLinksForTheUserin interfaceFCServerIfcExtended- Parameters:
container- container with all relevant info needed to create virtual files linked to a given userpassword- the user password- Throws:
AddUserExceptionModifyUserExceptionAddVirtualFolderExceptionLinkUserAndFolderExceptionAPINotConnectedException
-
internalAddSpacesUser
public void internalAddSpacesUser(unlimited.fc.rest.server.model.SpacesUserAndVirtualFoldersModel model) throws AddUserException, ModifyUserException, AddVirtualFolderException, LinkUserAndFolderException, unlimited.fc.server.api.FCServerLite.FallbackException, APINotConnectedException- Throws:
AddUserExceptionModifyUserExceptionAddVirtualFolderExceptionLinkUserAndFolderExceptionunlimited.fc.server.api.FCServerLite.FallbackExceptionAPINotConnectedException
-
shutdown
public void shutdown() throws java.lang.ExceptionTell the server to shut down.- Specified by:
shutdownin interfaceFCServerIfcExtended- Throws:
java.lang.Exception
-
generateDiagnostics
public void generateDiagnostics() throws java.lang.ExceptionGenerate a diagnostic on the server.- Specified by:
generateDiagnosticsin interfaceFCServerIfcExtended- Throws:
java.lang.Exception
-
getAuthorizationPath
protected java.lang.String getAuthorizationPath()
- Specified by:
getAuthorizationPathin classunlimited.core.util.LiteAPIBase
-
-