KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > dynamic > MockListeningConfigItem


1 /**
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.dynamic;
5
6 import org.apache.xmlbeans.XmlObject;
7
8 import com.tc.config.schema.listen.ConfigurationChangeListener;
9
10 /**
11  * A {@link MockConfigItem} that is also a {@link ConfigurationChangeListener}.
12  */

13 public class MockListeningConfigItem extends MockConfigItem implements ConfigurationChangeListener {
14
15   private int numConfigurationChangeds;
16   private XmlObject lastOldConfig;
17   private XmlObject lastNewConfig;
18
19   public void reset() {
20     super.reset();
21
22     this.numConfigurationChangeds = 0;
23     this.lastOldConfig = null;
24     this.lastNewConfig = null;
25   }
26
27   public void configurationChanged(XmlObject oldConfig, XmlObject newConfig) {
28     ++this.numConfigurationChangeds;
29     this.lastOldConfig = oldConfig;
30     this.lastNewConfig = newConfig;
31   }
32
33   public XmlObject getLastNewConfig() {
34     return lastNewConfig;
35   }
36
37   public XmlObject getLastOldConfig() {
38     return lastOldConfig;
39   }
40
41   public int getNumConfigurationChangeds() {
42     return numConfigurationChangeds;
43   }
44
45 }
46
Popular Tags