Class JsonLDStore

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

    public class JsonLDStore
    extends org.spdx.storage.simple.ExtendedSpdxStore
    implements org.spdx.storage.ISerializableModelStore
    Serializable store which reads and writes the SPDX Spec version 3 JSON LD format
    Author:
    Gary O'Neall
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.spdx.storage.IModelStore

        org.spdx.storage.IModelStore.IdType, org.spdx.storage.IModelStore.IModelStoreLock, org.spdx.storage.IModelStore.ModelUpdate
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonLDStore​(org.spdx.storage.IModelStore baseStore)
      Constructs a JsonLDStore with the specified base store
      JsonLDStore​(org.spdx.storage.IModelStore baseStore, boolean pretty)
      Constructs a JsonLDStore with the specified base store and pretty format option
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.spdx.library.model.v3_0_1.core.SpdxDocument deSerialize​(InputStream stream, boolean overwrite)  
      boolean getPretty()
      Check the pretty format option for JSON LD output
      void serialize​(OutputStream stream)  
      void serialize​(OutputStream stream, org.spdx.core.CoreModelObject objectToSerialize)  
      void setPretty​(boolean pretty)
      Sets the pretty format option for JSON LD output
      void setUseExternalListedElements​(boolean useExternalListedElements)
      Sets whether to use external listed elements
      • Methods inherited from class org.spdx.storage.simple.ExtendedSpdxStore

        addValueToCollection, clear, clearValueCollection, close, collectionContains, collectionSize, create, delete, enterCriticalSection, exists, getAllItems, getCaseSensitiveId, getIdType, getNextId, getPropertyValueDescriptors, getTypedValue, getValue, isAnon, isCollectionMembersAssignableTo, isCollectionProperty, isPropertyValueAssignableTo, leaveCriticalSection, listValues, removeProperty, removeValueFromCollection, setValue
      • Methods inherited from interface org.spdx.storage.IModelStore

        addValueToCollection, clearValueCollection, collectionContains, collectionSize, create, delete, enterCriticalSection, exists, getAllItems, getCaseSensisitiveId, getCaseSensitiveId, getIdType, getNextId, getPropertyValueDescriptors, getTypedValue, getValue, isAnon, isCollectionMembersAssignableTo, isCollectionProperty, isPropertyValueAssignableTo, leaveCriticalSection, listValues, removeProperty, removeValueFromCollection, setValue
    • Constructor Detail

      • JsonLDStore

        public JsonLDStore​(org.spdx.storage.IModelStore baseStore,
                           boolean pretty)
        Constructs a JsonLDStore with the specified base store and pretty format option
        Parameters:
        baseStore - underlying store to use
        pretty - if true, use less compact prettier JSON LD format on output
      • JsonLDStore

        public JsonLDStore​(org.spdx.storage.IModelStore baseStore)
        Constructs a JsonLDStore with the specified base store
        Parameters:
        baseStore - underlying store to use
    • Method Detail

      • getPretty

        public boolean getPretty()
        Check the pretty format option for JSON LD output
        Returns:
        if true, use less compact prettier JSON LD format on output
      • setPretty

        public void setPretty​(boolean pretty)
        Sets the pretty format option for JSON LD output
        Parameters:
        pretty - if true, use less compact prettier JSON LD format on output
      • serialize

        public void serialize​(OutputStream stream)
                       throws org.spdx.core.InvalidSPDXAnalysisException,
                              IOException
        Specified by:
        serialize in interface org.spdx.storage.ISerializableModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
        IOException
      • serialize

        public void serialize​(OutputStream stream,
                              @Nullable
                              org.spdx.core.CoreModelObject objectToSerialize)
                       throws org.spdx.core.InvalidSPDXAnalysisException,
                              IOException
        Specified by:
        serialize in interface org.spdx.storage.ISerializableModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
        IOException
      • deSerialize

        public org.spdx.library.model.v3_0_1.core.SpdxDocument deSerialize​(InputStream stream,
                                                                           boolean overwrite)
                                                                    throws org.spdx.core.InvalidSPDXAnalysisException,
                                                                           IOException
        Specified by:
        deSerialize in interface org.spdx.storage.ISerializableModelStore
        Throws:
        org.spdx.core.InvalidSPDXAnalysisException
        IOException
      • setUseExternalListedElements

        public void setUseExternalListedElements​(boolean useExternalListedElements)
        Sets whether to use external listed elements
        Parameters:
        useExternalListedElements - if true, don't serialize any listed licenses or exceptions - treat them as external