org.eclipse.team.core.variants
Class PersistantResourceVariantByteStore
java.lang.Object
org.eclipse.team.core.variants.ResourceVariantByteStore
org.eclipse.team.core.variants.PersistantResourceVariantByteStore
-
public class PersistantResourceVariantByteStore
- extends
ResourceVariantByteStore
A ResourceVariantByteStore
that caches the variant bytes using
the org.eclipse.core.resources.ISynchronizer
so that the tree is
cached across workbench invocations.
-
Since:
- 3.0
-
Restriction:
- This class is not intended to be subclassed by clients.
Method Summary
|
boolean
|
deleteBytes
(
IResource resource)
This method should be invoked by a client to indicate that it is known that
there is no remote resource associated with the local resource. |
void
|
dispose
()
Dispose of any cached sync bytes when this cache is no longer needed. |
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. |
byte[]
|
getBytes
(
IResource resource)
Return the bytes for the variant corresponding the given local resource. |
QualifiedName
|
getSyncName
()
Return the qualified name that uniquely identifies this tree. |
boolean
|
isVariantKnown
(
IResource resource)
Return whether the resource variant state for this resource is known. |
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. |
boolean
|
setBytes
(
IResource resource,
byte[] bytes)
Set the bytes for the variant corresponding the given local resource. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
PersistantResourceVariantByteStore
public PersistantResourceVariantByteStore(
QualifiedName name)
- Create a persistent tree that uses the given qualified name
as the key in the
org.eclipse.core.resources.ISynchronizer
.
It must be unique and should use the plugin as the local name
and a unique id within the plugin as the qualifier name.
-
Parameters:
-
name
- the key used in the Core synchronizer
dispose
public void dispose()
-
Description copied from class:
ResourceVariantByteStore
- Dispose of any cached sync bytes when this cache is no longer needed.
-
-
Specified by:
-
dispose
in class
ResourceVariantByteStore
-
getSyncName
public
QualifiedName getSyncName()
- Return the qualified name that uniquely identifies this tree.
-
-
Returns:
- the qualified name that uniquely identifies this tree.
getBytes
public byte[] getBytes(
IResource resource)
throws
TeamException
-
Description copied from class:
ResourceVariantByteStore
- Return the bytes for the variant corresponding the given local resource.
A return value of
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.
-
-
Specified by:
-
getBytes
in class
ResourceVariantByteStore
-
-
Parameters:
-
resource
- the local resource
-
Returns:
- the bytes that represent the resource's variant
-
Throws:
-
TeamException
setBytes
public boolean setBytes(
IResource resource,
byte[] bytes)
throws
TeamException
-
Description copied from class:
ResourceVariantByteStore
- Set the bytes for the variant corresponding the given local resource.
The bytes should never be
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.
-
-
Specified by:
-
setBytes
in class
ResourceVariantByteStore
-
-
Parameters:
-
resource
- the local resource -
bytes
- the bytes that represent the resource's variant
-
Returns:
-
true
if the bytes changed
-
Throws:
-
TeamException
flushBytes
public boolean flushBytes(
IResource resource,
int depth)
throws
TeamException
-
Description copied from class:
ResourceVariantByteStore
- Remove the bytes from the tree for the resource variants corresponding to the
given local resource and its descendants to the given depth.
After the bytes are removed,
getBytes(resource)
will
return null
for the affected resources.
-
-
Specified by:
-
flushBytes
in class
ResourceVariantByteStore
-
-
Parameters:
-
resource
- the local resource -
depth
- the depth of the operation (one of IResource.DEPTH_ZERO
,
IResource.DEPTH_ONE
, or IResource.DEPTH_INFINITE
)
-
Returns:
-
true
if there were bytes present which were removed
-
Throws:
-
TeamException
isVariantKnown
public boolean isVariantKnown(
IResource resource)
throws
TeamException
- Return whether the resource variant state for this resource is known.
This is used to differentiate the case where a resource variant has never been fetched
from the case where the resource variant is known to not exist. In the later
case, this method returns
true
while getBytes
returns null
-
-
Parameters:
-
resource
- the local resource
-
Returns:
- whether the resource variant state for this resource is known
-
Throws:
-
TeamException
deleteBytes
public boolean deleteBytes(
IResource resource)
throws
TeamException
- This method should be invoked by a client to indicate that it is known that
there is no remote resource associated with the local resource. After this method
is invoked,
isVariantKnown(resource)
will return true
and
getBytes(resource)
will return null
.
-
-
Specified by:
-
deleteBytes
in class
ResourceVariantByteStore
-
-
Parameters:
-
resource
- the local resource
-
Returns:
-
true
if this changes the remote sync bytes
-
Throws:
-
TeamException
members
public
IResource[] members(
IResource resource)
throws
TeamException
-
Description copied from class:
ResourceVariantByteStore
- Return the children of the given resource that have resource variants in this tree.
-
-
Specified by:
-
members
in class
ResourceVariantByteStore
-
-
Parameters:
-
resource
- the parent resource
-
Returns:
- the members who have resource variants in this tree.
-
Throws:
-
TeamException
run
public void run(
IResource root,
IWorkspaceRunnable runnable,
IProgressMonitor monitor)
throws
TeamException
-
Description copied from class:
ResourceVariantByteStore
- Run the given action which may contain multiple modifications
to the byte store. By default, the action is run. Subclasses
may override to obtain scheduling rules or batch deltas (if
the byte store modifies workspace resources).
-
-
Overrides:
-
run
in class
ResourceVariantByteStore
-
-
Parameters:
-
root
- the root resource for all modifications -
runnable
- the action to perform -
monitor
- a progress monitor.
-
Throws:
-
TeamException
- if the operation failed.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.