Skip to content

Commit

Permalink
Created ExtensibleExtension interface (#600)
Browse files Browse the repository at this point in the history
* copied and pasted from plugin file, replaced with extension keywords

Signed-off-by: Bexultan_Tokan <[email protected]>

* used gradlew spotless

Signed-off-by: Bexultan_Tokan <[email protected]>

* deleted unnecessary comments

Signed-off-by: Bexultan_Tokan <[email protected]>

* returned comments, removed @opensearch.api

Signed-off-by: Bexultan_Tokan <[email protected]>

---------

Signed-off-by: Bexultan_Tokan <[email protected]>
  • Loading branch information
bexultantokan authored Apr 3, 2023
1 parent e384dae commit c650fa2
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/main/java/org/opensearch/sdk/ExtensibleExtension.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.sdk;

import java.util.List;

/**
* An extension point for {@link Extension} implementations to be themselves extensible.
*
* This class provides a callback for extensible Extensions to be informed of other Extensions
* which extend them.
*
*/

public interface ExtensibleExtension {
/**
* Extension point for external Extensions to be extendable
*/

interface ExtensionLoader {
/**
* Load extensions of the type from all extending Extensions. The concrete extensions must have either a no-arg constructor
* or a single-arg constructor accepting the specific Extension class.
* @param extensionPointType the extension point type
* @param <T> extension point type
* @return all implementing extensions.
*/
<T> List<T> loadExtensions(Class<T> extensionPointType);
}

/**
* Allow this Extension to load extensions from other Extensions.
*
* This method is called once only, after initializing this Extension and all Extensions extending this Extension. It is called before
* any other methods on this Extension instance are called.
* @param loader the loader to use to load extensions
*/
default void loadExtensions(ExtensionLoader loader) {}
}

0 comments on commit c650fa2

Please sign in to comment.