1 /***
2 *
3 */
4 package net.sourceforge.jdbdump.gui;
5
6 import java.io.IOException;
7 import java.util.Hashtable;
8
9 import javax.faces.context.FacesContext;
10 import javax.faces.el.ValueBinding;
11
12 import net.sourceforge.jdbdump.connect.Configuration;
13 import net.sourceforge.jdbdump.connect.DatabaseConnectionData;
14
15 /***
16 * @author grabka
17 *
18 */
19 public class TabDbEditBean {
20
21 public String saveAction() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
22 FacesContext ctx = FacesContext.getCurrentInstance();
23
24 ValueBinding editedConnectionBind = ctx.getApplication().createValueBinding("#{dbEditBean}");
25 DbEditBean eb = (DbEditBean) editedConnectionBind.getValue(ctx);
26
27 DatabaseConnectionData data = new DatabaseConnectionData(eb.getDbServerName(), eb.getPort(),
28 eb.getEngine(), eb.getLogin(), eb.getPassword(), eb.getDbName(), eb.getDbTitle(), eb.getUrl());
29
30 Hashtable<String, DatabaseConnectionData> hash = Configuration.getInstance().getConnections();
31 hash.put(data.getTitle(), data);
32
33 return "dbList";
34 }
35 }