Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.team.core
Class RepositoryProvider


java.lang.Object
  extended by 
org.eclipse.team.core.RepositoryProvider
All Implemented Interfaces:
IProjectNature, IAdaptable

public abstract class RepositoryProvider
extends Object
implements IProjectNature, IAdaptable

A concrete subclass of RepositoryProvider is created for each project that is associated with a repository provider. The lifecycle of these instances is is similar to that of the platform's 'nature' mechanism.

To create a repository provider and have it registered with the platform, a client must minimally:

  1. extend RepositoryProvider
  2. define a repository extension in plugin.xml. Here is an example extension point definition:
    <extension point="org.eclipse.team.core.repository">
     <repository
      class="org.eclipse.myprovider.MyRepositoryProvider"
      id="org.eclipse.myprovider.myProviderID">
     </repository>
    </extension>

Once a repository provider is registered with Team, then you can associate a repository provider with a project by invoking RepositoryProvider.map().

Since:
2.0
See Also:
map(IProject, String)

Constructor Summary
RepositoryProvider ()
          Default constructor required for the resources plugin to instantiate this class from the nature extension definition.
 
Method Summary
 boolean canHandleLinkedResources ()
          Deprecated. see canHandleLinkedResourceURI()
 boolean canHandleLinkedResourceURI ()
          Return whether this repository provider can handle linked resources that are located via a URI (i.e. may not be on the local file system) or occur at an arbitrary depth in the project.
 void configure ()
          Configures the nature for the given project.
abstract  void configureProject ()
          Configures the provider for the given project.
protected  void deconfigured ()
          Method deconfigured is invoked after a provider has been unmaped.
  Object getAdapter ( Class adapter)
          Returns an object which is an instance of the given class associated with this object.
static  String[] getAllProviderTypeIds ()
          Returns all known (registered) RepositoryProvider ids.
  IFileHistoryProvider getFileHistoryProvider ()
          Returns an IFileHistoryProvider which can be used to access file histories.
  IFileModificationValidator getFileModificationValidator ()
          Deprecated. use getFileModificationValidator2()
  FileModificationValidator getFileModificationValidator2 ()
          Returns a FileModificationValidator for pre-checking operations that modify the contents of files.
abstract   String getID ()
          Answer the id of this provider instance.
  IMoveDeleteHook getMoveDeleteHook ()
          Returns an IMoveDeleteHook for handling moves and deletes that occur within projects managed by the provider.
  IProject getProject ()
          Returns the project to which this project nature applies.
static  RepositoryProvider getProvider ( IProject project)
          Returns the provider for a given IProject or null if a provider is not associated with the project or if the project is closed or does not exist.
static  RepositoryProvider getProvider ( IProject project, String id)
          Returns a provider of type with the given id if associated with the given project or null if the project is not associated with a provider of that type or the nature id is that of a non-team repository provider nature.
  IResourceRuleFactory getRuleFactory ()
          Return the resource rule factory for this provider.
  Subscriber getSubscriber ()
          Return a Subscriber that describes the synchronization state of the resources contained in the project associated with this provider.
static boolean isShared ( IProject project)
          Returns whether the given project is shared or not.
static void map ( IProject project, String id)
          Instantiate a new RepositoryProvider with concrete class by given providerID and associate it with project.
 void setProject ( IProject project)
          Sets the project to which this nature applies.
  String toString ()
          Returns a brief description of this provider.
static void unmap ( IProject project)
          Disassociates project with the repository provider its currently mapped to.
  IStatus validateCreateLink ( IResource resource, int updateFlags, IPath location)
          Deprecated. see validateCreateLink(IResource, int, URI) instead
  IStatus validateCreateLink ( IResource resource, int updateFlags, URI location)
          Method validateCreateLink is invoked by the Platform Core TeamHook when a linked resource is about to be added to the provider's project.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.resources. IProjectNature
deconfigure
 

Constructor Detail

RepositoryProvider

public RepositoryProvider()
Default constructor required for the resources plugin to instantiate this class from the nature extension definition.

Method Detail

map

public static void map(
IProject project,
                       
String id)
                throws 
TeamException
Instantiate a new RepositoryProvider with concrete class by given providerID and associate it with project.

Parameters:
project - the project to be mapped
id - the ID of the provider to be mapped to the project
Throws:
TeamException - if
  • There is no provider by that ID.
  • The project is already associated with a repository provider and that provider prevented its unmapping.
See Also:
unmap(IProject)

unmap

public static void unmap(
IProject project)
                  throws 
TeamException
Disassociates project with the repository provider its currently mapped to.

Parameters:
project -
Throws:
TeamException - The project isn't associated with any repository provider.

configureProject

public abstract void configureProject()
                               throws 
CoreException
Configures the provider for the given project. This method is called after setProject. If an exception is generated during configuration of the project, the provider will not be assigned to the project.

Throws:
CoreException - if the configuration fails.

configure

public final void configure()
                     throws 
CoreException
Configures the nature for the given project. This is called by RepositoryProvider.map() the first time a provider is mapped to a project. It is not intended to be called by clients.

Specified by:
configure in interface IProjectNature
Throws:
CoreException - if this method fails. If the configuration fails the provider will not be associated with the project.
See Also:
configureProject()

deconfigured

protected void deconfigured()
Method deconfigured is invoked after a provider has been unmaped. The project will no longer have the provider associated with it when this method is invoked. It is a last chance for the provider to clean up.


getID

public abstract 
String getID()
Answer the id of this provider instance. The id should be the repository provider's id as defined in the provider plugin's plugin.xml.

Returns:
the nature id of this provider

getFileModificationValidator

public 
IFileModificationValidator getFileModificationValidator()
Deprecated. use getFileModificationValidator2()

Returns an IFileModificationValidator for pre-checking operations that modify the contents of files. Returns null if the provider does not wish to participate in file modification validation.

Returns:
an IFileModificationValidator for pre-checking operations that modify the contents of files
See Also:
IFileModificationValidator

getFileModificationValidator2

public 
FileModificationValidator getFileModificationValidator2()
Returns a FileModificationValidator for pre-checking operations that modify the contents of files. Returns null if the provider does not wish to participate in file modification validation. By default, this method wraps the old validator returned from getFileModificationValidator(). Subclasses that which to remain backwards compatible while providing this new API should override getFileModificationValidator2() to return a subclass of FileModificationValidator and should return the same validator from getFileModificationValidator().

This method is not intended to be called by clients. Clients should use the IWorkspace.validateEdit(IFile[], Object) method instead.

Returns:
an FileModificationValidator for pre-checking operations that modify the contents of files
Since:
3.3
See Also:
FileModificationValidator, IWorkspace.validateEdit(IFile[], Object)

getFileHistoryProvider

public 
IFileHistoryProvider getFileHistoryProvider()
Returns an IFileHistoryProvider which can be used to access file histories. By default, returns null. Subclasses may override.

Returns:
an IFileHistoryProvider which can be used to access file histories.
Since:
3.2

getMoveDeleteHook

public 
IMoveDeleteHook getMoveDeleteHook()
Returns an IMoveDeleteHook for handling moves and deletes that occur within projects managed by the provider. This allows providers to control how moves and deletes occur and includes the ability to prevent them.

Returning null signals that the default move and delete behavior is desired.

Returns:
an IMoveDeleteHook for handling moves and deletes that occur within projects managed by the provider
See Also:
IMoveDeleteHook

toString

public 
String toString()
Returns a brief description of this provider. The exact details of the representation are unspecified and subject to change, but the following may be regarded as typical: "SampleProject:org.eclipse.team.cvs.provider"

Overrides:
toString in class Object
Returns:
a string description of this provider

getAllProviderTypeIds

public static final 
String[] getAllProviderTypeIds()
Returns all known (registered) RepositoryProvider ids.

Returns:
an array of registered repository provider ids.

getProvider

public static final 
RepositoryProvider getProvider(
IProject project)
Returns the provider for a given IProject or null if a provider is not associated with the project or if the project is closed or does not exist. This method should be called if the caller is looking for any repository provider. Otherwise call getProvider(project, id) to look for a specific repository provider type.

Parameters:
project - the project to query for a provider
Returns:
the repository provider associated with the project

getProvider

public static final 
RepositoryProvider getProvider(
IProject project,
                                                   
String id)
Returns a provider of type with the given id if associated with the given project or null if the project is not associated with a provider of that type or the nature id is that of a non-team repository provider nature.

Parameters:
project - the project to query for a provider
id - the repository provider id
Returns:
the repository provider

isShared

public static boolean isShared(
IProject project)
Returns whether the given project is shared or not. This is a lightweight method in that it will not instantiate a provider instance (as getProvider would) if one is not already instantiated. Note that IProject.touch() generates a project description delta. This, in combination with isShared() can be used to be notified of sharing/unsharing of projects.

Parameters:
project - the project being tested.
Returns:
boolean
Since:
2.1
See Also:
getProvider(IProject)

getProject

public 
IProject getProject()
Description copied from interface: IProjectNature
Returns the project to which this project nature applies.

Specified by:
getProject in interface IProjectNature
Returns:
the project handle

setProject

public void setProject(
IProject project)
Description copied from interface: IProjectNature
Sets the project to which this nature applies. Used when instantiating this project nature runtime. This is called by IProject.create() or IProject.setDescription() and should not be called directly by clients.

Specified by:
setProject in interface IProjectNature
Parameters:
project - the project to which this nature applies

validateCreateLink

public 
IStatus validateCreateLink(
IResource resource,
                                  int updateFlags,
                                  
IPath location)
Deprecated. see validateCreateLink(IResource, int, URI) instead

Method validateCreateLink is invoked by the Platform Core TeamHook when a linked resource is about to be added to the provider's project. It should not be called by other clients and it should not need to be overridden by subclasses (although it is possible to do so in special cases). Subclasses can indicate that they support linked resources by overriding the canHandleLinkedResources() method.

Parameters:
resource - see org.eclipse.core.resources.team.TeamHook
updateFlags - see org.eclipse.core.resources.team.TeamHook
location - see org.eclipse.core.resources.team.TeamHook
Returns:
IStatus see org.eclipse.core.resources.team.TeamHook
Since:
2.1
See Also:
canHandleLinkedResources()

validateCreateLink

public 
IStatus validateCreateLink(
IResource resource,
                                  int updateFlags,
                                  
URI location)
Method validateCreateLink is invoked by the Platform Core TeamHook when a linked resource is about to be added to the provider's project. It should not be called by other clients and it should not need to be overridden by subclasses (although it is possible to do so in special cases). Subclasses can indicate that they support linked resources by overriding the canHandleLinkedResourcesAtArbitraryDepth() method.

Parameters:
resource - see org.eclipse.core.resources.team.TeamHook
updateFlags - see org.eclipse.core.resources.team.TeamHook
location - see org.eclipse.core.resources.team.TeamHook
Returns:
IStatus see org.eclipse.core.resources.team.TeamHook
Since:
3.2
See Also:
canHandleLinkedResourceURI()

canHandleLinkedResources

public boolean canHandleLinkedResources()
Deprecated. see canHandleLinkedResourceURI()

Method canHandleLinkedResources should be overridden by subclasses who support linked resources. At a minimum, supporting linked resources requires changes to the move/delete hook IMoveDeleteHook. This method is called after the RepositoryProvider is instantiated but before setProject() is invoked so it will not have access to any state determined from the setProject() method.

Returns:
boolean
Since:
2.1
See Also:
IMoveDeleteHook

canHandleLinkedResourceURI

public boolean canHandleLinkedResourceURI()
Return whether this repository provider can handle linked resources that are located via a URI (i.e. may not be on the local file system) or occur at an arbitrary depth in the project. This should be overridden by subclasses who support linked resources at arbitrary depth and/or in non-local file systems. This is not enabled by default since linked resources previously only occurred at the root of a project but now can occur anywhere within a project. This method is called after the RepositoryProvider is instantiated but before setProject() is invoked so it will not have access to any state determined from the setProject() method.

Returns:
whether this repository provider can handle linked resources that are located via a URI or occur at an arbitrary depth in the project
Since:
3.2
See Also:
validateCreateLink(IResource, int, URI)

getAdapter

public 
Object getAdapter(
Class adapter)
Description copied from interface: IAdaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - the adapter class to look up
Returns:
a object castable to the given class, or null if this object does not have an adapter for the given class

getRuleFactory

public 
IResourceRuleFactory getRuleFactory()
Return the resource rule factory for this provider. This factory will be used to determine the scheduling rules that are to be obtained when performing various resource operations (e.g. move, copy, delete, etc.) on the resources in the project the provider is mapped to.

By default, the factory returned by this method is pessimistic and obtains the workspace lock for all operations that could result in a callback to the provider (either through the IMoveDeleteHook or IFileModificationValidator). This is done to ensure that older providers are not broken. However, providers should override this method and provide a subclass of ResourceRuleFactory that provides rules of a more optimistic granularity (e.g. project or lower).

Returns:
the rule factory for this provider
Since:
3.0
See Also:
ResourceRuleFactory

getSubscriber

public final 
Subscriber getSubscriber()
Return a Subscriber that describes the synchronization state of the resources contained in the project associated with this provider. The subscriber is obtained from the RepositoryProviderType associated with a provider and is thus shared for all providers of the same type.

Returns:
a subscriber that provides resource synchronization state or null
Since:
3.2

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire