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

📄 updatemanagerimpl.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   UpdateManagerImpl.java

package org.gudy.azureus2.pluginsimpl.local.update;

import com.aelitis.azureus.core.AzureusCore;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.platform.PlatformManagerFactory;
import org.gudy.azureus2.plugins.update.*;

// Referenced classes of package org.gudy.azureus2.pluginsimpl.local.update:
//			UpdatableComponentImpl, UpdateCheckInstanceImpl, UpdateInstallerImpl

public class UpdateManagerImpl
	implements UpdateManager
{

	protected static UpdateManagerImpl singleton;
	protected AzureusCore azureus_core;
	protected List components;
	protected List listeners;
	protected List verification_listeners;
	protected List installers;
	protected AEMonitor this_mon;

	public static UpdateManager getSingleton(AzureusCore core)
	{
		if (singleton == null)
			singleton = new UpdateManagerImpl(core);
		return singleton;
	}

	protected UpdateManagerImpl(AzureusCore _azureus_core)
	{
		components = new ArrayList();
		listeners = new ArrayList();
		verification_listeners = new ArrayList();
		installers = new ArrayList();
		this_mon = new AEMonitor("UpdateManager");
		azureus_core = _azureus_core;
		UpdateInstallerImpl.checkForFailedInstalls(this);
		try
		{
			PlatformManagerFactory.getPlatformManager();
		}
		catch (Throwable e) { }
	}

	public void registerUpdatableComponent(UpdatableComponent component, boolean mandatory)
	{
		this_mon.enter();
		components.add(new UpdatableComponentImpl(component, mandatory));
		this_mon.exit();
		break MISSING_BLOCK_LABEL_46;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public UpdateCheckInstance createUpdateCheckInstance()
	{
		return createUpdateCheckInstance(2, "");
	}

	public UpdateCheckInstance createUpdateCheckInstance(int type, String name)
	{
		UpdateCheckInstance updatecheckinstance;
		this_mon.enter();
		UpdatableComponentImpl comps[] = new UpdatableComponentImpl[components.size()];
		components.toArray(comps);
		UpdateCheckInstance res = new UpdateCheckInstanceImpl(this, type, name, comps);
		for (int i = 0; i < listeners.size(); i++)
			((UpdateManagerListener)listeners.get(i)).checkInstanceCreated(res);

		updatecheckinstance = res;
		this_mon.exit();
		return updatecheckinstance;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public UpdateCheckInstanceImpl createEmptyUpdateCheckInstance(int type, String name)
	{
		return createEmptyUpdateCheckInstance(type, name, false);
	}

	public UpdateCheckInstanceImpl createEmptyUpdateCheckInstance(int type, String name, boolean low_noise)
	{
		UpdateCheckInstanceImpl updatecheckinstanceimpl;
		this_mon.enter();
		UpdatableComponentImpl comps[] = new UpdatableComponentImpl[0];
		UpdateCheckInstanceImpl res = new UpdateCheckInstanceImpl(this, type, name, comps);
		res.setLowNoise(low_noise);
		for (int i = 0; i < listeners.size(); i++)
			((UpdateManagerListener)listeners.get(i)).checkInstanceCreated(res);

		updatecheckinstanceimpl = res;
		this_mon.exit();
		return updatecheckinstanceimpl;
		Exception exception;
		exception;
		this_mon.exit();
		throw exception;
	}

	public UpdateInstaller createInstaller()
		throws UpdateException
	{
		UpdateInstaller installer = new UpdateInstallerImpl(this);
		installers.add(installer);
		return installer;
	}

	public UpdateInstaller[] getInstallers()
	{
		UpdateInstaller res[] = new UpdateInstaller[installers.size()];
		installers.toArray(res);
		return res;
	}

	public String getInstallDir()
	{
		String str = SystemProperties.getApplicationPath();
		if (str.endsWith(File.separator))
			str = str.substring(0, str.length() - 1);
		return str;
	}

	public String getUserDir()
	{
		String str = SystemProperties.getUserPath();
		if (str.endsWith(File.separator))
			str = str.substring(0, str.length() - 1);
		return str;
	}

	public void restart()
		throws UpdateException
	{
		applyUpdates(true);
	}

	public void applyUpdates(boolean restart_after)
		throws UpdateException
	{
		try
		{
			if (restart_after)
				azureus_core.requestRestart();
			else
				azureus_core.requestStop();
		}
		catch (Throwable e)
		{
			throw new UpdateException("UpdateManager:applyUpdates fails", e);
		}
	}

	public InputStream verifyData(Update update, InputStream is, boolean force)
		throws UpdateException
	{
		boolean queried;
		boolean ok;
		Throwable failure;
		queried = false;
		ok = false;
		failure = null;
		File temp;
		temp = AETemporaryFileHandler.createTempFile();
		FileUtil.copyFile(is, temp);
		FileInputStream fileinputstream;
		AEVerifier.verifyData(temp);
		ok = true;
		fileinputstream = new FileInputStream(temp);
		int i;
		Throwable f;
		if (!queried && !ok)
		{
			if (failure == null)
				failure = new UpdateException("Verification failed");
			for (i = 0; i < verification_listeners.size(); i++)
				try
				{
					((UpdateManagerVerificationListener)verification_listeners.get(i)).verificationFailed(update, failure);
				}
				// Misplaced declaration of an exception variable
				catch (Throwable f)
				{
					Debug.printStackTrace(f);
				}

		}
		return fileinputstream;
		AEVerifierException e;
		e;
		if (force || e.getFailureType() != 1)
			break MISSING_BLOCK_LABEL_295;
		i = 0;
_L1:
		if (i >= verification_listeners.size())
			break MISSING_BLOCK_LABEL_295;
		FileInputStream fileinputstream1;
		queried = true;
		if (!((UpdateManagerVerificationListener)verification_listeners.get(i)).acceptUnVerifiedUpdate(update))
			break MISSING_BLOCK_LABEL_289;
		ok = true;
		fileinputstream1 = new FileInputStream(temp);
		if (!queried && !ok)
		{
			if (failure == null)
				failure = new UpdateException("Verification failed");
			for (int i = 0; i < verification_listeners.size(); i++)
				try
				{
					((UpdateManagerVerificationListener)verification_listeners.get(i)).verificationFailed(update, failure);
				}
				catch (Throwable f)
				{
					Debug.printStackTrace(f);
				}

		}
		return fileinputstream1;
		fileinputstream1;
		Debug.printStackTrace(fileinputstream1);
		i++;
		  goto _L1
		failure = e;
		throw e;
		UpdateException e;
		e;
		failure = e;
		throw e;
		e;
		failure = e;
		throw new UpdateException("Verification failed", e);
		Exception exception;
		exception;
		if (!queried && !ok)
		{
			if (failure == null)
				failure = new UpdateException("Verification failed");
			for (int i = 0; i < verification_listeners.size(); i++)
				try
				{
					((UpdateManagerVerificationListener)verification_listeners.get(i)).verificationFailed(update, failure);
				}
				catch (Throwable f)
				{
					Debug.printStackTrace(f);
				}

		}
		throw exception;
	}

	public void addVerificationListener(UpdateManagerVerificationListener l)
	{
		verification_listeners.add(l);
	}

	public void removeVerificationListener(UpdateManagerVerificationListener l)
	{
		verification_listeners.add(l);
	}

	public void addListener(UpdateManagerListener l)
	{
		listeners.add(l);
	}

	public void removeListener(UpdateManagerListener l)
	{
		listeners.remove(l);
	}

	public volatile UpdateCheckInstance createEmptyUpdateCheckInstance(int x0, String x1)
	{
		return createEmptyUpdateCheckInstance(x0, x1);
	}
}

⌨️ 快捷键说明

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