org.eclipse.mylar.tasks.core
Class AbstractRepositoryConnector

java.lang.Object
  extended by org.eclipse.mylar.tasks.core.AbstractRepositoryConnector
Direct Known Subclasses:
MockRepositoryConnector, WebRepositoryConnector

public abstract class AbstractRepositoryConnector
extends java.lang.Object

Operations on a task repository

Author:
Mik Kersten, Rob Elves

Field Summary
private static java.lang.String APPLICATION_OCTET_STREAM
           
static java.lang.String MESSAGE_ATTACHMENTS_NOT_SUPPORTED
           
static java.lang.String MYLAR_CONTEXT_DESCRIPTION
           
protected  java.util.List<java.lang.String> supportedVersions
           
protected  TaskList taskList
           
protected  java.util.Set<RepositoryTemplate> templates
           
 
Constructor Summary
AbstractRepositoryConnector()
           
 
Method Summary
 void addTemplate(RepositoryTemplate template)
           
 boolean attachContext(TaskRepository repository, AbstractRepositoryTask task, java.lang.String longComment)
          Attaches the associated context to task.
abstract  boolean canCreateNewTask(TaskRepository repository)
           
abstract  boolean canCreateTaskFromKey(TaskRepository repository)
           
abstract  ITask createTaskFromExistingKey(TaskRepository repository, java.lang.String id, java.net.Proxy proxySettings)
           
abstract  IAttachmentHandler getAttachmentHandler()
           
 java.util.Set<RepositoryAttachment> getContextAttachments(TaskRepository repository, AbstractRepositoryTask task)
          Implementors of this repositoryOperations must perform it locally without going to the server since it is used for frequent repositoryOperations such as decoration.
abstract  java.lang.String getLabel()
           
abstract  IOfflineTaskHandler getOfflineTaskHandler()
           
abstract  java.lang.String getRepositoryType()
           
abstract  java.lang.String getRepositoryUrlFromTaskUrl(java.lang.String url)
           
abstract  java.util.List<java.lang.String> getSupportedVersions()
           
 java.lang.String getTaskIdPrefix()
           
 RepositoryTemplate getTemplate(java.lang.String label)
          returns null if template not found
 java.util.Set<RepositoryTemplate> getTemplates()
           
 boolean hasRepositoryContext(TaskRepository repository, AbstractRepositoryTask task)
           
 void init(TaskList taskList)
           
abstract  org.eclipse.core.runtime.IStatus performQuery(AbstractRepositoryQuery query, TaskRepository repository, org.eclipse.core.runtime.IProgressMonitor monitor, QueryHitCollector resultCollector)
          Implementors must execute query synchronously.
 java.lang.String[] repositoryPropertyNames()
           
 boolean retrieveContext(TaskRepository repository, AbstractRepositoryTask task, RepositoryAttachment attachment, java.lang.String destinationPath)
          Retrieves a context stored in attachment from task.
abstract  void updateAttributes(TaskRepository repository, org.eclipse.core.runtime.IProgressMonitor monitor)
          Reset and update the repository attributes from the server (e.g.
abstract  void updateTask(TaskRepository repository, AbstractRepositoryTask repositoryTask)
          Updates the properties of repositoryTask.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_ATTACHMENTS_NOT_SUPPORTED

public static final java.lang.String MESSAGE_ATTACHMENTS_NOT_SUPPORTED
See Also:
Constant Field Values

MYLAR_CONTEXT_DESCRIPTION

public static final java.lang.String MYLAR_CONTEXT_DESCRIPTION
See Also:
Constant Field Values

APPLICATION_OCTET_STREAM

private static final java.lang.String APPLICATION_OCTET_STREAM
See Also:
Constant Field Values

supportedVersions

protected java.util.List<java.lang.String> supportedVersions

templates

protected java.util.Set<RepositoryTemplate> templates

taskList

protected TaskList taskList
Constructor Detail

AbstractRepositoryConnector

public AbstractRepositoryConnector()
Method Detail

init

public void init(TaskList taskList)

getAttachmentHandler

public abstract IAttachmentHandler getAttachmentHandler()
Returns:
null if not supported

getOfflineTaskHandler

public abstract IOfflineTaskHandler getOfflineTaskHandler()
Returns:
null if not supported

getRepositoryUrlFromTaskUrl

public abstract java.lang.String getRepositoryUrlFromTaskUrl(java.lang.String url)

canCreateTaskFromKey

public abstract boolean canCreateTaskFromKey(TaskRepository repository)

canCreateNewTask

public abstract boolean canCreateNewTask(TaskRepository repository)

createTaskFromExistingKey

public abstract ITask createTaskFromExistingKey(TaskRepository repository,
                                                java.lang.String id,
                                                java.net.Proxy proxySettings)
                                         throws org.eclipse.core.runtime.CoreException
Parameters:
id - identifier, e.g. "123" bug Bugzilla bug 123
proxySettings - TODO
Returns:
null if task could not be created
Throws:
org.eclipse.core.runtime.CoreException - TODO

performQuery

public abstract org.eclipse.core.runtime.IStatus performQuery(AbstractRepositoryQuery query,
                                                              TaskRepository repository,
                                                              org.eclipse.core.runtime.IProgressMonitor monitor,
                                                              QueryHitCollector resultCollector)
Implementors must execute query synchronously.

Parameters:
query -
repository - TODO
monitor -
resultCollector - IQueryHitCollector that collects the hits found

getLabel

public abstract java.lang.String getLabel()

getRepositoryType

public abstract java.lang.String getRepositoryType()
Returns:
the unique type of the repository, e.g. "bugzilla"

getSupportedVersions

public abstract java.util.List<java.lang.String> getSupportedVersions()

updateTask

public abstract void updateTask(TaskRepository repository,
                                AbstractRepositoryTask repositoryTask)
                         throws org.eclipse.core.runtime.CoreException
Updates the properties of repositoryTask. Invoked when on task synchronization if getOfflineTaskHandler() returns null or IOfflineTaskHandler.downloadTaskData(TaskRepository, String) returns null.

Connectors that provide RepositoryTaskData objects for all tasks do not need to implement this method.

Parameters:
repository - the repository
repositoryTask - the task that is synchronized
Throws:
org.eclipse.core.runtime.CoreException - thrown in case of error while synchronizing
See Also:
#getOfflineTaskHandler()}

repositoryPropertyNames

public java.lang.String[] repositoryPropertyNames()

getContextAttachments

public final java.util.Set<RepositoryAttachment> getContextAttachments(TaskRepository repository,
                                                                       AbstractRepositoryTask task)
Implementors of this repositoryOperations must perform it locally without going to the server since it is used for frequent repositoryOperations such as decoration.

Returns:
an empty set if no contexts

hasRepositoryContext

public final boolean hasRepositoryContext(TaskRepository repository,
                                          AbstractRepositoryTask task)

attachContext

public final boolean attachContext(TaskRepository repository,
                                   AbstractRepositoryTask task,
                                   java.lang.String longComment)
                            throws org.eclipse.core.runtime.CoreException
Attaches the associated context to task.

Returns:
false, if operation is not supported by repository
Throws:
org.eclipse.core.runtime.CoreException

retrieveContext

public final boolean retrieveContext(TaskRepository repository,
                                     AbstractRepositoryTask task,
                                     RepositoryAttachment attachment,
                                     java.lang.String destinationPath)
                              throws org.eclipse.core.runtime.CoreException
Retrieves a context stored in attachment from task.

Returns:
false, if operation is not supported by repository
Throws:
org.eclipse.core.runtime.CoreException

addTemplate

public void addTemplate(RepositoryTemplate template)

getTemplates

public java.util.Set<RepositoryTemplate> getTemplates()

getTemplate

public RepositoryTemplate getTemplate(java.lang.String label)
returns null if template not found


getTaskIdPrefix

public java.lang.String getTaskIdPrefix()

updateAttributes

public abstract void updateAttributes(TaskRepository repository,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                               throws org.eclipse.core.runtime.CoreException
Reset and update the repository attributes from the server (e.g. products, components) TODO: remove?

Throws:
org.eclipse.core.runtime.CoreException