Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ghettojedi.opp.aspect.concurrent
Class TransactionalMap  view TransactionalMap download TransactionalMap.java

java.lang.Object
  extended bycom.ghettojedi.opp.aspect.concurrent.TransactionalMap
All Implemented Interfaces:
java.io.Externalizable, java.util.Map, java.io.Serializable, com.ghettojedi.opp.transaction.Transactional

public class TransactionalMap
extends java.lang.Object
implements java.util.Map, java.io.Externalizable, com.ghettojedi.opp.transaction.Transactional


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
private  java.util.Map map
           
private  java.util.Map removed
           
(package private) static long serialVersionUID
           
private  int size
           
private  com.ghettojedi.opp.transaction.TransactionManager tm
           
private  java.util.Map writes
           
 
Constructor Summary
TransactionalMap()
           
TransactionalMap(java.util.Map map)
           
 
Method Summary
 void clear()
          Remove all entries from this Map (optional operation).
 void commit()
           
 boolean containsKey(java.lang.Object key)
          Returns true if this contains a mapping for the given key.
 boolean containsValue(java.lang.Object value)
          Returns true if this contains at least one mapping with the given value.
private  com.ghettojedi.opp.transaction.Transaction currentTransaction()
           
 java.util.Set entrySet()
          Returns a set view of the mappings in this Map.
 java.lang.Object get(java.lang.Object key)
          Returns the value mapped by the given key.
 java.util.Map getMap()
           
private  void init(java.util.Map map)
           
private  boolean isDirty()
           
 boolean isEmpty()
          Returns true if the map contains no mappings.
 java.util.Set keySet()
          Returns a set view of the keys in this Map.
 java.lang.Object put(java.lang.Object key, java.lang.Object newRecord)
          Associates the given key to the given value (optional operation).
 void putAll(java.util.Map t)
          Copies all entries of the given map to this one (optional operation).
private  void readCall()
           
 void readExternal(java.io.ObjectInput in)
          This method restores an object's state by reading in the instance data for the object from the passed in stream.
 java.lang.Object remove(java.lang.Object key)
          Removes the mapping for this key if present (optional operation).
 void rollback()
           
 int size()
          Returns the number of key-value mappings in the map.
private  java.util.Map snapshot()
           
 java.util.Collection values()
          Returns a collection (or bag) view of the values in this Map.
private  void writeCall()
           
 void writeExternal(java.io.ObjectOutput out)
          This method is responsible for writing the instance data of an object to the passed in stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

tm

private com.ghettojedi.opp.transaction.TransactionManager tm

map

private java.util.Map map

writes

private java.util.Map writes

removed

private java.util.Map removed

size

private int size
Constructor Detail

TransactionalMap

public TransactionalMap()

TransactionalMap

public TransactionalMap(java.util.Map map)
Method Detail

clear

public void clear()
Description copied from interface: java.util.Map
Remove all entries from this Map (optional operation).

Specified by:
clear in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object newRecord)
Description copied from interface: java.util.Map
Associates the given key to the given value (optional operation). If the map already contains the key, its value is replaced. Be aware that in a map that permits null values, a null return does not always imply that the mapping was created.

Specified by:
put in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Description copied from interface: java.util.Map
Removes the mapping for this key if present (optional operation). If the key is not present, this returns null. Note that maps which permit null values may also return null if the key was removed.

Specified by:
remove in interface java.util.Map

size

public int size()
Description copied from interface: java.util.Map
Returns the number of key-value mappings in the map. If there are more than Integer.MAX_VALUE mappings, return Integer.MAX_VALUE.

Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Description copied from interface: java.util.Map
Returns true if the map contains no mappings.

Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Description copied from interface: java.util.Map
Returns true if this contains a mapping for the given key.

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Description copied from interface: java.util.Map
Returns true if this contains at least one mapping with the given value. In other words, returns true if a value v exists where (value == null ? v == null : value.equals(v)). This usually requires linear time.

Specified by:
containsValue in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)
Description copied from interface: java.util.Map
Returns the value mapped by the given key. Returns null if there is no mapping. However, in Maps that accept null values, you must rely on containsKey to determine if a mapping exists.

Specified by:
get in interface java.util.Map

putAll

public void putAll(java.util.Map t)
Description copied from interface: java.util.Map
Copies all entries of the given map to this one (optional operation). If the map already contains a key, its value is replaced.

Specified by:
putAll in interface java.util.Map

keySet

public java.util.Set keySet()
Description copied from interface: java.util.Map
Returns a set view of the keys in this Map. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this set.

Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
Description copied from interface: java.util.Map
Returns a collection (or bag) view of the values in this Map. The collection is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the collection supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Collection.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this collection.

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
Description copied from interface: java.util.Map
Returns a set view of the mappings in this Map. Each element in the set is a Map.Entry. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods remove the underlying mapping from the map: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition, via add or addAll, is not supported via this set.

Specified by:
entrySet in interface java.util.Map

commit

public void commit()
Specified by:
commit in interface com.ghettojedi.opp.transaction.Transactional

rollback

public void rollback()
Specified by:
rollback in interface com.ghettojedi.opp.transaction.Transactional

getMap

public java.util.Map getMap()

init

private void init(java.util.Map map)

readCall

private void readCall()

writeCall

private void writeCall()

currentTransaction

private com.ghettojedi.opp.transaction.Transaction currentTransaction()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Description copied from interface: java.io.Externalizable
This method is responsible for writing the instance data of an object to the passed in stream. Note that this stream is not a subclass of OutputStream, but rather is a class that implements the ObjectOutput interface. That interface provides a number of methods for writing Java data values to a stream.

Not that the implementation of this method must be coordinated with the implementation of readExternal.

Specified by:
writeExternal in interface java.io.Externalizable

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Description copied from interface: java.io.Externalizable
This method restores an object's state by reading in the instance data for the object from the passed in stream. Note that this stream is not a subclass of InputStream, but rather is a class that implements the ObjectInput interface. That interface provides a mechanism for reading in Java data types from a stream.

Note that this method must be compatible with writeExternal. It must read back the exact same types that were written by that method in the exact order they were written.

If this method needs to read back an object instance, then the class for that object must be found and loaded. If that operation fails, then this method throws a ClassNotFoundException

Specified by:
readExternal in interface java.io.Externalizable

isDirty

private boolean isDirty()

snapshot

private java.util.Map snapshot()