private static void setPluginProps ( final String pluginDirName , final AbstractPlugin plugin , final Properties props ) throws Exception { final String author = props . getProperty ( Plugin . PLUGIN_AUTHOR ) ; final String name = props . getProperty ( Plugin . PLUGIN_NAME ) ; final String version = props . getProperty ( Plugin . PLUGIN_VERSION ) ; final String types = props . getProperty ( Plugin . PLUGIN_TYPES ) ; LOGGER . log ( Level . TRACE , "Plugin[name={0}, author={1}, version={2}, types={3}]" , name , author , version , types ) ; plugin . setAuthor ( author ) ; plugin . setName ( name ) ; plugin . setId ( name + "_" + version ) ; plugin . setVersion ( version ) ; plugin . setDir ( pluginDirName ) ; plugin . readLangs ( ) ; // try to find the setting config.json final File settingFile = Latkes . getWebFile ( "/plugins/" + pluginDirName + "/config.json" ) ; if ( null != settingFile && settingFile . exists ( ) ) { try { final String config = FileUtils . readFileToString ( settingFile ) ; final JSONObject jsonObject = new JSONObject ( config ) ; plugin . setSetting ( jsonObject ) ; } catch ( final IOException ie ) { LOGGER . log ( Level . ERROR , "reading the config of the plugin[" + name + "] failed" , ie ) ; } catch ( final JSONException e ) { LOGGER . log ( Level . ERROR , "convert the config of the plugin[" + name + "] to json failed" , e ) ; } } Arrays . stream ( types . split ( "," ) ) . map ( PluginType :: valueOf ) . forEach ( plugin :: addType ) ; }
Sets the specified plugin s properties from the specified properties file under the specified plugin directory .