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

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.variants
Class ResourceVariantByteStore

java.lang.Object
  extended by 
org.eclipse.team.core.variants.ResourceVariantByteStore
Direct Known Subclasses:
PersistantResourceVariantByteStore, SessionResourceVariantByteStore

public abstract class ResourceVariantByteStore
extends Object

The purpose of a 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).

Since:
3.0

Constructor Summary
ResourceVariantByteStore ()
           
 
Method Summary
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.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceVariantByteStore

public ResourceVariantByteStore()
Method Detail

dispose

public abstract void dispose()
Dispose of any cached sync bytes when this cache is no longer needed.


getBytes

public abstract byte[] getBytes(
IResource resource)
                         throws 
TeamException
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.

Parameters:
resource - the local resource
Returns:
the bytes that represent the resource's variant
Throws:
TeamException

setBytes

public abstract boolean setBytes(
IResource resource,
                                 byte[] bytes)
                          throws 
TeamException
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.

Parameters:
resource - the local resource
bytes - the bytes that represent the resource's variant
Returns:
true if the bytes changed
Throws:
TeamException

flushBytes

public abstract boolean flushBytes(
IResource resource,
                                   int depth)
                            throws 
TeamException
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.

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

deleteBytes

public abstract boolean deleteBytes(
IResource resource)
                             throws 
TeamException
Method called to indicate that it is known that there is no variant associated with the local resource. Subclasses may handle this information in different ways. The flush(IResource, int) method should be used in the cases where a client wishes to remove bytes for other reason.

Parameters:
resource - the local resource
Returns:
true if this changes the bytes for the variant
Throws:
TeamException

members

public abstract 
IResource[] members(
IResource resource)
                             throws 
TeamException
Return the children of the given resource that have resource variants in this tree.

Parameters:
resource - the parent resource
Returns:
the members who have resource variants in this tree.
Throws:
TeamException

equals

protected boolean equals(byte[] syncBytes1,
                         byte[] syncBytes2)
Helper method to compare two byte arrays for equality

Parameters:
syncBytes1 - the first byte array or null
syncBytes2 - the second byte array or null
Returns:
whether the two arrays are equal (i.e. same content)

run

public void run(
IResource root,
                
IWorkspaceRunnable runnable,
                
IProgressMonitor monitor)
         throws 
TeamException
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).

Parameters:
root - the root resource for all modifications
runnable - the action to perform
monitor - a progress monitor.
Throws:
TeamException - if the operation failed.
OperationCanceledException - if the operation is canceled.

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