Here is the source code to the CrushSQL plugin. Someone may find this useful in developing their own plugins. Same rules on how to make the package structure. (Third Party)
Start.java
package CrushSQL;

import java.util.*;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.text.*;
import javax.swing.*;

public class Start implements Serializable
{
	Properties settings = new Properties();
	static Thread scannerThread = null;
	String version = "4.3.5";
	GUI g = null;
	static URLClassLoader cl = null;
	static Class drvCls = null;
	static Driver driver = null;
	static boolean newTableStructure = true;
	static boolean oldTableStructure = true;

	static public void main(String[] args)
	{
		Start s = new Start();
		Properties p = s.getDefaults();
		try
		{
			p.put("enabled","true");
			p.put("debug","true");
			p.put("db_user","web");
			p.put("delete_expired_accounts","true");
			p.put("move_expired_accounts_filesystem","true");
//			p.put("delete_expired_accounts_filesystem","true");
			s.setSettings(p);
			s.run(null);
		}
		catch(Throwable e)
		{
		}
	}

	public Properties getDefaults()
	{
		Properties p = new Properties();
		p.put("enabled","false");
		p.put("debug","false");
		p.put("db_drv_file","./mysql-connector-java-5.0.4-bin.jar");
		p.put("db_drv","org.gjt.mm.mysql.Driver");
		p.put("db_url","jdbc:mysql://127.0.0.1:3306/crushftp?autoReconnect=true");
		p.put("db_user","CrushSQL");
		p.put("db_pass","");
		p.put("db_user_query","select * from users \r\n where userName=? \r\n and userPass=? \r\n and (expireDate is null or expireDate > ?)");
		p.put("db_quota_query","update directories set quotaBytes = ? \r\n where id = ? and dirFTPPath = ? and dirName = ?");
		p.put("sql_df","yyyy-MM-dd HH:mm:ss");
		p.put("server_item","All");

		p.put("db_user_list_query","select * from users");
		p.put("db_expired_user_query","select * from users where (expireDate is not null and expireDate < ?)");
		p.put("create_sql_dirs","false");
		p.put("delete_expired_accounts","false");
		p.put("scan_interval","10");
		p.put("delete_expired_accounts_filesystem","false");
		p.put("move_expired_accounts_filesystem","false");
		p.put("archive_path","/Archive/");

		p.put("version",version);
		return p;
	}

	public void setSettings(Properties p) throws Throwable
	{
		settings = p;
		if (g != null) g.setSettings(settings);
	}

	public Properties getSettings()
	{
		if (g != null) settings = g.getSettings();
		settings.put("version",version);
		return settings;
	}

	public javax.swing.JPanel getPrefsPanel()
	{
		if (g == null) g = new GUI();
		g.setParent(this);
		g.setSettings(settings);
		return g;
	}

	public Object run(Properties info)
	{
		if (!settings.getProperty("enabled").equalsIgnoreCase("true")) return null;

		Properties server_settings = (Properties)info.get("server_settings");
		synchronized(server_settings)
		{
			if (scannerThread == null)
			{
				class Runner implements Runnable
				{
					public void run()
					{
						try
						{
							while(true)
							{
								if (settings.getProperty("enabled").equalsIgnoreCase("true"))
								{
									findAndHandleExpiredUsers();
									makeUserDirectories();
								}
								if (Integer.parseInt(settings.getProperty("scan_interval","10")) < 1) settings.put("scan_interval","1");
								Thread.sleep(Integer.parseInt(settings.getProperty("scan_interval","10"))*1000*60);
							}
						}
						catch(Throwable e)
						{
							msg(e);
						}
						scannerThread = null;
					}

					public boolean isSymbolicLink(String link_name)
					{
						try
						{
							File f = new File( link_name );
							if ( ! f.getAbsolutePath().equals( f.getCanonicalPath() ) )
							{
								return true;
							}
						}
						catch(IOException e)
						{
						}
						return false;
					}

				}
				msg("Started user scanner.");
				Runner runner = new Runner();
				scannerThread = new Thread(runner);
				scannerThread.setName("CrushSQL:scannerThread");
				scannerThread.setPriority(Thread.MIN_PRIORITY);
				scannerThread.start();
			}
		}

		Properties user_info = (Properties)info.get("user_info");
		if (user_info == null) user_info = new Properties();
		if (info.getProperty("action","").equals("login") && (get("server_item").trim().equalsIgnoreCase("All") || get("server_item").trim().length() == 0 || user_info.getProperty("listen_ip_port","").equals(get("server_item").trim())))
		{
			loadUser(info);
		}
		else if (info.getProperty("action","").equals("quotaUpdate") && (get("server_item").trim().equalsIgnoreCase("All") || get("server_item").trim().length() == 0 || user_info.getProperty("listen_ip_port","").equals(get("server_item").trim())))
		{
			updateUser(info);
		}
		return null;
	}

	public void findAndHandleExpiredUsers()
	{
		if (!get("delete_expired_accounts").equals("true")) return;
		Connection conn = null;
		try
		{
			msg("Connecting to db.");
			//make our database connection
			conn=getConnection();

			ResultSet rs;
			String _sql = settings.getProperty("db_expired_user_query");
			PreparedStatement ps = conn.prepareStatement(_sql);
			SimpleDateFormat sdfExpire_CrushSQLDate = new SimpleDateFormat(get("sql_df"));
			msg("Connected.");
			ps.setString(1,sdfExpire_CrushSQLDate.format(new java.util.Date()));
			rs=ps.executeQuery();
			String ids = "";
			msg("Querying DB for expired users:"+_sql);
			while ( rs.next() )
			{
				msg("Found user, id="+rs.getString("id"));
				ids += ","+rs.getString("id");
			}
			msg("Done loading user info.");
			rs.close();
			ps.close();
			if (ids.length() > 0)
			{
				ids = ids.substring(1);
				Statement s = conn.createStatement();
				_sql="select * from directories where id in ("+ids+")";
				msg("Querying user's directories:"+_sql);
				rs=s.executeQuery(_sql);
				Vector files = new Vector();
				while ( rs.next() )
				{
					if (rs.getString("dirLocalPath").indexOf("://") < 0)
					{
						File file = new File(rs.getString("dirLocalPath"));
						msg("Got:"+file);
						files.addElement(file);
					}
				}
				rs.close();
				s.close();
				if (get("delete_expired_accounts").equals("true"))
				{
					//delete SQL users, and directories
					s = conn.createStatement();
					_sql="delete from directories where id in ("+ids+")";
					msg("Deleting expired user's sql directories:"+_sql);
					s.executeUpdate(_sql);
					_sql="delete from users where id in ("+ids+")";
					msg("Deleting expired user accounts:"+_sql);
					s.executeUpdate(_sql);
					s.close();
					if (get("move_expired_accounts_filesystem").equals("true"))
					{
						String dest = get("archive_path");
						if (!dest.endsWith("/")) dest += "/";
						new File(dest).mkdirs();
						for (int x=0; x<files.size(); x++)
						{
							File file = (File)files.elementAt(x);
							file.renameTo(new File(dest+file.getName()+"_"+new java.util.Date().getTime()));
						}
					}
					else if (get("delete_expired_accounts_filesystem").equals("true"))
					{
						for (int x=0; x<files.size(); x++)
						{
							File file = (File)files.elementAt(x);
							crushftp.handlers.Common.recurseDelete(file.getCanonicalPath(),false);
						}
					}
				}
			}
			conn.close();
		}
		catch(Throwable e)
		{
			msg(e);
		}
		if (conn != null) try{conn.close();}catch(Throwable e){}
	}

	public void makeUserDirectories()
	{
		if (!get("create_sql_dirs").equals("true")) return;
		Connection conn = null;
		try
		{
			msg("Connecting to db.");
			//make our database connection
			conn=getConnection();

			ResultSet rs;
			String _sql = settings.getProperty("db_user_list_query");
			PreparedStatement ps = conn.prepareStatement(_sql);
			msg("Connected.");
			rs=ps.executeQuery();
			msg("Querying DB for users to get a list of directories:"+_sql);
			Vector userIds = new Vector();
			while ( rs.next() )
			{
				msg("Found user, id="+rs.getString("id"));
				userIds.addElement(rs.getString("id")+":"+rs.getString("userName"));
			}
			msg("Done loading user info.");
			rs.close();
			ps.close();
			for (int x=0; x<userIds.size(); x++)
			{
				String id = userIds.elementAt(x).toString();
				String userName = id.substring(id.indexOf(":")+1);
				id = id.substring(0,id.indexOf(":"));
				Statement s = conn.createStatement();
				_sql="select * from directories where id = "+id+" or id = -1";
				msg("Querying user's directories: userName="+userName+", sql="+_sql);
				rs=s.executeQuery(_sql);
				Vector files = new Vector();
				while ( rs.next() )
				{
					if (rs.getString("dirLocalPath").indexOf("://") < 0 && rs.getString("dirLocalPath").endsWith("/"))
					{
						String path = rs.getString("dirLocalPath");
						path = crushftp.handlers.Common.replace_str(path,"%user_name%",userName);
						File file = new File(path);
						msg("Got:"+file);
						files.addElement(file);
					}
				}
				rs.close();
				s.close();
				if (get("create_sql_dirs").equals("true"))
				{
					for (int xx=0; xx<files.size(); xx++)
					{
						File file = (File)files.elementAt(xx);
						msg("Makign directory:"+file);
						file.mkdirs();
					}
				}
			}
			conn.close();
		}
		catch(Throwable e)
		{
			msg(e);
		}
		if (conn != null) try{conn.close();}catch(Throwable e){}
	}

	public void updateUser(Properties info)
	{
		Properties user = (Properties)info.get("user");
		String id = user.getProperty("SQL_ID","");
		Properties permissions = (Properties)info.get("permissions");
		if (id.equals("")) return;

		Connection conn=null;
		try
		{
			conn = getConnection();
			msg("Connected.");
			Statement s = conn.createStatement();
			msg("Getting Directory Info:id="+id);
			ResultSet rs = s.executeQuery("select * from directories where id ='"+id+"'");
			String dirFTPPath = "";
			String dirName = "";
			String newSize = "";
			boolean ok = false;
			while (rs.next() && ok == false)
			{
				dirFTPPath = rs.getString("dirFTPPath");
				dirName = rs.getString("dirName");
				dirName = crushftp.handlers.Common.replace_str(dirName,"%user_name%",info.getProperty("username"));
				Enumeration keys = permissions.keys();
				while (keys.hasMoreElements() && ok == false)
				{
					String key = keys.nextElement().toString();
					String val = permissions.getProperty(key);
					msg("Comparing:"+key.toUpperCase() + "     "+(dirFTPPath+dirName+"/").toUpperCase());
					if (key.toUpperCase().trim().equalsIgnoreCase((dirFTPPath+dirName+"/").toUpperCase().trim()))
					{
						newSize = val.substring(val.indexOf("(quota")+"(quota".length());
						newSize = newSize.substring(0,newSize.indexOf(")"));
						ok = true;
						msg("newSize:"+newSize);
					}
				}
			}
			rs.close();
			s.close();
			if (ok)
			{
				String _sql = settings.getProperty("db_quota_query");
				msg("Doing Quota Update:sql="+_sql);
				msg("Doing Quota Update:id="+id);
				msg("Doing Quota Update:dirFTPPath="+dirFTPPath);
				msg("Doing Quota Update:dirName="+dirName);
				PreparedStatement ps = conn.prepareStatement(_sql);
				ps.setString(1,newSize);
				ps.setString(2,id);
				ps.setString(3,dirFTPPath);
				ps.setString(4,dirName);
				ps.executeUpdate();
				ps.close();
			}
		}
		catch(Throwable e)
		{
			msg(e);
		}
		if (conn != null) try{conn.close();}catch(Throwable e){}

	}

	public Connection getConnection() throws Throwable
	{
		String db_drv_files[] = get("db_drv_file").split(";");
		URL urls[] = new URL[db_drv_files.length];
		for (int x=0; x<db_drv_files.length; x++)
		{
			urls[x] = new File(db_drv_files[x]).toURL();
		}
		if (cl == null)
		{
			cl = new URLClassLoader(urls);
			drvCls = Class.forName(get("db_drv"), true, cl);
			driver = (Driver)drvCls.newInstance();
		}
		Properties props = new Properties();props.setProperty("user", get("db_user"));props.setProperty("password", get("db_pass"));
		return driver.connect(get("db_url"),props);
	}
	public void loadUser(Properties info)
	{
		msg("Version "+version);
		boolean found_user = false;
		//we set a bunch of values to the defaults since we don't have options for them in the CrushSQL tables
		Properties user = (Properties)info.get("user");
		Vector ips = new Vector();
		Properties ip_data = new Properties();
		ip_data.put("type", "A");
		ip_data.put("start_ip", "0.0.0.0");
		ip_data.put("stop_ip", "255.255.255.255");
		ips.addElement(ip_data);
		user.put("ip_restrictions",ips);
		user.put("root_dir","/");
		user.put("dir_calc","false");
		user.put("logins_ip_auto_kick","false");
		user.put("max_login_time","0");
		user.put("purge_partial_days","0");
		user.put("purge_partial_delete","false");
		user.put("purge_partial_move_to","");
		user.put("purge_days","0");
		user.put("purge_delete","false");
		user.put("purge_move_to","");
		user.put("ignore_max_logins","true");
		user.put("speed_limit_upload","0");
		user.put("speed_limit_download","0");
		user.put("ratio","0");
		user.put("account_expire","");
		user.put("user_bytes_sent","0");
		user.put("user_bytes_received","0");
		user.put("ratio_field_permanent","false");
		user.put("account_expire_delete","false");
		user.put("max_download_amount","0");
		user.put("min_download_speed","0");
		user.put("welcome_message","");
		user.put("day_of_week_allow","1234567");
		user.put("macbinary_enabled","false");
		user.put("macbinary_always_enabled","false");
		user.put("macbinary_always_disabled","true");
		user.put("partial_download","true");
		user.put("default_owner_command","");
		user.put("default_group_command","");
		user.put("default_privs_command","");
		user.put("webInterfaceTemplate","");
		user.put("virtualUser","true");
		String username = info.getProperty("username");
		String password = info.getProperty("password");
		Connection conn = null;
		if (username.trim().length() > 0)
		{
			try
			{
				msg("Connecting to db.");
				//make our database connection
				conn=getConnection();

				ResultSet rs;
				String _sql = settings.getProperty("db_user_query");
				if (info.getProperty("anyPass","").equals("true"))
				{
					_sql = crushftp.handlers.Common.replace_str(_sql,"and userPass=?","");
				}
				PreparedStatement ps = conn.prepareStatement(_sql);
				SimpleDateFormat sdfExpire_CrushSQLDate = new SimpleDateFormat(get("sql_df"));
				msg("Connected.");
				int i = 1;
				ps.setString(i++,username);
				if (!info.getProperty("anyPass","").equals("true"))
				{
					ps.setString(i++,password);
				}
				ps.setString(i++,sdfExpire_CrushSQLDate.format(new java.util.Date()));
				rs=ps.executeQuery();
				String id = "-1";
				msg("Querying DB for user:"+_sql);
				while ( rs.next() )
				{
					msg("Found user.");
					found_user = true;
					id = rs.getString("id");
					user.put("SQL_ID",id);
					user.put("username",rs.getString("userName"));
					user.put("userpass",rs.getString("userPass"));
					if (info.getProperty("anyPass","").equals("true"))
					{
						user.put("password",new crushftp.handlers.Common().encode_pass(rs.getString("userPass"),"DES"));
					}
					user.put("max_idle_time",rs.getString("maxIdleTime"));
					user.put("max_logins",rs.getString("maxSimultaneousLogins"));
					user.put("max_logins_ip",rs.getString("maxLoginsPerIP"));
					user.put("site",(rs.getString("canRequestFilesAsZip").equals("Y")?"*ZIP*":""));
					msg("Checking expiration date...");
					if (rs.getString("expireDate") != null)
					{
						try
						{
							msg("Expire date:"+rs.getString("expireDate"));
							SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm aa");
							if (rs.getString("expireDate") != null && !rs.getString("expireDate").equals(""))
							{
								user.put("account_expire",sdf.format(sdfExpire_CrushSQLDate.parse(rs.getString("expireDate"))));
							}
						}
						catch(Throwable e)
						{
							msg("bad SQL date format...?"+e);
						}
					}
					msg("Grabbing all other SQL columns in main user table.");
					try
					{
						int columnCount = rs.getMetaData().getColumnCount();
						for (int x=1; x<=columnCount; x++)
						{
							String key = "";
							try
							{
								key = rs.getMetaData().getColumnName(x);
								user.put(key,rs.getString(x));
							}
							catch(Throwable ee)
							{
								msg(key + " : error : "+ ee.toString());
							}
						}
					}
					catch(Throwable ee)
					{
						msg(ee);
					}
				}
				msg("Done loading user info.");
				rs.close();
				ps.close();
				Statement s = conn.createStatement();
				user.put("events",getEvents(s,id));

				msg("Loading events...");
				load_table(id,"events",user,s);
				msg("Loading ip_restrictions...");
				load_table(id,"ip_restrictions",user,s);
				if (((Vector)user.get("ip_restrictions")).size() == 0)
				{
					user.put("ip_restrictions",ips);
				}
				msg("Loading web_buttons...");
				load_table(id,"web_buttons",user,s);
				msg("Loading web_customizations...");
				load_table(id,"web_customizations",user,s);
				msg("Loading domain_root_list...");
				load_table(id,"domain_root_list",user,s);
				_sql="select * from directories where id='"+id+"' or id = -1 ";
				msg("Querying user's directories:"+_sql);
				rs=s.executeQuery(_sql);

				Vector VFSItems = new Vector();
				Properties permissions = new Properties();//we also generate a cache of what the permissions are for the file system instead of loading from a file
				Properties server_item = (Properties)info.get("server_item");
				String users_path = System.getProperty("crushftp.plugins")+"plugins/CrushSQL_VFS/"+username;
				int root_dirs = 0;
				String root_dir = "/";
				while ( rs.next() )
				{
					String buildPrivs = "";
					buildPrivs += (rs.getString("privDownload").equals("Y")?"(read)":"");
					buildPrivs += (rs.getString("privUpload").equals("Y")?"(write)":"");
					buildPrivs += (rs.getString("privView").equals("Y")?"(view)":"");
					buildPrivs += (rs.getString("privDelete").equals("Y")?"(delete)":"");
					buildPrivs += (rs.getString("privDeleteDir").equals("Y")?"(deletedir)":"");
					buildPrivs += (rs.getString("privMakeDir").equals("Y")?"(makedir)":"");
					buildPrivs += (rs.getString("privRename").equals("Y")?"(rename)":"");
					buildPrivs += (rs.getString("privResume").equals("Y")?"(resume)":"");
					try{buildPrivs += (rs.getString("privRealQuota").equals("Y")?"(real_quota)":"");}catch(Exception e){}
					try{buildPrivs += (rs.getString("quotaBytes").equals("")?"":"(quota"+rs.getString("quotaBytes")+")");}catch(Throwable e){}
					String dirName = rs.getString("dirName"); 
					dirName = crushftp.handlers.Common.replace_str(dirName,"%user_name%",user.getProperty("username"));
					permissions.put((rs.getString("dirFTPPath")+dirName+"/").toUpperCase(),buildPrivs);
					Properties dir_item = new Properties();
					String dirLocalPath = rs.getString("dirLocalPath");
					dirLocalPath = crushftp.handlers.Common.replace_str(dirLocalPath,"%user_name%",user.getProperty("username"));

					if (dirLocalPath.indexOf("://") < 0  && get("create_sql_dirs").equals("true")&& !new File(dirLocalPath).exists() && dirLocalPath.endsWith("/")) new File(dirLocalPath).mkdirs();
					if (dirLocalPath.indexOf("://") >= 0)
					{
						dir_item.put("url",dirLocalPath);
					}
					else
					{
						dir_item.put("url",new File(dirLocalPath).toURL().toExternalForm());
					}
					dir_item.put("type","dir");
					if (!dirLocalPath.endsWith("/")) dir_item.put("type","file");
					Vector v = new Vector();
					v.addElement(dir_item);
					Properties p = new Properties();
					p.put("dir",rs.getString("dirFTPPath"));
					new File(users_path+rs.getString("dirFTPPath")).mkdirs();
					p.put("name",dirName);
					p.put("data",v);
					VFSItems.addElement(p);
					msg("Got:"+p);

					root_dirs++;
					root_dir = "/"+dirName+"/";
				}
				info.put("VFSItems",VFSItems);
				info.put("permissions",permissions);
				info.put("uVFS",users_path);
				if (root_dirs == 1)//they only have one dir in their file system, so start them in it automatically
				{
					user.put("root_dir",root_dir);
				}
				else if (root_dirs == 0)
				{
					user.put("root_dir","/"+username+"/");//if no dirs are specified, have a starting dir of their username so its compatible with the HomeDir plugin.
					msg("No directories found...HomeDirectory should take over...");
				}
				rs.close();
				s.close();
			}
			catch(Throwable e)
			{
				msg(e);
			}
			if (conn != null) try{conn.close();}catch(Throwable e){}
		}

		if (found_user)
		{
			msg("finished.  Returning success.");
			info.put("action","success");
		}
		else
		{
			msg("finished.  Returning failure.");
		}
	}

	public Vector getEvents(Statement s,String userid)
	{
		Vector retVal = new Vector();
		if (!oldTableStructure) return retVal;
		try
		{
			String _sql = " select event_type,ftp_event_dir,email_from,email_to,email_cc,email_bcc,email_subject,email_body,smtp_server,smtp_user,smtp_pass from emailEvents";
			_sql +=   " where userid='"+userid+"'";
			msg("Querying user's events:"+_sql);
			ResultSet  rs=s.executeQuery(_sql);
			/*
			   <event_dir_data></event_dir_data>
			   <event_if_list></event_if_list>
			   <to>production@sneinc.com</to>
			   <event_action_list>(send_email)</event_action_list>
			   <command>EMAIL</command>
			   <event_user_action_list>(upload)</event_user_action_list>
			   <subject>%user_name% has uploaded %user_session_upload_count% file(s)</subject>
			   <smtp_server>127.0.0.1</smtp_server>
			   <body>Files have been uploaded!&#xD;&lt;LINE&gt;%user_time% %the_file_path%%the_file_name% Total Size:%the_file_size%&lt;/LINE&gt;</body>
			   <smtp_user>production</smtp_user>
			   <cc></cc>
			   <smtp_pass>werwesdf</smtp_pass>
			   <event_always_cb>true</event_always_cb>
			   <from>ben@crushftp.com</from>
			   <event_after_list>(disconnect)</event_after_list>
			   <bcc></bcc>
			   <event_after_cb>true</event_after_cb>
			   <event_now_cb>false</event_now_cb>
			   <event_if_cb>false</event_if_cb>
			   <event_plugin_list></event_plugin_list>
			   <name>email_upload</name>
			*/
			while ( rs.next() )
			{
				Properties saver = new Properties();
				saver.put("command", "EMAIL");
				saver.put("name", "");
				saver.put("email_dir_data", rs.getString("ftp_event_dir"));
				saver.put("event_if_cb", "true");
				saver.put("event_now_cb", "false");
				saver.put("event_always_cb", "false");
				saver.put("event_after_cb", "true");
				saver.put("event_after_list", "(disconnect_all)");
				String eventType = rs.getString("event_type");
				if (eventType.toUpperCase().equals("DISCONNECT")) eventType = "(disconnect)";
				else if (eventType.toUpperCase().equals("LOGIN")) eventType = "(connect)";
				else if (eventType.toUpperCase().equals("UPLOAD")) eventType = "(upload)";
				else if (eventType.toUpperCase().equals("DOWNLOAD")) eventType = "(download)";
				saver.put("event_user_action_list", eventType);
				if (eventType.toUpperCase().equals("UPLOAD")) saver.put("event_if_list", "(upload_dir)");
				else if (eventType.toUpperCase().equals("DOWNLOAD")) saver.put("event_if_list", "(download_dir)");
				saver.put("to", rs.getString("email_to"));

				saver.put("cc", rs.getString("email_cc"));
				saver.put("bcc", rs.getString("email_bcc"));
				saver.put("from", rs.getString("email_from"));
				saver.put("subject", rs.getString("email_subject"));
				saver.put("body", rs.getString("email_body"));
				saver.put("smtp_server", rs.getString("smtp_server"));
				saver.put("smtp_user", rs.getString("smtp_user"));
				saver.put("smtp_pass", rs.getString("smtp_pass"));
				saver.put("event_plugin_list","");
				saver.put("event_action_list","(send_email)");
				retVal.addElement(saver);
				msg("Got:"+saver);
			}
			rs.close();
		}
		catch(Throwable e)
		{
			oldTableStructure = false;
			cl = null;//reset class loader
			msg(e);
		}
		msg("finished with events.");
		return retVal;
	}

	public void load_table(String userid, String table, Properties user, Statement s)
	{
		if (!newTableStructure) return;
		Vector v = new Vector();
		try
		{
			String _sql = " select * from " + table + " where userid='"+userid+"'";
			msg("Querying "+table+":"+_sql);
			ResultSet  rs=s.executeQuery(_sql);
			while ( rs.next() )
			{
				Properties saver = new Properties();
				try
				{
					int columnCount = rs.getMetaData().getColumnCount();
					for (int x=1; x<=columnCount; x++)
					{
						String key = rs.getMetaData().getColumnName(x);
						if (key.toUpperCase().startsWith("ORACLE_")) key = key.substring("ORACLE_".length());
						String val = rs.getString(x);
						if (val == null) val = "";
						saver.put(key.toLowerCase(),val);
					}
				}
				catch(Throwable ee)
				{
					msg(ee);
				}
				v.addElement(saver);
				msg("Got:"+saver);
			}
			rs.close();
			msg("Finished with table load.");
			msg(table);
			user.put(table,v);
		}
		catch(Throwable e)
		{
			newTableStructure = false;
			cl = null;//reset class loader
			msg(e);
		}
	}

	public void testSettings()
	{
		String error = "";
		int userCount = 0;
		try
		{
			String db_drv_files[] = get("db_drv_file").split(";");
			URL urls[] = new URL[db_drv_files.length];
			for (int x=0; x<db_drv_files.length; x++)
			{
				urls[x] = new File(db_drv_files[x]).toURL();
			}
			if (cl == null)
			{
				cl = new URLClassLoader(urls);
				drvCls = Class.forName(get("db_drv"), true, cl);
				driver = (Driver)drvCls.newInstance();
			}
			Properties props = new Properties();props.setProperty("user", get("db_user"));props.setProperty("password", get("db_pass"));
			Connection conn=driver.connect(get("db_url"),props);
			ResultSet rs;
			Statement s=conn.createStatement();
			String    _sql="select id,userName from users where 1=1";
			rs=s.executeQuery(_sql);
			while ( rs.next() )
			{
				String code = rs.getString("id");
				String name = rs.getString("userName");
				userCount++;
			}
			rs.close();
			s.close();
			conn.close();
			error = userCount + " users "+(userCount==1?"was":"were")+" found.\r\nSettings tested OK.";
		}
		catch(Throwable e)
		{
			cl = null;
			error = e.toString();
			msg(e);
		}
		JOptionPane.showMessageDialog(null, error, "Alert",JOptionPane.ERROR_MESSAGE);
	}

	public String get(String key)
	{
		return settings.getProperty(key,"");
	}

	public void msg(String s)
	{
		if (settings.getProperty("debug").equals("true")) crushftp.handlers.Common.debug(0,"CrushSQL:"+s);
	}

	public void msg(Throwable e)
	{
		if (settings.getProperty("debug").equals("true")) crushftp.handlers.Common.debug(0,e);
	}

}


GUI.java

package CrushSQL;

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.lang.reflect.*;
import java.io.*;

public class GUI extends JPanel
{
	private JLabel jLabel1 = new JLabel();
	private JButton browse_button = new JButton();
	private JTextField db_drv_field = new JTextField();
	private JTextField db_url_field = new JTextField();
	private JLabel jLabel2 = new JLabel();
	private JLabel jLabel3 = new JLabel();
	private JTextPane instructions_text = new JTextPane();
	private JTextField db_user_field = new JTextField();
	private JPasswordField db_pass_field = new JPasswordField();
	private JLabel jLabel4 = new JLabel();
	private JLabel jLabel5 = new JLabel();
	private JTextField sql_df_field = new JTextField();
	private JButton test_btn = new JButton();
	private JScrollPane jScrollPane1 = new JScrollPane();

	public GUI()
	{
		try
		{
			jbInit();
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

	Object parent = null;
	private JPanel SetupPanel = new JPanel();
	private JCheckBox enabled_cb = new JCheckBox();
	private JCheckBox debug_cb = new JCheckBox();
    private JTextField db_drv_file_field = new JTextField();
    private JLabel jLabel6 = new JLabel();
    private JLabel jLabel7 = new JLabel();
    private JLabel jLabel8 = new JLabel();
    private JComboBox server_item_combo = new JComboBox();
    private JTabbedPane jTabbedPane1 = new JTabbedPane();
    private JPanel HelpPanel = new JPanel();
    private BorderLayout borderLayout1 = new BorderLayout();
    private JLabel jLabel9 = new JLabel();
    private JScrollPane jScrollPane2 = new JScrollPane();
    private JTextArea db_user_query_field = new JTextArea();
    private JTextArea db_quota_query_field = new JTextArea();
    private JLabel jLabel10 = new JLabel();
    private JScrollPane jScrollPane3 = new JScrollPane();
    private JPanel AdvancedOptionsPanel = new JPanel();
    private JTextField scan_interval_field = new JTextField();
    private JLabel jLabel11 = new JLabel();
    private JCheckBox delete_expired_accounts_cb = new JCheckBox();
    private JCheckBox delete_expired_accounts_filesystem_cb = new JCheckBox();
    private JCheckBox move_expired_accounts_filesystem_cb = new JCheckBox();
    private JLabel jLabel12 = new JLabel();
    private JTextField archive_path_field = new JTextField();
    private JButton browse_folder_button = new JButton();
    private JTextArea db_expired_user_query_field = new JTextArea();
    private JScrollPane jScrollPane4 = new JScrollPane();
    private JLabel jLabel13 = new JLabel();
    private JCheckBox create_sql_dirs_cb = new JCheckBox();
    private JScrollPane jScrollPane5 = new JScrollPane();
    private JLabel jLabel14 = new JLabel();
    private JTextArea db_user_list_query_field = new JTextArea();
	public void setParent(Object parent)
	{
		this.parent = parent;
	}

	void jbInit() throws Exception
	{
		jLabel1.setFont(new java.awt.Font("Arial", 0, 12));
		jLabel1.setText("Database Driver Class:");
		jLabel1.setBounds(new Rectangle(13, 32, 133, 29));
		this.setLayout(null);
		db_drv_field.setBounds(new Rectangle(146, 34, 420, 22));
		db_url_field.setBounds(new Rectangle(115, 59, 451, 22));
		jLabel2.setBounds(new Rectangle(13, 57, 105, 29));
		jLabel2.setText("Database URL :");
		jLabel2.setFont(new java.awt.Font("Arial", 0, 12));
		jLabel3.setFont(new java.awt.Font("Arial", 0, 12));
		jLabel3.setText("Database User :");
		jLabel3.setBounds(new Rectangle(13, 81, 105, 29));
		db_user_field.setBounds(new Rectangle(115, 83, 100, 22));
		db_pass_field.setBounds(new Rectangle(255, 83, 88, 22));
		jLabel4.setBounds(new Rectangle(218, 81, 42, 29));
		jLabel4.setText("Pass :");
		jLabel4.setFont(new java.awt.Font("Arial", 0, 12));
		jLabel5.setFont(new java.awt.Font("Arial", 0, 12));
		jLabel5.setText("Date Format :");
		jLabel5.setBounds(new Rectangle(354, 81, 82, 29));
		sql_df_field.setBounds(new Rectangle(434, 83, 132, 22));
		test_btn.setBounds(new Rectangle(227, 244, 150, 32));
		test_btn.setText("Test Settings");
		test_btn.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent e) {
				test_btn_actionPerformed(e);
			}
		});
		instructions_text.setFont(new java.awt.Font("Arial", 0, 12));
		instructions_text.setContentType("text/html");
		instructions_text.setEditable(false);
		instructions_text.setText(
				"<html><body>" +
				"<b>Instructions</b><br>" +
				"CrushFTP will need to be able to load the java driver for whatever SQL type you are using.<br>" +
				"<br>" +
				"You can get the MySQL driver here: http://dev.mysql.com/downloads/connector/j/5.0.html<br>" +
				"<br>" +
				"Then use the browse button above to pick the .jar file.  If you move the folder where this .jar file is at, you will need to pick it again. (MySQL: mysql-connector-java-5.0.4-bin.jar)<br>" +
				"There is nothing that limits this plugin to MySQL, its just the database I have provided the table creation scripts for.  The tables are simple, and you can create them by hand as well.  Just be sure to match up the column names correctly, as well as the table names.<br><br>" +
				"<br>" +
				"<b>Setup</b><br>" +
				"<b>1)</b> You will be using these tables (The table scripts are included below):<br>" +
				"users, directories, events, etc.<br>" +
				"<b>2)</b> Create a database for CrushFTP...name it something like 'crushftp'.<br>" +
				"<b>3)</b> Use the table scripts to generate the table structures in the 'crushftp' database.<br>" +
				"<b>4)</b> Change the settings above to match the SQL driver you are using.  Also set the correct IP to the server, the correct database name, and a valid user / pass.<br>" +
				"<b>5)</b> Create a record in the users table.  Give it a username and password...the rest can be left at their defaults.<br>" +
				"<b>6)</b> Create a record in the directories table. The directory's ID must link to a user's ID.  For example: ID=1,dirName=MyApps, dirFTPPath=/, dirLocalPath=/Applications/, privDownload=Y, privView=Y  (leave the rest at their defaults.)<br>" +
				"dirName is the display name CrushFTP will display this item as.<br>" +
				"dirFTPPath is the FTP path at which this item should appear. (usually '/')<br>" +
				"dirLocalPath is the local directory path this item links to.  It MUST end and start with '/'.  If this is a path on windows you should use forward slashes ex:'/C:/Program Files/'.  If this is MacOS X '/Applications/'.<br>" +
				"<b>7)</b> Go login with an FTP client and test!<br>" +
				"<br> If you do not know what to enter in a field, look at a user.xml file for a user that was made in the CrushFTP User Manager.  The tables basically represent the xml file.<br>" +
				"<br> " +
				"<br><b>Microsoft SQL Server Setup Instructions</b> <br>" +
				"1)The Microsoft SQL Server driver is sqljdbc.jar, and can be downloaded here: http://msdn2.microsoft.com/en-us/data/aa937724.aspx  If the sqljdbc.jar is loaded into c:\\CrushFTP, then the Database Driver File input box would hold:  'C:\\CrushFTP\\sqljdbc.jar'.<br> " +
				"2)The class name has changed between SQL Server 2000 JDBC driver and the SQL Server 2005 JDBC driver.  The class name for the SQL Server 2000 JDBC driver is: 'com.microsoft.jdbc.sqlserver.SQLServerDriver'.   The SQL Server 2005 JDBC driver class name is 'com.microsoft.sqlserver.jdbc.SQLServerDriver'.   Note the change from 'microsoft.jdbc.sqlserver' to 'microsoft.sqlserver.jdbc'.<br> " +
				"3)The URL prefix has also changed between the SQL Server 2000 JDBC driver and the SQL Server 2005 JDBC driver.  The SQL Server JDBC driver uses a URL prefix of 'jdbc:microsoft:sqlserver://', while SQL Server 2005 JDBC driver uses a URL prefix of: 'jdbc:sqlserver://'.  Note the removal of 'microsoft' from the URL path.<br> " +
				"<br> " +
				"--Ben Spink ben@crushftp.com<br><br>" +
				"The SQL scripts below are for MySQL.  (You will have to tweak them slightly for MS SQL.)  They will generate the tables needed by this plugin.  You can add additional columns to the users table, just look in the user.xml file for the proper column names.  (CMD-C, or CTR-C will copy the text if you select it even though there is no right click or 'Edit' menu.)<br><br>" +
				" # Database: crushftp<br>"+
				" # ************************************************************<br>"+
				" # Dump of table directories<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `users` (<br>"+
				" `id` int(11) NOT NULL auto_increment,<br>"+
				" `userName` varchar(50) NOT NULL default 'anonymous',<br>"+
				" `userPass` varchar(50) NOT NULL default '',<br>"+
				" `maxIdleTime` int(11) NOT NULL default '10',<br>"+
				" `expireDate` datetime default NULL,<br>"+
				" `maxSimultaneousLogins` int(11) NOT NULL default '0',<br>"+
				" `maxLoginsPerIP` int(11) NOT NULL default '0',<br>"+
				" `canRequestFilesAsZip` char(1) NOT NULL default 'Y',<br>"+
				" `requireEncryption` char(1) NOT NULL default 'N',<br>"+
				" PRIMARY KEY (`id`)<br>"+
				" ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" CREATE TABLE `directories` (<br>"+
				" `id` int(11) NOT NULL default '0',<br>"+
				" `dirName` varchar(255) NOT NULL default 'dirName',<br>"+
				" `dirFTPPath` varchar(255) NOT NULL default '/',<br>"+
				" `dirLocalPath` varchar(255) NOT NULL default '/',<br>"+
				" `privDownload` char(1) NOT NULL default 'Y',<br>"+
				" `privUpload` char(1) NOT NULL default 'N',<br>"+
				" `privView` char(1) NOT NULL default 'Y',<br>"+
				" `privDelete` char(1) NOT NULL default 'N',<br>"+
				" `privDeleteDir` char(1) NOT NULL default 'N',<br>"+
				" `privMakeDir` char(1) NOT NULL default 'N',<br>"+
				" `privRename` char(1) NOT NULL default 'N',<br>"+
				" `privResume` char(1) NOT NULL default 'Y',<br>"+
				" `privRealQuota` char(1) NOT NULL default 'Y',<br>"+
				" `quotaBytes` varchar(255) NOT NULL default ''<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" # Dump of table events<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `events` (<br>"+
				" `userid` int(11) NOT NULL default '0',<br>"+
				" `name` varchar(255) NOT NULL default '',<br>"+
				" `command` varchar(255) NOT NULL default '',<br>"+
				" `event_dir_data` varchar(255) NOT NULL default '',<br>"+
				" `event_if_list` varchar(255) NOT NULL default '',<br>"+
				" `event_action_list` varchar(255) NOT NULL default '',<br>"+
				" `event_user_action_list` varchar(255) NOT NULL default '',<br>"+
				" `event_after_list` varchar(255) NOT NULL default '',<br>"+
				" `event_plugin_list` varchar(255) NOT NULL default '',<br>"+
				" `from` varchar(255) NOT NULL default '',<br>"+
				" `to` varchar(255) NOT NULL default '',<br>"+
				" `cc` varchar(255) NOT NULL default '',<br>"+
				" `bcc` varchar(255) NOT NULL default '',<br>"+
				" `subject` varchar(255) NOT NULL default '',<br>"+
				" `body` varchar(255) NOT NULL default '',<br>"+
				" `event_always_cb` varchar(10) NOT NULL default 'false',<br>"+
				" `event_after_cb` varchar(10) NOT NULL default 'false',<br>"+
				" `event_now_cb` varchar(10) NOT NULL default 'false',<br>"+
				" `event_if_cb` varchar(10) NOT NULL default 'false'<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" # Dump of table ip_restrictions<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `ip_restrictions` (<br>"+
				" `userid` int(11) NOT NULL default '0',<br>"+
				" `start_ip` varchar(255) default NULL,<br>"+
				" `type` varchar(1) default NULL,<br>"+
				" `stop_ip` varchar(255) default NULL<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" # Dump of table users<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" # Dump of table domain_root_list<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `domain_root_list` (<br>"+
				" `userid` int(11) NOT NULL default '0',<br>"+
				" `domain` varchar(255) default NULL,<br>"+
				" `path` varchar(255) default NULL<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" # Dump of table web_buttons<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `web_buttons` (<br>"+
				" `userid` int(11) NOT NULL default '0',<br>"+
				" `sort_order` int(11) NOT NULL default '0',<br>"+
				" `key` varchar(255) default NULL,<br>"+
				" `value` varchar(255) default NULL<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
				"  <br>"+
				"  <br>"+
				"  <br>"+
				" # Dump of table web_customizations<br>"+
				" # ------------------------------------------------------------<br>"+
				"  <br>"+
				" CREATE TABLE `web_customizations` (<br>"+
				" `userid` int(11) NOT NULL default '0',<br>"+
				" `key` varchar(255) default NULL,<br>"+
				" `value` varchar(255) default NULL<br>"+
				" ) ENGINE=MyISAM DEFAULT CHARSET=latin1;<br>"+
 				"</body></html>"
				);
		browse_button.setBounds(new Rectangle(462, 1, 107, 31));
		browse_button.setText("Browse...");
		browse_button.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent e) {
				browse_button_actionPerformed(e);
			}
		});
		SetupPanel.setBorder(BorderFactory.createEtchedBorder());
		SetupPanel.setLayout(null);
		enabled_cb.setText("Enabled");
		enabled_cb.setBounds(new Rectangle(6, 4, 100, 22));
		debug_cb.setBounds(new Rectangle(122, 4, 100, 22));
		debug_cb.setText("Debug");
		db_drv_file_field.setBounds(new Rectangle(146, 8, 312, 22));
        jLabel6.setBounds(new Rectangle(13, 6, 129, 29));
        jLabel6.setText("Database Driver File:");
        jLabel6.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel7.setBounds(new Rectangle(13, 106, 105, 29));
        jLabel7.setText("Server Item:");
        jLabel7.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel8.setFont(new java.awt.Font("Arial", 0, 10));
        jLabel8.setText("You can specify which server item will use this plugin.  Example: " +
    "lookup_21, or lookup_8080. (Leave blank for all.)");
        jLabel8.setBounds(new Rectangle(14, 123, 564, 29));
        server_item_combo.setBounds(new Rectangle(115, 108, 183, 27));
        jTabbedPane1.setBounds(new Rectangle(0, 26, 593, 338));
        HelpPanel.setLayout(borderLayout1);
        jLabel9.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel9.setText("User Lookup Query :");
        jLabel9.setBounds(new Rectangle(13, 148, 120, 29));
        jScrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane2.setBounds(new Rectangle(133, 148, 434, 44));
        jLabel10.setBounds(new Rectangle(13, 197, 152, 29));
        jLabel10.setText("User Quota Update Query :");
        jLabel10.setFont(new java.awt.Font("Arial", 0, 12));
        jScrollPane3.setBounds(new Rectangle(163, 197, 404, 44));
        jScrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        scan_interval_field.setText("10");
        scan_interval_field.setBounds(new Rectangle(205, 3, 48, 22));
        AdvancedOptionsPanel.setLayout(null);
        jLabel11.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel11.setText("Scan for accounts every x minutes:");
        jLabel11.setBounds(new Rectangle(7, 6, 201, 16));
        delete_expired_accounts_cb.setText("Delete expired accounts?");
        delete_expired_accounts_cb.setBounds(new Rectangle(8, 118, 199, 22));
        delete_expired_accounts_filesystem_cb.setBounds(new Rectangle(44, 194, 269, 22));
        delete_expired_accounts_filesystem_cb.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(ActionEvent e) {
                delete_expired_accounts_filesystem_cb_actionPerformed(e);
            }
        });
        delete_expired_accounts_filesystem_cb.setToolTipText("Recursively delete folders that the user has access to.");
        delete_expired_accounts_filesystem_cb.setText("Delete expired accounts file system?");
        move_expired_accounts_filesystem_cb.setText("Move expired accounts file system to archive?");
        move_expired_accounts_filesystem_cb.setToolTipText("Recursively move folders that the user has access to into an archive " +
    "location.");
        move_expired_accounts_filesystem_cb.setBounds(new Rectangle(44, 217, 335, 22));
        jLabel12.setBounds(new Rectangle(77, 245, 173, 16));
        jLabel12.setText("Path location to move files to:");
        jLabel12.setFont(new java.awt.Font("Arial", 0, 12));
        archive_path_field.setBounds(new Rectangle(77, 261, 332, 22));
        archive_path_field.setText("/Archive/");
        browse_folder_button.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(ActionEvent e) {
				browse_folder_button_actionPerformed(e);
			}
		});
        browse_folder_button.setText("Browse...");
        browse_folder_button.setBounds(new Rectangle(413, 257, 107, 31));
        jScrollPane4.setBounds(new Rectangle(170, 150, 395, 44));
        jLabel13.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel13.setHorizontalAlignment(SwingConstants.TRAILING);
        jLabel13.setText("Query:");
        jLabel13.setBounds(new Rectangle(42, 150, 124, 38));
        create_sql_dirs_cb.setBounds(new Rectangle(7, 25, 299, 22));
        create_sql_dirs_cb.setText("Create SQL directories if they don\'t exist?");
        jScrollPane5.setBounds(new Rectangle(170, 57, 395, 44));
        jLabel14.setFont(new java.awt.Font("Arial", 0, 12));
        jLabel14.setHorizontalAlignment(SwingConstants.TRAILING);
        jLabel14.setText("Query:");
        jLabel14.setBounds(new Rectangle(73, 57, 93, 29));
        SetupPanel.add(browse_button, null);
        SetupPanel.add(db_drv_file_field, null);
        SetupPanel.add(jLabel6, null);
        SetupPanel.add(jLabel1, null);
        SetupPanel.add(db_drv_field, null);
        SetupPanel.add(jLabel2, null);
        SetupPanel.add(db_url_field, null);
        SetupPanel.add(jLabel4, null);
        SetupPanel.add(db_pass_field, null);
        SetupPanel.add(jLabel3, null);
        SetupPanel.add(db_user_field, null);
        SetupPanel.add(sql_df_field, null);
        SetupPanel.add(jLabel5, null);
        SetupPanel.add(jLabel7, null);
        SetupPanel.add(jLabel8, null);
        SetupPanel.add(server_item_combo, null);
		this.add(enabled_cb, null);
		this.add(debug_cb, null);
        this.add(jTabbedPane1, null);
        jTabbedPane1.add(HelpPanel, "Help");
        jTabbedPane1.add(SetupPanel, "Setup");
		jTabbedPane1.add(AdvancedOptionsPanel, "Advanced Options");
        HelpPanel.add(jScrollPane1, BorderLayout.CENTER);
        jScrollPane1.getViewport().add(instructions_text, null);
        SetupPanel.add(test_btn, null);
        SetupPanel.add(jLabel9, null);
        SetupPanel.add(jScrollPane2, null);
        SetupPanel.add(jLabel10, null);
        SetupPanel.add(jScrollPane3, null);
        jScrollPane3.getViewport().add(db_quota_query_field, null);
        jScrollPane2.getViewport().add(db_user_query_field, null);
        AdvancedOptionsPanel.add(jLabel11, null);
        AdvancedOptionsPanel.add(scan_interval_field, null);
        AdvancedOptionsPanel.add(create_sql_dirs_cb, null);
        AdvancedOptionsPanel.add(archive_path_field, null);
        AdvancedOptionsPanel.add(move_expired_accounts_filesystem_cb, null);
        AdvancedOptionsPanel.add(delete_expired_accounts_filesystem_cb, null);
        AdvancedOptionsPanel.add(browse_folder_button, null);
        AdvancedOptionsPanel.add(jLabel12, null);
        AdvancedOptionsPanel.add(jScrollPane5, null);
        AdvancedOptionsPanel.add(jLabel14, null);
        AdvancedOptionsPanel.add(jScrollPane4, null);
        AdvancedOptionsPanel.add(jLabel13, null);
        AdvancedOptionsPanel.add(delete_expired_accounts_cb, null);
        jScrollPane4.getViewport().add(db_expired_user_query_field, null);
        jScrollPane5.getViewport().add(db_user_list_query_field, null);
		class scrollUp implements Runnable
		{
			public void run()
			{
				try{Thread.sleep(2000);}catch(Exception e){}
				jScrollPane1.getVerticalScrollBar().setValue(0);
			}
		}
		new Thread(new scrollUp()).start();
		buildServerList();
        jTabbedPane1.setSelectedIndex(1);
	}

	public Properties getSettings()
	{
		Properties p = new Properties();
		p.put("enabled",enabled_cb.isSelected()+"");
		p.put("debug",debug_cb.isSelected()+"");
		p.put("db_drv_file",db_drv_file_field.getText());
		p.put("db_drv",db_drv_field.getText());
		p.put("db_url",db_url_field.getText());
		p.put("db_user",db_user_field.getText());
		p.put("db_pass",new String(db_pass_field.getPassword()));
		p.put("db_user_query",db_user_query_field.getText());
		p.put("db_quota_query",db_quota_query_field.getText());
		p.put("sql_df",sql_df_field.getText());
		p.put("server_item",server_item_combo.getSelectedItem());

		p.put("db_user_list_query",db_user_list_query_field.getText());
		p.put("db_expired_user_query",db_expired_user_query_field.getText());
		p.put("delete_expired_accounts",delete_expired_accounts_cb.isSelected()+"");
		p.put("create_sql_dirs",create_sql_dirs_cb.isSelected()+"");
		p.put("scan_interval",scan_interval_field.getText());
		p.put("delete_expired_accounts_filesystem",delete_expired_accounts_filesystem_cb.isSelected()+"");
		p.put("move_expired_accounts_filesystem",move_expired_accounts_filesystem_cb.isSelected()+"");
		p.put("archive_path",archive_path_field.getText());
		return p;
	}

	public void buildServerList()
	{
		server_item_combo.removeAllItems();
		server_item_combo.addItem("All");
		try
		{
			Vector the_server_list = (Vector)crushftp.server.ServerStatus.server_settings.get("server_list");
			for (int x=0; x<the_server_list.size(); x++)
			{
				Properties server_item = (Properties)((Properties)the_server_list.elementAt(x)).clone();
				server_item_combo.addItem(server_item.getProperty("ip","lookup")+"_"+server_item.getProperty("port","21"));
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

	public void setSettings(Properties p)
	{
		enabled_cb.setSelected(p.getProperty("enabled").equalsIgnoreCase("true"));
		debug_cb.setSelected(p.getProperty("debug").equalsIgnoreCase("true"));
		db_drv_file_field.setText(p.getProperty("db_drv_file"));
		db_drv_field.setText(p.getProperty("db_drv"));
		db_url_field.setText(p.getProperty("db_url"));
		db_user_field.setText(p.getProperty("db_user"));
		db_pass_field.setText(p.getProperty("db_pass"));
		sql_df_field.setText(p.getProperty("sql_df"));
		db_user_query_field.setText(p.getProperty("db_user_query"));
		db_quota_query_field.setText(p.getProperty("db_quota_query"));
		server_item_combo.setSelectedItem(p.getProperty("server_item"));

		db_user_list_query_field.setText(p.getProperty("db_user_list_query"));
		db_expired_user_query_field.setText(p.getProperty("db_expired_user_query"));
		if (db_expired_user_query_field.getText().equals(db_user_query_field.getText())) db_expired_user_query_field.setText("select * from users where (expireDate is not null and expireDate < ?)");//bugfix for period of time where the wrong value was being saved to this query
		create_sql_dirs_cb.setSelected(p.getProperty("create_sql_dirs").equalsIgnoreCase("true"));
		delete_expired_accounts_cb.setSelected(p.getProperty("delete_expired_accounts").equalsIgnoreCase("true"));
		scan_interval_field.setText(p.getProperty("scan_interval"));
		delete_expired_accounts_filesystem_cb.setSelected(p.getProperty("delete_expired_accounts_filesystem").equalsIgnoreCase("true"));
		move_expired_accounts_filesystem_cb.setSelected(p.getProperty("move_expired_accounts_filesystem").equalsIgnoreCase("true"));
		archive_path_field.setText(p.getProperty("archive_path"));
	}

	void test_btn_actionPerformed(ActionEvent e)
	{
		Properties p = getSettings();
		try
		{
			Method setSettings = parent.getClass().getMethod("setSettings",new Class[] { new Properties().getClass() });
			setSettings.invoke(parent,new Object[]{p});
			Method testSettings = parent.getClass().getMethod("testSettings",null);
			testSettings.invoke(parent,null);
		}
		catch(Exception ee)
		{
		}
	}
	void browse_button_actionPerformed(ActionEvent e)
	{
		JFileChooser d = new JFileChooser();
		d.setFileSelectionMode(JFileChooser.FILES_ONLY);
		d.setMultiSelectionEnabled(true);
		d.setCurrentDirectory(new File("/"));
		d.setApproveButtonText("Pick Selected Files");
		d.setDialogTitle("Pick JDBC Driver Files (One or more .JAR files.)");
		d.setFileFilter(null);
		int res = d.showOpenDialog(this);
		String the_dir = "";
		if(res == JFileChooser.APPROVE_OPTION)
		{
			File f[] = d.getSelectedFiles();
			for (int x=0; x<f.length; x++)
			{
				the_dir += f[x].toString().replace('\\','/')+"/"+";";
			}
		}
		else return;
		the_dir = the_dir.substring(0,the_dir.length()-1);
		db_drv_file_field.setText(the_dir);
	}

    void browse_folder_button_actionPerformed(ActionEvent e)
	{
		JFileChooser d = new JFileChooser();
		d.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
		d.setCurrentDirectory(new File("./"));
		d.setApproveButtonText("Pick");
		d.setFileFilter(null);
		int res = d.showOpenDialog(this);
		String the_dir = "";
		if(res == JFileChooser.APPROVE_OPTION)
		{
			File f = d.getSelectedFile();
			the_dir = f.toString()+"/";
		}
		else return;
		archive_path_field.setText(the_dir);
    }

    void delete_expired_accounts_filesystem_cb_actionPerformed(ActionEvent e)
	{
		if (delete_expired_accounts_filesystem_cb.isSelected())
		{
			JOptionPane.showMessageDialog(null,"WARNING!!!\r\n\r\nWhen the date is expired in the SQL table, all directories\r\nand their files listed in the directories table\r\nWILL BE DELETED PERMANENTLY.\r\n\r\nIf you are unsure, do not enable this.");
		}
    }

}

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-1) was last changed on 09-Oct-2016 18:14 by Ben Spink
G’day (anonymous guest)

OLD WIKI!!!#

New: CrushFTPv9#

OLD WIKI!!!#


CrushFTP8 | What's New

Referenced by
LeftMenu
Third Party

JSPWiki v2.8.2