openlsd.network.client.admin.LSDClientAdmin Class Reference

Inheritance diagram for openlsd.network.client.admin.LSDClientAdmin:

Inheritance graph
[legend]
Collaboration diagram for openlsd.network.client.admin.LSDClientAdmin:

Collaboration graph
[legend]

List of all members.


Detailed Description

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

Author:
Frederic Bregier LGPL

Public Member Functions

 LSDClientAdmin (String Hostname, int ServerPort, boolean immediate, boolean keepalived)
 LSDClientAdmin (String Hostname, int ServerPort, boolean ServerCompressed, boolean ClientCompressed, boolean immediate, boolean keepalived)
int enableLegacy (String key, boolean unique, long legacy, boolean enable)
int startServer (String key, boolean unique, int server, int action)
int shutdown (String key, boolean immediat)
int createDirectory (String key, boolean unique, long legacy, long storage)
int deleteDirectory (String key, boolean unique, long legacy, long storage, boolean recursive)
void lock ()
void connect (boolean immediate, boolean keepalived)
boolean connectionJoin ()
boolean sessionReconnect ()
boolean isConnected ()
void clear ()
Object getObject ()
void setObject (Object object)
Object clearObject ()
void close ()
void realClose ()
int getStatus ()
void initShared ()
void unlock ()
String toString ()

Static Public Member Functions

static void initClient ()
static void endClient ()
static void endClient (boolean toexit)
static boolean isSessionOK (IoSession session)

Public Attributes

String hostname = "localhost"
int serverPort = 8080
boolean serverCompressed = false
boolean clientCompressed = false
long idip = LSDConstants.invalide_idx
IoSession session = null
SocketConnector connector = null
LSDClientSession ls = null
LSDClientCommonSessionHandler lscsh = null
ExecutorService executorChainService = null
LSDPoolConnectionAbstract poolConnection = null

Protected Member Functions

LSDClientCommonSessionHandler createSessionHandler ()

Constructor & Destructor Documentation

openlsd.network.client.admin.LSDClientAdmin.LSDClientAdmin ( 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 

openlsd.network.client.admin.LSDClientAdmin.LSDClientAdmin ( 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 


Member Function Documentation

LSDClientCommonSessionHandler openlsd.network.client.admin.LSDClientAdmin.createSessionHandler (  )  [protected, virtual]

Create a SessionHandler. This function has to be rewritten by classes that extends this one.

Returns:
a new SessionHandler

Implements openlsd.network.client.common.LSDClientCommon.

int openlsd.network.client.admin.LSDClientAdmin.enableLegacy ( 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.

int openlsd.network.client.admin.LSDClientAdmin.startServer ( 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.

int openlsd.network.client.admin.LSDClientAdmin.shutdown ( 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.

int openlsd.network.client.admin.LSDClientAdmin.createDirectory ( 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.

int openlsd.network.client.admin.LSDClientAdmin.deleteDirectory ( 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.

Lock in case of shared connection (no synchronized since if connection are not shared, they can be done in parallel)

static void openlsd.network.client.common.LSDClientCommon.initClient (  )  [static, inherited]

Init global structure like IoBufferAllocator

static void openlsd.network.client.common.LSDClientCommon.endClient (  )  [static, inherited]

End global structure like IoBufferAllocator

static void openlsd.network.client.common.LSDClientCommon.endClient ( boolean  toexit  )  [static, inherited]

End global structure like IoBufferAllocator

Parameters:
toexit 

void openlsd.network.client.common.LSDClientCommon.connect ( boolean  immediate,
boolean  keepalived 
) [inherited]

The client is now to be connected to the server using the specific SessionHandler that extends the LSDClientCommonSessionHandler class. This function is called by the Constructor.

If the connection is not ok, then the function isConnected() returns false. The client is immediately connected if immediate is true, else it will be connected after connectionJoint() will be called.

Parameters:
immediate 
keepalived True if the chainFilter should add the keepalived feature (mandatory in immediate mode to true if the keepalived filter is wanted)

boolean openlsd.network.client.common.LSDClientCommon.connectionJoin (  )  [inherited]

Join the connection, so as to finalize the connection process

Returns:
True if OK, else false

boolean openlsd.network.client.common.LSDClientCommon.sessionReconnect (  )  [inherited]

Enable to try to reconnect to the server if disconnected.

Returns:
True if reconnected, else False

boolean openlsd.network.client.common.LSDClientCommon.isConnected (  )  [inherited]

Returns the status of the connection and clear the session if not connected (sessionStop)

Returns:
the status of the connection

static boolean openlsd.network.client.common.LSDClientCommon.isSessionOK ( IoSession  session  )  [static, inherited]

Test if the session is still OK

Parameters:
session 
Returns:
True if the session is OK, else False

void openlsd.network.client.common.LSDClientCommon.clear (  )  [inherited]

clear session information

Object openlsd.network.client.common.LSDClientCommon.getObject (  )  [inherited]

Return the current user object of the session

Returns:
the user object or null if no session or object

void openlsd.network.client.common.LSDClientCommon.setObject ( Object  object  )  [inherited]

Set the current user object of the session

Parameters:
object 

Object openlsd.network.client.common.LSDClientCommon.clearObject (  )  [inherited]

Return the current user object of the session before clear the object stored.

Returns:
the past user object or null if no session or object

void openlsd.network.client.common.LSDClientCommon.close (  )  [inherited]

void openlsd.network.client.common.LSDClientCommon.realClose (  )  [inherited]

Will totally close the current session and finalize the Client. Reconnection cannot be done.

int openlsd.network.client.common.LSDClientCommon.getStatus (  )  [inherited]

Return the status of the request: 1 running, 0 finished, -1 error system, -2 error as request, -3 error as unavailable request, -4 error as cannot restore to previous state, -5 error as bad client request, -6 error as no service.

Returns:
the status (-6 to 1)

void openlsd.network.client.common.LSDClientCommon.initShared (  )  [inherited]

Initialized a lock to enable shared connection among threads

void openlsd.network.client.common.LSDClientCommon.unlock (  )  [inherited]

UnLock in case of shared connection

String openlsd.network.client.common.LSDClientCommon.toString (  )  [inherited]

Returns:
The String of the Client


Member Data Documentation

Hostname

Port for the server

Are messages compressed from Server

Are messages compressed from Client

Idip of server: not mandatory, should be set if needed after constructor

Associated session

SocketConnector openlsd.network.client.common.LSDClientCommon.connector = null [inherited]

Associated socket connector

Associated session info

Associated Session Handler

Associated ExecutorChainService

LSDPoolConnectionAbstract openlsd.network.client.common.LSDClientCommon.poolConnection = null [inherited]

The referent pool of connections if this connection is taken from a pool of connections


The documentation for this class was generated from the following file: