/******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.core.subscribers; import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.sync.IRemoteResource; /** * A TeamSubscriber provides synchronization between local resources and a remote location * that is used to share those resources. * * [Note: How can we allow the refresh() operation to optimize the sync calculation based * on the currently configured compare criteria?] */ abstract public class TeamSubscriber { private List listeners = new ArrayList(1); /** * Return the unique id that identified this subscriber. */ abstract public QualifiedName getId(); /** * Return the name of this subscription, in a format that is suitable for * display to an end user. * * @return String representing the name of this subscription. */ abstract public String getName(); /** * Return the description of this subscription, in a format that is suitable for * display to an end user. The description should contain enough details to * understand the connection type of this subscriber. * * @return String representing the description of this subscription. */ abstract public String getDescription(); /** * Returns true if this resource is supervised by this subscriber. * A supervised resource is one for which this subscriber maintains the synchronization * state. Returns false in all other cases. * * @return true if this resource is supervised, and * false otherwise */ abstract public boolean isSupervised(IResource resource) throws TeamException; /** * Returns all non-transient member resources of the given resource. * The result will include entries for resources that exist * either in the workspace or are implicated in an incoming change. * Returns an empty list if the given resource exists neither in * the workspace nor in the corresponding team stream, or if the * given resource is transient. *

* This is a fast operation; the repository is not contacted. *

*

* [Issue1 : Is there any filtering on the members? Just the ones * that changed in some way, or *every member*? * ]

* * @param resource the resource * @return a list of member resources * @exception CoreException if this request fails. Reasons include: */ abstract public IResource[] members(IResource resource) throws TeamException; /** * Returns the list of root resources this subscriber considers for synchronization. * A client should call this method first then can safely call members * to navigate the resources managed by this subscriber. * * @return a list of resources * @throws TeamException */ abstract public IResource[] roots(); /** * Returns a handle to the remote resource corresponding to the given * resource, or null if there is no corresponding resource * edition. *

* This is a fast operation; the repository is not contacted. *

* * @param resource the resource * @return a server resource * @exception CoreException if this request fails. Reasons include: * */ abstract public IRemoteResource getRemoteResource(IResource resource) throws TeamException; /** * Returns synchronization info for the given resource, or * null if there is no synchronization info * because the subscriber does not apply to this resource. *

* Note that sync info may be returned for non-existing * or for resources which have no corresponding remote resource. *

*

* This method may take some time; it depends on the comparison criteria * that is used to calculate the synchronization state (e.g. using content * or only timestamps). *

* * @param resource the resource of interest * @return sync info */ abstract public SyncInfo getSyncInfo(IResource resource, IProgressMonitor monitor) throws TeamException; /** * Refreshes the resource hierarchy from the given resources and their * children (to the specified depth) from the corresponding resources in * the remote location. Resources are ignored in the following cases: *