Class 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.Logger logger  
      • Fields inherited from class unlimited.core.util.LiteAPIBase

        password, port, server, username, webResourceConnector
    • Constructor Summary

      Constructors 
      Constructor Description
      FCServerLite()
      Default Contructor
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addTemporaryToken​(java.lang.String username, java.lang.String token)
      Add a temporary password token for a user.
      void addTempUser​(java.lang.String newusername, java.lang.String newuserpass)
      Adds a temporary FC web user to the system.
      void addTempUser​(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir)
      Adds a temporary FC web user to the system.
      void addTempUser​(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir, int userType)
      Deprecated.
      Adds a temporary user to the system.
      void addTempUser​(UserContainer user, java.lang.String password)
      Deprecated.
      void addUser​(java.lang.String newusername, java.lang.String newuserpass)
      Creates a new user on the remote FC server
      void addUser​(java.lang.String newusername, java.lang.String newuserpass, java.lang.String newhomedir)
      Creates a new user on the remote FC server with a home directory
      void addUser​(UserContainer user, java.lang.String password)
      Deprecated.
      void addUserGroup​(UserGroupContainer group)
      Add a new UserGroupContainer to the system.
      java.lang.String addVirtualFolder​(VirtualFolderContainer virtualFolder)
      Add a new VirtualFolderContainer to the system.
      void clearBlockedUser​(java.lang.String username)  
      void connect()
      Default connect.
      void connect​(java.lang.String hostname, int port, java.lang.String adminuser, java.lang.String adminpass)
      Connect with the arguments provided.
      void connect​(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.
      void connectNoStatus()
      Connects with no status message
      void createVirtualDownloadLinksForTheUser​(CreateVirtualDownloadLinksForUserContainer container, java.lang.String password)
      Deprecated.
      void deleteTemporaryToken​(java.lang.String username, java.lang.String token)
      Deletes temporary password token for a user.
      void deleteUserGroup​(java.lang.String groupName)
      Deletes the UserGroupContainer with the given name.
      void deleteVirtualFolder​(java.lang.String virtualFolderName)
      deletes the VirtualFolderContainer with the given name.
      void delUser​(java.lang.String delusername)
      Delets a user on the remote FC server
      void delUser​(java.lang.String delusername, boolean deleteHomeDirectory)
      Delets a user on the remote FC server and the user's home dir.
      void disconnect()
      Disconnct from the FileCatalyst Direct Server
      void enableUserGroup​(java.lang.String groupName)
      enables the UserGroup with the given name.
      void generateDiagnostics()
      Generate a diagnostic on the server.
      unlimited.fc.rest.shared.model.dataitem.DataItemsModel getAllConfigData()
      Returns All Of The Current Server Configurations
      java.util.Collection<UserContainer> getAllUsers()  
      protected java.lang.String getAuthorizationPath()  
      java.util.LinkedList<ClientSessionContainer> getClientSessions()
      Gets the list of sessions currently running on FileCatalyst Server.
      unlimited.fc.com.configsource.FCServerFileConfigSource getConfigSource()  
      java.lang.String getConfigValue​(java.lang.String configName)
      Returns a specific configuration
      int getDefaultIdleTime()
      Returns the amount of time that a client session is allowed to be idle when connected to the Server
      java.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.String getHostname()
      Returns the host name of the server
      java.net.URI getHTMLAdminURL​(boolean bypassServerConfigs)
      Returns the current HTML admin URL when called.
      int getHTTPPort()
      Get http port.
      long getLastConfigChangeTime()
      get last time for configuration change
      long getLastUsersChangeTime()
      get last time for configuration change
      java.lang.String getLicenseString()
      Returns the server license string
      java.lang.String getPassword()
      Returns the password of the server
      PermissionsContainer getPermissionsForGroupAndFolder​(java.lang.String groupname, java.lang.String foldername)
      Return a permission container that describes the relationship between the group and folder.
      PermissionsContainer getPermissionsForUserAndFolder​(java.lang.String userName, java.lang.String virtualFolderName)
      Permission list that a user has regarding a folder.
      int getReceiveRateKbps()
      Shows kbps rates (receive) of the server
      java.lang.String getRequestString()
      Returns the server request string
      int getTotalRateKbps()
      Shows kbps rates (total) of the server
      int getTransmitRateKbps()
      Shows kbps rates (transmit) of the server
      UserContainer getUser​(java.lang.String username)
      Get user information from the FileCatalyst Server.
      int getUserCount()
      Returns the current user count on the server
      UserGroupContainer getUserGroup​(java.lang.String groupName)
      UserGroupContainer associated with the entered name.
      java.util.Collection<UserGroupContainer> getUserGroups()
      List of UserGroupContainer.
      java.lang.String getUsername()
      Returns the user name of the server
      java.util.Collection<UserContainer> getUsers()
      Return a collection of the users on the system
      java.util.Collection<ResourceGrantedToFolder> getUsersLinkedToFolder​(java.lang.String virtualFolderName)
      Return a list of users linked to a folder
      java.util.Collection<java.lang.String> getUsersLinkedToGroup​(java.lang.String groupname)
      Returns user names linked to group name.
      VirtualFolderContainer getVirtualFolder​(java.lang.String virtualFolderName)
      returns the VirtualFolderContainer associated with the entered name.
      java.util.Collection<VirtualFolderContainer> getVirtualFolders()
      returns the VirtualFolders.
      void internalAddSpacesUser​(unlimited.fc.rest.server.model.SpacesUserAndVirtualFoldersModel model)  
      boolean isConnected()
      Tests to see if the ServerAPI is connected to the RemoteAdmin.
      boolean isStatusClientDisabled()
      Returns true.
      void killAllSessions()
      Kill all connected user sessions on the system
      void killSessionBySessionId​(java.lang.String sessionID)
      Kill specific session connected to the system
      void killSessionByUserId​(java.lang.String username)
      Kill specific users connected to the system
      void linkGroupAndFolder​(java.lang.String groupname, java.lang.String foldername, PermissionsContainer permission)
      Create access for a group to a virtual folder with a specified permission set.
      void linkUserAndFolder​(java.lang.String userName, java.lang.String virtualFolderName, PermissionsContainer permission)
      Links a user to a virtual folder with given permissions
      void linkUserAndGroup​(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 server
      UserContainer[] listUsers()
      Return list of UserContainers from the remote FC server
      void modifyUser​(UserContainer modifiedUserContainer)
      Modify a user on the remote server.
      void modifyUserGroup​(UserGroupContainer group)
      modifies the group with the name group.getName with the values of group.
      void modifyVirtualFolder​(VirtualFolderContainer virtualFolder)
      Modifies the virtual folder with with with the given name.
      void modUserPassword​(java.lang.String username, java.lang.String newpassword)
      Modify a user's password on the remote FC server
      void resetAllOverrides()
      Resets all bandwidth/priority overrides back to default values.
      void setConfigValue​(java.lang.String configName, java.lang.String configValue)
      Sets a specific configuration
      void setDefaultIdleTime​(int idleTime)
      Sets the amount of time that a session can be idle for
      void setHostname​(java.lang.String server)
      Sets the host name of the server to a new value
      void setLicenseString​(java.lang.String newLicense)
      Sets the server license key
      void setOverrideBandwidth​(java.lang.String sessionID, int bandwidthKbps)
      Sets an override priority for a given client session.
      void setOverridePriority​(java.lang.String sessionID, int priority)
      Sets an override priority for a given client session.
      void setPassword​(java.lang.String password)
      Sets the password of the server to a new value
      void setPort​(int port)
      Sets the port of the server to a new value
      protected void setSingleDataItem​(unlimited.fc.rest.shared.model.dataitem.DataItemModel dim)
      Sets a new single data item
      void setUserEnable​(java.lang.String username, boolean enabled)
      Allows enabling or disabling users on the remote FC server
      void setUserName​(java.lang.String username)
      Sets the user name of the server to a new value
      void shutdown()
      Tell the server to shut down.
      void unlinkGroupAndFolder​(java.lang.String groupname, java.lang.String foldername)
      Remove access of a group to a virtual folder.
      void unlinkUserAndFolder​(java.lang.String userName, java.lang.String virtualFolderName)
      Unlinks a user to a virtual folder.
      void unlinkUserAndGroup​(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
    • Field Detail

      • logger

        protected static java.util.logging.Logger logger
    • Constructor Detail

      • FCServerLite

        public FCServerLite()
        Default Contructor
    • Method Detail

      • connect

        public void connect()
                     throws java.lang.Exception
        Default connect. Assume the privage variables have already been set.
        Specified by:
        connect in interface FCServerIfc
        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.Exception
        Connect with the arguments provided. This will set the internal values for the WebResourceConnector that is used to communicate with the Server application.
        Specified by:
        connect in interface FCServerIfc
        Parameters:
        hostname - Hostname or IP of the server you wish to connect to
        port - HTTP port of the server that you wish to connect to
        adminuser - Administration username of the server
        adminpass - 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.Exception
        Connect when a particular HTTP scheme is known.
        Parameters:
        hostname - Hostname or IP of the server you wish to connect to
        port - HTTP port of the server that you wish to connect to
        adminuser - Administration username of the server
        adminpass - Administration password of the server
        httpScheme - 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.Exception
        Disconnct from the FileCatalyst Direct Server
        Specified by:
        disconnect in interface FCServerIfc
        Throws:
        java.lang.Exception
      • getUsername

        public java.lang.String getUsername()
        Returns the user name of the server
        Specified by:
        getUsername in interface FCServerIfc
        Overrides:
        getUsername in class unlimited.core.util.LiteAPIBase
        Returns:
        String representing the user name
      • getPassword

        public java.lang.String getPassword()
        Returns the password of the server
        Specified by:
        getPassword in interface FCServerIfc
        Overrides:
        getPassword in class unlimited.core.util.LiteAPIBase
        Returns:
        String representing the password
      • getHostname

        public java.lang.String getHostname()
        Returns the host name of the server
        Specified by:
        getHostname in interface FCServerIfc
        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:
        setUserName in interface FCServerIfc
        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:
        setPassword in interface FCServerIfc
        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:
        setHostname in interface FCServerIfc
        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:
        setPort in interface FCServerIfc
        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:
        isConnected in interface FCServerIfc
        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.Exception
        Return user name list on the remote FC server
        Specified by:
        listUserNames in interface FCServerIfc
        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:
        listUsers in interface FCServerIfcExtended
        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.Exception
        Creates a new user on the remote FC server
        Specified by:
        addUser in interface FCServerIfc
        Parameters:
        newusername - String
        newuserpass - 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.Exception
        Creates a new user on the remote FC server with a home directory
        Specified by:
        addUser in interface FCServerIfc
        Parameters:
        newusername - String
        newuserpass - String
        newhomedir - 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.Exception
        Delets a user on the remote FC server
        Specified by:
        delUser in interface FCServerIfc
        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.Exception
        Delets a user on the remote FC server and the user's home dir.
        Specified by:
        delUser in interface FCServerIfc
        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.Exception
        Allows enabling or disabling users on the remote FC server
        Specified by:
        setUserEnable in interface FCServerIfc
        Parameters:
        username - String
        enabled - 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.Exception
        Modify a user's password on the remote FC server
        Specified by:
        modUserPassword in interface FCServerIfc
        Parameters:
        username - String
        newpassword - 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.Exception
        Add 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:
        addTemporaryToken in interface FCServerIfc
        Parameters:
        username - String
        newpassword - 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.Exception
        Deletes 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:
        deleteTemporaryToken in interface FCServerIfc
        Parameters:
        username - String
        newpassword - 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:
        getUser in interface FCServerIfc
        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:
        modifyUser in interface FCServerIfc
        Parameters:
        data - .user UserContainer User container which has values already modified.
        Throws:
        InvalidArgumentException - If user does not exist on the server
        java.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:
        addUserGroup in interface FCServerIfc
        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:
        getUserGroup in interface FCServerIfc
        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:
        getUserGroups in interface FCServerIfc
        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:
        modifyUserGroup in interface FCServerIfc
        Parameters:
        group -
        Throws:
        java.lang.Exception
      • deleteUserGroup

        public void deleteUserGroup​(java.lang.String groupName)
                             throws java.lang.Exception
        Deletes the UserGroupContainer with the given name. all relationships associated with this group will be deleted.
        Specified by:
        deleteUserGroup in interface FCServerIfc
        Parameters:
        groupName -
        Throws:
        java.lang.Exception
      • enableUserGroup

        public void enableUserGroup​(java.lang.String groupName)
                             throws java.lang.Exception
        enables the UserGroup with the given name. all relationships associated with this group will be deleted.
        Specified by:
        enableUserGroup in interface FCServerIfc
        Parameters:
        groupName -
        Throws:
        java.lang.Exception
      • linkUserAndGroup

        public void linkUserAndGroup​(java.lang.String userName,
                                     java.lang.String groupName)
                              throws java.lang.Exception
        links the User and the UserGroupContainer with the given names.
        Specified by:
        linkUserAndGroup in interface FCServerIfc
        Parameters:
        userName -
        groupName -
        Throws:
        java.lang.Exception
      • unlinkUserAndGroup

        public void unlinkUserAndGroup​(java.lang.String userName,
                                       java.lang.String groupname)
                                throws java.lang.Exception
        unlinks the User and the UserGroupContainer with the given names.
        Specified by:
        unlinkUserAndGroup in interface FCServerIfc
        Parameters:
        userName -
        groupName -
        Throws:
        java.lang.Exception
      • getUsersLinkedToGroup

        public java.util.Collection<java.lang.String> getUsersLinkedToGroup​(java.lang.String groupname)
                                                                     throws java.lang.Exception
        Returns user names linked to group name.
        Specified by:
        getUsersLinkedToGroup in interface FCServerIfc
        Parameters:
        groupName -
        Throws:
        java.lang.Exception
      • getGroupsLinkedToUser

        public java.util.Collection<java.lang.String> getGroupsLinkedToUser​(java.lang.String userName)
                                                                     throws java.lang.Exception
        Returns group collection linked to user name.
        Specified by:
        getGroupsLinkedToUser in interface FCServerIfc
        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:
        addVirtualFolder in interface FCServerIfc
        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:
        getVirtualFolder in interface FCServerIfc
        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:
        getVirtualFolders in interface FCServerIfc
        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:
        modifyVirtualFolder in interface FCServerIfc
        Parameters:
        folder -
        Throws:
        java.lang.Exception
      • deleteVirtualFolder

        public void deleteVirtualFolder​(java.lang.String virtualFolderName)
                                 throws java.lang.Exception
        deletes the VirtualFolderContainer with the given name. all relationships associated with this VirtualFolderContainer will be deleted.
        Specified by:
        deleteVirtualFolder in interface FCServerIfc
        Parameters:
        virtualFolderName -
        Throws:
        java.lang.Exception
      • linkUserAndFolder

        public void linkUserAndFolder​(java.lang.String userName,
                                      java.lang.String virtualFolderName,
                                      PermissionsContainer permission)
                               throws java.lang.Exception
        Links a user to a virtual folder with given permissions
        Specified by:
        linkUserAndFolder in interface FCServerIfc
        Parameters:
        userName -
        virtualFolderName -
        permission -
        Throws:
        java.lang.Exception
      • unlinkUserAndFolder

        public void unlinkUserAndFolder​(java.lang.String userName,
                                        java.lang.String virtualFolderName)
                                 throws java.lang.Exception
        Unlinks a user to a virtual folder.
        Specified by:
        unlinkUserAndFolder in interface FCServerIfc
        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:
        getFoldersLinkedToUser in interface FCServerIfc
        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:
        getUsersLinkedToFolder in interface FCServerIfc
        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:
        getPermissionsForUserAndFolder in interface FCServerIfc
        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.Exception
        Create access for a group to a virtual folder with a specified permission set.
        Specified by:
        linkGroupAndFolder in interface FCServerIfc
        Parameters:
        groupname - Name of the group
        foldername - Folder name (not label), used as PK in the database
        permission - 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.Exception
        Remove access of a group to a virtual folder.
        Specified by:
        unlinkGroupAndFolder in interface FCServerIfc
        Parameters:
        groupname - Name of the group
        foldername - 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:
        getFoldersLinkedToGroup in interface FCServerIfc
        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:
        getGroupsLinkedToFolder in interface FCServerIfc
        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:
        getPermissionsForGroupAndFolder in interface FCServerIfc
        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.IllegalStateException
        Kill specific users connected to the system
        Specified by:
        killSessionByUserId in interface FCServerIfc
        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.IllegalStateException
        Kill all connected user sessions on the system
        Specified by:
        killAllSessions in interface FCServerIfc
        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:
        getClientSessions in interface FCServerIfc
        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.Exception
        Sets an override priority for a given client session.
        Specified by:
        setOverridePriority in interface FCServerIfc
        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.Exception
        Sets an override priority for a given client session.
        Specified by:
        setOverrideBandwidth in interface FCServerIfc
        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.Exception
        Resets all bandwidth/priority overrides back to default values.
        Specified by:
        resetAllOverrides in interface FCServerIfc
        Throws:
        java.lang.Exception - Cannot connect to the remote server
      • killSessionBySessionId

        public void killSessionBySessionId​(java.lang.String sessionID)
                                    throws java.lang.Exception,
                                           java.lang.IllegalStateException
        Kill specific session connected to the system
        Specified by:
        killSessionBySessionId in interface FCServerIfc
        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.IllegalStateException
        Shows kbps rates (transmit) of the server
        Specified by:
        getTransmitRateKbps in interface FCServerIfc
        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.IllegalStateException
        Shows kbps rates (receive) of the server
        Specified by:
        getReceiveRateKbps in interface FCServerIfc
        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.IllegalStateException
        Shows kbps rates (total) of the server
        Specified by:
        getTotalRateKbps in interface FCServerIfc
        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.IllegalStateException
        get 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.IllegalStateException
        get 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.
      • getAllConfigData

        public unlimited.fc.rest.shared.model.dataitem.DataItemsModel getAllConfigData()
                                                                                throws APINotConnectedException
        Returns 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 APINotConnectedException
        Returns 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.Exception
        Sets a specific configuration
        Parameters:
        configName - Configuration that you would like
        configValue - Value for the configuration that you are setting
        Throws:
        java.lang.Exception
      • setLicenseString

        public void setLicenseString​(java.lang.String newLicense)
                              throws java.lang.Exception
        Sets the server license key
        Specified by:
        setLicenseString in interface FCServerIfc
        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.Exception
        Sets 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:
        getAllUsers in interface FCServerIfc
        Throws:
        java.lang.Exception
      • getUserCount

        public int getUserCount()
                         throws java.lang.Exception
        Returns the current user count on the server
        Specified by:
        getUserCount in interface FCServerIfc
        Returns:
        Current user count
        Throws:
        java.lang.Exception
      • connectNoStatus

        public void connectNoStatus()
                             throws java.lang.Exception
        Connects with no status message
        Specified by:
        connectNoStatus in interface FCServerIfc
        Throws:
        java.lang.Exception
      • setDefaultIdleTime

        public void setDefaultIdleTime​(int idleTime)
                                throws java.lang.Exception
        Description copied from interface: FCServerIfc
        Sets the amount of time that a session can be idle for
        Specified by:
        setDefaultIdleTime in interface FCServerIfc
        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.Exception
        Adds 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:
        addTempUser in interface FCServerIfc
        Parameters:
        newusername - Name of the user to be created
        newuserpass - 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.Exception
        Adds 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:
        addTempUser in interface FCServerIfc
        Parameters:
        newusername - Name of the user to be created
        newuserpass - Password for the user to be created
        newhomedir - 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.Exception
        Deprecated.
        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:
        addTempUser in interface FCServerIfc
        Parameters:
        newusername - Name of the user to be created
        newuserpass - Password for the user to be created
        newhomedir - Home directory of the user to be created
        userType - Ignored. Value always default to TEMPORARY_FC_WEB_USER (3)
        Throws:
        java.lang.Exception
      • getHTTPPort

        public int getHTTPPort()
        Get http port.
        Specified by:
        getHTTPPort in interface FCServerIfc
        Returns:
        http port if http enable, otherwise return 0.
      • getHTMLAdminURL

        public java.net.URI getHTMLAdminURL​(boolean bypassServerConfigs)
                                     throws java.lang.Exception
        Description copied from interface: FCServerIfcExtended
        Returns the current HTML admin URL when called. Throws exception if the administration can't be properly used.
        Specified by:
        getHTMLAdminURL in interface FCServerIfcExtended
        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:
        getConfigSource in interface FCServerIfc
      • shutdown

        public void shutdown()
                      throws java.lang.Exception
        Tell the server to shut down.
        Specified by:
        shutdown in interface FCServerIfcExtended
        Throws:
        java.lang.Exception
      • generateDiagnostics

        public void generateDiagnostics()
                                 throws java.lang.Exception
        Generate a diagnostic on the server.
        Specified by:
        generateDiagnostics in interface FCServerIfcExtended
        Throws:
        java.lang.Exception
      • getAuthorizationPath

        protected java.lang.String getAuthorizationPath()
        Specified by:
        getAuthorizationPath in class unlimited.core.util.LiteAPIBase