public synchronized boolean installPlugin ( String id , String version ) throws PluginException { // Download to temporary location Path downloaded = downloadPlugin ( id , version ) ; Path pluginsRoot = pluginManager . getPluginsRoot ( ) ; Path file = pluginsRoot . resolve ( downloaded . getFileName ( ) ) ; try { Files . move ( downloaded , file ) ; } catch ( IOException e ) { throw new PluginException ( e , "Failed to write file '{}' to plugins folder" , file ) ; } String pluginId = pluginManager . loadPlugin ( file ) ; PluginState state = pluginManager . startPlugin ( pluginId ) ; return PluginState . STARTED . equals ( state ) ; }
Installs a plugin by id and version .