Skip to content

Commit 651470e

Browse files
bactgoneall
authored andcommitted
Update README-V3-UPGRADE.md
Fix repo name and add link to repos. Few long paragraphs are break to smaller ones for readability. Signed-off-by: Arthit Suriyawongkul <[email protected]>
1 parent fb38245 commit 651470e

File tree

4 files changed

+38
-20
lines changed

4 files changed

+38
-20
lines changed

README-V3-UPGRADE.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Upgrading from version 2 to version 3
1+
# Upgrading from SPDX version 2 to version 3
22

33
With the support of SPDX 3.0, several changes have been made to the library codebase that will break previous API's.
44
Although we tried to keep breaking changes to a minimum, some of the changes were necessary due to breaking changes in the spec. itself.
55
We also took advantage of the changes to fix some annoying design flaws in the previous implementation of the library.
66

7-
## New initialisation methods
7+
## New initialization methods
88

9-
v2 of the library introduces an explicit initialisation process. This involves:
9+
v2 of the library introduces an explicit initialization process. This involves:
1010

1111
1. (optional) Calling `org.spdx.core.DefaultModelStore.initialize(...)` with your own choice of ModelStore and CopyManager.
1212
2. (required) Calling `org.spdx.library.SpdxModelFactory.init()` (this must happen _soon after_ the call to `DefaultModelStore.initialize()` - ideally before any other SPDX classes or methods are used).
@@ -16,14 +16,14 @@ Notes:
1616
- Step #1 is optional; if not provided, a default ModelStore and CopyManager will be automatically created and configured by `SpdxModelFactory.init()`.
1717
- Once initialized (via Step #2), further calls to `DefaultModelStore.initialize(...)` will be ignored.
1818

19-
## Deprecated configuration for using online licenses from Jar file removed
19+
## Deprecated configuration for using online licenses from jar file removed
2020

21-
The configuration properties `OnlyUseLocalLicenses` and `SPDXParser.OnlyUseLocalLicenses` will no longer force the
22-
library to use the licenses distributed with the Jar file. The supported property `org.spdx.useJARLicenseInfoOnly` should be used.
21+
The configuration properties `OnlyUseLocalLicenses` and `SPDXParser.OnlyUseLocalLicenses` will no longer force the
22+
library to use the licenses distributed with the jar file. The supported property `org.spdx.useJARLicenseInfoOnly` should be used.
2323

24-
## Classes and Methods moved to SPDX Java Core library
24+
## Classes and methods moved to SPDX Java Core library
2525

26-
The SPDX Java Core Library is in a separate repository and jar file.
26+
The SPDX Java Core Library is in a separate repository [`spdx-java-core`][spdx-java-core] and jar file.
2727

2828
The following classes and methods are moved from `org.spdx.library` to `org.spdx.core`:
2929

@@ -34,10 +34,12 @@ The following classes and methods are moved from `org.spdx.library` to `org.spdx
3434
- `SimpleUriValue`
3535
- `TypedValue`
3636

37-
The packages in `org.spdx.licenseTemplates` are now in the `java-spdx-core` repository.
37+
The packages in `org.spdx.licenseTemplates` are now in the `spdx-java-core` repository.
3838

3939
A new class `LicenseTextHelper` was added and the method `isLicenseTextEquivalent(String, String)` along with many supporting methods were moved to `LicenseTextHelper` from `org.spdx.utility.compare.LicenseCompareHelper`.
4040

41+
[spdx-java-core]: https://github.com/spdx/spdx-java-core/
42+
4143
## Other moved classes
4244

4345
- `org.spdx.library.model.license.ListedLicenses` moved to `org.spdx.library.ListedLicenses`
@@ -52,17 +54,27 @@ To support accessing SPDX 2.X model object while updating the library for SPDX 3
5254

5355
Many of the class and property names have been changed to append `CompatV2` to clearly designate a compatible object is being referenced.
5456

55-
Also note that the model classes are now stored in a separate repository `spdx-java-model-2_X`.
57+
Also note that the model classes are now stored in a separate repository [`spdx-java-model-2_X`][spdx-java-model-2_X].
58+
59+
[spdx-java-model-2_X]: https://github.com/spdx/spdx-java-model-2_X
5660

5761
## SPDX version 3.x package
5862

59-
SPDX 3.0.1 model objects can be found in packages underneath `org.spdx.library.model.v3_0_1`. Note that Spdx-Java-Library will only track the latest minor+patch version for the last 2 major SPDX specification versions (i.e. v2.3.0 and v3.0.1), because minor+patch versions of the SPDX specification are backwards compatible _within_ a major version.
63+
SPDX 3.0.1 model objects can be found in packages underneath `org.spdx.library.model.v3_0_1`,
64+
from a separate repository [`spdx-java-model-3_0`][spdx-java-model-3_0].
65+
66+
Note that Spdx-Java-Library will only track the latest minor+patch version for the last 2 major SPDX specification versions (i.e. v2.3.0 and v3.0.1), because minor+patch versions of the SPDX specification are backwards compatible _within_ a major version.
67+
68+
[spdx-java-model-3_0]: https://github.com/spdx/spdx-java-model-3_0
6069

6170
## Changes to ExternalElement and ExternalExtractedLicenseInfo (SPDX Version 2.X classes)
6271

63-
- Constructors changed to take the document URI for the document containing the external element or license. This is different from the previous constructor which took the document URI of the document containing the reference and an ID of the form `DocumentRef-XX:[ID]` To accommodate compatibility, the constructors
72+
- Constructors changed to take the document URI for the document containing the external element or license.
73+
- This is different from the previous constructor which took the document URI of the document containing the reference and an ID of the form `DocumentRef-XX:[ID]`.
74+
- To accommodate compatibility, the constructors
6475
will check for the old DocumentRef format and attempt a conversion.
65-
- Added a method `referenceElementId(SpdxDocument documentReferencingExternal)` which will convert return the `DocumentRef-XX:[ID]`. This should be used in place of the getId which previously returned this format.
76+
- Added a method `referenceElementId(SpdxDocument documentReferencingExternal)` which will convert return the `DocumentRef-XX:[ID]`.
77+
- This should be used in place of the getId which previously returned this format.
6678

6779
Note that this incompatibility was introduced due to using a common mode store API which in some cases will not have the documentUri as a required parameter
6880

@@ -73,8 +85,9 @@ Since SPDX documents are not generally required in SPDX spec version 3.0, the SP
7385
To find all the SPDX documents in a serialization, you can execute:
7486

7587
```java
76-
List<SpdxDocument> docs = (List<SpdxDocument>)SpdxModelFactory.getSpdxObjects(store, null, SpdxConstantsCompatV2.CLASS_SPDX_DOCUMENT, null, null)
77-
.collect(Collectors.toList());
88+
List<SpdxDocument> docs =
89+
(List<SpdxDocument>) SpdxModelFactory.getSpdxObjects(store, null, SpdxConstantsCompatV2.CLASS_SPDX_DOCUMENT, null, null)
90+
.collect(Collectors.toList());
7891
```
7992

8093
after deserialization to get a list of all SPDX documents.
@@ -85,13 +98,14 @@ For the RDF store, to keep compatible with the SPDX 2.X requirements, it now onl
8598

8699
### Change propertyName to propertyDescriptor
87100

88-
One significant change to the model store which impacts most of the API's.
89-
All `String` `propertyName` properties are replaced by a `propertyDescriptor` of type `PropertyDescriptor`.
101+
One significant change to the model store which impacts most of the API's is that all `String` `propertyName` properties are replaced by a `propertyDescriptor` of type `PropertyDescriptor`.
102+
90103
The `PropertyDescriptor` has a `name` property and a `nameSpace` property.
104+
91105
The property constants defined in `org.spdx.library.SpdxConstants` have all been changed to use constant `PropertyDescriptor`s.
92106
If you're using the constants, you may not need to change much beyond the method signatures for anything that was passing along the `propertyName`.
93107

94-
### Make DocumentNamespace Optional
108+
### Make DocumentNamespace optional
95109

96110
In SPDX 3.0, not all elements are contained within an SPDX document and we can't be guaranteed that a namespace is available for all `TypedValue` typed properties. Methods that are passed a `DocumentNamespace` and an `id` now are passed a URI.
97111

@@ -101,6 +115,7 @@ To translate from SPDX 2.X, the `DocumentNamespace` concatenated with the `id` c
101115

102116
`TypedValue` now takes an ObjectURI rather than an ID.
103117
Note that the method signature has not changed, so you may need to manually search for usage in order to change.
118+
104119
There is a convenience helper method `CompatibleModelStoreWrapper.typedValueFromDocUri(String documentUri, String id, boolean anonymous, String type)` that will convert from the SPDX V2 TypedValue to the current version.
105120

106121
### CompatibleModelStoreWrapper

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ See [README-V3-UPGRADE.md](README-V3-UPGRADE.md) for library upgrade instruction
5050

5151
## API Documentation
5252

53-
[![SPDX Java library family diagram](spdx_java_lib_family.png)](./spdx_java_lib_family.png)
53+
[![SPDX Java library family diagram](./spdx-java-lib-family.png)](./spdx-java-lib-family.png)
5454

5555
Here are links to the API documentation for the family of SPDX Java libraries.
5656

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
' SPDX-FileType: DOCUMENTATION
33
' SPDX-License-Identifier: Apache-2.0
44

5-
@startuml spdx_java_lib_family
5+
' Use PlantUML to generate PNG or SVG diagrams from this file.
6+
' See https://plantuml.com/ for installation and usage instructions.
7+
8+
@startuml spdx-java-lib-family
69
scale 1.5
710

811
title Family of SPDX Java libraries

0 commit comments

Comments
 (0)