Skip to content
Snippets Groups Projects
Commit a9ee6f7b authored by felmer's avatar felmer
Browse files

SE-191 throw useful exception if plugin not found

SVN: 14461
parent ec543939
No related branches found
No related tags found
No related merge requests found
...@@ -50,12 +50,12 @@ public class PluginTaskProvider<P> ...@@ -50,12 +50,12 @@ public class PluginTaskProvider<P>
/** creates an instance of the plugin with the given key */ /** creates an instance of the plugin with the given key */
public P createPluginInstance(String pluginKey, File storeRoot) public P createPluginInstance(String pluginKey, File storeRoot)
{ {
return factories.tryGet(pluginKey).createPluginInstance(storeRoot); return getFactory(pluginKey).createPluginInstance(storeRoot);
} }
public DatastoreServiceDescription getPluginDescription(String pluginKey) public DatastoreServiceDescription getPluginDescription(String pluginKey)
{ {
return factories.tryGet(pluginKey).getPluginDescription(); return getFactory(pluginKey).getPluginDescription();
} }
public List<DatastoreServiceDescription> getPluginDescriptions() public List<DatastoreServiceDescription> getPluginDescriptions()
...@@ -87,4 +87,14 @@ public class PluginTaskProvider<P> ...@@ -87,4 +87,14 @@ public class PluginTaskProvider<P>
} }
} }
private AbstractPluginTaskFactory<P> getFactory(String pluginKey)
{
AbstractPluginTaskFactory<P> factory = factories.tryGet(pluginKey);
if (factory == null)
{
throw new IllegalArgumentException("No plugin registered for key '" + pluginKey + "'.");
}
return factory;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment