Alignment of ServerPluginProvider to latest interfaces
Adoption of Optional<T> and removal of name in the
ServerPluginProvider.
Aligned with the refs/changes/70/56270/3 on Gerrit
Change-Id: Icfe9f1ece3a58002db30d64236daaaf031575ed2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginProvider.java b/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginProvider.java
index 1c46c7b..0651148 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginProvider.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginProvider.java
@@ -58,10 +58,11 @@
}
@Override
- public ServerPlugin get(String name, File srcFile, PluginUser pluginUser,
+ public ServerPlugin get(File srcFile, PluginUser pluginUser,
FileSnapshot snapshot, String pluginCanonicalWebUrl, File pluginDataDir)
throws InvalidPluginException {
ScalaPluginScriptEngine scriptEngine = scriptEngineProvider.get();
+ String name = getPluginName(srcFile);
return new ServerPlugin(name, pluginCanonicalWebUrl, pluginUser, srcFile,
snapshot, new ScalaPluginScanner(name, srcFile, scriptEngine),
pluginDataDir, scriptEngine.getClassLoader());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginScanner.java b/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginScanner.java
index 5af869b..e72fc72 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginScanner.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/scripting/scala/ScalaPluginScanner.java
@@ -13,6 +13,7 @@
// limitations under the License.
package com.googlesource.gerrit.plugins.scripting.scala;
+import com.google.common.base.Optional;
import com.google.gerrit.server.plugins.AbstractPreloadedPluginScanner;
import com.google.gerrit.server.plugins.InvalidPluginException;
import com.google.gerrit.server.plugins.Plugin;
@@ -53,14 +54,14 @@
}
@Override
- public <T> T getResource(String resourcePath, Class<? extends T> resourceClass) {
- return null;
+ public <T> Optional<T> getResource(String resourcePath, Class<? extends T> resourceClass) {
+ return Optional.absent();
}
@Override
- public InputStream getResourceInputStream(String resourcePath)
+ public Optional<InputStream> getResourceInputStream(String resourcePath)
throws IOException {
- return null;
+ return Optional.absent();
}
@Override