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

Identify component factories by identifier string #99

Open
kevinwallimann opened this issue Feb 19, 2020 · 0 comments
Open

Identify component factories by identifier string #99

kevinwallimann opened this issue Feb 19, 2020 · 0 comments
Assignees
Milestone

Comments

@kevinwallimann
Copy link
Collaborator

kevinwallimann commented Feb 19, 2020

Description
Currently, component factories are loaded in ClassLoaderUtils given their fully qualified classnames. The classname is passed by the configuration. (e.g. component.writer)

That means that components don't have the possibility to be refactored (renaming, moving to a different package) without introducing a breaking change which would require updating any existing configuration that uses that component.

Tasks

  • Add a method getIdentifier: String to the interface ComponentFactory. getClass.getName may be used as a default value. (so this feature won't be a breaking change)
  • Implementing components are responsible for providing a unique identifier. It's advisable to prefix the identifier with a human readable name, because it will be referenced in the configuration, logged, etc..
  • Use getIdentifier to load the factory in ClassLoaderUtils. Currently, it loads the class directly given the class name. This approach doesn't work to efficiently load the factory by the identifier. With Configuration property keys of components should be accessible via reflection #83, component factories can be loaded using the Service Provider Interface (SPI), i.e. with ServiceLoader. All factories expose the getIdentifier method, that's how it can be found

Other

  • The same identifier might be used by each component to prefix its configuration properties to avoid name clashes.
@kevinwallimann kevinwallimann self-assigned this Feb 19, 2020
@kevinwallimann kevinwallimann modified the milestones: v2.x.0, v3.x.0 Feb 19, 2020
@kevinwallimann kevinwallimann modified the milestones: v3.x.0, v4.0.0 May 25, 2020
@kevinwallimann kevinwallimann modified the milestones: v4.0.0, v5.0.0 Jun 17, 2020
@kevinwallimann kevinwallimann modified the milestones: v5.0.0, backlog Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant