Migrated to solr 1.4. Added a filter factory so that solr can use the greek lower...
[pithos] / src / gr / ebs / gss / server / ejb / ExternalAPI.java
index 2634c21..9d80371 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007, 2008, 2009 Electronic Business Systems Ltd.
+ * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
  *
  * This file is part of GSS.
  *
@@ -21,11 +21,14 @@ package gr.ebs.gss.server.ejb;
 import gr.ebs.gss.client.exceptions.DuplicateNameException;
 import gr.ebs.gss.client.exceptions.GSSIOException;
 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.FileUploadStatus;
+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.dto.FileBodyDTO;
 import gr.ebs.gss.server.domain.dto.FileHeaderDTO;
 import gr.ebs.gss.server.domain.dto.FolderDTO;
@@ -37,6 +40,7 @@ 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;
@@ -45,6 +49,9 @@ 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;
+
 /**
  * The External API for GSS clients.
  *
@@ -249,6 +256,7 @@ public interface ExternalAPI {
         * @param userId the ID of the current user
         * @param folderId the ID of the folder to retrieve
         * @param folderName
+        * @param readForAll
         * @param permissions
         * @return the updated folder
         * @throws InsufficientPermissionsException if the user does not have the
@@ -258,7 +266,9 @@ public interface ExternalAPI {
         * @throws DuplicateNameException if the specified name already exists in
         *             the parent folder, as either a folder or file
         */
-       public FolderDTO updateFolder(Long userId, Long folderId, String folderName, Set<PermissionDTO> permissions)
+       public FolderDTO updateFolder(Long userId, Long folderId, String folderName,
+                               Boolean readForAll,
+                               Set<PermissionDTO> permissions)
                        throws InsufficientPermissionsException, ObjectNotFoundException, DuplicateNameException;
 
        /**
@@ -828,28 +838,18 @@ public interface ExternalAPI {
         * Create a new user with the specified name, username and e-mail address.
         *
         * @param username the username of the new user
-        * @param name the full name of the new user
+        * @param name the name of the new user
         * @param mail the e-mail of the new user
+        * @param idp the IdP of the new user
+        * @param idpid the IdP identifier of the new user
         * @return the newly-created User object
         * @throws DuplicateNameException if a user with the same username already exists
         * @throws ObjectNotFoundException if no username was provided
         */
-       public User createUser(String username, String name, String mail)
+       public User createUser(String username, String name, String mail, String idp, String idpid)
                        throws DuplicateNameException, ObjectNotFoundException;
 
        /**
-        * Update the user with the specified username with the provided name
-        * and e-mail address.
-        *
-        * @param username the username of the user
-        * @param name the modified full name of the user
-        * @param mail the modified e-mail of the user
-        * @return the updated User object
-        * @throws ObjectNotFoundException if no username was provided
-        */
-       public User updateUser(String username, String name, String mail) throws ObjectNotFoundException;
-
-       /**
         * Updates the authentication token for the specified user.
         *
         * @param userId the ID of the user whose token should be updated
@@ -1104,6 +1104,11 @@ public interface ExternalAPI {
        public void 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();
+       
+       /**
         * Creates a new file with the specified owner, parent folder and name. The
         * new file has the same permissions as its parent folder. The file contents
         * are already uploaded outside of externalAPI and the uploaded file is used as a parameter.
@@ -1219,4 +1224,57 @@ public interface ExternalAPI {
         */
        public String resetWebDAVPassword(Long userId) throws ObjectNotFoundException;
 
+       /**
+        * Find the invite for the specified invitation code.
+        *
+        * @param code the invitation code
+        * @return the Invitation or null if not found
+        */
+       public Invitation findInvite(String code);
+
+       /**
+        * Create a new user in the connected IdP.
+        *
+        * @param username the username of the new user
+        * @param firstname the first name of the new user
+        * @param lastname the last name of the new user
+        * @param email the e-mail of the new user
+        * @param password the password of the new user
+        */
+       public void createLdapUser(String username, String firstname, String lastname, String email, String password);
+
+       /**
+        * Retrieves the available user classes.
+        */
+       public List<UserClass> getUserClasses();
+
+       /**
+        * Upgrades the user class to the default "coupon bearer" class and marks
+        * the provided coupon as used.
+        *
+        * @param username the username of the user
+        * @param code the coupon code
+        * @return the new user class
+        * @throws InvitationUsedException when trying to reuse an already used invitation
+        * @throws ObjectNotFoundException if the user was not found
+        */
+       public UserClass upgradeUserClass(String username, String code)
+                       throws ObjectNotFoundException, InvitationUsedException;
+
+       /**
+        * Retrieve the user class for coupon-bearing users.
+        */
+       public UserClass getCouponUserClass();
+
+       /**
+        * Delete the actual file in the specified file system path.
+        */
+       public void deleteActualFile(String path);
+
+       /**
+        * Posts the file specified by id to solr indexing server
+        * 
+        * @param id
+        */
+       public void postFileToSolr(Long id);
 }