info.aduna.gee.publication.servlets.db
Class DatabaseHandler

java.lang.Object
  extended by info.aduna.gee.publication.servlets.db.DatabaseHandler

public class DatabaseHandler
extends Object

Class DatabaseHandler contains utility methods for adding and removing Zpad users. Futhermore: DatabaseHandler is the only class that has knowledge about the "database" files in the user's or system's configuration.


Field Summary
static String EXTERNAL_EMAIL
           
static String EXTERNAL_PASSWORD
           
 
Constructor Summary
DatabaseHandler()
           
 
Method Summary
protected static SubscriptionDefinitions _evaluateAndMergeSystemSubscriptions(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, Vector sbsInfos)
           
protected static void _rmMinusR(File fileOrDir)
           
static void addCover(javax.servlet.http.HttpServletRequest request, CoverInfo coverInfo)
          Add a cover to a Zpad server.
static void addCoverBuilder(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, String categories)
          Add a cover builing user to a Zpad server.
static void addDefaultsUser(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, String categories)
          Add a 'defaults' maintenance user to a Zpad server.
static void addReplicator(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, String categories)
          Add a replicator user to a Zpad server.
static void addUser(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, String categories)
          Add a user to a Zpad server.
static void copyDirectory(File source, File dest)
          Copy the contents of one directory to another.
static void copyFile(File source, File dest)
          Copy the contents of one file to another.
static InputStream getDecodingInputStream(String path)
           
static HashSet getUserCategories(javax.servlet.http.HttpServletRequest request, UserInfo userInfo)
           
static WProperties getUserCLabelDescriptions(javax.servlet.http.HttpServletRequest request, UserInfo userInfo)
           
static CoverInfo getUserCover(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, boolean useRequest)
          Get the user's Cover.
static SubscriptionDefinitions getUserDefaultSubscriptions(javax.servlet.http.HttpServletRequest request, UserInfo userInfo)
           
static HashMap getUserSubscriptions(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, boolean ignorePL)
           
static SubscriptionDefinitions getUserSystemSubscriptions(javax.servlet.http.HttpServletRequest request, UserInfo userInfo)
           
static void removeCover(javax.servlet.http.HttpServletRequest request, CoverInfo coverInfo)
          Remove a cover from a Zpad server.
static void removeUser(javax.servlet.http.HttpServletRequest request, UserInfo userInfo)
          Remove a user from a Zpad server.
static void removeUser(String host, UserInfo userInfo)
           
static void storeCoverCategoryRules(javax.servlet.http.HttpServletRequest request, CoverInfo coverInfo, String carString)
          Store the cover's category rules
static void storeUserCategories(javax.servlet.http.HttpServletRequest request, UserInfo userInfo, String categories)
          Store the user's categories
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTERNAL_PASSWORD

public static final String EXTERNAL_PASSWORD
See Also:
Constant Field Values

EXTERNAL_EMAIL

public static final String EXTERNAL_EMAIL
See Also:
Constant Field Values
Constructor Detail

DatabaseHandler

public DatabaseHandler()
Method Detail

addUser

public static void addUser(javax.servlet.http.HttpServletRequest request,
                           UserInfo userInfo,
                           String categories)
                    throws IOException
Add a user to a Zpad server. This sets up a directory for the user on the server and adds the user info to the database.

Throws:
IOException

addCoverBuilder

public static void addCoverBuilder(javax.servlet.http.HttpServletRequest request,
                                   UserInfo userInfo,
                                   String categories)
                            throws IOException
Add a cover builing user to a Zpad server. This sets up a directory for the user on the server and adds the user info to the database.

Throws:
IOException

addReplicator

public static void addReplicator(javax.servlet.http.HttpServletRequest request,
                                 UserInfo userInfo,
                                 String categories)
                          throws IOException
Add a replicator user to a Zpad server. This sets up a directory for the user on the server and adds the user info to the database.

Throws:
IOException

addDefaultsUser

public static void addDefaultsUser(javax.servlet.http.HttpServletRequest request,
                                   UserInfo userInfo,
                                   String categories)
                            throws IOException
Add a 'defaults' maintenance user to a Zpad server. This sets up a directory for the user on the server and adds the user info to the database.

Throws:
IOException

removeUser

public static void removeUser(javax.servlet.http.HttpServletRequest request,
                              UserInfo userInfo)
                       throws IOException
Remove a user from a Zpad server. Marks the user directory as deleted and removes the user from the database. Note that the directory will have to be removed manually.

Throws:
IOException

removeUser

public static void removeUser(String host,
                              UserInfo userInfo)
                       throws IOException
Throws:
IOException

addCover

public static void addCover(javax.servlet.http.HttpServletRequest request,
                            CoverInfo coverInfo)
                     throws IOException
Add a cover to a Zpad server. This sets up a directory for the cover on the server and adds the cover info to the database.

Throws:
IOException

removeCover

public static void removeCover(javax.servlet.http.HttpServletRequest request,
                               CoverInfo coverInfo)
                        throws IOException
Remove a cover from a Zpad server. Marks the cover directory as deleted and removes the cover from the database. Note that the directory will have to be removed manually.

Throws:
IOException

copyDirectory

public static void copyDirectory(File source,
                                 File dest)
                          throws IOException
Copy the contents of one directory to another.

Parameters:
source - the directory to copy
dest - the directory to copy to.
Throws:
IOException

copyFile

public static void copyFile(File source,
                            File dest)
                     throws IOException
Copy the contents of one file to another.

Parameters:
source - the file to copy
dest - the file to copy to.
Throws:
IOException

getUserCategories

public static HashSet getUserCategories(javax.servlet.http.HttpServletRequest request,
                                        UserInfo userInfo)

getUserSubscriptions

public static HashMap getUserSubscriptions(javax.servlet.http.HttpServletRequest request,
                                           UserInfo userInfo,
                                           boolean ignorePL)
                                    throws IOException
Throws:
IOException

getUserSystemSubscriptions

public static SubscriptionDefinitions getUserSystemSubscriptions(javax.servlet.http.HttpServletRequest request,
                                                                 UserInfo userInfo)

getUserDefaultSubscriptions

public static SubscriptionDefinitions getUserDefaultSubscriptions(javax.servlet.http.HttpServletRequest request,
                                                                  UserInfo userInfo)

_evaluateAndMergeSystemSubscriptions

protected static SubscriptionDefinitions _evaluateAndMergeSystemSubscriptions(javax.servlet.http.HttpServletRequest request,
                                                                              UserInfo userInfo,
                                                                              Vector sbsInfos)

getUserCLabelDescriptions

public static WProperties getUserCLabelDescriptions(javax.servlet.http.HttpServletRequest request,
                                                    UserInfo userInfo)

getDecodingInputStream

public static InputStream getDecodingInputStream(String path)

storeUserCategories

public static void storeUserCategories(javax.servlet.http.HttpServletRequest request,
                                       UserInfo userInfo,
                                       String categories)
Store the user's categories


storeCoverCategoryRules

public static void storeCoverCategoryRules(javax.servlet.http.HttpServletRequest request,
                                           CoverInfo coverInfo,
                                           String carString)
Store the cover's category rules


getUserCover

public static CoverInfo getUserCover(javax.servlet.http.HttpServletRequest request,
                                     UserInfo userInfo,
                                     boolean useRequest)
Get the user's Cover.

Parameters:
useRequest - if true, use the "cover=...." that might be part of the request if false, ignore it (e.g. in "/find/....?cover=....)

_rmMinusR

protected static void _rmMinusR(File fileOrDir)


Copyright © 1997-2008 Aduna. All Rights Reserved.