public class ThreeWaySynchronizer extends Object
Constructor and Description |
---|
ThreeWaySynchronizer(QualifiedName name)
Create a three-way synchronizer that uses a persistent
byte store with the given qualified name as its unique
identifier.
|
ThreeWaySynchronizer(ResourceVariantByteStore store)
Create a three-way synchronizer that uses the given byte store
as its underlying byte cache.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(ISynchronizerChangeListener listener)
Adds a listener to this synchronizer.
|
void |
flush(IResource resource,
int depth)
Flush any cached bytes for the given resource to the depth specified.
|
byte[] |
getBaseBytes(IResource resource)
Return the base bytes that are cached for the given resource
or
null if no base is cached. |
byte[] |
getRemoteBytes(IResource resource)
Return the remote bytes that are cached for the given resource
or
null if no remote is cached. |
boolean |
hasSyncBytes(IResource resource)
Return whether the given resource has sync bytes in the synchronizer.
|
boolean |
isIgnored(IResource resource)
Returns whether the resource has been marked as ignored
using
setIgnored(IResource) . |
boolean |
isLocallyModified(IResource resource)
Return whether the local resource has been modified since the last time
the base bytes were set.
|
IResource[] |
members(IResource resource)
Return the members of the local resource that either have sync bytes
or exist locally and are not ignored.
|
void |
removeListener(ISynchronizerChangeListener listener)
Removes a listener previously registered with this synchronizer.
|
boolean |
removeRemoteBytes(IResource resource)
Remove the remote bytes associated with the resource.
|
void |
run(IResource resourceRule,
IWorkspaceRunnable runnable,
IProgressMonitor monitor)
Perform multiple sync state modifications and fire only a single change notification
at the end.
|
void |
setBaseBytes(IResource resource,
byte[] baseBytes)
Set the base bytes for the given resource.
|
void |
setIgnored(IResource resource)
Mark the resource as being ignored.
|
boolean |
setRemoteBytes(IResource resource,
byte[] remoteBytes)
Set the remote bytes for the given resource.
|
public ThreeWaySynchronizer(QualifiedName name)
name
- the unique identifier for the persistent storepublic ThreeWaySynchronizer(ResourceVariantByteStore store)
store
- the byte store this synchronizer uses to cache its bytespublic void addListener(ISynchronizerChangeListener listener)
IResource
delta mechanism if they
need to know about local modifications.
Has no effect if an identical listener is already registered.
Team resource change listeners are informed about state changes that affect the resources supervised by this subscriber.
listener
- a synchronizer change listenerpublic void removeListener(ISynchronizerChangeListener listener)
listener
- a synchronizer change listenerpublic byte[] getBaseBytes(IResource resource) throws TeamException
null
if no base is cached. The returned bytes
should uniquely identify the resource variant that is the base
for the given local resource.resource
- the resourcenull
TeamException
public void setBaseBytes(IResource resource, byte[] baseBytes) throws TeamException
resource
- the resourcebaseBytes
- the base bytes that identify the base resource variantTeamException
public boolean isLocallyModified(IResource resource) throws TeamException
false
for ignored resources and true
for non-existant resources
that have base bytes cached.resource
- the resourcetrue
if the resource has been modified since the
last time the base bytes were set.TeamException
public byte[] getRemoteBytes(IResource resource) throws TeamException
null
if no remote is cached. The returned bytes
should uniquely identify the resource variant that is the remote
for the given local resource.resource
- the resourcenull
TeamException
public boolean setRemoteBytes(IResource resource, byte[] remoteBytes) throws TeamException
removeRemoteBytes(IResource)
should be called.resource
- the resourceremoteBytes
- the base bytes that identify the remote resource varianttrue
if the remote bytes changed as a result of the setTeamException
public boolean removeRemoteBytes(IResource resource) throws TeamException
resource
- the resourcetrue
if the remote bytes changed as a result of the removalTeamException
public boolean hasSyncBytes(IResource resource) throws TeamException
resource
- the local resourceTeamException
public boolean isIgnored(IResource resource) throws TeamException
setIgnored(IResource)
.resource
- the resourcetrue
if the resource is ignored.TeamException
public void setIgnored(IResource resource) throws TeamException
members
method,
are never dirty (see isLocallyModified
) and
do not have base or remote bytes cached for them.resource
- the resource to be ignoredTeamException
public IResource[] members(IResource resource) throws TeamException
resource
- the local resourceTeamException
public void flush(IResource resource, int depth) throws TeamException
resource
- the resourcedepth
- the depth of the flush (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)TeamException
public void run(IResource resourceRule, IWorkspaceRunnable runnable, IProgressMonitor monitor) throws TeamException
resourceRule
- the scheduling rule that encompasses all modificationsrunnable
- the runnable that performs the sync state modificationsmonitor
- a progress monitorTeamException
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.