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

📄 jspmyadminconfig.java

📁 管理 MySQL 的工具, 相當方便好用
💻 JAVA
字号:
/*
 * jspMyAdminConfig.java 0.6 2001/08/25 
 * Copyright (c) 2001 zsolyfree@yahoo.com under the GPL (www.gnu.org/copyleft/)
 * 
 * TERMS OF USAGE:
 * This file was written and developed by Zsolt Mali (zsolyfree@yahoo.com)
 * for educational and demonstration purposes only.  You have all rights to use,
 * modify, and redistribute this file as you like.  The only
 * requirement is that you must retain this notice, without modifications, at
 * the top of your source code.  No warranties or guarantees are expressed or
 * implied. DO NOT use this code in a production environment without
 * understanding the limitations and weaknesses pretaining to or caused by the
 * use of these scripts, directly or indirectly. USE AT YOUR OWN RISK!
 */
package com.jspmyadmin;

import java.util.*;


public class jspMyAdminConfig {

/**
 * Class description goes here.
 *
 * @version 	0.9  2001/07/09 21:01:36 PM 
 * @author 	Zsolt Mali
 */

Hashtable servers = new Hashtable();
int nofservers = 0;
/** 
 * constructor DSJspUtils 
 * 
 * @author Zsolt Mali
 * @param source the Hashtable with the config file key, value pairs
 */
public jspMyAdminConfig ( Hashtable source) {
        this.servers = source;
        init();

}//end constructor --> jspMyAdminConfig

/**
 * Makes the initializations and set the static variables
 * 
 * 
 * @author Zsolt Mali
 */
public void init() {
      int i = 1;
      
      this.nofservers = ( (this.servers.containsKey("host")) && (!this.servers.get("host").equals("")) ) 
          ? (this.nofservers+1)
          : this.nofservers;

      while ( this.servers.containsKey("host"+i) ) {
      this.nofservers = ( (this.servers.containsKey("host"+i)) && (!this.servers.get("host"+i).equals("")) ) 
          ? (this.nofservers+1)
          : this.nofservers;
      i++;
      }
}//end method --> public void init()

/**
 * Makes the initializations and set the static variables
 * 
 * 
 * @author Zsolt Mali
 */
public int getNumberOfServers() {
        return this.nofservers;
}//end method --> public void getNumberOfServers()

/**
 * Getting the value for the specified key for the specified server  
 * (default we getting the first key)
 * 
 * @author Zsolt Mali
 * @param localkey the key from config 
 * @param number the number from config 
 */
public String get4Server( String localkey, int number) {
     if ( number>0 ) {
         return (String)this.servers.get(localkey+number);
     }
     else if ( number == 0) {
         return (String)this.servers.get(localkey);
     }
     else {
         return "";
     }
}//end method --> public String get4Server( String localkey, int number )

/**
 * Getting the value for the specified key  
 * 
 * @author Zsolt Mali
 * @param key the key which value we are looking for
 */
public Object get( Object key ) {
       return this.servers.get( key );
}//end method --> public Object get( Object key )

/**
 * Returning the value for the specified key as String 
 * 
 * @author Zsolt Mali
 * @param key the key which value we are looking for
 */
public String get( String key ) {
       return (String)this.servers.get( key );
}//end method --> public Object get( Object key )

/**
 * Returns the value for the specified key as Integer 
 * 
 * @author Zsolt Mali
 * @param key the key which value we are looking for
 */
public int getInt( Object key ) throws NumberFormatException {
       return Integer.parseInt((String)this.servers.get( key ));
}//end method --> public int get( Object key )

/**
 * Appends a new key value pair to hashtable
 * 
 * 
 * @author Zsolt Mali
 * @param key the key
 * @param value
 */
public void set( Object key, Object value ) {
        this.servers.put( key, value);
}//end method --> public void set( Object key, Object value)

/**
 * Appends a new key value pair to hashtable
 * 
 * 
 * @author Zsolt Mali
 * @param key the key
 * @param value
 */
public void set( String key, String value ) {
        this.servers.put( key, value);
}//end method --> public void set( Object key, Object value)


}//end class --> jspMyAdminConfig

⌨️ 快捷键说明

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