Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back default values for the SPDX default model store #284

Open
goneall opened this issue Jan 24, 2025 · 7 comments · May be fixed by #286
Open

Add back default values for the SPDX default model store #284

goneall opened this issue Jan 24, 2025 · 7 comments · May be fixed by #286

Comments

@goneall
Copy link
Member

goneall commented Jan 24, 2025

See #237 (comment) for discussion.

@goneall
Copy link
Member Author

goneall commented Jan 24, 2025

Since the default model store is in core and the CopyManager and InMemSpdxStore are in the higher level library, we'll probably need to initialize the default model store in the SpdxModelFactory.init().

@dwalluck
Copy link
Contributor

Why wasn't SpdxModelFactory.init() required in V2? I guess I would have to stick this call in a static block in my application somewhere, unless the library itself could initialize it (I assume there's a singleton somewhere).

@dwalluck
Copy link
Contributor

In any case, it would be nice to have init() call DefaultModelStore.initialize(new InMemSpdxStore(), DEFAULT_DOCUMENT_URI, new ModelCopyManager());.

@dwalluck
Copy link
Contributor

Unless it should also be possible for the application to provide a different model store?

@goneall
Copy link
Member Author

goneall commented Jan 25, 2025

Unless it should also be possible for the application to provide a different model store?

How about creating 2 init methods, one that passes in the parameters to DefaultModelStore.initialize and one that just defaults it.

Another complication would be if we called init twice - currently there is no impact on multiple calls. Since we may be changing the state of the DefaultModelStore in the init function, I'm thinking we only modify the state of the DefaultModelStore if it is the initial call to init. Perhaps issue a warning if there is a subsequent call to init that would have modified the model store. A bit more complicated to implement, but it would avoid some common issues.

@goneall
Copy link
Member Author

goneall commented Jan 25, 2025

I'll create a PR with the above proposed solution.

@goneall
Copy link
Member Author

goneall commented Jan 26, 2025

@dwalluck I'm rethinking the second init method with the default model store parameters.

See #286 (comment) for reasoning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants