01: package com.jamonapi;
02:
03: /**
04: * This class is a wrapper for the internal data structure of a Monitor. It adds info specific to this monitor
05: * too such as the details of the key. However, it uses the data of the underlying monitor (such as hits/total/avg etc).
06: * DecoMon stood for decorator though I suspec that this is no longer the decorator pattern. It seems to be a useful
07: * pattern of passing around hte internals and merging them with another classes differences though I am not sure what that
08: * pattern is (similar to flyweight but with different intent).
09: *
10: * @author ssouza
11: *
12: */
13:
14: class DecoMon extends MonitorImp {
15:
16: // The two following fields are unique to this instance. MonInternals are shared
17: // by all monitors with this same logical key.
18: private MonKey decoKey;
19:
20: /** Creates a new instance of BaseMon. It takes a reference to the enabled monitor it calls */
21: public DecoMon(MonInternals monData) {
22: super (monData);
23:
24: }
25:
26: public DecoMon(MonKey key, MonInternals monData) {
27: super (monData);
28: this .decoKey = key;
29: }
30:
31: /** Get the key for this monitor. Example: MonKey could contain "pageHits", "ms." */
32: public MonKey getMonKey() {
33: if (decoKey != null)
34: return decoKey;
35: else
36: return monData.key;
37: }
38:
39: }
|