00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.console.wizard.objects;
00026
00027 import java.util.ArrayList;
00028
00029 import org.objectweb.cjdbc.common.i18n.WizardTranslate;
00030 import org.objectweb.cjdbc.console.wizard.WizardConstants;
00031
00032
00033
00034
00035
00036
00037
00038
00039 public class ConnectionTypeInfo
00040 {
00041
00042 String type = WizardConstants.CONNECTION_MANAGERS[0];
00043 final Exception badValue = new Exception("Bad Parameter");
00044 private ArrayList values = new ArrayList();
00045
00046 public String[] getAttributes()
00047 {
00048 if (type == WizardConstants.CONNECTION_MANAGERS[0])
00049 return new String[]{};
00050 if (type == WizardConstants.CONNECTION_MANAGERS[1])
00051 return new String[]{WizardTranslate.get("label.poolSize")};
00052 if (type == WizardConstants.CONNECTION_MANAGERS[2])
00053 return new String[]{WizardTranslate.get("label.poolSize"),
00054 WizardTranslate.get("label.timeout")};
00055 if (type == WizardConstants.CONNECTION_MANAGERS[3])
00056 return new String[]{WizardTranslate.get("label.initPoolSize"),
00057 WizardTranslate.get("label.minPoolSize"),
00058 WizardTranslate.get("label.maxPoolSize"),
00059 WizardTranslate.get("label.idleTimeout"),
00060 WizardTranslate.get("label.waitTimeout")};
00061 else
00062 return null;
00063 }
00064
00065
00066
00067
00068
00069
00070 public ArrayList getValues()
00071 {
00072 return values;
00073 }
00074
00075 public int getValue(int index)
00076 {
00077 try
00078 {
00079 Object value = values.get(index);
00080 if (value instanceof String)
00081 return Integer.parseInt((String) value);
00082 else if (value instanceof Integer)
00083 return ((Integer) values.get(index)).intValue();
00084 else
00085 throw badValue;
00086 }
00087 catch (Exception e)
00088 {
00089 e.printStackTrace();
00090 return 0;
00091 }
00092 }
00093
00094
00095
00096
00097
00098
00099 public void setValues(ArrayList values)
00100 {
00101 this.values = values;
00102 }
00103
00104
00105
00106
00107
00108
00109 public String getType()
00110 {
00111 return type;
00112 }
00113
00114 public String toString()
00115 {
00116 return type;
00117 }
00118
00119
00120
00121
00122
00123
00124 public void setType(String type)
00125 {
00126 this.type = type;
00127 }
00128 }