Package org.spdx.jacksonstore
Class MultiFormatStore
java.lang.Object
org.spdx.storage.simple.ExtendedSpdxStore
org.spdx.jacksonstore.MultiFormatStore
- All Implemented Interfaces:
AutoCloseable
,org.spdx.storage.IModelStore
,org.spdx.storage.ISerializableModelStore
public class MultiFormatStore
extends org.spdx.storage.simple.ExtendedSpdxStore
implements org.spdx.storage.ISerializableModelStore
Model store that supports multiple serialization formats (JSON, XML, YAML)
Note that the serialization/deserialization methods are synchronized to prevent the format or verbose changing while serializing
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
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
ConstructorsConstructorDescriptionMultiFormatStore
(org.spdx.storage.IModelStore baseStore, MultiFormatStore.Format format) Default compact version of MultiFormatStoreMultiFormatStore
(org.spdx.storage.IModelStore baseStore, MultiFormatStore.Format format, MultiFormatStore.Verbose verbose) -
Method Summary
Modifier and TypeMethodDescriptionvoid
static String
collectionPropertyNameToPropertyName
(String collectionPropertyName) org.spdx.library.model.v2.SpdxDocument
deSerialize
(InputStream stream, boolean overwrite) static String
propertyNameToCollectionPropertyName
(String propertyName) void
serialize
(OutputStream stream) void
serialize
(OutputStream stream, org.spdx.core.CoreModelObject modelObject) void
setFormat
(MultiFormatStore.Format format) void
setVerbose
(MultiFormatStore.Verbose verbose) 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.AutoCloseable
close
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 Details
-
MultiFormatStore
public MultiFormatStore(org.spdx.storage.IModelStore baseStore, MultiFormatStore.Format format, MultiFormatStore.Verbose verbose) - Parameters:
baseStore
- modelStore to store the results of the deserializationformat
- Format - XML, JSON or YAMLverbose
- How verbose to make the document
-
MultiFormatStore
Default compact version of MultiFormatStore- Parameters:
baseStore
- modelStore to store the results of the deserializationformat
- Format - XML, JSON or YAML
-
-
Method Details
-
getFormat
- Returns:
- the format
-
setFormat
- Parameters:
format
- the format to set
-
getVerbose
- Returns:
- the verbose
-
setVerbose
- Parameters:
verbose
- the verbose to set
-
serialize
public void serialize(OutputStream stream) throws org.spdx.core.InvalidSPDXAnalysisException, IOException - Specified by:
serialize
in interfaceorg.spdx.storage.ISerializableModelStore
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
IOException
-
serialize
public void serialize(OutputStream stream, @Nullable org.spdx.core.CoreModelObject modelObject) throws org.spdx.core.InvalidSPDXAnalysisException, IOException - Specified by:
serialize
in interfaceorg.spdx.storage.ISerializableModelStore
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
IOException
-
propertyNameToCollectionPropertyName
- Parameters:
propertyName
- name of the singular property- Returns:
- property name used for an array or collection of these values
-
collectionPropertyNameToPropertyName
-
deSerialize
public org.spdx.library.model.v2.SpdxDocument deSerialize(InputStream stream, boolean overwrite) throws org.spdx.core.InvalidSPDXAnalysisException, IOException - Specified by:
deSerialize
in interfaceorg.spdx.storage.ISerializableModelStore
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
IOException
-
clear
- Parameters:
documentNamespace
- Document namespace or Uri- Throws:
org.spdx.core.InvalidSPDXAnalysisException
- on SPDX parsing errors
-
getDocumentUris
- Returns:
- set of SPDX V2 document URI's in this model store
- Throws:
org.spdx.core.InvalidSPDXAnalysisException
- on SPDX parsing errors
-