Awake File v1.1

org.awakefw.file.api.server
Class DefaultAwakeFileConfigurator

java.lang.Object
  extended by org.awakefw.file.api.server.DefaultAwakeFileConfigurator
All Implemented Interfaces:
AwakeFileConfigurator

public class DefaultAwakeFileConfigurator
extends Object
implements AwakeFileConfigurator

Default implementation of server side configuration for the Awake File Framework:

Since:
1.0

Constructor Summary
DefaultAwakeFileConfigurator()
          Constructor.
 
Method Summary
 boolean allowCallAfterAnalysis(String username, Connection connection, String methodName, List<Object> params)
          Allows, for the passed client username, to define a specific piece of Java code to analyze the method name and it's parameter values before allowing or not it's execution.
 File getServerRoot()
          Allows to define the Awake File Server root directory for the file storage & access.
 void runIfCallRefused(String username, Connection connection, String ipAddress, String methodName, List<Object> params)
          The event will be logged as Level.WARNING in the user.home/.awake/log/Awake.log file
 boolean useOneRootPerUsername()
          Allows to define if the Awake File Server must use a root directory per client username for the file storage & access.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAwakeFileConfigurator

public DefaultAwakeFileConfigurator()
Constructor.

Method Detail

allowCallAfterAnalysis

public boolean allowCallAfterAnalysis(String username,
                                      Connection connection,
                                      String methodName,
                                      List<Object> params)
                               throws IOException,
                                      SQLException
Description copied from interface: AwakeFileConfigurator
Allows, for the passed client username, to define a specific piece of Java code to analyze the method name and it's parameter values before allowing or not it's execution.
If the analysis defined by the method returns false, the the method call won't be executed.

Specified by:
allowCallAfterAnalysis in interface AwakeFileConfigurator
Parameters:
username - the client username to check the rule for
connection - the SQL Connection as configured in AwakeCommonsConfigurator.getConnection() implementation. Will be null if getConnection() was no configured.
methodName - the full method name to call in the format org.acme.config.package.MyClass.myMethod
params - the list of parameters passed to the method. Empty list if none.
Returns:
true: all methods called are always allowed for all client usernames
Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

getServerRoot

public File getServerRoot()
Description copied from interface: AwakeFileConfigurator
Allows to define the Awake File Server root directory for the file storage & access.

Specified by:
getServerRoot in interface AwakeFileConfigurator
Returns:
user.home/.awake-server-root. (user.home is the one of the servlet container).

runIfCallRefused

public void runIfCallRefused(String username,
                             Connection connection,
                             String ipAddress,
                             String methodName,
                             List<Object> params)
                      throws IOException,
                             SQLException
The event will be logged as Level.WARNING in the user.home/.awake/log/Awake.log file

Specified by:
runIfCallRefused in interface AwakeFileConfigurator
Parameters:
username - the client username
connection - the SQL Connection as configured in AwakeCommonsConfigurator.getConnection() implementation. Will be null if getConnection() was no configured.
ipAddress - the IP address of the client user
methodName - the full method name to call in the format org.acme.config.package.MyClass.myMethod
params - the list of parameters passed to the method

Throws:
IOException - if an IOException occurs
SQLException - if a SQLException occurs

useOneRootPerUsername

public boolean useOneRootPerUsername()
Description copied from interface: AwakeFileConfigurator
Allows to define if the Awake File Server must use a root directory per client username for the file storage & access.
If true, the name of the username will be used as root directory per user.

Specified by:
useOneRootPerUsername in interface AwakeFileConfigurator
Returns:
true: each user have it's own root directory. (The root directory name is the login username).

Awake File v1.1

Copyright © 2012 Kawan Softwares SAS