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 enumstatic enumNested 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 TypeMethodDescriptionvoidstatic StringcollectionPropertyNameToPropertyName(String collectionPropertyName) org.spdx.library.model.v2.SpdxDocumentdeSerialize(InputStream stream, boolean overwrite) static StringpropertyNameToCollectionPropertyName(String propertyName) voidserialize(OutputStream stream) voidserialize(OutputStream stream, org.spdx.core.CoreModelObject modelObject) voidsetFormat(MultiFormatStore.Format format) voidsetVerbose(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, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods 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:
serializein interfaceorg.spdx.storage.ISerializableModelStore- Throws:
org.spdx.core.InvalidSPDXAnalysisExceptionIOException
-
serialize
public void serialize(OutputStream stream, @Nullable org.spdx.core.CoreModelObject modelObject) throws org.spdx.core.InvalidSPDXAnalysisException, IOException - Specified by:
serializein interfaceorg.spdx.storage.ISerializableModelStore- Throws:
org.spdx.core.InvalidSPDXAnalysisExceptionIOException
-
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:
deSerializein interfaceorg.spdx.storage.ISerializableModelStore- Throws:
org.spdx.core.InvalidSPDXAnalysisExceptionIOException
-
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
-