-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Providing an option for the plugins to use Spring DI (#5012)
providing an option for the plugins to use Spring DI Signed-off-by: Santhosh Gandhe <[email protected]> Update data-prepper-api/src/main/java/org/opensearch/dataprepper/model/annotations/DataPrepperPlugin.java modified the comment line based on the suggession Co-authored-by: David Venable <[email protected]> Signed-off-by: Santhosh Gandhe <[email protected]> Integration test to validate the DI context enabling in plugins Signed-off-by: Santhosh Gandhe <[email protected]> Co-authored-by: David Venable <[email protected]>
- Loading branch information
Showing
8 changed files
with
157 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...plugin-framework/src/test/java/org/opensearch/dataprepper/plugins/test/TestComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.opensearch.dataprepper.plugins.test; | ||
|
||
import javax.inject.Named; | ||
|
||
@Named | ||
public class TestComponent { | ||
public String getIdentifier() { | ||
return "test-component"; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...-plugin-framework/src/test/java/org/opensearch/dataprepper/plugins/test/TestDISource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.test; | ||
|
||
import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin; | ||
import org.opensearch.dataprepper.model.annotations.DataPrepperPluginConstructor; | ||
import org.opensearch.dataprepper.model.buffer.Buffer; | ||
import org.opensearch.dataprepper.model.record.Record; | ||
import org.opensearch.dataprepper.model.source.Source; | ||
import org.opensearch.dataprepper.plugin.TestPluggableInterface; | ||
|
||
@DataPrepperPlugin(name = "test_di_source", | ||
alternateNames = { "test_source_alternate_name1", "test_source_alternate_name2" }, | ||
deprecatedName = "test_source_deprecated_name", | ||
pluginType = Source.class, | ||
packagesToScan = {TestDISource.class}) | ||
public class TestDISource implements Source<Record<String>>, TestPluggableInterface { | ||
|
||
private final TestComponent testComponent; | ||
|
||
@DataPrepperPluginConstructor | ||
public TestDISource(TestComponent testComponent) { | ||
this.testComponent = testComponent; | ||
} | ||
|
||
@Override | ||
public void start(Buffer<Record<String>> buffer) { | ||
} | ||
|
||
public TestComponent getTestComponent() { | ||
return testComponent; | ||
} | ||
|
||
@Override | ||
public void stop() {} | ||
} |