org.chorem.jtimer.ws.xmlrpc
Class ChoremXMLRPCClient

java.lang.Object
  extended by org.chorem.jtimer.ws.xmlrpc.AbstractXMLRPCClient
      extended by org.chorem.jtimer.ws.xmlrpc.ChoremXMLRPCClient
All Implemented Interfaces:
EventListener, DataEventListener, VetoableDataEventListener, ProjectManagement

public class ChoremXMLRPCClient
extends AbstractXMLRPCClient
implements ProjectManagement

ChoremXMLRPCClient.

Version:
$Revision: 2832 $ Last update : $Date: 2008-06-13 17:56:15 +0200 (ven., 13 juin 2008)$ By : $Author: echatellier $
Author:
chatellier

Field Summary
protected  ConnectionDataHandler connectionDataHandler
          Connection handler.
protected  TimerDataManager dataManager
          Data manager
protected  String endpoint
          Endpoint.
protected  String resourceName
          Resource name.
protected  Map<List<String>,String> taskToTopiaId
          Map des task vers les topiaId.
 
Constructor Summary
ChoremXMLRPCClient()
           
 
Method Summary
 void addProject(TimerProject project)
          Add project event.
protected  void addTask(Map<String,TimerProject> mapOfProjects, List<String> taskNames)
          Add new task in current tree.
protected  String addTask(String userId, String superTopiaId, String name)
          Add task on remote server.
 void addTask(TimerTask task)
          Add task event.
protected  void addTask(TimerTask task, List<String> taskNames)
          Add task in task subtask.
 void changeClosedState(TimerTask task)
          Change task state.
 void checkAddProject(TimerProject project)
          Check add project.
 void checkAddTask(TimerTask parent, TimerTask task)
          Check add task.
 void checkChangeClosedState(TimerTask task)
          Check change task state.
 void checkDeleteProject(TimerProject project)
          Check delete project.
 void checkDeleteTask(TimerTask task)
          Check delete task.
 void checkMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks)
          Check merge task.
 void checkModifyProject(TimerProject project)
          Check modify project.
 void checkModifyTask(TimerTask task)
          Check modify task.
 void checkMoveTask(TimerTask destination, Collection<TimerTask> tasksToMove)
          Check move task.
 void checkSetAnnotation(TimerTask task, Date date, String annotation)
          Check update task annotation.
 void checkSetTaskTime(TimerTask task, Date date, Long value)
          Check update task time.
 void dataLoaded(Collection<TimerProject> projects)
          All data loaded.
 void deleteProject(TimerProject project)
          Delete project.
 void deleteTask(TimerTask task)
          Delete task.
protected  Object get(String serviceName, Object... args)
          Redefine get to prefix service name
 String getEndpoint()
          Get endpoint address.
 Map<String,String> getIdAndLoginsMap()
          Get id/login map available on remote services.
protected  Date getLastUpdate(String userId)
          Get last update date from remote server.
 String getResourceName()
          Get service resource name.
 List<TimerProject> getUserProjects(String userId)
          Get project list
 String login(String login, String password)
          Do login operation
 void modifyProject(TimerProject project)
          Modify project.
 void modifyTask(TimerTask task)
          Modify task.
 void moveTask(TimerTask task)
          Post move task.
 void postMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks)
          Post merge task.
 void preMergeTasks(TimerTask destinationTask, List<TimerTask> otherTasks)
          Pre merge task.
 void preMoveTask(TimerTask task)
          Pre move task.
 void setAnnotation(TimerTask task, Date date, String annotation)
          Add annotation.
 void setConnectionDataHandler(ConnectionDataHandler connectionDataHandler)
          Set connection handler.
 void setDataManager(TimerDataManager dataManager)
          Set data manager.
 void setEndpoint(String endpoint)
          Set service endpoint.
 void setResourceName(String resourceName)
          Set service resource name.
 void setTaskTime(TimerTask task, Date date, Long time)
          Set task time.
 void startTask(TimerTask task)
          Start task.
 void stopTask(TimerTask task)
          Stop task.
protected  void synchronization()
          Synchronization (from server).
 void synchronize(String userId, List<TimerProject> projects)
          Synchronize a single project.
protected  void synchronizeTask(String userId, TimerTask task, Date lastUpdateDate, List<String> currentTaskPath)
          Synchronize a single task.
protected  void syncTask(String userId, String topiaId, Date dateOfDay, long timeOfDay)
          Sync a task, call xmlrpc.
 void syncTask(String userId, TimerTask task, Date dateOfDay, long timeOfDay)
          Sync a task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endpoint

protected String endpoint
Endpoint.


resourceName

protected String resourceName
Resource name.


taskToTopiaId

protected Map<List<String>,String> taskToTopiaId
Map des task vers les topiaId.


connectionDataHandler

protected ConnectionDataHandler connectionDataHandler
Connection handler.


dataManager

protected TimerDataManager dataManager
Data manager

Constructor Detail

ChoremXMLRPCClient

public ChoremXMLRPCClient()
Method Detail

setDataManager

public void setDataManager(TimerDataManager dataManager)
Description copied from interface: ProjectManagement
Set data manager.

Specified by:
setDataManager in interface ProjectManagement
Parameters:
dataManager - data manager

setEndpoint

public void setEndpoint(String endpoint)
Description copied from interface: ProjectManagement
Set service endpoint.

Specified by:
setEndpoint in interface ProjectManagement
Parameters:
endpoint - service endpoint

getEndpoint

public String getEndpoint()
Description copied from class: AbstractXMLRPCClient
Get endpoint address.

Specified by:
getEndpoint in interface ProjectManagement
Specified by:
getEndpoint in class AbstractXMLRPCClient
Returns:
endpoint address

getResourceName

public String getResourceName()
Description copied from interface: ProjectManagement
Get service resource name.

Specified by:
getResourceName in interface ProjectManagement
Returns:
service resource name

setResourceName

public void setResourceName(String resourceName)
Description copied from interface: ProjectManagement
Set service resource name.

Specified by:
setResourceName in interface ProjectManagement
Parameters:
resourceName - service resource name

setConnectionDataHandler

public void setConnectionDataHandler(ConnectionDataHandler connectionDataHandler)
Description copied from interface: ProjectManagement
Set connection handler.

Specified by:
setConnectionDataHandler in interface ProjectManagement
Parameters:
connectionDataHandler - connection handler

get

protected Object get(String serviceName,
                     Object... args)
              throws org.apache.xmlrpc.XmlRpcException
Redefine get to prefix service name

Overrides:
get in class AbstractXMLRPCClient
Parameters:
serviceName - service name
args - service params
Returns:
service result
Throws:
org.apache.xmlrpc.XmlRpcException - when xml-rpc exception

getIdAndLoginsMap

public Map<String,String> getIdAndLoginsMap()
                                     throws WebServiceException
Description copied from interface: ProjectManagement
Get id/login map available on remote services.

Specified by:
getIdAndLoginsMap in interface ProjectManagement
Returns:
all id/login couple
Throws:
WebServiceException - when call fail

login

public String login(String login,
                    String password)
             throws WebServiceException
Description copied from interface: ProjectManagement
Do login operation

Specified by:
login in interface ProjectManagement
Parameters:
login - username
password - password
Returns:
user id
Throws:
WebServiceException - when call fail

getUserProjects

public List<TimerProject> getUserProjects(String userId)
                                   throws WebServiceException
Description copied from interface: ProjectManagement
Get project list

Specified by:
getUserProjects in interface ProjectManagement
Parameters:
userId - user id
Returns:
list of project
Throws:
WebServiceException - when call fail
See Also:
TimerProject

addTask

protected void addTask(Map<String,TimerProject> mapOfProjects,
                       List<String> taskNames)
Add new task in current tree.

Parameters:
mapOfProjects - map of already seen projects
taskNames - task name path

addTask

protected void addTask(TimerTask task,
                       List<String> taskNames)
Add task in task subtask.

Parameters:
task - task to add into
taskNames - task names

getLastUpdate

protected Date getLastUpdate(String userId)
Get last update date from remote server.

Parameters:
userId - user id
Returns:
date of last update or null

synchronize

public void synchronize(String userId,
                        List<TimerProject> projects)
                 throws WebServiceException
Description copied from interface: ProjectManagement
Synchronize a single project.

Specified by:
synchronize in interface ProjectManagement
Parameters:
userId - user id
projects - project list to synchronize
Throws:
WebServiceException - when call fail

synchronizeTask

protected void synchronizeTask(String userId,
                               TimerTask task,
                               Date lastUpdateDate,
                               List<String> currentTaskPath)
                        throws WebServiceException
Synchronize a single task.

Parameters:
userId - user id
task - task to sync
lastUpdateDate - last update date (can be null)
currentTaskPath - current task path
Throws:
WebServiceException - when call fail

addTask

protected String addTask(String userId,
                         String superTopiaId,
                         String name)
Add task on remote server.

Parameters:
userId - user id
superTopiaId - parent task topiaId
name - name of task to add
Returns:
topiaId of created task

syncTask

protected void syncTask(String userId,
                        String topiaId,
                        Date dateOfDay,
                        long timeOfDay)
                 throws WebServiceException
Sync a task, call xmlrpc.

Parameters:
userId - user id
topiaId - task topiaId
dateOfDay - date
timeOfDay - time in seconds
Throws:
WebServiceException - when call fail

syncTask

public void syncTask(String userId,
                     TimerTask task,
                     Date dateOfDay,
                     long timeOfDay)
              throws WebServiceException
Description copied from interface: ProjectManagement
Sync a task.

Specified by:
syncTask in interface ProjectManagement
Parameters:
userId - user id
task - task to sync
dateOfDay - date
timeOfDay - time in seconds
Throws:
WebServiceException - when call fail

synchronization

protected void synchronization()
Synchronization (from server).


addProject

public void addProject(TimerProject project)
Description copied from interface: DataEventListener
Add project event.

Specified by:
addProject in interface DataEventListener
Parameters:
project - project to add

addTask

public void addTask(TimerTask task)
Description copied from interface: DataEventListener
Add task event.

Specified by:
addTask in interface DataEventListener
Parameters:
task - task to add

dataLoaded

public void dataLoaded(Collection<TimerProject> projects)
Description copied from interface: DataEventListener
All data loaded.

Specified by:
dataLoaded in interface DataEventListener
Parameters:
projects - projects collection

deleteProject

public void deleteProject(TimerProject project)
Description copied from interface: DataEventListener
Delete project.

Specified by:
deleteProject in interface DataEventListener
Parameters:
project - deleted project

deleteTask

public void deleteTask(TimerTask task)
Description copied from interface: DataEventListener
Delete task.

Specified by:
deleteTask in interface DataEventListener
Parameters:
task - deleted task

modifyProject

public void modifyProject(TimerProject project)
Description copied from interface: DataEventListener
Modify project.

Specified by:
modifyProject in interface DataEventListener
Parameters:
project - modified project

modifyTask

public void modifyTask(TimerTask task)
Description copied from interface: DataEventListener
Modify task.

Specified by:
modifyTask in interface DataEventListener
Parameters:
task - modified task

changeClosedState

public void changeClosedState(TimerTask task)
Description copied from interface: DataEventListener
Change task state.

Specified by:
changeClosedState in interface DataEventListener
Parameters:
task - task

moveTask

public void moveTask(TimerTask task)
Description copied from interface: DataEventListener
Post move task.

Specified by:
moveTask in interface DataEventListener
Parameters:
task - task

postMergeTasks

public void postMergeTasks(TimerTask destinationTask,
                           List<TimerTask> otherTasks)
Description copied from interface: DataEventListener
Post merge task.

Specified by:
postMergeTasks in interface DataEventListener
Parameters:
destinationTask - task where all other task will be merged
otherTasks - other tasks to merge

preMergeTasks

public void preMergeTasks(TimerTask destinationTask,
                          List<TimerTask> otherTasks)
Description copied from interface: DataEventListener
Pre merge task.

Specified by:
preMergeTasks in interface DataEventListener
Parameters:
destinationTask - task where all other task will be merged
otherTasks - other tasks to merge

preMoveTask

public void preMoveTask(TimerTask task)
Description copied from interface: DataEventListener
Pre move task.

Specified by:
preMoveTask in interface DataEventListener
Parameters:
task - task

startTask

public void startTask(TimerTask task)
Description copied from interface: DataEventListener
Start task.

Specified by:
startTask in interface DataEventListener
Parameters:
task - started task

stopTask

public void stopTask(TimerTask task)
Description copied from interface: DataEventListener
Stop task.

Specified by:
stopTask in interface DataEventListener
Parameters:
task - stoped task

checkSetAnnotation

public void checkSetAnnotation(TimerTask task,
                               Date date,
                               String annotation)
Check update task annotation.

Specified by:
checkSetAnnotation in interface VetoableDataEventListener
Parameters:
task - task to update
date - day of change
annotation - new annotation

setAnnotation

public void setAnnotation(TimerTask task,
                          Date date,
                          String annotation)
Add annotation.

Specified by:
setAnnotation in interface DataEventListener
Parameters:
task - task where annotation is changed
date - date
annotation - new annotation value

checkSetTaskTime

public void checkSetTaskTime(TimerTask task,
                             Date date,
                             Long value)
Check update task time.

Specified by:
checkSetTaskTime in interface VetoableDataEventListener
Parameters:
task - task to update
date - day of change
value - new time in seconds

setTaskTime

public void setTaskTime(TimerTask task,
                        Date date,
                        Long time)
Set task time.

Specified by:
setTaskTime in interface DataEventListener
Parameters:
task - task where time is changed
date - date
time - task time

checkAddProject

public void checkAddProject(TimerProject project)
Check add project. Synchronized projects are added by synchronization.

Specified by:
checkAddProject in interface VetoableDataEventListener
Parameters:
project - project to add

checkAddTask

public void checkAddTask(TimerTask parent,
                         TimerTask task)
Check add task. can add, even in sync projects

Specified by:
checkAddTask in interface VetoableDataEventListener
Parameters:
parent - parent task
task - task to add

checkChangeClosedState

public void checkChangeClosedState(TimerTask task)
Check change task state.

Specified by:
checkChangeClosedState in interface VetoableDataEventListener
Parameters:
task - task

checkDeleteProject

public void checkDeleteProject(TimerProject project)
Check delete project.

Specified by:
checkDeleteProject in interface VetoableDataEventListener
Parameters:
project - deleted project

checkDeleteTask

public void checkDeleteTask(TimerTask task)
Check delete task.

Specified by:
checkDeleteTask in interface VetoableDataEventListener
Parameters:
task - deleted task

checkModifyProject

public void checkModifyProject(TimerProject project)
Check modify project.

Specified by:
checkModifyProject in interface VetoableDataEventListener
Parameters:
project - modified project

checkModifyTask

public void checkModifyTask(TimerTask task)
Check modify task.

Specified by:
checkModifyTask in interface VetoableDataEventListener
Parameters:
task - modified task

checkMoveTask

public void checkMoveTask(TimerTask destination,
                          Collection<TimerTask> tasksToMove)
Check move task.

Specified by:
checkMoveTask in interface VetoableDataEventListener
Parameters:
destination - task to move to
tasksToMove - tasks to move

checkMergeTasks

public void checkMergeTasks(TimerTask destinationTask,
                            List<TimerTask> otherTasks)
Check merge task.

Specified by:
checkMergeTasks in interface VetoableDataEventListener
Parameters:
destinationTask - task result of merge
otherTasks - other task to merge


Copyright © 2007-2012 CodeLutin. All Rights Reserved.