Class SessionResourceVariantByteStore


  • public class SessionResourceVariantByteStore
    extends ResourceVariantByteStore
    A ResourceVariantByteStore that caches the variant bytes in memory and does not persist them over workbench invocations.
    Since:
    3.0
    Restriction:
    This class is not intended to be subclassed by clients.
    • Constructor Detail

      • SessionResourceVariantByteStore

        public SessionResourceVariantByteStore()
    • Method Detail

      • deleteBytes

        public boolean deleteBytes​(IResource resource)
                            throws TeamException
        Description copied from class: ResourceVariantByteStore
        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.
        Specified by:
        deleteBytes in class ResourceVariantByteStore
        Parameters:
        resource - the local resource
        Returns:
        true if this changes the bytes for the variant
        Throws:
        TeamException - if an error occurs
      • 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 - if an error occurs
      • 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 - if an error occurs
      • isEmpty

        public boolean isEmpty()
        Return true if no bytes are contained in this tree.
        Returns:
        true if no bytes are contained in this tree.
      • members

        public IResource[] members​(IResource resource)
        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.
      • 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 - if an error occurs