-
Notifications
You must be signed in to change notification settings - Fork 58
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
[FEATURE] Create abstract Base classes for Extension and ExtensionRestHandler #136
Comments
Design for components section of this issue, as discussed with @dbwiddis:
|
A good example of this pattern in the OpenSearch codebase is the plugin "action" to handle REST request which |
There should be a similar method like getExtensionSettings named as |
I'm not sure that is the best approach here. In the plugin ecosystem, OpenSearch initializes the plugins (from We are instantiating extensions from a different Node instance and many of these don't apply; those that are relevant should be present in the |
Continuing the above example. The fundamental difference is that in the Plugin case, every plugin needs access to the same Java object(s) (e.g., the So to get an
I obviously favor the last one, but open to discussion on this. |
An option to the proposed approach (private instance, public getters, protected setters) would just be to have protected instance variables. |
Hey @ryanbogan ... after reviewing @owaiskazi19 comments here and elsewhere I think we're all in agreement on the following approach. Yes this is the opposite of what I've said before but I've come to see the light. :-) In SDK:
In Extension:
|
Thanks @dbwiddis for outlining the clear steps for createComponent interface. |
@ryanbogan the 5th point in above comment can be address in #160. |
Is your feature request related to a problem?
Extension developers need a stable API (interface) to implement extensions.
SDK developers need a way to add additional functionality without forcing extension developers to change their code.
What solution would you like?
I propose to create a 3-layer inheritance for
Extension
andExtensionRestHandler
implementations.Extension
interface will include all the methods required byExtensionsRunner
includingBaseExtension
abstract class will provide default methods so users don't need to implement everything in the interface but have the ability to overrideExtensionRestHandler
with aBaseExtensionRestHandler
Also we should create a new
ExtensionRestRequest
class to be the sole argument toExtensionRestHandler.handleRequest()
.RestRequest
method names exactly to ease porting extension codeWhat alternatives have you considered?
An interface-only model requires using default methods and exposes a lot of implementation details that aren't really needed.
An abstract-class-only model would work but from an "API" or "SDK" perspective I prefer the cleanliness of an interface.
Do you have any additional context?
@owaiskazi19 please provide some input on what the API method for creating components should look like (what arguments, etc.)
@cwperks this relates to this comment on your draft PR.
@mloufra the create components piece may touch your code after refactoring ExtensionsRunner in #116 so will try to coordinate my implementation with yours in #116. If you can let me know which branch on your local fork you're pushing code to it will be helpful.
The text was updated successfully, but these errors were encountered: