⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plugininitializer.java

📁 java 文件下载器。可自定义
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
						Debug.printStackTrace(e);
						Logger.log(new LogAlert(false, (new StringBuilder()).append("Load of built in plugin '").append(plugin_id).append("' fails").toString(), e));
					}
					if (f_enabled)
					{
						if (core_operation != null)
							core_operation.reportCurrentTask((new StringBuilder()).append(MessageText.getString("splash.plugin.init")).append(" ").append(plugin_interface.getPluginName()).toString());
						fireCreated(plugin_interface);
						plugin.initialize(plugin_interface);
						if (!(plugin instanceof FailedPlugin))
							plugin_interface.getPluginStateImpl().setOperational(true, false);
					}
				}

			
			{
				this$0 = PluginInitializer.this;
				plugin_class = class1;
				plugin = plugin1;
				plugin_interface = plugininterfaceimpl;
				plugin_id = s;
				f_enabled = flag;
				super();
			}
			});
			synchronized (s_plugin_interfaces)
			{
				s_plugins.add(plugin);
				s_plugin_interfaces.add(plugin_interface);
			}
		}
		catch (Throwable e)
		{
			Debug.printStackTrace(e);
			String msg = (new StringBuilder()).append("Error loading internal plugin '").append(plugin_class.getName()).append("'").toString();
			Logger.log(new LogAlert(false, msg, e));
			System.out.println((new StringBuilder()).append(msg).append(" : ").append(e).toString());
			throw new PluginException(msg, e);
		}
	}

	protected void initializePluginFromInstance(final Plugin plugin, String plugin_id, String plugin_config_key)
		throws PluginException
	{
		try
		{
			final PluginInterfaceImpl plugin_interface = new PluginInterfaceImpl(plugin, this, plugin.getClass(), plugin.getClass().getClassLoader(), plugin_config_key, new Properties(), "", plugin_id, null);
			UtilitiesImpl.callWithPluginThreadContext(plugin_interface, new org.gudy.azureus2.pluginsimpl.local.utils.UtilitiesImpl.runnableWithException() {

				final PluginInterfaceImpl val$plugin_interface;
				final Plugin val$plugin;
				final PluginInitializer this$0;

				public void run()
					throws PluginException
				{
					fireCreated(plugin_interface);
					plugin.initialize(plugin_interface);
					if (!(plugin instanceof FailedPlugin))
						plugin_interface.getPluginStateImpl().setOperational(true, false);
				}

			
			{
				this$0 = PluginInitializer.this;
				plugin_interface = plugininterfaceimpl;
				plugin = plugin1;
				super();
			}
			});
			synchronized (s_plugin_interfaces)
			{
				s_plugins.add(plugin);
				s_plugin_interfaces.add(plugin_interface);
			}
		}
		catch (Throwable e)
		{
			Debug.printStackTrace(e);
			String msg = (new StringBuilder()).append("Error loading internal plugin '").append(plugin.getClass().getName()).append("'").toString();
			Logger.log(new LogAlert(false, msg, e));
			System.out.println((new StringBuilder()).append(msg).append(" : ").append(e).toString());
			throw new PluginException(msg, e);
		}
	}

	protected void unloadPlugin(PluginInterfaceImpl pi)
	{
		synchronized (s_plugin_interfaces)
		{
			s_plugins.remove(pi.getPlugin());
			s_plugin_interfaces.remove(pi);
		}
		pi.unloadSupport();
		for (int i = 0; i < loaded_pi_list.size(); i++)
		{
			List l = (List)loaded_pi_list.get(i);
			if (l.remove(pi))
			{
				if (l.size() == 0)
					loaded_pi_list.remove(i);
				return;
			}
		}

	}

	protected void reloadPlugin(PluginInterfaceImpl pi)
		throws PluginException
	{
		reloadPlugin(pi, false, true);
	}

	protected void reloadPlugin(PluginInterfaceImpl pi, boolean loading_for_startup, boolean initialise)
		throws PluginException
	{
		unloadPlugin(pi);
		Object key = pi.getInitializerKey();
		String config_key = pi.getPluginConfigKey();
		if (key instanceof File)
		{
			List pis = loadPluginFromDir((File)key, false, loading_for_startup, initialise);
			initialisePlugin(pis);
		} else
		{
			initializePluginFromClass((Class)key, pi.getPluginID(), config_key, false, loading_for_startup, initialise);
		}
	}

	protected AzureusCore getAzureusCore()
	{
		return azureus_core;
	}

	protected GlobalManager getGlobalManager()
	{
		return azureus_core.getGlobalManager();
	}

	public static PluginInterface getDefaultInterface()
	{
		return singleton.getDefaultInterfaceSupport();
	}

	protected PluginInterface getDefaultInterfaceSupport()
	{
		if (default_plugin == null)
			default_plugin = new PluginInterfaceImpl(new Plugin() {

				final PluginInitializer this$0;

				public void initialize(PluginInterface plugininterface)
				{
				}

			
			{
				this$0 = PluginInitializer.this;
				super();
			}
			}, this, getClass(), getClass().getClassLoader(), "default", new Properties(), null, "<internal>", null);
		return default_plugin;
	}

	public void downloadManagerAdded(DownloadManager downloadmanager)
	{
	}

	public void downloadManagerRemoved(DownloadManager downloadmanager)
	{
	}

	public void destroyInitiated()
	{
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
			((PluginInterfaceImpl)plugin_interfaces.get(i)).closedownInitiated();

		if (default_plugin != null)
			default_plugin.closedownInitiated();
	}

	public void destroyed()
	{
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
			((PluginInterfaceImpl)plugin_interfaces.get(i)).closedownComplete();

		if (default_plugin != null)
			default_plugin.closedownComplete();
	}

	public void seedingStatusChanged(boolean flag, boolean flag1)
	{
	}

	protected void fireEventSupport(final int type, final Object value)
	{
		PluginEvent ev = new PluginEvent() {

			final int val$type;
			final Object val$value;
			final PluginInitializer this$0;

			public int getType()
			{
				return type;
			}

			public Object getValue()
			{
				return value;
			}

			
			{
				this$0 = PluginInitializer.this;
				type = i;
				value = obj;
				super();
			}
		};
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
			try
			{
				((PluginInterfaceImpl)plugin_interfaces.get(i)).firePluginEvent(ev);
			}
			catch (Throwable e)
			{
				Debug.printStackTrace(e);
			}

		if (default_plugin != null)
			default_plugin.firePluginEvent(ev);
	}

	public static void fireEvent(int type)
	{
		singleton.fireEventSupport(type, null);
	}

	public static void fireEvent(int type, Object value)
	{
		singleton.fireEventSupport(type, value);
	}

	public void initialisationComplete()
	{
		initialisation_complete = true;
		UIManagerImpl.initialisationComplete();
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
			((PluginInterfaceImpl)plugin_interfaces.get(i)).initialisationComplete();

		if (default_plugin != null)
			default_plugin.initialisationComplete();
	}

	protected boolean isInitialisationComplete()
	{
		return initialisation_complete;
	}

	public static List getPluginInterfaces()
	{
		return singleton.getPluginInterfacesSupport();
	}

	protected List getPluginInterfacesSupport()
	{
		checkPluginsInitialised();
		List list = s_plugin_interfaces;
		JVM INSTR monitorenter ;
		return new ArrayList(s_plugin_interfaces);
		Exception exception;
		exception;
		throw exception;
	}

	public PluginInterface[] getPlugins()
	{
		List pis = getPluginInterfacesSupport();
		PluginInterface res[] = new PluginInterface[pis.size()];
		pis.toArray(res);
		return res;
	}

	protected PluginManager getPluginManager()
	{
		return plugin_manager;
	}

	protected PluginInterfaceImpl getPluginFromClass(Class cla)
	{
		return getPluginFromClass(cla.getName());
	}

	protected PluginInterfaceImpl getPluginFromClass(String class_name)
	{
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
		{
			PluginInterfaceImpl pi = (PluginInterfaceImpl)plugin_interfaces.get(i);
			if (pi.getPlugin().getClass().getName().equals(class_name))
				return pi;
		}

		for (int i = 0; i < loaded_pi_list.size(); i++)
		{
			List l = (List)loaded_pi_list.get(i);
			for (int j = 0; j < l.size(); j++)
			{
				PluginInterfaceImpl pi = (PluginInterfaceImpl)l.get(j);
				if (pi.getPlugin().getClass().getName().equals(class_name))
					return pi;
			}

		}

		return null;
	}

	public void generate(IndentWriter writer)
	{
		writer.println("Plugins");
		writer.indent();
		List plugin_interfaces;
		synchronized (s_plugin_interfaces)
		{
			plugin_interfaces = new ArrayList(s_plugin_interfaces);
		}
		for (int i = 0; i < plugin_interfaces.size(); i++)
		{
			PluginInterfaceImpl pi = (PluginInterfaceImpl)plugin_interfaces.get(i);
			pi.generateEvidence(writer);
		}

		writer.exdent();
		break MISSING_BLOCK_LABEL_94;
		Exception exception1;
		exception1;
		writer.exdent();
		throw exception1;
	}

	static 
	{
		LOGID = LogIDs.CORE;
	}








}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -