db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r159273 [3/5] - in incubator/jdo/trunk/api20: ./ src/java/ src/java/javax/ src/java/javax/jdo/ src/java/javax/jdo/datastore/ src/java/javax/jdo/identity/ src/java/javax/jdo/listener/ src/java/javax/jdo/spi/ test/ test/java/ test/java/javax/ test/java/javax/jdo/ test/java/javax/jdo/identity/ test/java/javax/jdo/listener/
Date Mon, 28 Mar 2005 18:25:16 GMT
Added: incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/DataStoreCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/DataStoreCache.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/DataStoreCache.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/DataStoreCache.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DataStoreCache.java
+ *
+ */
+ 
+package javax.jdo.datastore;
+
+import java.util.Collection;
+
+
+/** 
+ * Many JDO implementations allow instances to be cached in a
+ * second-level cache, and allow direct management of the cache by
+ * knowledgeable applications. This interface standardizes this
+ * behavior.
+ * @since 2.0
+ * @version 2.0
+ */
+public interface DataStoreCache {
+
+    /** Evict the parameter instance from the second-level cache.
+     * @param oid the object id of the instance to evict.
+     * @since 2.0
+     */
+    void evict (Object oid);
+
+    /** Evict the parameter instances from the second-level cache.
+     * All instances in the PersistenceManager's cache are evicted 
+     * from the second-level cache.
+     * @since 2.0
+     */
+    void evictAll ();
+
+    /** Evict the parameter instances from the second-level cache.
+     * @param oids the object ids of the instance to evict.
+     * @since 2.0
+     */
+    void evictAll (Object[] oids);
+
+    /** Evict the parameter instances from the second-level cache.
+     * @param oids the object ids of the instance to evict.
+     * @since 2.0
+     */
+    void evictAll (Collection oids);
+
+    /** Evict the parameter instances from the second-level cache.
+     * @param pcClass the class of instances to evict
+     * @param subclasses if true, evict instances of subclasses also
+     * @since 2.0
+     */
+    void evictAll (Class pcClass, boolean subclasses);
+
+    /** Pin the parameter instance in the second-level cache.
+     * @param oid the object id of the instance to pin.
+     * @since 2.0
+     */
+    void pin (Object oid);
+
+    /** Pin the parameter instances in the second-level cache.
+     * @param oids the object ids of the instances to pin.
+     * @since 2.0
+     */
+    void pinAll (Collection oids);
+
+    /** Pin the parameter instances in the second-level cache.
+     * @param oids the object ids of the instances to pin.
+     * @since 2.0
+     */
+    void pinAll (Object[] oids);
+
+    /** Pin instances in the second-level cache.
+     * @param pcClass the class of instances to pin
+     * @param subclasses if true, pin instances of subclasses also
+     * @since 2.0
+     */
+    void pinAll (Class pcClass, boolean subclasses);
+
+    /** Unpin the parameter instance from the second-level cache.
+     * @param oid the object id of the instance to unpin.
+     * @since 2.0
+     */
+    void unpin(Object oid);
+
+    /** Unpin the parameter instances from the second-level cache.
+     * @param oids the object ids of the instance to evict.
+     * @since 2.0
+     */
+    void unpinAll(Collection oids);
+
+    /** Unpin the parameter instance from the second-level cache.
+     * @param oids the object id of the instance to evict.
+     * @since 2.0
+     */
+    void unpinAll(Object[] oids);
+
+    /** Unpin instances from the second-level cache.
+     * @param pcClass the class of instances to unpin
+     * @param subclasses if true, unpin instances of subclasses also
+     * @since 2.0
+     */
+    void unpinAll(Class pcClass, boolean subclasses);
+    
+    /** 
+     * This class is an empty implementation of the DataStoreCache 
+     * interface. It can be used by an implementation that does not
+     * support a second-level cache.
+     * @since 2.0
+     */
+    public class EmptyDataStoreCache implements DataStoreCache {
+        
+        public EmptyDataStoreCache() {
+        }
+        
+        public void evict(Object oid) {
+        }
+
+        public void evictAll() {
+        }
+
+        public void evictAll(Object[] oids) {
+        }
+
+        public void evictAll(Collection oids) {
+        }
+
+        public void evictAll(Class pcClass, boolean subclasses) {
+        }
+
+        public void pin(Object oid) {
+        }
+
+        public void pinAll(Object[] oids) {
+        }
+
+        public void pinAll(Collection oids) {
+        }
+
+        public void pinAll(Class pcClass, boolean subclasses) {
+        }
+
+        public void unpin(Object oid) {
+        }
+
+        public void unpinAll(Object[] oids) {
+        }
+
+        public void unpinAll(Collection oids) {
+        }
+
+        public void unpinAll(Class pcClass, boolean subclasses) {
+        }
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/JDOConnection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/JDOConnection.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/JDOConnection.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/JDOConnection.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * JDOConnection.java
+ *
+ */
+ 
+package javax.jdo.datastore;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * The underlying connection that is being used by a 
+ * {@link PersistenceManager}. 
+ * @version 2.0
+ * @since 2.0
+ */
+public interface JDOConnection {
+
+    /**
+     * Returns the native, datastore-specific connection that this
+     * connection wraps. In general, it is not recommended that this
+     * native connection be used directly, since the JDO
+     * implementation has no way to intercept calls to it, so it is
+     * quite possible to put the <code>PersistenceManager</code>'s
+     * connection into an invalid state.
+     * @return the native connection
+     * @since 2.0
+     */
+    Object getNativeConnection ();
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/Sequence.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/Sequence.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/Sequence.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/Sequence.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * Sequence.java
+ *
+ */
+ 
+package javax.jdo.datastore;
+
+
+/**
+ *	Implementations of this interface can be used to obtain
+ *	sequences. The behavior with regard to the transaction and
+ *	rollover behavior are defined in the metadata.
+ *
+ *	@version 2.0
+ *	@since 2.0
+ */
+public interface Sequence {
+
+    /**
+     * Returns the fully qualified name of the <code>Sequence</code>.
+     */
+    String getName ();
+
+    /**
+     * Returns the next sequence value object.
+     */
+    Object next ();
+
+    /**
+     * Provides a hint to the implementation that the application
+     * will need <code>additional</code> sequence value objects in
+     * short order. There is no externally visible behavior of this
+     * method. It is used to potentially improve the efficiency of
+     * the algorithm of obtaining additional sequence value objects.
+     */
+    void allocate ();
+
+    /**
+     * Returns the current sequence value object if it is
+     * available. It is intended to return a sequence value object
+     * previously used. The implementation might choose to return
+     * <code>null</code> for all cases or for any cases where a
+     * sequence value object is not available.
+     */
+    Object current ();
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/package.html?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/package.html (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/datastore/package.html Mon Mar 28 10:25:05 2005
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>Datastore package</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+This package contains the JDO specification datastore interfaces.
+</body>
+</html>

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ByteIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ByteIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ByteIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ByteIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * ByteIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is for identity with a single byte field.
+ * @version 2.0
+ */
+public class ByteIdentity extends SingleFieldIdentity {
+    
+    /** The key.
+     */
+    private byte key;
+    
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public ByteIdentity(Class pcClass, byte key) {
+        super (pcClass);
+        this.key = key;
+        hashCode = super.hashClassName() ^ key;
+    }
+    
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public ByteIdentity(Class pcClass, Byte key) {
+        this (pcClass, key.byteValue());
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public ByteIdentity(Class pcClass, int key) {
+        this (pcClass, (byte)key);
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param str the key
+     */
+    public ByteIdentity(Class pcClass, String str) {
+        this (pcClass, Byte.parseByte(str));
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public ByteIdentity() {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public byte getKey() {
+        return key;
+    }
+
+    /** Return the String version of the key.
+     * @return the key.
+     */
+    public String toString() {
+        return getTargetClassName() + " " + Byte.toString(key);
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            ByteIdentity other = (ByteIdentity)obj;
+            return key == other.key;
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeByte (key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = in.readByte ();
+        hashCode = super.hashCode() ^ key;
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/CharIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/CharIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/CharIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/CharIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * CharIdentity.java
+ *
+ */
+
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import javax.jdo.spi.I18NHelper;
+
+/** This class is for identity with a single character field.
+ * @version 2.0
+ */
+public class CharIdentity extends SingleFieldIdentity {
+
+    /** The Internationalization message helper.
+     */
+    private static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
+
+    /** The key.
+     */
+    private char key;
+
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public CharIdentity (Class pcClass, char key) {
+        super (pcClass);
+        this.key = key;
+        computeHashCode();
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public CharIdentity (Class pcClass, Character key) {
+        this (pcClass, key.charValue ());
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the target class
+     * @param key the key
+     */
+    public CharIdentity (Class pcClass, int key) {
+        this (pcClass, (char)key);
+    }
+
+    /** Constructor with class and key. The String must have exactly one
+     * character.
+     * @param pcClass the target class
+     * @param str the key
+     */
+    public CharIdentity (Class pcClass, String str) {
+        super(pcClass);
+        if (str.length() != 1) 
+            throw new IllegalArgumentException(msg.msg("EXC_StringWrongLength"));
+        this.key = str.charAt(0);
+        computeHashCode();
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public CharIdentity () {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public char getKey () {
+        return key;
+    }
+
+    /** Return the String form of the key.
+     * @return the String form of the key
+     */
+    public String toString () {
+        return getTargetClassName() + " " + key;
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals (Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            CharIdentity other = (CharIdentity) obj;
+            return key == other.key;
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeChar(key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = in.readChar();
+    }
+    
+    private void computeHashCode() {
+        hashCode = hashClassName() ^ key;
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/IntIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/IntIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/IntIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/IntIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * IntIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is for identity with a single int field.
+ * @version 2.0
+ */
+public class IntIdentity extends SingleFieldIdentity {
+    private int key;
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public IntIdentity (Class pcClass, int key) {
+        super (pcClass);
+        this.key = key;
+        hashCode = hashClassName() ^ key;
+	}
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public IntIdentity (Class pcClass, Integer key) {
+        this (pcClass, key.intValue ());
+    }
+
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param str the key
+     */
+    public IntIdentity (Class pcClass, String str) {
+        this (pcClass, Integer.parseInt (str));
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public IntIdentity () {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public int getKey () {
+        return key;
+    }
+
+    /** Return the String form of the key.
+     * @return the String form of the key
+     */
+    public String toString () {
+        return getTargetClassName() + " " + key;
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals (Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            IntIdentity other = (IntIdentity) obj;
+            return key == other.key;
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeInt(key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = in.readInt();
+        hashCode = hashClassName() ^ key;
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/LongIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/LongIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/LongIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/LongIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * LongIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is for identity with a single long field.
+ * @version 2.0
+ */
+public class LongIdentity extends SingleFieldIdentity {
+	
+    /** The key.
+     */
+    private long key;
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public LongIdentity (Class pcClass, long key) {
+        super (pcClass);
+        this.key = key;
+        hashCode = hashClassName() ^ (int)key;
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public LongIdentity (Class pcClass, Long key) {
+        this (pcClass, key.longValue ());
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param str the key
+     */
+    public LongIdentity (Class pcClass, String str) {
+        this (pcClass, Long.parseLong (str));
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public LongIdentity () {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public long getKey () {
+        return key;
+    }
+
+    /** Return the String form of the key.
+     * @return the String form of the key
+     */
+    public String toString () {
+        return getTargetClassName() + " " + key;
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals (Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            LongIdentity other = (LongIdentity) obj;
+            return key == other.key;
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeLong(key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = in.readLong();
+        hashCode = hashClassName() ^ (int)key;
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ShortIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ShortIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ShortIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/ShortIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * ShortIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is for identity with a single short field.
+ * @version 2.0
+ */
+public class ShortIdentity
+	extends SingleFieldIdentity
+{
+	private short key;
+
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public ShortIdentity (Class pcClass, short key) {
+        super (pcClass);
+        this.key = key;
+        hashCode = hashClassName() ^ key;
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public ShortIdentity (Class pcClass, Short key) {
+        this (pcClass, key.shortValue ());
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public ShortIdentity (Class pcClass, int key) {
+        this (pcClass, (short)key);
+    }
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param str the key
+     */
+    public ShortIdentity (Class pcClass, String str) {
+        this (pcClass, Short.parseShort (str));
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public ShortIdentity () {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public short getKey () {
+        return key;
+    }
+
+    /** Return the String form of the key.
+     * @return the String form of the key
+     */
+    public String toString () {
+        return getTargetClassName() + " " + key;
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals (Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            ShortIdentity other = (ShortIdentity) obj;
+            return key == other.key;
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeShort(key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = in.readShort();
+        hashCode = hashClassName() ^ key;
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/SingleFieldIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * SingleFieldIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is the abstract base class for all single field identity
+ * classes. A common case of application identity uses exactly one 
+ * persistent field in the class to represent identity. In this case, 
+ * the application can use a standard JDO class instead of creating 
+ * a new user-defined class for the purpose.
+ * @version 2.0
+ */
+public abstract class SingleFieldIdentity
+    implements Externalizable {
+    
+    /** The class of the target object.
+     */
+    transient private Class targetClass;
+    
+    /** The name of the class of the target object.
+     */
+    private String targetClassName;
+
+    /** The hashCode.
+     */
+    protected int hashCode;
+
+    /** Constructor with target class.
+     * @param pcClass the class of the target
+     * @since 2.0
+     */
+    protected SingleFieldIdentity(Class pcClass) {
+        if (pcClass == null)
+            throw new NullPointerException();
+        targetClass = pcClass;
+        targetClassName = pcClass.getName();
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public SingleFieldIdentity () {
+    }
+
+    /** Return the target class.
+     * @return the target class.
+     * @since 2.0
+     */
+    public Class getTargetClass() {
+        return targetClass;
+    }
+
+    /** Return the target class name.
+     * @return the target class name.
+     * @since 2.0
+     */
+    public String getTargetClassName() {
+        return targetClassName;
+    }
+
+    /** Check the class and class name and object type. If restored
+     * from serialization, class will be null so compare class name.
+     * @param obj the other object
+     * @return true if the class or class name is the same
+     * @since 2.0
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (obj == null || this.getClass() != obj.getClass()) {
+            return false;
+        } else {
+            SingleFieldIdentity other = (SingleFieldIdentity) obj;
+            if (targetClass != null && targetClass == other.targetClass)
+                return true;
+            return targetClassName.equals (other.targetClassName);
+        }
+    }
+
+    /** Return the hash code of the class name.
+     * @return the hash code of the class name
+     */
+    protected int hashClassName() {
+        return targetClassName.hashCode();
+    }
+    
+    /** Return the cached hash code.
+     * @return the cached hash code.
+     */
+    public int hashCode() {
+        return hashCode;
+    }
+
+    /** Write to the output stream.
+     * @param out the stream
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(targetClassName);
+        out.writeInt(hashCode);
+    }
+
+    /** Read from the input stream.
+     * @return a new instance with the target class name set
+     * @since 2.0
+     */
+    public void readExternal(ObjectInput in)
+            throws IOException, ClassNotFoundException {
+        targetClass = null;
+        targetClassName = (String)in.readObject();
+        hashCode = in.readInt();
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/StringIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/StringIdentity.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/StringIdentity.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/StringIdentity.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * StringIdentity.java
+ *
+ */
+ 
+package javax.jdo.identity;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/** This class is for identity with a single String field.
+ * @version 2.0
+ */
+public class StringIdentity extends SingleFieldIdentity {
+    
+    /** The key.
+     */
+    private String key;
+
+
+    /** Constructor with class and key.
+     * @param pcClass the class
+     * @param key the key
+     */
+    public StringIdentity (Class pcClass, String key) {
+        super (pcClass);
+        if (key == null)
+            throw new NullPointerException ();
+        this.key = key;
+        hashCode = hashClassName() ^ key.hashCode();
+    }
+
+    /** Constructor only for Externalizable.
+     */
+    public StringIdentity () {
+    }
+
+    /** Return the key.
+     * @return the key
+     */
+    public String getKey () {
+        return key;
+    }
+
+    /** Return the String form of the key.
+     * @return the String form of the key
+     */
+    public String toString () {
+        return getTargetClassName() + " " + key;
+    }
+
+    /** Determine if the other object represents the same object id.
+     * @param obj the other object
+     * @return true if both objects represent the same object id
+     */
+    public boolean equals (Object obj) {
+        if (this == obj) {
+            return true;
+        } else if (!super.equals (obj)) {
+            return false;
+        } else {
+            StringIdentity other = (StringIdentity) obj;
+            return key.equals(other.key);
+        }
+    }
+
+    /** Write this object. Write the superclass first.
+     * @param out the output
+     */
+    public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal (out);
+        out.writeObject(key);
+    }
+
+    /** Read this object. Read the superclass first.
+     * @param in the input
+     */
+    public void readExternal(ObjectInput in)
+		throws IOException, ClassNotFoundException {
+        super.readExternal (in);
+        key = (String)in.readObject();
+        hashCode = hashClassName() ^ key.hashCode();
+    }
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/identity/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/identity/package.html?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/identity/package.html (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/identity/package.html Mon Mar 28 10:25:05 2005
@@ -0,0 +1,26 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>Listener package</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+This package contains the JDO specification identity interfaces and classes.
+</body>
+</html>

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * AttachCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is used to notify instances of attach events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface AttachCallback {
+    
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#attachCopy} before the copy is made.
+     * @since 2.0
+     */
+    public void jdoPreAttach();
+
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#attachCopy} on the persistent
+     * instance after the copy is made.
+     * @param attached	The corresponding (non-attached) instance that was
+     * attached in the call to {@link PersistenceManager#attachCopy}.
+     * @since 2.0
+     */
+    public void jdoPostAttach(Object attached);
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/AttachLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * AttachLifecycleListener.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * attach events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface AttachLifecycleListener
+    extends InstanceLifecycleListener {
+    
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#attachCopy} before the copy is made.
+     * It is called before the method {@link AttachCallback#jdoPreAttach}
+     * is invoked on the instance to be attached.
+     * @param event the attach event.
+     * @since 2.0
+	 */
+    void preAttach (InstanceLifecycleEvent event);
+    
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#attachCopy} on the persistent
+     * instance after the copy is made.
+     * @param event the attach event.
+     * @since 2.0
+     */
+    void postAttach (InstanceLifecycleEvent event);
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * ClearCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is used to notify instances of clear events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface ClearCallback {
+    
+    /**
+     * Called before the values in the instance are cleared.
+     *
+     * <P>Transient fields should be cleared in this method.  
+     * Associations between this
+     * instance and others in the runtime environment should be cleared.
+     *
+     * <P>This method is not modified by the enhancer.
+     */
+    void jdoPreClear();
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/ClearLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * ClearLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * clear events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface ClearLifecycleListener
+    extends InstanceLifecycleListener {
+
+    /**
+     * This method is called before the implementation calls the instance
+     *  method {@link ClearCallback#jdoPreClear} and before it clears the values 
+     *  in the instance to their Java default values. This happens during 
+     *  an application call to evict, and in afterCompletion for commit 
+     *  with RetainValues false and rollback with RestoreValues false. 
+     *  <P>The method is called during any state transition to hollow.
+     *  Non-persistent, non-transactional fields should be cleared 
+     *  in this method. Associations between this instance and others 
+     *  in the runtime environment should be cleared. 
+     *  <P>This method is not modified by the enhancer, so access to fields 
+     *  is not mediated.
+     * @param event the clear event.
+     * @since 2.0
+     */
+    void preClear (InstanceLifecycleEvent event);
+    
+    /**
+     * This method is called after the {@link ClearCallback#jdoPreClear} 
+     * method is invoked on the instance and the fields have been cleared 
+     * by the JDO implementation.
+     * @param event the clear event.
+     * @since 2.0
+     */
+    void postClear (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/CreateLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/CreateLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/CreateLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/CreateLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * CreateLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * create events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface CreateLifecycleListener
+    extends InstanceLifecycleListener {
+
+    /**
+     * Invoked whenever an instance is made persistent via a
+     * call to {@link PersistenceManager#makePersistent} or during
+     * persistence by reachability.
+     * @param event the create event.
+     * @since 2.0
+     */
+    void postCreate (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DeleteCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/** 
+ * This interface is used to notify instances of delete events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface DeleteCallback
+{
+    /**
+     * Called before the instance is deleted.
+     * This method is called before the state transition to persistent-deleted 
+     * or persistent-new-deleted. Access to field values within this call 
+     * are valid. Access to field values after this call are disallowed. 
+     * <P>This method is modified by the enhancer so that fields referenced 
+     * can be used in the business logic of the method.
+     */
+    void jdoPreDelete();
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DeleteLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DeleteLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * delete events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface DeleteLifecycleListener
+    extends InstanceLifecycleListener {
+
+    /**
+     * Invoked whenever a persistent instance is deleted, for example
+     * during {@link PersistenceManager#deletePersistent}. Access to field
+     * values within this call are permitted.  
+     * <P>This method is called before the instance callback
+     * {@link DeleteCallback#jdoPreDelete}.
+     * @param event the delete event.
+     * @since 2.0
+     */
+    void preDelete (InstanceLifecycleEvent event);
+
+    /**
+     * Invoked whenever a persistent instance is deleted, for example
+     * during {@link PersistenceManager#deletePersistent}.
+     * <P>This method is called after the instance transitions
+     * to persistent-deleted. Access to field values is not permitted.
+     * @param event the delete event.
+     * @since 2.0
+     */
+    void postDelete (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DetachCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is used to notify instances of detach events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface DetachCallback {
+    
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#detachCopy} on the
+     * persistent instance before the copy is made.
+     * @since 2.0
+     */
+    public void jdoPreDetach();
+
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#detachCopy} on the
+     * detached instance after the copy is made.
+     * @param detached The corresponding (attached) persistent instance.
+     * @since 2.0
+     */
+    public void jdoPostDetach(Object detached);
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DetachLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DetachLifecycleListener.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * detach events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface DetachLifecycleListener
+    extends InstanceLifecycleListener {
+    
+    /** 
+     * This method is called during the execution of 
+     * {@link PersistenceManager#detachCopy} before the 
+     * detached copy is made. It is called before the method
+     * {@link DetachCallback#jdoPreDetach} is called on the
+     * instance to be detached.
+     * @param event the detach event.
+     * @since 2.0
+     */
+    void preDetach (InstanceLifecycleEvent event);
+    
+    /**
+     * This method is called during the execution of
+     * {@link PersistenceManager#detachCopy} after the 
+     * detached copy is made. It is called after the method
+     * {@link DetachCallback#jdoPreDetach} is called on
+     * the detached instance.
+     * @param event the detach event.
+     * @since 2.0
+     */
+    void postDetach (InstanceLifecycleEvent event); 
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DirtyLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DirtyLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DirtyLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/DirtyLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * DirtyLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * dirty events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface DirtyLifecycleListener
+    extends InstanceLifecycleListener {
+
+    /**
+     *	Invoked whenever a persistent instance is first made dirty,
+     *	during an operation that modifies the value of a persistent or
+     *	transactional field. Called before the value is changed.
+     * @since 2.0
+     */
+    void preDirty (InstanceLifecycleEvent event);
+
+    /**
+     *	Invoked whenever a persistent instance is first made dirty,
+     *	during an operation that modifies the value of a persistent or
+     *	transactional field. Called after the value is changed.
+     * @since 2.0
+     */
+    void postDirty (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleEvent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleEvent.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleEvent.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleEvent.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * InstanceLifecycleEvent.java
+ *
+ */
+
+package javax.jdo.listener;
+
+/**
+ * This is the event class used in life cycle event notifications.
+ * <P>Note that although InstanceLifecycleEvent inherits Serializable interface 
+ * from EventObject, it is not intended to be Serializable. Appropriate 
+ * serialization methods are implemented to throw NotSerializableException.
+ * @version 2.0
+ * @since 2.0
+ */
+public class InstanceLifecycleEvent
+    extends java.util.EventObject {
+
+    public static final int CREATE = 0;
+    public static final int LOAD = 1;
+    public static final int STORE = 2;
+    public static final int CLEAR = 3;
+    public static final int DELETE = 4;
+    public static final int DIRTY = 5;
+    public static final int DETACH = 6;
+    public static final int ATTACH = 7;
+
+    /**
+     * The event type that triggered the construction of this event object.
+     */
+    private final int eventType;
+    
+    /** 
+     * The "other" object associated with the event.
+     */
+    private final Object target;
+
+    /**
+     *	Creates a new event object with the specified
+     *	<code>source</code> and <code>type</code>.
+     * @param source the instance that triggered the event
+     * @param type the event type
+     * @since 2.0
+     */
+    public InstanceLifecycleEvent (Object source, int type) {
+        super (source);
+        eventType = type;
+        target = null;
+    }
+
+    /**
+     *	Creates a new event object with the specified
+     *	<code>source</code>, <code>type</code>, and <code>target</code>.
+     * @param source the instance that triggered the event
+     * @param type the event type
+     * @param target the "other" instance
+     * @since 2.0
+     */
+    public InstanceLifecycleEvent (Object source, int type, Object target) {
+        super (source);
+        eventType = type;
+        this.target = target;
+    }
+
+    /**
+     *	Returns the event type that triggered this event.
+     * @return the event type
+     * @since 2.0
+     */
+    public int getEventType () {
+        return eventType;
+    }
+
+    /**
+     *	Returns the "other" object.
+     * @return the "other" object
+     * @since 2.0
+     */
+    public Object getTarget () {
+        return target;
+    }
+    
+    /**
+     * Serialization is not supported for InstanceLifecycleEvents.
+     * param out the output stream
+     * @since 2.0
+     */
+    private void writeObject(java.io.ObjectOutputStream out) 
+        throws java.io.IOException {
+        throw new java.io.NotSerializableException();
+    }
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/InstanceLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * InstanceLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+/**
+ * All lifecycle listeners extend from this base interface.
+ * In order to minimize the impact on domain classes, instance callbacks 
+ * can be defined to use a life-cycle listener pattern instead of 
+ * having the domain class implement the callback interface(s).
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface InstanceLifecycleListener {
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * LoadCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+/**
+ * This interface is used to notify instances of load events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface LoadCallback {
+    
+    /**
+     * Called after the values are loaded from the data store into
+     * this instance.
+     *
+     * <P>This method is not modified by the enhancer.
+     * <P>Derived fields should be initialized in this method.
+     * The context in which this call is made does not allow access to 
+     * other persistent JDO instances.
+     */
+    void jdoPostLoad();
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/LoadLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * LoadLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * load events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface LoadLifecycleListener
+    extends InstanceLifecycleListener {
+
+    /**
+     * Invoked whenever a persistent instance is loaded from the data
+     * store. It is called after the method {@link LoadCallback#jdoPostLoad}
+     * is invoked on the persistent instance.
+     * @param event the load event.
+     * @since 2.0
+     */
+    void postLoad (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreCallback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreCallback.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreCallback.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreCallback.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * StoreCallback.java
+ *
+ */
+ 
+package javax.jdo.listener;
+
+/**
+ * This interface is used to notify instances of store events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface StoreCallback {
+    
+    /**
+     * Called before the values are stored from this instance to the
+     * data store.
+     *
+     * <P>Data store fields that might have been affected by modified
+     * non-persistent fields should be updated in this method.
+     *
+     * <P>This method is modified by the enhancer so that changes to 
+     * persistent fields will be reflected in the data store. 
+     * The context in which this call is made allows access to the 
+     * <code>PersistenceManager</code> and other persistent JDO instances.
+     */
+    void jdoPreStore();
+}

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreLifecycleListener.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreLifecycleListener.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreLifecycleListener.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/StoreLifecycleListener.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * StoreLifecycleListener.java
+ *
+ */
+
+package javax.jdo.listener;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+/**
+ * This interface is implemented by listeners to be notified of
+ * store events.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface StoreLifecycleListener
+	extends InstanceLifecycleListener {
+
+    /**
+     * Invoked whenever a persistent instance is stored, for example
+     * during {@link PersistenceManager#flush} or {@link
+     * Transaction#commit}. It is called before the
+     * method {@link StoreCallback#jdoPreStore} is invoked.
+     * @param event the store event.
+     * @since 2.0
+     */
+    void preStore (InstanceLifecycleEvent event);
+    
+    /**
+     * Invoked whenever a persistent instance is stored, for example
+     * during {@link PersistenceManager#flush} or {@link
+     * Transaction#commit}. It is called after the
+     * field values have been stored.
+     * @param event the store event.
+     * @since 2.0
+     */
+    void postStore (InstanceLifecycleEvent event);
+}
\ No newline at end of file

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/listener/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/listener/package.html?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/listener/package.html (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/listener/package.html Mon Mar 28 10:25:05 2005
@@ -0,0 +1,54 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>Listener package</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+This package contains the JDO specification listener interfaces and classes.
+<P>There are two kinds of interfaces defined to allow an application to 
+manage life cycle changes to persistent objects. 
+<P>The first kind is defined
+on the persistent domain class itself. This allows methods in the domain class
+to be called during life cycle events. The domain class implements one or more
+of the interfaces 
+{@link javax.jdo.listener.AttachCallback}, 
+{@link javax.jdo.listener.ClearCallback}, 
+{@link javax.jdo.listener.DeleteCallback}, 
+{@link javax.jdo.listener.DetachCallback},
+{@link javax.jdo.listener.LoadCallback}, or 
+{@link javax.jdo.listener.StoreCallback}. 
+The methods in the interfaces
+are called during life cycle events.
+<P>The second kind is defined on an external class using the listener pattern.
+Instances of classes that implement one or more of the listener interfaces 
+{@link javax.jdo.listener.AttachLifecycleListener}, 
+{@link javax.jdo.listener.ClearLifecycleListener}, 
+{@link javax.jdo.listener.CreateLifecycleListener}, 
+{@link javax.jdo.listener.DeleteLifecycleListener}, 
+{@link javax.jdo.listener.DetachLifecycleListener}, 
+{@link javax.jdo.listener.DirtyLifecycleListener}, 
+{@link javax.jdo.listener.LoadLifecycleListener}, or 
+{@link javax.jdo.listener.StoreLifecycleListener}
+are registered
+with the PersistenceManager or PersistenceManagerFactory
+and receive callbacks during life cycle events
+of the persistent instances of interest.
+</body>
+</html>

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/package.html?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/package.html (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/package.html Mon Mar 28 10:25:05 2005
@@ -0,0 +1,90 @@
+<!--
+ Copyright 2005 The Apache Software Foundation.
+ 
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at 
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License.
+-->
+
+<html>
+<head>
+<title>JDO package</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+This package contains the JDO specification interfaces and classes. 
+<P>There are two major objectives of the JDO architecture: 
+first, to provide application programmers a transparent,
+Java-centric view of persistent information, including enterprise data 
+and locally stored data; and second, to enable pluggable implementations 
+of data stores into 
+application servers.  Data stored in data stores is presented as
+instances of persistence-capable classes.
+<P>JDO defines interfaces and classes to be used by application programmers 
+when using classes whose instances are to be stored in persistent storage 
+(persistence-capable classes), and specifies the contracts between 
+suppliers of persistence-capable classes and the 
+runtime environment (which is part of the JDO implementation).
+<P>The JDO architecture defines a standard set of contracts between an 
+application programmer and an JDO vendor. These contracts focus on the 
+view of the Java instances of persistence capable classes.
+<P>The JDO PersistenceManagerFactory is the boostrap class for a JDO
+application.  The application gets an instance of the
+PersistenceManagerFactory by construction or via JDNI lookup.
+<P>The application acquires an instance of the JDO PersistenceManager by
+calling the getPersistenceManager method on an instance of JDO
+PersistenceManagerFactory.  
+<P>The JDO PersistenceManager is the primary interface for JDO-aware 
+application components: 
+<ul>
+<li>it gives access to the current Transaction interface;
+<li>it is the factory for the Query interface;
+<li>it contains methods for managing the life cycle of persistent instances.
+</ul>
+<P>A JDO PersistenceManager instance supports any number of JDO instances 
+at a time. It is responsible for managing the identity of its 
+associated JDO instances. A JDO instance is associated with either 
+zero or one JDO PersistenceManager. It will be zero if and only if the 
+JDO instance is transient nontransactional. As soon as the instance is made persistent 
+or transactional, it will be associated with exactly one JDO PersistenceManager.
+<P>A JDO PersistenceManager instance supports one transaction at a time, 
+and uses one connection to the underlying data source at a time. The JDO 
+PersistenceManager instance might use multiple transactions serially, 
+and might use multiple connections serially.
+<P>Normally, cache management is automatic and transparent. When instances 
+are queried, navigated to, or modified, instantiation of instances and 
+their fields and garbage collection of unreferenced instances occurs 
+without any explicit control. When the transaction in which persistent 
+instances are created, deleted, or modified commits, eviction is 
+automatically done by the transaction completion mechanisms. 
+<P>Operations on persistent JDO instances at the user's choice might be 
+performed in the context of a transaction. That is, the view of data 
+in the data store is transactionally consistent, according to the 
+standard definition of ACID transactions.
+<P>The Transaction interface is used to mark the beginning and end of a 
+application-defined unit of work.  The PersistenceManager allows the 
+application to get the instance that manages these transactional
+boundaries via the currentTransaction method.
+<P>The persistent manager instance is a factory for query instances, 
+and queries are executed in the context of the persistent manager instance. 
+The actual query execution might be performed by the JDO PersistenceManager 
+or might be delegated by the JDO PersistenceManager to its data store. 
+The actual query executed thus might be implemented in a very different 
+language from Java, and might be optimized to take advantage of particular 
+query language implementations.
+<P>Extents are collections of data store objects managed by the data store, 
+not by explicit user operations on collections. Extent capability is a 
+boolean property of classes that are persistence capable. If an instance 
+of a class that has a managed extent is made persistent via reachability, 
+the instance is put into the extent implicitly.
+</body>
+</html>

Added: incubator/jdo/trunk/api20/src/java/javax/jdo/spi/Detachable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/api20/src/java/javax/jdo/spi/Detachable.java?view=auto&rev=159273
==============================================================================
--- incubator/jdo/trunk/api20/src/java/javax/jdo/spi/Detachable.java (added)
+++ incubator/jdo/trunk/api20/src/java/javax/jdo/spi/Detachable.java Mon Mar 28 10:25:05 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+/*
+ * Detachable.java
+ *
+ */
+
+package javax.jdo.spi;
+
+/**
+ * This interface is implemented by classes that can be detached from the
+ * persistence context and later attached. The interface includes the 
+ * contract by which the StateManager can set the object id and version
+ * so they are preserved while outside the persistence environment.
+ * @version 2.0
+ * @since 2.0
+ */
+public interface Detachable {
+    
+    /** Replace the object id in the detached object.
+     */
+    void jdoReplaceObjectId();
+    
+    /** Replace the version in the detached object.
+     */
+    void jdoReplaceVersion();
+    
+    /** Provide the loaded field list in the detached object.
+     */
+    void jdoProvideLoadedFieldList();
+    
+    /** Replace the loaded field list in the detached object.
+     */
+    void jdoReplaceLoadedFieldList();
+    
+    /** Provide the modified field list in the detached object.
+     */
+    void jdoProvideModifiedFieldList();
+    
+    /** Replace the modified field list in the detached object.
+     */
+    void jdoReplaceModifiedFieldList();
+}



Mime
View raw message