View Javadoc

1   /*
2    * $Id: DatabaseConnectionData.java,v 1.11 2006/01/12 15:15:22 grabka Exp $ 
3    * 
4    */
5   
6   /*
7    * 
8    * 				UNDER CONSTRUCTION !!!
9    * 
10   */
11  
12  package net.sourceforge.jdbdump.connect;
13  
14  import java.util.*;
15  
16  public class DatabaseConnectionData extends Properties{
17  
18  	private static final long serialVersionUID = 1295234520171150641L;
19  	static private String[] propertyNames;
20  
21  	static {
22  	  propertyNames = new String[] {
23  	    "server",
24  	    "port",
25  	    "dbType",
26  	    "login",
27  	    "password",
28  	    "dbName",
29  	    "dbTitle",
30  	    "URL"
31  	    };
32  	}	
33  	
34  	DatabaseConnectionData(){
35  		
36  	}
37  
38  	public DatabaseConnectionData(String server, String port, String dbType, String login, String password, String dbName, String dbTitle, String URL){
39  		try{
40  			this.setProperty("server", server);
41  			this.setProperty("port", port);
42  			this.setProperty("dbType", dbType);
43  			this.setProperty("login", login);
44  			this.setProperty("password", password);
45  			this.setProperty("dbName", dbName);
46  			this.setProperty("dbTitle", dbTitle);
47  			this.setProperty("URL", URL);
48  		}catch(Exception e){
49  			
50  		};
51  	};
52  	
53  	public Object setProperty(String key, String value){
54  		int i;
55  		for(i = 0; i < propertyNames.length; i++)
56  			if(propertyNames[i] == key )
57  				return super.setProperty(key, value);
58  		return null;
59  	}
60  	
61  	public String getServer(){
62  		return this.getProperty("server");
63  	}
64  
65  	public String getPort() {
66  		return this.getProperty("port");
67  	}
68  
69  	public String getDatabaseType(){
70  		return this.getProperty("dbType");
71  	}
72  
73  	public String getLogin(){
74  		return this.getProperty("login");
75  	}
76  
77  	public String getPassword(){
78  		return this.getProperty("password");
79  	}
80  
81  	public String getDatabaseName(){
82  		return this.getProperty("dbName");
83  	}
84  	
85  	public String getTitle(){
86  		return this.getProperty("dbTitle");
87  	}
88  	
89  	public String getURL(){
90  		return this.getProperty("URL");
91  	}
92  
93  }
94