-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow DevelopmentServer testing with internal and external plugins to…
…gether Co-authored-by: Pratham Desai <[email protected]>
- Loading branch information
Showing
5 changed files
with
56 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
### External Plugins Directory | ||
|
||
External plugins can be added to this directory to test with `DevelopmentServer`. Each | ||
plugin should be added as its own subdirectory. |
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
44 changes: 44 additions & 0 deletions
44
testing/trino-server-dev/src/main/java/io/trino/server/HybridDevelopmentPluginsProvider.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,44 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.server; | ||
|
||
import com.google.inject.Inject; | ||
import io.trino.server.PluginManager.PluginsProvider; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
/** | ||
* Supports loading internal and external plugins simultaneously during development. | ||
* The `plugin.dir` value in `config.properties` is relative to `trino-server-dev` module. | ||
*/ | ||
public class HybridDevelopmentPluginsProvider | ||
implements PluginsProvider | ||
{ | ||
private final DevelopmentPluginsProvider developmentPluginsProvider; | ||
private final ServerPluginsProvider serverPluginsProvider; | ||
|
||
@Inject | ||
public HybridDevelopmentPluginsProvider(DevelopmentPluginsProvider developmentPluginsProvider, ServerPluginsProvider serverPluginsProvider) | ||
{ | ||
this.developmentPluginsProvider = requireNonNull(developmentPluginsProvider, "developmentPluginsProvider is null"); | ||
this.serverPluginsProvider = requireNonNull(serverPluginsProvider, "serverPluginsProvider is null"); | ||
} | ||
|
||
@Override | ||
public void loadPlugins(Loader loader, ClassLoaderFactory createClassLoader) | ||
{ | ||
developmentPluginsProvider.loadPlugins(loader, createClassLoader); | ||
serverPluginsProvider.loadPlugins(loader, createClassLoader); | ||
} | ||
} |