public class Client extends java.lang.Object implements ClientInterface
ClientInterface
,
ClientManagerInterface
,
TaskInterface
,
Task
Constructor and Description |
---|
Client(java.lang.String sessionKey)
Construct an object Client
|
Modifier and Type | Method and Description |
---|---|
void |
addTask(TaskInterface task)
Add a task to the client's list of TaskInterface
|
void |
cleanTasks(long maxTaskInactivityDuration)
Destroy all the old tasks from the client's list of tasks
|
long |
connectedSince()
Return the duration since the client connected
|
java.lang.String |
getPath()
Return the path to the client's directory on the server
|
java.lang.String |
getSessionKey()
Return the sessionKey of the client
|
TaskInterface |
getTaskById(int idTask)
Return the task's id given in parameters
|
int |
getTaskId(TaskInterface task)
Return the id of the TaskInterface given in parameters
|
long |
inactiveSince()
Return the duration since the client sent his last request
|
void |
inActivity()
Actualize the date of the client's last action
|
void |
kill()
Destroy all the tasks from the client's list of tasks and the
directory related to the client
|
void |
removeTask(TaskInterface task)
Remove a task from the client's list of TaskInterface
|
public Client(java.lang.String sessionKey)
sessionKey
- the string of the client's sessionKeytasksCleanerTimer
- the time frequency in milliseconds of the
cleaner timer's wakingmaxTaskInactivityDuration
- the time in milliseconds from which
a task is considered as too oldpublic java.lang.String getSessionKey()
getSessionKey
in interface ClientInterface
public java.lang.String getPath()
getPath
in interface ClientInterface
public void addTask(TaskInterface task)
addTask
in interface ClientInterface
task
- the TaskInterface to add to the client's list of
TaskInterfacepublic void removeTask(TaskInterface task)
removeTask
in interface ClientInterface
task
- the TaskInterface to remove from the cllient's list
of TaskInterfacepublic TaskInterface getTaskById(int idTask)
getTaskById
in interface ClientInterface
public int getTaskId(TaskInterface task)
getTaskId
in interface ClientInterface
public long connectedSince()
connectedSince
in interface ClientInterface
public long inactiveSince()
inactiveSince
in interface ClientInterface
public void inActivity()
inActivity
in interface ClientInterface
public void cleanTasks(long maxTaskInactivityDuration)
cleanTasks
in interface ClientInterface
public void kill()
kill
in interface ClientInterface