Expand the access privilege of plugin classes.

Plugin and PluginGuiceEnvironment can be useful outside of its own
package, so expand the access privilege of their methods.

Change-Id: I9bbdd408c22b237247393131ccd0a0f9c766e637
This commit is contained in:
Yuxuan 'fishy' Wang
2015-07-06 15:17:41 -07:00
parent 7b06ff8917
commit ccbe4a9677
4 changed files with 12 additions and 12 deletions

View File

@@ -58,7 +58,7 @@ class JsPlugin extends Plugin {
} }
@Override @Override
void stop(PluginGuiceEnvironment env) { protected void stop(PluginGuiceEnvironment env) {
if (manager != null) { if (manager != null) {
manager.stop(); manager.stop();
httpInjector = null; httpInjector = null;
@@ -83,7 +83,7 @@ class JsPlugin extends Plugin {
} }
@Override @Override
boolean canReload() { protected boolean canReload() {
return true; return true;
} }

View File

@@ -130,9 +130,9 @@ public abstract class Plugin {
return disabled; return disabled;
} }
abstract void start(PluginGuiceEnvironment env) throws Exception; protected abstract void start(PluginGuiceEnvironment env) throws Exception;
abstract void stop(PluginGuiceEnvironment env); protected abstract void stop(PluginGuiceEnvironment env);
public abstract PluginContentScanner getContentScanner(); public abstract PluginContentScanner getContentScanner();
@@ -168,7 +168,7 @@ public abstract class Plugin {
return "Plugin [" + name + "]"; return "Plugin [" + name + "]";
} }
abstract boolean canReload(); protected abstract boolean canReload();
boolean isModified(Path jar) { boolean isModified(Path jar) {
return snapshot.lastModified() != lastModified(jar); return snapshot.lastModified() != lastModified(jar);

View File

@@ -145,7 +145,7 @@ public class PluginGuiceEnvironment {
|| (httpMaps != null && httpMaps.containsKey(type)); || (httpMaps != null && httpMaps.containsKey(type));
} }
Module getSysModule() { public Module getSysModule() {
return sysModule; return sysModule;
} }
@@ -210,15 +210,15 @@ public class PluginGuiceEnvironment {
return httpGen.get(); return httpGen.get();
} }
RequestContext enter(Plugin plugin) { public RequestContext enter(Plugin plugin) {
return local.setContext(new PluginRequestContext(plugin.getPluginUser())); return local.setContext(new PluginRequestContext(plugin.getPluginUser()));
} }
void exit(RequestContext old) { public void exit(RequestContext old) {
local.setContext(old); local.setContext(old);
} }
void onStartPlugin(Plugin plugin) { public void onStartPlugin(Plugin plugin) {
RequestContext oldContext = enter(plugin); RequestContext oldContext = enter(plugin);
try { try {
attachItem(sysItems, plugin.getSysInjector(), plugin); attachItem(sysItems, plugin.getSysInjector(), plugin);

View File

@@ -151,7 +151,7 @@ public class ServerPlugin extends Plugin {
} }
@Override @Override
boolean canReload() { protected boolean canReload() {
Attributes main = manifest.getMainAttributes(); Attributes main = manifest.getMainAttributes();
String v = main.getValue("Gerrit-ReloadMode"); String v = main.getValue("Gerrit-ReloadMode");
if (Strings.isNullOrEmpty(v) || "reload".equalsIgnoreCase(v)) { if (Strings.isNullOrEmpty(v) || "reload".equalsIgnoreCase(v)) {
@@ -167,7 +167,7 @@ public class ServerPlugin extends Plugin {
} }
@Override @Override
void start(PluginGuiceEnvironment env) throws Exception { protected void start(PluginGuiceEnvironment env) throws Exception {
RequestContext oldContext = env.enter(this); RequestContext oldContext = env.enter(this);
try { try {
startPlugin(env); startPlugin(env);
@@ -241,7 +241,7 @@ public class ServerPlugin extends Plugin {
} }
@Override @Override
void stop(PluginGuiceEnvironment env) { protected void stop(PluginGuiceEnvironment env) {
if (serverManager != null) { if (serverManager != null) {
RequestContext oldContext = env.enter(this); RequestContext oldContext = env.enter(this);
try { try {