public abstract class ResourceVariantByteStore extends Object
ResourceVariantByteStore
is to support the caching of
the synchronization bytes for the resource variants that represent
a resource line-up of interest such as a version, baseline or branch. The
cache stores bytes in order to minimize the memory footprint of the tree. It is the
responsibility of the client of this API to cache enough bytes to meaningfully identify
a resource variant (and possibly create an IResourceVariant
handle from them).
The bytes for a resource variant are accessed using the local IResource
handle
that corresponds to the resource variant (using the getBytes
method).
The potential children of a resource variant are also accessed
by using the local handle that corresponds to the resource variant
(using the members
method).
Constructor and Description |
---|
ResourceVariantByteStore() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
deleteBytes(IResource resource)
Method called to indicate that it is known that there is no variant associated
with the local resource.
|
abstract void |
dispose()
Dispose of any cached sync bytes when this cache is no longer needed.
|
protected boolean |
equals(byte[] syncBytes1,
byte[] syncBytes2)
Helper method to compare two byte arrays for equality
|
abstract boolean |
flushBytes(IResource resource,
int depth)
Remove the bytes from the tree for the resource variants corresponding to the
given local resource and its descendants to the given depth.
|
abstract byte[] |
getBytes(IResource resource)
Return the bytes for the variant corresponding the given local resource.
|
abstract IResource[] |
members(IResource resource)
Return the children of the given resource that have resource variants in this tree.
|
void |
run(IResource root,
IWorkspaceRunnable runnable,
IProgressMonitor monitor)
Run the given action which may contain multiple modifications
to the byte store.
|
abstract boolean |
setBytes(IResource resource,
byte[] bytes)
Set the bytes for the variant corresponding the given local resource.
|
public abstract void dispose()
public abstract byte[] getBytes(IResource resource) throws TeamException
null
means that no bytes have been stored
for the resource variant. It is up to the client to determine whether
this means that the resource variant does not exist or that it has not been
fetched or otherwise determined yet.resource
- the local resourceTeamException
public abstract boolean setBytes(IResource resource, byte[] bytes) throws TeamException
null
. If it is known that the remote
does not exist, deleteBytes(IResource)
should be used instead.
If the sync bytes for the remote are stale and should be removed,
flushBytes(IResouce, int)
should be called.resource
- the local resourcebytes
- the bytes that represent the resource's varianttrue
if the bytes changedTeamException
public abstract boolean flushBytes(IResource resource, int depth) throws TeamException
getBytes(resource)
will
return null
for the affected resources.resource
- the local resourcedepth
- the depth of the operation (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)true
if there were bytes present which were removedTeamException
public abstract boolean deleteBytes(IResource resource) throws TeamException
flush(IResource, int)
method should be used in the cases
where a client wishes to remove bytes for other reason.resource
- the local resourcetrue
if this changes the bytes for the variantTeamException
public abstract IResource[] members(IResource resource) throws TeamException
resource
- the parent resourceTeamException
protected boolean equals(byte[] syncBytes1, byte[] syncBytes2)
syncBytes1
- the first byte array or null
syncBytes2
- the second byte array or null
public void run(IResource root, IWorkspaceRunnable runnable, IProgressMonitor monitor) throws TeamException
root
- the root resource for all modificationsrunnable
- the action to performmonitor
- a progress monitor.TeamException
- if the operation failed.OperationCanceledException
- if the operation is canceled.
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.