001: /*
002: * Created on May 4, 2003
003: *
004: * Dbmjui is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU General Public License version 2 as
006: * published by the Free Software Foundation.
007: *
008: * Dbmjui is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * General Public License for more details.
012: *
013: * You should have received a copy of the GNU General Public
014: * License along with dbmjui; see the file COPYING. If not,
015: * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
016: * Boston, MA 02111-1307, USA.
017: *
018: */
019: package fr.aliacom.dbmjui.beans;
020:
021: import java.beans.PropertyChangeListener;
022: import java.beans.PropertyChangeSupport;
023:
024: import org.apache.log4j.Logger;
025:
026: import fr.aliacom.dbmjui.DbInstance;
027:
028: /**
029: * @author tom
030: *
031: * (c) 2001, 2003 Thomas Cataldo
032: */
033: public class InstanceInformations {
034:
035: private int state;
036: private int data;
037: private int dataMax;
038: private int log;
039: private int logMax;
040: private int cchr;
041: private int dchr;
042: private int session;
043: private int sessionMax;
044: private String backUp;
045: private boolean autologEnabled;
046:
047: private String fullName;
048: private String name;
049: private String path;
050: private String version;
051:
052: private DbInstance dbi;
053:
054: private PropertyChangeSupport pcs;
055:
056: private static final Logger logger = Logger
057: .getLogger(InstanceInformations.class);
058:
059: public InstanceInformations() {
060: pcs = new PropertyChangeSupport(this );
061: }
062:
063: public void addPropertyChangeListener(String property,
064: PropertyChangeListener pcl) {
065: logger.debug("pcl added prop=" + property + " : " + pcl);
066: pcs.addPropertyChangeListener(property, pcl);
067: }
068:
069: public void addPropertyChangeListener(PropertyChangeListener pcl) {
070: logger.debug("pcl added : " + pcl);
071: pcs.addPropertyChangeListener(pcl);
072: }
073:
074: public void removePropertyChangeListener(String property,
075: PropertyChangeListener pcl) {
076: logger.debug("pcl removed prop=" + property + " : " + pcl);
077: pcs.removePropertyChangeListener(property, pcl);
078: }
079:
080: public void removePropertyChangeListener(PropertyChangeListener pcl) {
081: logger.debug("pcl removed : " + pcl);
082: pcs.removePropertyChangeListener(pcl);
083: }
084:
085: /**
086: * @return the converter cache hit rate
087: */
088: public int getCchr() {
089: return cchr;
090: }
091:
092: /**
093: * @return used data in pages
094: */
095: public int getData() {
096: return data;
097: }
098:
099: /**
100: * @return max data in pages
101: */
102: public int getDataMax() {
103: return dataMax;
104: }
105:
106: /**
107: * @return the data cache hit rate
108: */
109: public int getDchr() {
110: return dchr;
111: }
112:
113: /**
114: * @return used log pages
115: */
116: public int getLog() {
117: return log;
118: }
119:
120: /**
121: * @return max log pages
122: */
123: public int getLogMax() {
124: return logMax;
125: }
126:
127: /**
128: * @return used sessions
129: */
130: public int getSession() {
131: return session;
132: }
133:
134: /**
135: * @return max number of session
136: */
137: public int getSessionMax() {
138: return sessionMax;
139: }
140:
141: /**
142: * @return one of the DbState constants
143: */
144: public int getState() {
145: return state;
146: }
147:
148: /**
149: * @param i
150: */
151: public void setCchr(int i) {
152: cchr = i;
153: }
154:
155: /**
156: * @param i
157: */
158: public void setData(int i) {
159: int oldData = data;
160: data = i;
161: pcs.firePropertyChange("data", oldData, data);
162: }
163:
164: /**
165: * @param i
166: */
167: public void setDataMax(int i) {
168: int oldDataMax = dataMax;
169: dataMax = i;
170: pcs.firePropertyChange("dataMax", oldDataMax, dataMax);
171: }
172:
173: /**
174: * @param i
175: */
176: public void setDchr(int i) {
177: dchr = i;
178: }
179:
180: /**
181: * @param i
182: */
183: public void setLog(int i) {
184: int oldLog = log;
185: log = i;
186: pcs.firePropertyChange("log", oldLog, log);
187: }
188:
189: /**
190: * @param i
191: */
192: public void setLogMax(int i) {
193: logMax = i;
194: }
195:
196: /**
197: * @param i
198: */
199: public void setSession(int i) {
200: int oldSession = session;
201: session = i;
202: pcs.firePropertyChange("session", oldSession, session);
203: }
204:
205: /**
206: * @param i
207: */
208: public void setSessionMax(int i) {
209: sessionMax = i;
210: }
211:
212: /**
213: * @param i
214: */
215: public void setState(int i) {
216: int oldState = state;
217: state = i;
218: pcs.firePropertyChange("state", oldState, state);
219: }
220:
221: /**
222: * @return XXX
223: */
224: public String getBackUp() {
225: return backUp;
226: }
227:
228: /**
229: * @param string
230: */
231: public void setBackUp(String string) {
232: backUp = string;
233: }
234:
235: /**
236: * @return XXX
237: */
238: public String getName() {
239: return name;
240: }
241:
242: /**
243: *
244: * @return the path to the database files
245: */
246: public String getPath() {
247: return path;
248: }
249:
250: /**
251: * @return the version of the SAPDB kernel
252: */
253: public String getVersion() {
254: return version;
255: }
256:
257: /**
258: * @param string
259: */
260: public void setName(String string) {
261: name = string;
262: }
263:
264: /**
265: * @param string
266: */
267: public void setPath(String string) {
268: path = string;
269: }
270:
271: /**
272: * @param string the version string
273: */
274: public void setVersion(String string) {
275: version = string;
276: }
277:
278: /**
279: * @return the database instance
280: */
281: public DbInstance getDbi() {
282: return dbi;
283: }
284:
285: /**
286: * @param instance
287: */
288: public void setDbi(DbInstance instance) {
289: dbi = instance;
290: }
291:
292: /**
293: * @return true if autolog is enabled
294: */
295: public boolean isAutologEnabled() {
296: return autologEnabled;
297: }
298:
299: /**
300: * @param b
301: */
302: public void setAutologEnabled(boolean b) {
303: autologEnabled = b;
304: }
305:
306: /**
307: * @return the name used in the dbi list
308: */
309: public String getFullName() {
310: return fullName;
311: }
312:
313: /**
314: * @param string
315: */
316: public void setFullName(String string) {
317: fullName = string;
318: }
319:
320: public String toString() {
321: return "InstanceInformations for name=" + name + " fullName="
322: + fullName;
323: }
324:
325: }
|