Methods Summary |
---|
public static void | checkBootstrapPlugins()
try{
File target_props = getPropsIfNotPresent( AZUPDATER_PLUGIN_ID, true );
if ( target_props != null ){
writePluginProperties(
target_props,
new String[]{
"plugin.class=org.gudy.azureus2.update.UpdaterUpdateChecker;org.gudy.azureus2.update.UpdaterPatcher",
"plugin.name=Azureus Update Support;Azureus Updater Support Patcher" });
}
// has to go into USER dir as currently VISTA plugin install into shared is BROKEN!
target_props = getPropsIfNotPresent( AZUPNPAV_PLUGIN_ID, false );
if ( target_props != null ){
writePluginProperties(
target_props,
new String[]{
"plugin.class=com.aelitis.azureus.plugins.upnpmediaserver.UPnPMediaServer",
"plugin.name=UPnP Media Server",
"plugin.id=azupnpav" });
}
}catch( Throwable e){
Debug.printStackTrace(e);
}
|
public static boolean | disableNativeCode(java.lang.String version)
try {
File plugin_dir = null;
// we can't check the user-dir here due to crazy recursion problems
// during startup (platform manager init etc)
File shared_plugin_dir = FileUtil.getApplicationFile("plugins");
File shared_updater_plugin = new File(shared_plugin_dir, AZUPDATER_PLUGIN_ID);
if (shared_updater_plugin.exists()) {
plugin_dir = shared_updater_plugin;
}
if ( plugin_dir == null ){
return (false);
}
return (new File(plugin_dir, "disnat" + version).exists());
} catch (Throwable e) {
e.printStackTrace();
}
return (false);
|
public static void | ensurePluginPresent(java.lang.String id, java.lang.String cla, java.lang.String name)
File target_props = getPropsIfNotPresent( id, false );
if ( target_props != null ){
writePluginProperties(
target_props,
new String[]{
"plugin.class=" + cla,
"plugin.name=" + name,
"plugin.id=" + id });
}
|
protected static java.io.File | getPropsIfNotPresent(java.lang.String id, boolean use_shared)
File user_plugin_dir = FileUtil.getUserFile("plugins");
File user_plugin = new File(user_plugin_dir, id);
File user_props = new File( user_plugin, "plugin.properties" );
if ( user_props.exists()){
return( null );
}
File shared_plugin_dir = FileUtil.getApplicationFile("plugins");
File shared_plugin = new File(shared_plugin_dir, id);
File shared_props = new File(shared_plugin, "plugin.properties");
if ( shared_props.exists()){
return( null );
}
if ( use_shared ){
FileUtil.mkdirs( shared_plugin );
return( shared_props );
}else{
FileUtil.mkdirs( user_plugin );
return( user_props );
}
|
public static java.lang.String | getUpdaterPluginVersion()
try {
PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID(AZUPDATER_PLUGIN_ID);
if (pi != null) {
String version = pi.getPluginVersion();
if (version != null) {
return version;
}
}
} catch (Throwable t) {
}
return "0";
|
protected static void | writePluginProperties(java.io.File target, java.lang.String[] lines)
try{
PrintWriter pw = null;
try{
pw = new PrintWriter(new FileWriter(target));
for (int i=0;i<lines.length;i++){
pw.println( lines[i] );
}
pw.println( "plugin.install_if_missing=yes" );
}finally{
if ( pw != null ){
pw.close();
}
}
if (!target.exists()) {
throw (new Exception("Failed to write '" + target.toString() + "'"));
}
} catch (Throwable e) {
Logger.log(
new LogAlert(
LogAlert.UNREPEATABLE,
"Plugin bootstrap: initialisation error for " + target, e ));
}
|