You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
Copy file name to clipboardExpand all lines: README-V3-UPGRADE.md
+33-18Lines changed: 33 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
# Upgrading from version 2 to version 3
1
+
# Upgrading from SPDX version 2 to version 3
2
2
3
3
With the support of SPDX 3.0, several changes have been made to the library codebase that will break previous API's.
4
4
Although we tried to keep breaking changes to a minimum, some of the changes were necessary due to breaking changes in the spec. itself.
5
5
We also took advantage of the changes to fix some annoying design flaws in the previous implementation of the library.
6
6
7
-
## New initialisation methods
7
+
## New initialization methods
8
8
9
-
v2 of the library introduces an explicit initialisation process. This involves:
9
+
v2 of the library introduces an explicit initialization process. This involves:
10
10
11
11
1. (optional) Calling `org.spdx.core.DefaultModelStore.initialize(...)` with your own choice of ModelStore and CopyManager.
12
12
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:
16
16
- Step #1 is optional; if not provided, a default ModelStore and CopyManager will be automatically created and configured by `SpdxModelFactory.init()`.
17
17
- Once initialized (via Step #2), further calls to `DefaultModelStore.initialize(...)` will be ignored.
18
18
19
-
## Deprecated configuration for using online licenses from Jar file removed
19
+
## Deprecated configuration for using online licenses from jar file removed
20
20
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.
23
23
24
-
## Classes and Methods moved to SPDX Java Core library
24
+
## Classes and methods moved to SPDX Java Core library
25
25
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.
27
27
28
28
The following classes and methods are moved from `org.spdx.library` to `org.spdx.core`:
29
29
@@ -34,10 +34,12 @@ The following classes and methods are moved from `org.spdx.library` to `org.spdx
34
34
-`SimpleUriValue`
35
35
-`TypedValue`
36
36
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.
38
38
39
39
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`.
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.
## Changes to ExternalElement and ExternalExtractedLicenseInfo (SPDX Version 2.X classes)
62
71
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
64
75
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.
66
78
67
79
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
68
80
@@ -73,8 +85,9 @@ Since SPDX documents are not generally required in SPDX spec version 3.0, the SP
73
85
To find all the SPDX documents in a serialization, you can execute:
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
85
98
86
99
### Change propertyName to propertyDescriptor
87
100
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
+
90
103
The `PropertyDescriptor` has a `name` property and a `nameSpace` property.
104
+
91
105
The property constants defined in `org.spdx.library.SpdxConstants` have all been changed to use constant `PropertyDescriptor`s.
92
106
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`.
93
107
94
-
### Make DocumentNamespace Optional
108
+
### Make DocumentNamespace optional
95
109
96
110
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.
97
111
@@ -101,6 +115,7 @@ To translate from SPDX 2.X, the `DocumentNamespace` concatenated with the `id` c
101
115
102
116
`TypedValue` now takes an ObjectURI rather than an ID.
103
117
Note that the method signature has not changed, so you may need to manually search for usage in order to change.
118
+
104
119
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.
0 commit comments