Class ExtendedSpdxStore

  • All Implemented Interfaces:
    AutoCloseable, org.spdx.storage.IModelStore

    public abstract class ExtendedSpdxStore
    extends Object
    implements org.spdx.storage.IModelStore
    A simple abstract SPDX store that stores everything in an underlying model store which is initialized in the constructor. This class can be useful for subclassing and overriding specific methods and/or implementing serialization with a choice of underlying message stores.
    Author:
    Gary O'Neall
    • Constructor Detail

      • ExtendedSpdxStore

        public ExtendedSpdxStore​(org.spdx.storage.IModelStore baseStore)
        Parameters:
        baseStore - store used as the base for this extended SPDX store
    • Method Detail

      • exists

        public boolean exists​(String objectUri)
        Specified by:
        exists in interface org.spdx.storage.IModelStore
      • create

        public void create​(org.spdx.core.TypedValue typedValue)
                    throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        create in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getPropertyValueDescriptors

        public List<org.spdx.storage.PropertyDescriptor> getPropertyValueDescriptors​(String objectUri)
                                                                              throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        getPropertyValueDescriptors in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • setValue

        public void setValue​(String objectUri,
                             org.spdx.storage.PropertyDescriptor propertyDescriptor,
                             Object value)
                      throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        setValue in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getValue

        public Optional<Object> getValue​(String objectUri,
                                         org.spdx.storage.PropertyDescriptor propertyDescriptor)
                                  throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        getValue in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getNextId

        public String getNextId​(org.spdx.storage.IModelStore.IdType idType)
                         throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        getNextId in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • removeProperty

        public void removeProperty​(String objectUri,
                                   org.spdx.storage.PropertyDescriptor propertyDescriptor)
                            throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        removeProperty in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getAllItems

        public Stream<org.spdx.core.TypedValue> getAllItems​(String documentUri,
                                                            String typeFilter)
                                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        getAllItems in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • enterCriticalSection

        public org.spdx.storage.IModelStore.IModelStoreLock enterCriticalSection​(boolean readLockRequested)
                                                                          throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        enterCriticalSection in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • leaveCriticalSection

        public void leaveCriticalSection​(org.spdx.storage.IModelStore.IModelStoreLock lock)
        Specified by:
        leaveCriticalSection in interface org.spdx.storage.IModelStore
      • removeValueFromCollection

        public boolean removeValueFromCollection​(String objectUri,
                                                 org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                                 Object value)
                                          throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        removeValueFromCollection in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • collectionSize

        public int collectionSize​(String objectUri,
                                  org.spdx.storage.PropertyDescriptor propertyDescriptor)
                           throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        collectionSize in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • collectionContains

        public boolean collectionContains​(String objectUri,
                                          org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                          Object value)
                                   throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        collectionContains in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • clearValueCollection

        public void clearValueCollection​(String objectUri,
                                         org.spdx.storage.PropertyDescriptor propertyDescriptor)
                                  throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        clearValueCollection in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • addValueToCollection

        public boolean addValueToCollection​(String objectUri,
                                            org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                            Object value)
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        addValueToCollection in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • listValues

        public Iterator<Object> listValues​(String objectUri,
                                           org.spdx.storage.PropertyDescriptor propertyDescriptor)
                                    throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        listValues in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • isCollectionMembersAssignableTo

        public boolean isCollectionMembersAssignableTo​(String objectUri,
                                                       org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                                       Class<?> clazz)
                                                throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        isCollectionMembersAssignableTo in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • isPropertyValueAssignableTo

        public boolean isPropertyValueAssignableTo​(String objectUri,
                                                   org.spdx.storage.PropertyDescriptor propertyDescriptor,
                                                   Class<?> clazz,
                                                   String specVersion)
                                            throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        isPropertyValueAssignableTo in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • isCollectionProperty

        public boolean isCollectionProperty​(String objectUri,
                                            org.spdx.storage.PropertyDescriptor propertyDescriptor)
                                     throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        isCollectionProperty in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • getIdType

        public org.spdx.storage.IModelStore.IdType getIdType​(String id)
        Specified by:
        getIdType in interface org.spdx.storage.IModelStore
      • isAnon

        public boolean isAnon​(String objectUri)
        Specified by:
        isAnon in interface org.spdx.storage.IModelStore
      • getCaseSensisitiveId

        public Optional<String> getCaseSensisitiveId​(String documentUri,
                                                     String caseInsensisitiveId)
        Specified by:
        getCaseSensisitiveId in interface org.spdx.storage.IModelStore
      • getTypedValue

        public Optional<org.spdx.core.TypedValue> getTypedValue​(String objectUri)
                                                         throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        getTypedValue in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
      • clear

        protected void clear()
                      throws org.spdx.core.InvalidSPDXAnalysisException
        Clear all values for the document
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException - on errors accessing the store
      • delete

        public void delete​(String objectUri)
                    throws org.spdx.core.InvalidSPDXAnalysisException
        Specified by:
        delete in interface org.spdx.storage.IModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException