do not lock resource if entity object does not exist
[pithos] / src / gr / ebs / gss / server / ejb / ExternalAPI.java
index 9d80371..454b359 100644 (file)
@@ -24,11 +24,15 @@ import gr.ebs.gss.client.exceptions.InsufficientPermissionsException;
 import gr.ebs.gss.client.exceptions.InvitationUsedException;
 import gr.ebs.gss.client.exceptions.ObjectNotFoundException;
 import gr.ebs.gss.client.exceptions.QuotaExceededException;
+import gr.ebs.gss.server.domain.FileHeader;
 import gr.ebs.gss.server.domain.FileUploadStatus;
+import gr.ebs.gss.server.domain.FileLock;
 import gr.ebs.gss.server.domain.Invitation;
 import gr.ebs.gss.server.domain.Nonce;
 import gr.ebs.gss.server.domain.User;
 import gr.ebs.gss.server.domain.UserClass;
+import gr.ebs.gss.server.domain.UserLogin;
+import gr.ebs.gss.server.domain.WebDavNonce;
 import gr.ebs.gss.server.domain.dto.FileBodyDTO;
 import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
 import gr.ebs.gss.server.domain.dto.FolderDTO;
@@ -40,7 +44,6 @@ import gr.ebs.gss.server.domain.dto.UserDTO;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.MalformedURLException;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
@@ -49,8 +52,7 @@ import javax.ejb.Local;
 import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
 
-import org.apache.commons.configuration.Configuration;
-import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 
 /**
  * The External API for GSS clients.
@@ -345,19 +347,6 @@ public interface ExternalAPI {
        public void deleteFile(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
 
        /**
-        * Deletes the specified file in the specified user's namespace.
-        *
-        * @param userId the ID of the current user
-        * @param fileIds the IDs of the files to delete
-        * @throws ObjectNotFoundException if the user or file was not found, with
-        *             the exception message mentioning the precise problem
-        * @throws InsufficientPermissionsException if the user does not have the
-        *             appropriate privileges
-        */
-       public void deleteFiles(Long userId, List<Long> fileIds)
-                       throws ObjectNotFoundException, InsufficientPermissionsException;
-
-       /**
         * Creates a new tag for the specified user and file.
         *
         * @param userId the creator of the tag
@@ -648,31 +637,6 @@ public interface ExternalAPI {
        public void removeFileFromTrash(Long userId, Long fileId) throws ObjectNotFoundException, InsufficientPermissionsException;
 
        /**
-        * Marks  the specified files as deleted in the specified user's namespace.
-        *
-        * @param userId the ID of the current user
-        * @param fileIds the IDs of the file to delete
-        * @throws ObjectNotFoundException if the user or file was not found, with
-        *             the exception message mentioning the precise problem
-        * @throws InsufficientPermissionsException if the user does not have the
-        *             appropriate privileges
-        */
-       public void moveFilesToTrash(Long userId, List<Long> fileIds)
-                       throws ObjectNotFoundException, InsufficientPermissionsException;
-
-       /**
-        * Marks  the specified deleted files as undeleted in the specified user's namespace.
-        *
-        * @param userId the ID of the current user
-        * @param fileIds the IDs of the file to undelete
-        * @throws ObjectNotFoundException if the user or file was not found, with
-        *             the exception message mentioning the precise problem
-        * @throws InsufficientPermissionsException if the user does not have the
-        *             appropriate privileges
-        */
-       public void removeFilesFromTrash(Long userId, List<Long> fileIds) throws ObjectNotFoundException, InsufficientPermissionsException;
-
-       /**
         * Marks  the specified folder as deleted in the specified user's namespace.
         *
         * @param userId the ID of the current user
@@ -992,7 +956,7 @@ public interface ExternalAPI {
         * @return list of files that match query
         * @throws ObjectNotFoundException if no user or query was specified
         */
-       public List<FileHeaderDTO> searchFiles(Long userId, String query) throws ObjectNotFoundException;
+       public List<FileHeader> searchFiles(Long userId, String query) throws ObjectNotFoundException;
 
        /**
         * Creates a nonce for the specified user.
@@ -1072,20 +1036,6 @@ public interface ExternalAPI {
                        throws ObjectNotFoundException, InsufficientPermissionsException,  GSSIOException, QuotaExceededException;
 
        /**
-        * Remove file version identified by bodyId
-        *
-        * @param userId the ID of the user
-        * @param fileId the ID of the file
-        * @param bodyId the ID of the body
-        *
-        * @throws ObjectNotFoundException
-        * @throws InsufficientPermissionsException
-        *
-        */
-       public void removeVersion(Long userId, Long fileId, Long bodyId)
-                       throws ObjectNotFoundException, InsufficientPermissionsException;
-
-       /**
         * Removes all old file versions for specified file keeping only the current revision
         *
         * @param userId the ID of the user
@@ -1101,12 +1051,12 @@ public interface ExternalAPI {
        /**
         * It is used by the Solr mbean to rebuild the index.
         */
-       public void rebuildSolrIndex();
+       public String rebuildSolrIndex();
 
        /**
         * It is used by the Solr mbean to refresh the index. It does not delete anything just re-add everything in the index
         */
-       public void refreshSolrIndex();
+       public String refreshSolrIndex();
        
        /**
         * Creates a new file with the specified owner, parent folder and name. The
@@ -1270,11 +1220,87 @@ public interface ExternalAPI {
         * Delete the actual file in the specified file system path.
         */
        public void deleteActualFile(String path);
+       
+       /**
+        * Update the userLogin with the values from the supplied object.
+        */
+       public void addUserLogin(UserLogin userLogin);
+       
+       /**
+        * Retrieves the user's current session login and the user's last login
+        * @param userId
+        * @return a list of last two user logins
+        * @throws ObjectNotFoundException 
+        */
+       public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException;
 
        /**
         * Posts the file specified by id to solr indexing server
-        * 
+        *
+     * @param solr
+        * @param id
+        */
+       public void postFileToSolr(CommonsHttpSolrServer solr, Long id);
+
+       /**
+        * @param username
+        * @return
+        */
+       UserDTO getUserByUserName(String username);
+
+       /**
+        * @param lock
+        * @return
+        */
+       FileLock saveOrUpdateLock(FileLock lock);
+
+       /**
+        * @param lock
+        */
+       void removeLock(FileLock lock);
+
+       /**
+        * @param tokenId
+        * @return
+        */
+       FileLock getLockByToken(String tokenId);
+
+       /**
         * @param id
+        * @return
         */
-       public void postFileToSolr(Long id);
+       FileLock getLockById(String id);
+
+       /**
+        * @param userId
+        * @param folderId
+        * @param name
+        * @return
+        * @throws DuplicateNameException
+        * @throws ObjectNotFoundException
+        * @throws GSSIOException
+        * @throws InsufficientPermissionsException
+        * @throws QuotaExceededException
+        */
+       FileHeaderDTO createEmptyFile(Long userId, Long folderId, String name) throws DuplicateNameException, ObjectNotFoundException, GSSIOException, InsufficientPermissionsException, QuotaExceededException;
+
+       /**
+        * @param nonce
+        * @return
+        */
+       WebDavNonce saveOrUpdateWebDavNonce(WebDavNonce nonce);
+
+       /**
+        * @param nonce
+        */
+       void removeWebDavNonce(WebDavNonce nonce);
+
+       /**
+        * @param tokenId
+        * @return
+        */
+       WebDavNonce getWebDavNonce(String tokenId);
+       
+
+
 }