openlsd.network.client.admin
Class LSDClientAdmin

java.lang.Object
  extended by openlsd.network.client.common.LSDClientCommon
      extended by openlsd.network.client.admin.LSDClientAdmin

public class LSDClientAdmin
extends LSDClientCommon

Class LSDClientAdmin is the class that defines function to offer service to client part for Admin.

Author:
Frederic Bregier LGPL

Field Summary
 
Fields inherited from class openlsd.network.client.common.LSDClientCommon
clientCompressed, connector, executorChainService, hostname, idip, ls, lscsh, poolConnection, serverCompressed, serverPort, session
 
Constructor Summary
LSDClientAdmin(java.lang.String Hostname, int ServerPort, boolean immediate, boolean keepalived)
          Create a new ClientAdmin using a specific Hostname and serverPort.
LSDClientAdmin(java.lang.String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, boolean keepalived)
          Create a new ClientAdmin using a specific Hostname and serverPort and the properties of compression for server and client part.
 
Method Summary
 int createDirectory(java.lang.String key, boolean unique, long legacy, long storage)
          Ask to create the directory for a legacy, and eventually up to the specified storage.
protected  LSDClientCommonSessionHandler createSessionHandler()
          Create a SessionHandler.
 int deleteDirectory(java.lang.String key, boolean unique, long legacy, long storage, boolean recursive)
          Ask to delete the directory for a legacy, and eventually up to the specified storage.
 int enableLegacy(java.lang.String key, boolean unique, long legacy, boolean enable)
          Ask to enable/disable a legacy for some operations like put/del (move is still allow since this kind of disable is intend for moving files).
 int shutdown(java.lang.String key, boolean immediat)
          Ask to shutdown the server (with the opion immediat or not).
 int startServer(java.lang.String key, boolean unique, int server, int action)
          Ask to start/stop a server (server 1 = User, 2 = UserCompressed, 3 = Protected).
 
Methods inherited from class openlsd.network.client.common.LSDClientCommon
clear, clearObject, close, connect, connectionJoin, endClient, endClient, executorsClose, getObject, getStatus, initClient, initShared, isConnected, isSessionOK, lock, realClose, sessionReconnect, setObject, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LSDClientAdmin

public LSDClientAdmin(java.lang.String Hostname,
                      int ServerPort,
                      boolean immediate,
                      boolean keepalived)
Create a new ClientAdmin using a specific Hostname and serverPort. The client is immediately connected.

Parameters:
Hostname -
ServerPort -
immediate -
keepalived -

LSDClientAdmin

public LSDClientAdmin(java.lang.String Hostname,
                      int ServerPort,
                      boolean ServerCompressed,
                      boolean ClientCompressed,
                      boolean immediate,
                      boolean keepalived)
Create a new ClientAdmin using a specific Hostname and serverPort and the properties of compression for server and client part. The client is immediately connected.

Parameters:
Hostname -
ServerPort -
ServerCompressed -
ClientCompressed -
immediate -
keepalived -
Method Detail

createSessionHandler

protected LSDClientCommonSessionHandler createSessionHandler()
Create a SessionHandler. This function has to be rewritten by classes that extends this one.

Specified by:
createSessionHandler in class LSDClientCommon
Returns:
a new SessionHandler

enableLegacy

public int enableLegacy(java.lang.String key,
                        boolean unique,
                        long legacy,
                        boolean enable)
Ask to enable/disable a legacy for some operations like put/del (move is still allow since this kind of disable is intend for moving files). The boolean unique set if the get should close the connection after the full reception (true), or not (false).

Parameters:
key -
unique -
legacy -
enable - (true if to enable, false if to disable)
Returns:
the status of the command or <0 if an error occurs.

startServer

public int startServer(java.lang.String key,
                       boolean unique,
                       int server,
                       int action)
Ask to start/stop a server (server 1 = User, 2 = UserCompressed, 3 = Protected). The boolean unique set if the get should close the connection after the full reception (true), or not (false).

Parameters:
key -
unique -
server -
action - (0 if to stop, 1 if to start, 2 if to restart)
Returns:
the status of the command or <0 if an error occurs.

shutdown

public int shutdown(java.lang.String key,
                    boolean immediat)
Ask to shutdown the server (with the opion immediat or not).

Parameters:
key -
immediat - (true if to do without waiting current sessions, false if to do with waiting all sessions to finish)
Returns:
the status of the command or <0 if an error occurs.

createDirectory

public int createDirectory(java.lang.String key,
                           boolean unique,
                           long legacy,
                           long storage)
Ask to create the directory for a legacy, and eventually up to the specified storage. The boolean unique set if the get should close the connection after the full reception (true), or not (false).

Parameters:
key -
unique -
legacy -
storage -
Returns:
the status of the command or <0 if an error occurs.

deleteDirectory

public int deleteDirectory(java.lang.String key,
                           boolean unique,
                           long legacy,
                           long storage,
                           boolean recursive)
Ask to delete the directory for a legacy, and eventually up to the specified storage. The boolean tells if the wipe should be recursive. No files will be deleted, only empty directories. The boolean unique set if the get should close the connection after the full reception (true), or not (false). If the storage is KO, then the full legacy is to be deleted (in the same condition, no file is deleted).

Parameters:
key -
unique -
legacy -
storage -
recursive -
Returns:
the status of the command or <0 if an error occurs.