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

📄 pluginloader.java

📁 100%Java编写及时报信工具
💻 JAVA
字号:
package jim;

import java.util.*;
/* Copyright, 2001 Jason Dominiczak.
 *
 * This file is part of JIM - The Java Instant Messenger.
 * eMailer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.

 * JIM is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with eMailer; see the file COPYING. If not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA.
 */
public class PluginLoader {
	static java.util.Vector pluginVector=new Vector();
/**
 * PluginLoader constructor comment.
 */
public PluginLoader() {
	super();
	initialize();
}
/**
 * Insert the method's description here.
 * Creation date: (10/7/2001 9:13:11 PM)
 * @param name java.lang.String
 */
protected static PluginInterface getClass(String name) {
	PluginInterface plInt = null;
		try
		{
			Class plugin = Class.forName(name);
			plInt = (PluginInterface) plugin.newInstance();
		}
		catch(ClassNotFoundException e)
		{
			
		}
		catch(IllegalAccessException e)
		{
			
		}
		catch(InstantiationException e)
		{
			
		}
		return plInt;
}
/**
 * Insert the method's description here.
 * Creation date: (10/7/2001 9:18:59 PM)
 * @return jim.PluginInterface[]
 */
public PluginInterface[] getPlugins() {
	PluginInterface[] array=new PluginInterface[pluginVector.size()];
		
		for(int i=0;i<array.length;i++)
			array[i]=(PluginInterface)pluginVector.elementAt(i);
			
		return array;
}
/**
 * Called whenever the part throws an exception.
 * @param exception java.lang.Throwable
 */
private void handleException(java.lang.Throwable exception) {

	/* Uncomment the following lines to print uncaught exceptions to stdout */
	// System.out.println("--------- UNCAUGHT EXCEPTION ---------");
	// exception.printStackTrace(System.out);
}
/**
 * Initialize the class.
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initialize() {
	try {
		// user code begin {1}
		// user code end
	} catch (java.lang.Throwable ivjExc) {
		handleException(ivjExc);
	}
	// user code begin {2}
	// user code end
}
/**
 * Insert the method's description here.
 * Creation date: (10/7/2001 5:53:33 PM)
 * @return boolean
 */
public boolean initializePlugins(String pluginString) {
	StringTokenizer st = new StringTokenizer(pluginString, ";");
   		while (st.hasMoreTokens())
		{
			try{
				Class pluginClass = Class.forName(st.nextToken());
				PluginInterface pluginInter = null;
				pluginInter = (PluginInterface) pluginClass.newInstance();
				pluginVector.addElement(pluginInter);
				//pluginInter.sendMessage("hi","hi");
			}
			catch(java.lang.ClassNotFoundException e){
			}
			catch(java.lang.InstantiationException e){
			}
			catch(java.lang.IllegalAccessException e){
			}
			catch(java.lang.NullPointerException e){
				System.out.println("--------- NEW UNCAUGHT EXCEPTION ---------");
				e.printStackTrace(System.out);
			}
		}
	if(pluginVector==null)
		return false;
	return true;
}
/**
 * Insert the method's description here.
 * Creation date: (10/7/2001 5:53:33 PM)
 * @return boolean
 */
public boolean initializePlugins(String pluginString, Jim jimProgram) {
	pluginVector = new Vector();
	StringTokenizer st = new StringTokenizer(pluginString, ";");
   		while (st.hasMoreTokens())
		{
			try{
				Class pluginClass = Class.forName(st.nextToken());
				PluginInterface pluginInter = null;
				pluginInter = (PluginInterface) pluginClass.newInstance();
				pluginVector.addElement(pluginInter);
				pluginInter.setJim(jimProgram);
			}
			catch(java.lang.ClassNotFoundException e){
			}
			catch(java.lang.InstantiationException e){
			}
			catch(java.lang.IllegalAccessException e){
			}
			catch(java.lang.NullPointerException e){
				System.out.println("--------- NEW UNCAUGHT EXCEPTION ---------");
				e.printStackTrace(System.out);
			}
		}
	if(pluginVector==null)
		return false;
	return true;
}
/**
 * main entrypoint - starts the part when it is run as an application
 * @param args java.lang.String[]
 */
public static void main(java.lang.String[] args) {
	try {
		PluginLoader aPluginLoader;
		aPluginLoader = new PluginLoader();
	} catch (Throwable exception) {
		System.err.println("Exception occurred in main() of java.lang.Object");
		exception.printStackTrace(System.out);
	}
}
}

⌨️ 快捷键说明

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