* Add property read access to methods registered by PropertyRecorder.

Fixes bug 458 <http://www.helma.org/bugs/show_bug.cgi?id=458>.
* Make all PropertyRecorder methods synchronized.
This commit is contained in:
hns 2006-04-10 11:25:22 +00:00
parent 0aed9bbdc5
commit 7fadb9ce20

View file

@ -100,6 +100,10 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
* @return the property for the given name * @return the property for the given name
*/ */
public synchronized Object get(String name, Scriptable start) { public synchronized Object get(String name, Scriptable start) {
// register property for PropertyRecorder interface
if (isRecording) {
changedProperties.add(name);
}
return super.get(name, start); return super.get(name, start);
} }
@ -670,7 +674,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
/** /**
* Tell this PropertyRecorder to start recording changes to properties * Tell this PropertyRecorder to start recording changes to properties
*/ */
public void startRecording() { public synchronized void startRecording() {
changedProperties = new HashSet(); changedProperties = new HashSet();
isRecording = true; isRecording = true;
} }
@ -678,7 +682,7 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
/** /**
* Tell this PropertyRecorder to stop recording changes to properties * Tell this PropertyRecorder to stop recording changes to properties
*/ */
public void stopRecording() { public synchronized void stopRecording() {
isRecording = false; isRecording = false;
} }
@ -688,14 +692,14 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder {
* *
* @return a Set containing the names of changed properties * @return a Set containing the names of changed properties
*/ */
public Set getChangeSet() { public synchronized Set getChangeSet() {
return changedProperties; return changedProperties;
} }
/** /**
* Clear the set of changed properties. * Clear the set of changed properties.
*/ */
public void clearChangeSet() { public synchronized void clearChangeSet() {
changedProperties = null; changedProperties = null;
} }
} }