org.apache.openjpa.util
Class ProxyProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by org.apache.openjpa.util.ProxyProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>, Proxy, ProxyMap

public class ProxyProperties
extends java.util.Properties
implements ProxyMap

Extension of the Properties type that dirties the persistent/transactional field it is assigned to on modification. The need to dirty the field on any modification mandates that this class must override all mutator methods of the base type. This may lead to multiple calls to dirty for one state change if one mutator method of the base type calls another.

Author:
Abe White
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ProxyProperties()
           
ProxyProperties(boolean trackChanges, OpenJPAConfiguration conf)
           
 
Method Summary
 void clear()
           
 java.lang.Object copy(java.lang.Object orig)
          Return an unproxied copy of the given instance.
 java.util.Set entrySet()
           
 ChangeTracker getChangeTracker()
          Return the change tracker for this proxy, or null if none.
 OpenJPAStateManager getOwner()
          Return the owning object.
 int getOwnerField()
          Return the owning field index.
 java.util.Set keySet()
           
 void load(java.io.InputStream in)
           
 ProxyMap newInstance(java.lang.Class keyType, java.lang.Class valueType, java.util.Comparator compare, boolean trackChanges, OpenJPAConfiguration conf)
          This method should return a new proxy of the same concrete type as the implementing class.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map m)
           
 java.lang.Object remove(java.lang.Object key)
           
 void setOwner(OpenJPAStateManager sm, int field)
          Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to.
 java.lang.Object setProperty(java.lang.String key, java.lang.String value)
           
 java.util.Collection values()
           
protected  java.lang.Object writeReplace()
           
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, loadFromXML, propertyNames, save, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, equals, get, hashCode, isEmpty, keys, rehash, size, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProxyProperties

public ProxyProperties()

ProxyProperties

public ProxyProperties(boolean trackChanges,
                       OpenJPAConfiguration conf)
Method Detail

setOwner

public void setOwner(OpenJPAStateManager sm,
                     int field)
Description copied from interface: Proxy
Reset the state of the proxy, and set the owning instance of the proxy and the name of the field it is assigned to. Set to null to indicate that the proxy is no longer managed.

Specified by:
setOwner in interface Proxy

getOwner

public OpenJPAStateManager getOwner()
Description copied from interface: Proxy
Return the owning object.

Specified by:
getOwner in interface Proxy

getOwnerField

public int getOwnerField()
Description copied from interface: Proxy
Return the owning field index.

Specified by:
getOwnerField in interface Proxy

getChangeTracker

public ChangeTracker getChangeTracker()
Description copied from interface: Proxy
Return the change tracker for this proxy, or null if none.

Specified by:
getChangeTracker in interface Proxy

copy

public java.lang.Object copy(java.lang.Object orig)
Description copied from interface: Proxy
Return an unproxied copy of the given instance. This method is used by proxy managers to create backup values for use in rollback.

Specified by:
copy in interface Proxy

newInstance

public ProxyMap newInstance(java.lang.Class keyType,
                            java.lang.Class valueType,
                            java.util.Comparator compare,
                            boolean trackChanges,
                            OpenJPAConfiguration conf)
Description copied from interface: ProxyMap
This method should return a new proxy of the same concrete type as the implementing class. Used by the ProxyManager factories: one template instance of each type is created for the purpose of producing new instances via this method. Overcomes the performance penalties of reflection.

Specified by:
newInstance in interface ProxyMap

clear

public void clear()
Specified by:
clear in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
clear in class java.util.Hashtable<java.lang.Object,java.lang.Object>

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
keySet in class java.util.Hashtable<java.lang.Object,java.lang.Object>

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
values in class java.util.Hashtable<java.lang.Object,java.lang.Object>

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
entrySet in class java.util.Hashtable<java.lang.Object,java.lang.Object>

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
put in class java.util.Hashtable<java.lang.Object,java.lang.Object>

putAll

public void putAll(java.util.Map m)
Specified by:
putAll in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
putAll in class java.util.Hashtable<java.lang.Object,java.lang.Object>

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<java.lang.Object,java.lang.Object>
Overrides:
remove in class java.util.Hashtable<java.lang.Object,java.lang.Object>

setProperty

public java.lang.Object setProperty(java.lang.String key,
                                    java.lang.String value)
Overrides:
setProperty in class java.util.Properties

load

public void load(java.io.InputStream in)
          throws java.io.IOException
Overrides:
load in class java.util.Properties
Throws:
java.io.IOException

writeReplace

protected java.lang.Object writeReplace()
                                 throws java.io.ObjectStreamException
Throws:
java.io.ObjectStreamException


Copyright © 2006 Apache Software Foundation. All Rights Reserved.