Esempio n. 1
0
        public void Post(UpdateFile request)
        {
            logger.Debug("Request received for updating user file for client id :" + request.clientId
                         + " and file name :" + request.file.filepath);

            if (!filesystem.AuthenticateUser(request.clientId, request.password))
            {
                throw new AuthenticationException("Authentication failed");
            }

            filesystem.addFileSynchronized(request.clientId, request.file);
        }
Esempio n. 2
0
        public void Post(UpdateFile request)
        {
            logger.Info("****Request received for updating user file for client id  : " + request.clientId
                        + " and file name : " + request.file.filemetadata.filepath
                        );

            if (!filesystem.AuthenticateUser(request.clientId, request.password))
            {
                throw new AuthenticationException("Authentication failed");
            }

            // Send the File to the All other Nodes in a Ordered Way
            FileServerComm serverComm = FileServerComm.getInstance();

            Address [] memberAdresses = serverComm.getFileServerGroup().getLiveMembers();

            List <Address> where = new List <Address>();
            where.AddRange(memberAdresses);

            if (true == serverComm.getFileHandler().sendsynchaddFileToMemory(request.clientId, request.file,
                                                                             serverComm.getOOBHandler(), serverComm.getFileServerGroup(),
                                                                             where))
            {
                try {
                    filesystem.addFileSynchronized(request.clientId, request.file);
                } catch (Exception e) {
                    logger.Debug("Exception occured while updating user file for client id  : " + request.clientId
                                 + " and file name : " + request.file.filemetadata.filepath, e);
                    throw e;
                }
            }
            else
            {
                throw new Exception("File Cannot be Added, Some Internal error");
            }
        }