db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158176 [57/79] - in incubator/jdo/trunk/ri11: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/ejb/ src/java/org/apache/jdo/enhancer/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/enhancer/ src/java/org/apache/jdo/impl/enhancer/classfile/ src/java/org/apache/jdo/impl/enhancer/core/ src/java/org/apache/jdo/impl/enhancer/generator/ src/java/org/apache/jdo/impl/enhancer/meta/ src/java/org/apache/jdo/impl/enhancer/meta/model/ src/java/org/apache/jdo/impl/enhancer/meta/prop/ src/java/org/apache/jdo/impl/enhancer/meta/util/ src/java/org/apache/jdo/impl/enhancer/util/ src/java/org/apache/jdo/impl/fostore/ src/java/org/apache/jdo/impl/jdoql/ src/java/org/apache/jdo/impl/jdoql/jdoqlc/ src/java/org/apache/jdo/impl/jdoql/scope/ src/java/org/apache/jdo/impl/jdoql/tree/ src/java/org/apache/jdo/impl/model/ src/java/org/apache/jdo/impl/model/java/ src/java/org/apache/jdo/impl/model/java/runtime/ src/java/org/apache/jdo/impl/model/jdo/ src/java/org/apache/jdo/impl/model/jdo/caching/ src/java/org/apache/jdo/impl/model/jdo/util/ src/java/org/apache/jdo/impl/model/jdo/xml/ src/java/org/apache/jdo/impl/pm/ src/java/org/apache/jdo/impl/sco/ src/java/org/apache/jdo/impl/state/ src/java/org/apache/jdo/jdoql/ src/java/org/apache/jdo/jdoql/tree/ src/java/org/apache/jdo/model/ src/java/org/apache/jdo/model/java/ src/java/org/apache/jdo/model/jdo/ src/java/org/apache/jdo/pm/ src/java/org/apache/jdo/sco/ src/java/org/apache/jdo/state/ src/java/org/apache/jdo/store/ src/java/org/apache/jdo/util/ test/ test/conf/ test/enhancer/ test/enhancer/sempdept/ test/enhancer/sempdept/src/ test/enhancer/sempdept/src/empdept/ test/fsuid2/ test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/ test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/ test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/ test/java/org/apache/jdo/pc/empdept/ test/java/org/apache/jdo/pc/serializable/ test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/ test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/ test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/ test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/ test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/ test/jdo/org/apache/jdo/pc/xempdept/ xdocs/
Date Sat, 19 Mar 2005 01:06:13 GMT
Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModel.mdl
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelFactory.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelFactory.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelFactory.java Fri Mar 18 17:02:29 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+import org.apache.jdo.model.java.JavaModel;
+
+
+/**
+ * Factory for JDOModel instances. The factory provides a mechanism to cache 
+ * JDOModel instances per user defined keys.
+ * 
+ * @author Michael Bouschen
+ */
+public interface JDOModelFactory 
+{
+    /**
+     * Creates a new empty JDOModel instance.
+     * @exception ModelException if impossible
+     */
+    public JDOModel createJDOModel(JavaModel javaModel)
+        throws ModelException;
+    
+    /**
+     * Returns the JDOModel instance for the specified JavaModel.
+     * @param javaModel the javaModel used to cache the returned JDOModel instance
+     */
+    public JDOModel getJDOModel(JavaModel javaModel);
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelHelper.jpg
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelHelper.jpg?view=auto&rev=158176
==============================================================================
Binary file - no diff available.

Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelHelper.jpg
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOModelHelper.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOPackage.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOPackage.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOPackage.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOPackage.java Fri Mar 18 17:02:29 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+
+/**
+ * A JDOPackage instance represents the JDO package metadata.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOPackage 
+    extends JDOElement
+{
+    /**
+     * Returns the name of this JDOPackage.
+     * @return the name
+     */
+    public String getName();
+
+    /**
+     * Sets the name of this JDOPackage.
+     * @param name the name
+     * @exception ModelException if impossible
+     */
+    public void setName(String name)
+        throws ModelException;
+
+    /**
+     * Returns the declaring JDOModel of this JDOPackage.
+     * @return the JDOModel that owns this JDOPackage.
+     */
+    public JDOModel getDeclaringModel();
+
+    /**
+     * Set the declaring JDOModel for this JDOPackage.
+     * @param model the declaring JDOModel of this JDOPackage.
+     */
+    public void setDeclaringModel(JDOModel model);
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOReference.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOReference.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOReference.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDOReference.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+/**
+ * A JDOReference instance represents the JDO relationship metadata 
+ * of a reference relationship field.
+ *
+ * @author Michael Bouschen
+ */
+public interface JDOReference
+    extends JDORelationship 
+{
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDORelationship.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDORelationship.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDORelationship.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/JDORelationship.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+import org.apache.jdo.model.ModelException;
+
+/**
+ * JDORelationship is the super interface for all interfaces representing 
+ * JDO relationship metadata of a managed field of a persistence-capable class.
+ * 
+ * @author Michael Bouschen
+ */
+public interface JDORelationship 
+    extends JDOElement 
+{
+    /**
+     * Constant representing the cardinality zero used for lower and upper 
+     * bounds.
+     */
+    public static final int CARDINALITY_ZERO = 0;
+
+    /**
+     * Constant representing the cardinality one used for lower and upper bounds.
+     */
+    public static final int CARDINALITY_ONE = 1;
+
+    /**
+     * Constant representing the cardinality n used for lower and upper bounds.
+     */
+    public static final int CARDINALITY_N = java.lang.Integer.MAX_VALUE;
+
+    /** 
+     * Get the lower cardinality bound for this relationship element.
+     * @return the lower cardinality bound
+     */
+    public int getLowerBound();
+
+    /** 
+     * Set the lower cardinality bound for this relationship element.
+     * @param lowerBound an integer indicating the lower cardinality bound
+     * @exception ModelException if impossible
+     */
+    public void setLowerBound(int lowerBound)
+        throws ModelException;
+    
+    /** 
+     * Get the upper cardinality bound for this relationship element.
+     * @return the upper cardinality bound
+     */
+    public int getUpperBound();
+
+    /** 
+     * Set the upper cardinality bound for this relationship element.
+     * @param upperBound an integer indicating the upper cardinality bound
+     * @exception ModelException if impossible
+     */
+    public void setUpperBound(int upperBound)
+        throws ModelException;
+
+    /** 
+     * Get the declaring field of this JDORelationship.
+     * @return the field that owns this JDORelationship, or <code>null</code>
+     * if the element is not attached to any field
+     */
+    public JDOField getDeclaringField();
+
+    /** 
+     * Set the declaring field of this JDORelationship.
+     * @param declaringField the declaring field of this relationship element
+     * @exception ModelException if impossible
+     */
+    public void setDeclaringField(JDOField declaringField)
+        throws ModelException;
+
+    /**
+     * Get the inverse JDORelationship in the case of a managed relationship.
+     * @return the inverse relationship
+     */
+    public JDORelationship getInverseRelationship();
+
+    /**
+     * Set the inverse JDORelationship in the case of a managed relationship.
+     * @param inverseRelationship the inverse relationship
+     * @exception ModelException if impossible
+     */
+    public void setInverseRelationship(JDORelationship inverseRelationship)
+        throws ModelException;
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/NullValueTreatment.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/NullValueTreatment.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/NullValueTreatment.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/NullValueTreatment.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+/**
+ * This interface provides constants denoting the treatment of null values 
+ * for persistent fields during storage in the data store.
+ *
+ * @author Michael Bouschen
+ */
+public class NullValueTreatment 
+{
+    /**
+     * Constant representing converting a null value of a field of nullable type 
+     * to the default value for the type in the datastore.
+     */
+    public static final int NONE = 0;
+
+    /** 
+     * Constant representing throwing an exception when storing a null value of 
+     * field of a nullable type that is mapped to non-nullable type in the 
+     * datastore.
+     */
+    public static final int EXCEPTION = 1;
+
+    /**
+     * Constant representing converting a null value of a field of nullable type 
+     * to the default value for the type in the datastore.
+     */
+    public static final int DEFAULT = 2;
+
+    /**
+     * Returns a string representation of the specified NullValueTreatment 
+     * constant.  
+     * @param nullValueTreatment the null value treatment, one of 
+     * {@link #NONE}, {@link #EXCEPTION} or {@link #DEFAULT}
+     * @return the string representation of the NullValueTreatment constant
+     */
+    public static String toString(int nullValueTreatment) 
+    {
+        switch (nullValueTreatment) {
+        case NONE :
+            return "none"; //NOI18N
+        case EXCEPTION :
+            return "exception"; //NOI18N
+        case DEFAULT :
+            return "default"; //NOI18N
+        default:
+            return "UNSPECIFIED"; //NOI18N
+        }
+    }
+
+    /**
+     * Returns the NullValueTreatment constant for the string representation.
+     * @param nullValueTreatment the string representation of the null value
+     * treatment
+     * @return the null value treatment, one of {@link #NONE}, 
+     * {@link #EXCEPTION} or {@link #DEFAULT}
+     **/
+    public static int toNullValueTreatment(String nullValueTreatment)
+    {
+        if ((nullValueTreatment == null) || (nullValueTreatment.length() == 0))
+            return NONE;
+ 
+        if ("none".equals(nullValueTreatment)) //NOI18N
+            return NONE;
+        else if ("exception".equals(nullValueTreatment)) //NOI18N
+            return EXCEPTION;
+        else if ("default".equals(nullValueTreatment)) //NOI18N
+            return DEFAULT;
+        else
+            return NONE;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/PersistenceModifier.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/PersistenceModifier.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/PersistenceModifier.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/PersistenceModifier.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.model.jdo;
+
+/**
+ * This interface provides constants denoting JDO specific 
+ * modifiers for fields of a persistence-capable class.
+ *
+ * @author Michael Bouschen
+ */
+public class PersistenceModifier 
+{
+    /** Constant representing an unspecified field modifier */
+    public static final int UNSPECIFIED = 0;
+
+    /** Constant representing a none field modifier.  */
+    public static final int NONE = 1;
+
+    /** Constant representing a transactional field modifier. */
+    public static final int TRANSACTIONAL = 2;
+
+    /** Constant representing a persistence field modifier. */
+    public static final int PERSISTENT  = 4;
+
+    /** Constant representing a possibly persistence field modifier. */
+    public static final int POSSIBLY_PERSISTENT  = 8;
+
+    /**
+     * Returns a string representation of the specified persistence modifer. 
+     * @param persistenceModifier the persistence modifer, one of  
+     * {@link #UNSPECIFIED}, {@link #NONE}, {@link #PERSISTENT},
+     * {@link #TRANSACTIONAL}, or {@link #POSSIBLY_PERSISTENT}.
+     * @return the string representation of the PersistenceModifer constant
+     */
+    public static String toString(int persistenceModifier) 
+    {
+        switch (persistenceModifier) {
+        case NONE :
+            return "none"; //NOI18N
+        case TRANSACTIONAL :
+            return "transactional"; //NOI18N
+        case PERSISTENT:
+            return "persistent"; //NOI18N
+        case POSSIBLY_PERSISTENT:
+            return "possibly-persistent"; //NOI18N
+        default:
+            return "UNSPECIFIED"; //NOI18N
+        }
+    }
+    
+    /**
+     * Returns the PersistenceModifier constant for the specified string.
+     * @param persistenceModifier the string representation of the persistence 
+     * modifer
+     * @return the persistence modifer, one of {@link #UNSPECIFIED}, 
+     * {@link #NONE}, {@link #PERSISTENT} or {@link #TRANSACTIONAL}
+     **/
+    public static int toPersistenceModifier(String persistenceModifier)
+    {
+        if ((persistenceModifier == null) || (persistenceModifier.length() == 0))
+            return UNSPECIFIED;
+ 
+        if ("none".equals(persistenceModifier)) //NOI18N
+            return NONE;
+        else if ("transactional".equals(persistenceModifier)) //NOI18N
+            return TRANSACTIONAL;
+        else if ("persistent".equals(persistenceModifier)) //NOI18N
+            return PERSISTENT;
+        else if ("possibly-persistent".equals(persistenceModifier)) //NOI18N
+            return POSSIBLY_PERSISTENT;
+        else
+            return UNSPECIFIED;
+    }
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/jdo/package.html Fri Mar 18 17:02:29 2005
@@ -0,0 +1,27 @@
+<!--
+ 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>JDOModel API package.</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package defines the JDOModel API. 
+  It provides interfaces to access JDO metadata.
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/model/package.html Fri Mar 18 17:02:29 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>Package org.apache.jdo.model</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package defines the Model Exception classes.</p>
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/Accessor.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/Accessor.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/Accessor.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/Accessor.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+/*
+ * Accessor.java
+ *
+ * Created on August 10, 2001, 3:17 PM
+ */
+
+package org.apache.jdo.pm;
+
+/**
+ *
+ * @author  Dave Bristor
+ * @version 1.0
+ */
+public interface Accessor {
+    /** 
+     * Return a default value in a Factory (either 
+     * a PersistenceManagerFactory or a ConnectionFactory.
+     * @return String form of a default value
+     */
+    public String getDefault();
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerFactoryInternal.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerFactoryInternal.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerFactoryInternal.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerFactoryInternal.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+/*
+ * PersistenceManagerFactoryInternal.java
+ *
+ * Create on March 3, 2000
+ */
+
+package org.apache.jdo.pm;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.store.StoreManager;
+import org.apache.jdo.store.TranscriberFactory;
+
+
+/**
+* JDORI-internal PMF.
+*
+* @author Dave Bristor
+*/
+public interface PersistenceManagerFactoryInternal
+    extends PersistenceManagerFactory {
+
+    /**
+    * Provides the factory which can make Transcribers for this PMF.
+    * @return A TranscriberFactory particular to a kind of PMF.
+    */
+    public TranscriberFactory getTranscriberFactory();
+
+    /**
+    * In order for the application to construct instance of the ObjectId
+    * class it needs to know the class being used by the JDO implementation.
+    * @param cls the PersistenceCapable Class
+    * @return the Class of the ObjectId of the parameter
+    */
+    public Class getObjectIdClass(Class cls);
+
+    /**
+    * Provides a StoreManager that is ready to accept operations on it such
+    * as insert, etc.
+    * @param pm PersistenceManager that is requesting a StoreManager.
+    */
+    public StoreManager getStoreManager(PersistenceManager pm);
+
+    /**
+    * Allows the PMF to release any resources associated with the given PM's
+    * store manager.
+    * @param pm PersistenceManager that is releasing a StoreManager.
+    */
+    public void releaseStoreManager(PersistenceManager pm);
+
+    /**
+    * Returns store-specific mapping between Java classes and tracked SCO
+    * classes supported by this PMF. Called by PersistenceManager inside
+    *  requests for a new tracked instance.
+    * @param type Class to find mapping for.
+    * @return A Class for the tracked SCO or null if this Java class is not
+    * supported as tracked SCO.
+    */
+    public Class getTrackedClass(Class type);
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerInternal.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerInternal.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerInternal.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/PersistenceManagerInternal.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,257 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.pm;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Map;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.spi.PersistenceCapable;
+
+import org.apache.jdo.state.StateManagerInternal;
+import org.apache.jdo.store.StoreManager;
+
+
+/**
+ * Extends the PersistenceManager interface for JDO-internal use.  Provides
+ * additional information and helper methods for StateManagerInternal
+ * interaction with the cache.
+ *
+ * @author Marina Vatkina
+ */
+public interface PersistenceManagerInternal extends PersistenceManager {
+    /**
+     * assert this PM instance is open
+     */
+    public void assertIsOpen();
+
+    /**
+     * assert that the NontransactionalRead flag is true or a transaction is active.
+     */
+    public void assertReadAllowed();
+    
+    /**
+    * Provides a StoreManager that is ready to accept operations on it.
+    * @return A StoreManager.
+    */
+    public StoreManager getStoreManager();
+
+    /**
+    * Provides a StateManagerInternal for the given Object Id.
+    * @param oid the given Object Id.
+    * @param pcClass Class of a PersistenceCapable instance to be created
+    * if this Object Id was not registered with this PersistenceManager.
+    * @return A StateManagerInternal.
+    */
+    public StateManagerInternal getStateManager(Object oid, Class pcClass);
+
+    /**
+    * Finds a StateManagerInternal for the given PersistenceCapable object.
+    * Validates PersistenceManager associated with this PersistenceCapable object.
+    * @param pc the given PersistenceCapable object.
+    * @return A StateManagerInternal.
+    */
+    public StateManagerInternal findStateManager(PersistenceCapable pc);
+
+
+    /**
+     * Provides a Class of the given name.  This method will use one of as
+     * many as three ClassLoaders in attempting to load the named class. The
+     * ClassLoaders are:
+     * <ul>
+     *   <li>The given Class Loader</li>
+     *   <li>The current Thread's context Class Loader</li>
+     *   <li>The class loader that was the context Class Loader of the thread
+     *     which created this PersistenceManagerInternal</li> 
+     * </ul>
+     * For each such non-null Class Loader, it is used as a parameter of
+     * Class.forName. If the result is not null, then the given Comparator's
+     * compare method is invoked with that Class and the given Object o. If
+     * that returns zero, that Class is returned. If either the Class.forName
+     * returns null or the comparator returns non-zero, the next non-null
+     * ClassLoader in the above list is tried in the same manner.
+     * <p>
+     * If after the above has been tried on all the ClassLoaders, an
+     * appropriate Class has not been found, throws JDOUserException.
+     * @param name Fully qualified name of the Class to load.
+     * @param given ClassLoader which is the first to be tried
+     * in loading the named Class. 
+     * @throws ClassNotFoundException - if an appropriate Class can not
+     * be loaded.
+     */
+
+     /* XXX At one point, we discussed also using a Comparator to validate
+     * the class loaded by the loader.  Pending resolution, we are omitting
+     * this, instead following the proposal Craig made to the JDO Experts.
+     *
+     * @param c Comparator used to determine if a
+     * Class loaded from a ClassLoader  is in fact
+     * that which the caller wants. Invoked with a loaded Class
+     * as the first argument, and the given object o as the second
+     * argument. If it returns zero, the comparison is deemed to have succeed,
+     * and that Class will be returned by this method.
+     * @param o Object passed as second argument to given
+     * Comparator's compare method.
+     */
+
+     public Class loadClass(String name,
+                            ClassLoader given) throws ClassNotFoundException;
+     //                     Comparator c,
+     //                     Object o) throws ClassNotFoundException;
+
+
+    /**
+     * Provides the Class object of the persistence-capable class that defines 
+     * the specified class as its ObjectId class. This method will use one of as
+     * many as three ClassLoaders in attempting to find the persistence-capable 
+     * class. The ClassLoaders are the same as in {@link #loadClass}:
+     * <ul>
+     * <li>The given Class Loader, here the given class loader is the class 
+     * loader of the ObjectId class</li>
+     * <li>The current Thread's context Class Loader</li>
+     * <li>The class loader that was the context Class Loader of the thread
+     *     which created this PersistenceManagerInternal</li> 
+     * </ul>
+     * The method returns the top most persistence-capable class in the case of 
+     * an inheritance hierachy.
+     */
+    public Class loadPCClassForObjectIdClass(Class objectIdClass) 
+        throws ClassNotFoundException;
+
+    /**
+    * Provides an object id for the given PersistenceCapable.  The object id
+    * must not be given to user/client code.
+    */     
+    public Object getInternalObjectId(Object pc);
+
+    /**
+    * Adds persistent object to the cache.
+    * @param sm instance of StateManagerInternal to be added
+    * @param oid ObjectId of the corresponding persistence-capable instance
+    * @param transactional true if the corresponding lifecycle state is transactional
+    * @param throwDuplicateException true if the exception should be thrown in case the same ObjectId
+    * has been already registered.
+    */
+    public void register(StateManagerInternal sm, Object oid, boolean transactional, 
+        boolean throwDuplicateException);
+
+    /**
+    * Adds transient object to the transient cache.
+    * @param sm instance of StateManagerInternal to be added
+    */
+    public void registerTransient(StateManagerInternal sm);
+
+    /**
+    * Removes the object from the cache.
+    * @param oid ObjectId of the instance to be removed.
+    */
+    public void deregister(Object oid);
+
+    /**
+    * Removes transient object from the transient cache.
+    * @param sm instance of StateManagerInternal to be removed
+    */
+    public void deregisterTransient(StateManagerInternal sm);
+
+    /**
+    * Replaces the objectId key value in the cache.
+    * @param oldId previous value of ObjectId.
+    * @param newId new value of ObjectId.
+    */
+    public void replaceObjectId(Object oldId, Object newId);
+
+   /** A helper method called from the StateManager inside getPersistenceManager()
+     * to identify StateManager associated with this PC instance
+     * @param pc PC instance
+     * @param sm StateManager to save
+     */  
+    public void hereIsStateManager(StateManagerInternal sm, PersistenceCapable pc);
+
+   /**
+    * Called by StateManagerInternal#markAsFlushed() to adjust transactional cache(s)
+    * if necessary after successful flush to the data store.
+    * @param sm StateManagerInternal instance that has been flushed
+    */
+    public void markAsFlushed(StateManagerInternal sm);
+
+   /**
+    * Returns true if the call initiated as a result of the commit process,
+    * versus flush for query in a datastore transaction.
+    * @return true if commit has started
+    */
+    public boolean insideCommit();
+
+    /**
+     * Called internally by the runtime to create a new tracked instance.
+     * Will not result in marking field as dirty
+     *
+     * Returns a new Second Class Object instance of the type java.uti.Date,
+     * or supported subclass.
+     * @param type Class of the new SCO instance
+     * @return the object of the class type
+     */
+    public Object newSCOInstanceInternal (Class type);
+
+    /**
+     * Called internally by the runtime to create a new tracked instance of type
+     * Collection.
+     * Will not result in marking field as dirty
+     *   
+     */  
+    public Collection newCollectionInstanceInternal(Class type,
+        Class elementType, boolean allowNulls, Integer initialSize,
+        Float loadFactor, Collection initialContents, Comparator comparator);
+
+    /**
+     * Called internally by the runtime to create a new tracked instance of type Map.
+     * Will not result in marking field as dirty
+     *   
+     */  
+    public Map newMapInstanceInternal(Class type, Class keyType, Class valueType, 
+        boolean allowNulls, Integer initialSize, Float loadFactor, 
+        Map initialContents, Comparator comparator);
+
+    /**
+     * Called by StateManager to verify field type.
+     * @param type Class type of the field.
+     * @return true if this type is a supported SCO type.
+     */
+    public boolean isSupportedSCOType(Class type);
+
+    /**
+     * Called by Query or Extent to flush updates to the database
+     * in a datastore transaction. It is up to the StoreManager to decide
+     * at what point of the processing to call this method. No validation
+     * of the transaction type is performed.
+     * @throws JDOUserException if current transaction is not active.
+     */
+    public void flush();
+
+    /**
+     * Returns current instance of PersistenceManager wrapper
+     */  
+    public PersistenceManager getCurrentWrapper();
+
+    /**
+     * Returns a Collection of instances that has been made persistent
+     * or become persistent through persistence-by-reachability
+     * algorithm in this transaction. Called by the Extent.iterator.
+     * @return Collection of Persistent-New instances.
+     */
+    public Collection getInsertedInstances();
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/pm/package.html Fri Mar 18 17:02:29 2005
@@ -0,0 +1,27 @@
+<!--
+ 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>Package org.apache.jdo.pm</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains provides internal interfaces for 
+PersistenceManagerFactory and PersistenceManager extending the ones from javax.jdo.
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCO.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCO.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCO.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCO.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+/*
+ * SCO.java
+ *
+ * created May 9, 2000
+ *
+ * @author Marina Vatkina
+ * @version 1.0.1
+ */
+
+package org.apache.jdo.sco;
+
+public interface SCO {
+    /**
+     * Returns the field name
+     *
+     * @return field name as java.lang.String
+     */
+    String getFieldName();
+
+    /**
+     * Returns the owner object of the SCO instance
+     *
+     * @return owner object
+     */
+    Object getOwner();
+
+    /** 
+     * Sets the owner and field number.  Called by StateManager upon
+     * assignment to a managed instance.
+     * @param owner the owner object. 
+     * @param fieldNumber the number of the field associated with this instance.
+     */
+    void setOwner (Object owner, int fieldNumber);
+
+    /**
+     * Nullifies references to the owner Object iff the passed in owner and 
+     * fieldNumber match.
+     * @param owner the existing owner object.
+     * @param fieldNumber the existing number of the field.
+     */
+    void unsetOwner(Object owner, int fieldNumber);
+
+    /**
+     * Make a copy of this object.
+     * @since 1.0.1
+     */
+    Object clone();
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOCollection.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOCollection.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOCollection.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+/*
+ * SCOCollection.java
+ *
+ * created April 3, 2000
+ *
+ * @author Marina Vatkina
+ * @version 1.0.1
+ */
+
+package org.apache.jdo.sco;
+import java.util.Collection;
+import java.util.Iterator;
+
+public interface SCOCollection extends java.util.Collection, SCO {
+    /**
+     * Resets removed and added lists after flush
+     */
+    void reset();
+
+    /**
+     * Adds object to the Collection without recording
+     * the event. Used internaly to initially populate the Collection
+     */ 
+    void addInternal(Object o);
+
+    /**
+     * Adds objects of the given Collection to this Collection without recording
+     * the event. Used internaly to initially populate the Collection
+     */ 
+    void addAllInternal(Collection c);
+
+
+    /**
+     * Clears Collection without recording
+     * the event. Used internaly to clear the Collection
+     */
+    void clearInternal();
+
+
+    /**
+     * Removes element from the Collection without recording
+     * the event. Used internaly to update the Collection
+     */
+    void removeInternal(Object o);
+
+    /**
+     * Returns the Collection of added elements
+     *
+     * @return Collection of the added elements as java.util.Collection
+     */
+    Collection getAdded();
+
+    /**
+     * Returns the Collection of removed elements
+     *
+     * @return Collection of the removed elements as java.util.Collection
+     */
+    Collection getRemoved();
+
+    /**
+     * Returns the element type assignment compatible with all
+     * added elements of this collection.
+     * 
+     * @return the element type assignment compatible with all
+     * added elements.
+     */
+    Class getElementType();
+
+    /**
+     * Returns whether nulls are permitted as elements.
+     *   
+     * @return true if nulls are permitted as elements. 
+     */ 
+    boolean allowNulls();
+
+    /**
+     * Set the contents of this Collection from the frozen elements.
+     * @since 1.0.1
+     * @param elements the frozen elements.
+     */
+    void setFrozen(Object[] elements);
+    
+    /**
+     * Get an iterator over the frozen elements of this collection. This allows
+     * iterator of the elements without thawing them, as is needed for
+     * transcription.
+     * @since 1.0.1
+     * @return an iterator over the frozen elements.
+     */
+    Iterator frozenIterator();
+    
+    /** Get an iterator regardless of whether the map is frozen.
+     * If frozen, get a frozen iterator.
+     * If thawed, get a regular iterator.
+     * @since 1.0.1
+     * @return the iterator over the elements.
+     */
+    Iterator eitherIterator();
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCODate.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCODate.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCODate.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCODate.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+/*
+ * SCODate.java
+ *
+ * created April 5, 2000
+ *
+ * @author Marina Vatkina
+ * @version 1.0
+ */
+
+package org.apache.jdo.sco;
+
+public interface SCODate extends SCO
+{
+    /**
+     * Sets initial date value without notifying the owner object
+     *
+     * @param time in milliseconds
+     */
+    void setTimeInternal(long time);
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOMap.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOMap.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOMap.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/SCOMap.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,142 @@
+/*
+ * 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.
+ */
+
+/*
+ * SCOMap.java
+ *
+ * created September 20, 2001
+ *
+ * @author Marina Vatkina
+ * @version 1.0.1
+ */
+
+package org.apache.jdo.sco;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+public interface SCOMap extends java.util.Map, SCO {
+    /**
+     * Resets removed and added lists after flush
+     */
+    void reset();
+
+    /**
+     * Associates the specified value with the specified key in this map 
+     * without recording the event. Used internaly to initially populate 
+     * the Map.
+     */ 
+    void putInternal(Object key, Object value);
+
+    /**
+     * Copies all of the mappings from the specified map to this one without 
+     * recording the event. Used internaly to initially populate the Map.
+     */ 
+    void putAllInternal(Map t);
+
+
+    /**
+     * Clears Map without recording
+     * the event. Used internaly to clear the Map
+     */
+    void clearInternal();
+
+
+    /**
+     * Removes mappings from the Map without recording
+     * the event. Used internally to update the Map
+     */
+    void removeInternal(Object key);
+
+    /**
+     * Returns the Collection of added keys
+     *
+     * @return Collection of the added keys as java.util.Collection
+     */
+    Collection getAddedKeys();
+
+    /**
+     * Returns the Collection of added values
+     *
+     * @return Collection of the added values as java.util.Collection
+     */
+    Collection getAddedValues();
+
+    /**
+     * Returns the Collection of removed keys
+     *
+     * @return Collection of the removed keys as java.util.Collection
+     */
+    Collection getRemovedKeys();
+
+    /**
+     * Returns the Collection of removed values
+     *
+     * @return Collection of the removed values as java.util.Collection
+     */
+    Collection getRemovedValues();
+
+    /**
+     * Returns the type of the key assignment compatible with all
+     * keys of this map.
+     * 
+     * @return the type of the key assignment compatible with all
+     * keys.
+     */
+    Class getKeyType();
+
+    /**
+     * Returns the type of the value assignment compatible with all
+     * values of this map.
+     * 
+     * @return the type of the value assignment compatible with all
+     * values.
+     */
+    Class getValueType();
+
+    /**
+     * Returns whether nulls are permitted as keys or values.
+     *   
+     * @return true if nulls are permitted as keys or values. 
+     */ 
+    boolean allowNulls();
+
+    /**
+     * Set the contents of this Map from the frozen entries.
+     * @since 1.0.1
+     * @param entries the array of entries
+     */
+    void setFrozen(Map.Entry[] entries);
+    
+    /** Get an iterator regardless of whether the map is frozen.
+     * If frozen, get a frozen iterator.
+     * If thawed, get a regular iterator.
+     * @since 1.0.1
+     * @return an iterator over the map entries.
+     */
+    Iterator eitherIterator();
+    
+    /**
+     * Get an iterator over the frozen elements of this map. This allows
+     * iteration of the elements without thawing them, as is needed for
+     * transcription.
+     * @since 1.0.1
+     * @return an iterator over the frozen map entries.
+     */
+    Iterator frozenIterator();
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/sco/package.html Fri Mar 18 17:02:29 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>Package org.apache.jdo.sco</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains SCO-related interfaces.</p>
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/FieldManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/FieldManager.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/FieldManager.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/FieldManager.java Fri Mar 18 17:02:29 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.
+ */
+
+package org.apache.jdo.state;
+
+/**
+ * This is the means by which a StateManager implementation's giveXXXField()
+ * method (where XXX is e.g. Int) can give the value to an object that wants
+ * the field.
+ *
+ * @author Dave Bristor
+ */
+public interface FieldManager {
+    /**
+     * Provides the means by which the value of a boolean field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Boolean that is the value of a particular field.
+     */
+    public void storeBooleanField(int fieldNum, boolean value);
+
+    public boolean fetchBooleanField(int fieldNum);
+    
+    /**
+     * Provides the means by which the value of a char field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Char that is the value of a particular field.
+     */
+    public void storeCharField(int fieldNum, char value);
+
+    public char fetchCharField(int fieldNum);
+    
+    /**
+     * Provides the means by which the value of a byte field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Byte that is the value of a particular field.
+     */
+    public void storeByteField(int fieldNum, byte value);
+
+    public byte fetchByteField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a short field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Short that is the value of a particular field.
+     */
+    public void storeShortField(int fieldNum, short value);
+
+    public short fetchShortField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a int field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Int that is the value of a particular field.
+     */
+    public void storeIntField(int fieldNum, int value);
+
+    public int fetchIntField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a long field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Long that is the value of a particular field.
+     */
+    public void storeLongField(int fieldNum, long value);
+
+    public long fetchLongField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a  field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value  that is the value of a particular field.
+     */
+    public void storeFloatField(int fieldNum, float value);
+
+    public float fetchFloatField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a double field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Double that is the value of a particular field.
+     */
+    public void storeDoubleField(int fieldNum, double value);
+
+    public double fetchDoubleField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of a String field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value String that is the value of a particular field.
+     */
+    public void storeStringField(int fieldNum, String value);
+
+    public String fetchStringField(int fieldNum);
+
+    /**
+     * Provides the means by which the value of an Object field can be given
+     * by a StateManager to an object that needs the value.
+     * @param fieldNum Field number of the field in the object whose value is
+     * given.
+     * @param value Object that is the value of a particular field.
+     */
+    public void storeObjectField(int fieldNum, Object value);
+
+    public Object fetchObjectField(int fieldNum);
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/StateManagerInternal.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/StateManagerInternal.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/StateManagerInternal.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/StateManagerInternal.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,275 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.state;
+
+import javax.jdo.spi.PersistenceCapable;
+import javax.jdo.spi.StateManager;
+
+import org.apache.jdo.pm.PersistenceManagerInternal;
+import org.apache.jdo.sco.SCO;
+import org.apache.jdo.store.StoreManager;
+
+
+/**
+ * Extends the StateManager interface for JDO-internal use.  Provides
+ * additional information about the state of particular fields.  Provides a
+ * means to give a field's value to an object that can cause that value to be
+ * stored.
+ *
+ * @author Dave Bristor
+ */
+public interface StateManagerInternal extends StateManager {
+
+    /**
+    * Return values for flush operations
+    */
+    public static final int FLUSHED_PARTIAL  = -1;
+    public static final int FLUSHED_NONE     = 0;
+    public static final int FLUSHED_COMPLETE = 1;
+
+    /**
+    * Provides the object managed by this state manager.
+    * @return The object managed by this state manager.
+    */
+    public PersistenceCapable getObject();
+
+
+    /**
+    * Returns internal representation of the object id associated with this statemanager.
+    * @return internal representation of the object id associated with this statemanager.
+    */
+    public Object getInternalObjectId();
+
+    /**
+    * Returns external representation of the object id associated with this statemanager.
+    * @return external representation of the object id associated with this statemanager.
+    */
+    public Object getExternalObjectId();
+
+    /**
+    * Allows a client to change this state manager's object Id.  For example,
+    * with datastore identity, allows one object id to be used before the
+    * object has been stored (i.e. a "provisional" id), and another once the
+    * object has been put into the datbase.
+    */
+    public void setObjectId(Object objectId);
+
+    /**
+    * Causes the state manager to send itself to the store manager for
+    * insert, update, and so on as per its own state.  It should flush itself
+    * only if it has no dependencies on other state manager.
+    * @param srm The StoreManager to which the instance should send itself.
+    * @return true if the state manager could flush itself, false if it has
+    * dependencies on other state managers and could not flush itself.
+    */
+    public boolean flush(StoreManager srm);
+
+    /**
+     * Causes the values of the field indicated by the specified field number
+     * be given to the FieldManager.
+     * @param fieldNumber Indicates which field should be provided to the
+     * fieldManager.
+     * @param fieldManager FieldManager to which the field should be given.
+     * @param identifying If true, provides values from the before or flushed
+     * image, as determined by this StateManager's state; if false provides
+     * values from the current image.
+     */
+    public void provideField(int fieldNumber, FieldManager fieldManager,
+                             boolean identifying);
+
+    /**
+     * Causes the values of the fields  indicated by the specified fields to
+     * be given to the FieldManager.
+     * @param fields Indicates which fields should be provided to the
+     * fieldManager.
+     * @param fieldManager FieldManager to which the field should be given.
+     * @param identifying If true, provides values from the before or flushed
+     * image, as determined by this StateManager's state; if false provides
+     * values from the current image.
+     */
+    public void provideFields(int fields[], FieldManager fieldManager,
+                              boolean identifying);
+
+    /**
+    * For replacing field values in a PC with the ones that is provided by
+    * the FieldManager.
+    * @param fields Indicates which fields should be replaced in the PC.
+    * @param fieldManager FieldManager from which the field values should
+    * be obtained.
+    */
+    public void replaceFields(int fields[], FieldManager fieldManager);
+
+    /** 
+     * Fetch or refresh object from the data store.
+     */  
+    public void reload();
+
+    /** 
+     * Retrieve an instance from the store.
+     */  
+    public void retrieve();
+    
+    /**
+     * Transition the lifecycle state as if the instance is retrieved from the 
+     * datastore, but use the specified field values instead of loading them 
+     * from the datastore.
+     * @param fields Indicates which fields should be replaced in the PC.
+     * @param fieldManager FieldManager from which the field values should
+     * be obtained.
+     */
+    public void replace(int fields[], FieldManager fieldManager);
+
+    /**
+     * Transitions lifecycle state in afterCompletion callback
+     * @param abort true if transaction has been rolled back
+     * @param retainValues true if values need to be preserved on commit.
+     * @param restoreValues true if values need to be restored on rollback.
+     */
+    public void afterCompletion(boolean abort, boolean retainValues,
+        boolean restoreValues);
+
+   /**
+     * Transitions lifecycle state in to PERSISTENT_NEW
+     */
+    public void makePersistent();
+
+   /**
+     * Transitions lifecycle state in to transactional
+     */
+    public void makeTransactional();
+
+   /**
+     * Transitions lifecycle state in to nontransactional
+     */
+    public void makeNontransactional();
+
+   /**
+     * Transitions lifecycle state in to TRANSIENT
+     */
+    public void makeTransient();
+
+   /**
+     * Transitions lifecycle state in to PERSISTENT_DELETED
+     */
+    public void deletePersistent();
+
+   /**
+     * Transitions lifecycle state to P_CLEAN or P_NON_TX
+     */
+    public void refreshInstance();
+
+   /**
+     * Transitions lifecycle state to HOLLOW
+     */
+    public void evictInstance();
+
+   /**
+     * Calls preStore on the associated object if necessary.
+     */
+    public void preStore();
+
+   /**
+     * Replaces field values that are regular SCO instances with tracked SCOs.
+     * Called internally during the afterCompletion processing when instance 
+     * transions to P-nontransactional (if the retainValues flag is set to true).
+     * May be called by the StoreManager during the flush process to store tracked
+     * instances in the data store.
+     */
+    public void replaceSCOFields();
+
+   /** Processes relationships for reachability algorithm
+     * and define the dependencies  
+     * @param flag is true if method is called inside the flush, false otherwise
+     */  
+    public void handleReachability(boolean flag);
+
+    /**
+     * Returns true if the instance exists in a datastore. Returns false
+     * for transient instances, PersistentNew, PersistentNewDeleted, and 
+     * PersistentDeletedFlushed
+     */
+    public boolean isStored();
+
+    /**
+     * Returns true if the instance has been flushed to the datastore. 
+     */
+    public boolean isFlushed();
+
+    /**
+     * Sets dependency object containing dependency information specific to this 
+     * instance of the StateManager
+     * @param dependency new dependency object
+     */  
+    public Object setDependency(Object dependency);
+
+    /**
+     * Returns dependency object that contains dependency information specific to 
+     * this instance of the StateManager
+     */  
+    public Object getDependency();
+    
+    /** 
+     * Returns PersistenceManager associated with this StateManager instance
+     * @return the PersistenceManager
+     */
+    public PersistenceManagerInternal getPersistenceManager();
+
+    /** Mark the associated PersistenceCapable field dirty.
+     * <P> The StateManager will make a copy of the field
+     * so it can be restored if needed later, and then mark
+     * the field as modified in the current transaction.
+     * @param fieldNumber the number of the field
+     */  
+    public void makeDirty (int fieldNumber); 
+
+    /**
+     * Processes changes to the Tracked SCO instance owned by this
+     * StateManager.
+     * @param fieldNumber the number of the field
+     * @param sco Tracked SCO instance.
+     */
+    public void trackUpdates(int fieldNumber, SCO sco);
+
+    /**
+     * Returns field name for the field number. Used for debugging.
+     * @param fieldNumber the number of the field
+     * @return field name as String
+     */  
+    public String getFieldName(int fieldNumber);
+
+    /**
+     * Allows StateManager to set the actual PC Class if it was not available
+     * at the constructor time and create a hollow instnce of that type.
+     * @param pcClass the Class type of the instance.
+     */
+    public void setPCClass(Class pcClass);
+
+    /**
+     * Returns PC Class known to this StateManager. Can be a candidate Class.
+     * @return the Class type of the PC instance.
+     */  
+    public Class getPCClass();
+
+    /** Tests whether this StateManager represents a instance made persistent
+     * object.
+     *
+     * @return <code>true</code> if this StateManager represents an
+     * instance made persistent in the current transaction.
+     */
+    public boolean isNew();
+
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/package.html?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/package.html (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/state/package.html Fri Mar 18 17:02:29 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>Package org.apache.jdo.state</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+</head>
+
+<body bgcolor="#FFFFFF">
+<p>This package contains the internal StateManager and teh FIeldManager interface.</p>
+</body>
+</html>

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Bundle.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Bundle.properties?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Bundle.properties (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Bundle.properties Fri Mar 18 17:02:29 2005
@@ -0,0 +1,30 @@
+#
+# 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.
+
+# This file should conform to netbeans standards
+# (http://www.netbeans.org/i18n)
+
+# resource bundle for the messages
+# key consists of: <PREFIX_><description>
+# <PREFIX_> - any valid prefix like MSG_, EXC_, etc.
+# <description> - short description started with the upper case letter and used
+# upper case to represent each next word.
+
+#
+# StoreManagerImpl
+#
+EXC_UnableToFlushAll=Not able to flush all transactional instances to the data store.
+
+

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Connector.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Connector.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Connector.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/Connector.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.store;
+
+/**
+* A Connector is the store-independent means of representing a connection.
+* Each different kind of store should implement it's own connector, which
+* delegates the operations to its particular kind of connection.
+*
+* @author Dave Bristor
+*/
+public interface Connector {
+
+    /**
+    * Informs the Connector that a transaction is beginning.
+    * @param optimistic If true, then an optimistic transaction is
+    * beginning.
+    * @throws JDODataStoreException is [@link setRollbackOnly} has been
+    * invoked on this Connector.
+    */
+    public void begin(boolean optimistic);
+    
+    /**
+    * Informs the Connector that the transaction has reached it's
+    * beforeCompletion phase.
+    * @throws JDODataStoreException is [@link setRollbackOnly} has been
+    * invoked on this Connector.
+    */
+    public void beforeCompletion();
+    
+    /**
+    * Requests that the Connector send all pending database operations to the
+    * store.
+    * @throws JDODataStoreException is [@link setRollbackOnly} has been
+    * invoked on this Connector.
+    */
+    public void flush();
+    
+    /**
+    * Requests that the Connector make all changes made since the previous
+    * commit/rollback permanent and releases any database locks held by the
+    * Connector.
+    * @throws JDODataStoreException is [@link setRollbackOnly} has been
+    * invoked on this Connector.
+    */
+    public void commit();
+
+    /**
+    * Requests that the Connector drop all changes made since the previous
+    * commit/rollback and releases any database locks currently held by this
+    * Connector.
+    */
+    public void rollback();
+
+    /**
+     * Requests that the Connector put itself in a state such that the only
+     * allowable operations is {@link
+     * org.apache.jdo.store.Connector#getRollbackOnly}. Once set, attempts to 
+     * do any other operations will result in a JDODataStoreException.
+     */
+    public void setRollbackOnly();
+    
+    /**
+     * Indicates whether or not the connector can do operations other than
+     * rollback.
+     * @return <code>false</code> if the connector can do operations other than
+     * rollback.
+     */
+    public boolean getRollbackOnly();
+    
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManager.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManager.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManager.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,263 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.store;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.spi.PersistenceCapable;
+import javax.jdo.spi.StateManager;
+
+import org.apache.jdo.jdoql.QueryResult;
+import org.apache.jdo.jdoql.QueryResultHelper;
+import org.apache.jdo.pm.PersistenceManagerInternal;
+import org.apache.jdo.state.StateManagerInternal;
+
+
+/**
+ * StoreManager represents the datastore to the rest of the JDO components.
+ * It provides the means to write and read instances, to get the extent of
+ * classes, and to get the object id for a persistence capable object.
+ */
+public interface StoreManager {
+    /**
+     * Returns a Connector suitable for committing or rolling back operations
+     * on this store.
+     */
+    public Connector getConnector();
+
+    /**
+     * Returns a Connector suitable for committing or rolling back operations
+     * on this store for a specific userid.
+     * @param userid the userid for the connection
+     * @param password the password for the connection
+     */
+    public Connector getConnector(String userid, String password);
+
+    //
+    // Methods which represent individual requests on the store
+    //
+
+    /**
+     * Causes the object managed by the given state manager's object to be
+     * inserted into the database.
+     * @param loadedFields BitSet of fields to be inserted in the database (may be
+     * ignored).
+     * @param dirtyFields BitSet of all fields as all fields are marked as dirty for
+     * <code>insert</code>. After return, bits will remain as set for fields that 
+     * were <em>not</em> inserted. If any bits are set, the return will be 
+     * <code>FLUSHED_PARTIAL</code>. 
+     * @param sm The state manager whose object is to be inserted.
+     * @return one of <code>StateManagerInternal.FLUSHED_{COMPLETE, PARTIAL,
+     * NONE}</code>,
+     * depending on the success of the operation in inserting specified fields
+     * into the database.
+     */
+    public int insert(BitSet loadedFields, BitSet dirtyFields,
+                      StateManagerInternal sm);
+
+    /**
+     * Causes the object managed by the given state manager to be updated
+     * in the database.
+     * @param loadedFields BitSet of fields loaded from the database.
+     * @param dirtyFields BitSet of changed fields that are to be flushed to the
+     * database. It is the StoreManager policy which fields are to be verified 
+     * against those in the database, if this <code>update</code> is within the
+     * context of an optimistic transaction.  After return, bits will remain set
+     * for fields that were not flushed, and in such case the return will be
+     * <code>FLUSHED_PARTIAL</code>. 
+     * @param sm The state manager whose object is to be updated.
+     * @return one of <code>StateManagerInternal.FLUSHED_{COMPLETE, PARTIAL,
+     * NONE}</code>, depending on the success of the operation in updating
+     * specified fields into the database.
+     */
+    public int update(BitSet loadedFields, BitSet dirtyFields,
+                      StateManagerInternal sm);
+
+    /**
+     * Causes the object managed by the given state manager to be verified
+     * in the database.
+     * @param loadedFields BitSet of fields to be verified against those in the
+     * database.
+     * @param dirtyFields Unused as there are no changed fields in this transaction.
+     * @param sm The state manager whose object is to be verified.
+     * @return StateManagerInternal.FLUSHED_COMPLETE.
+     * @throws JDODataStoreException if data in memory does not match that in
+     * the database.
+     */
+    public int verifyFields(BitSet loadedFields, BitSet dirtyFields,
+                             StateManagerInternal sm);
+
+    // RESOLVE: Marina, do we need this? @see org.apache.jdo.impl.fostore.FOStoreStoreManager#verifyExistence.
+    /**
+     * Causes the database to check if the object managed by the given state
+     * manager exists in the database.
+     * @param sm The state manager whose object is to be verified.
+     * @return true if object exists in the database.
+     */
+//    public boolean verifyExistence(StateManagerInternal sm);
+
+    /**
+     * Causes the object managed by the given state manager to be deleted
+     * in the database.
+     * @param loadedFields BitSet of fields loaded from the database.
+     * @param dirtyFields BitSet of changed fields. It is the StoreManager policy 
+     * which fields are to be verified against those in the database, if this 
+     * <code>delete</code> is within the context of an optimistic transaction. After 
+     * return, bits will remain set for the fields that were not flushed, if the 
+     * <code>update</code> was performed to resolve dependencies. In such case the 
+     * return will be <code>StateManagerInternal.FLUSHED_PARTIAL</code>.
+     * @param sm The state manager whose object is to be deleted.
+     * @return one of <code>StateManagerInternal.FLUSHED_{COMPLETE, 
+     * NONE}</code>, depending on the success of the delete operation.
+     */
+    public int delete(BitSet loadedFields, BitSet dirtyFields,
+                          StateManagerInternal sm);
+
+    //
+    // The following methods allow fields of an object to be read from the
+    // store to the client.  There are not any corresponding methods for
+    // update, nor delete,as those are handled via prepare and commit.  I.e.,
+    // when the prepare method of an implementation of this interface is
+    // invoked, it should examine the given sm to see if it is dirty or
+    // deleted, and update or remove it in the store accordingly.
+    //
+    
+    /**
+     * Causes values for fields required by the state manager's object to
+     * be retrieved from the store and supplied to the state manager.
+     * @param sm The state manager whose fields are to be read.
+     * @param fieldNums The fields which are to be read.
+     */
+    public void fetch(StateManagerInternal sm, int fieldNums[]);
+
+    /**
+     * Provides the means to get all instances of a particular class, or of
+     * that class and its subclasses.  If there are no instances of the given
+     * class (nor its subclass) in the store, returns null.
+     * @param pcClass Indicates the class of the instances that are in the
+     * returned Extent.
+     * @param subclasses If true, then instances subclasses of pcClass are
+     * included in the resulting Extent.  If false, then only instances of
+     * pcClass are  included.
+     * @param pm PersistenceManagerInternal making the request.
+     * @return An Extent from which instances of pcClass (and subclasses if
+     * appropriate) can be obtained.  Does not return null if there are no
+     * instances; in that case it returns an empty Extent.
+     */
+    public Extent getExtent(Class pcClass, boolean subclasses,
+                            PersistenceManagerInternal pm);
+
+    //
+    // The following methods provide mappings between object ids, state
+    // managers, and persistence capables.
+    //
+    
+    /**
+     * Creates a new Object Id for the given StateManagerInternal.  The
+     * resulting Object Id should not be given to user/client code.
+     * @param sm StateManagerInternal for which an Object Id is needed.
+     * @param pm PersistenceManagerInternal in which the sm's object is
+     * created.
+     * @return Object Id corresponding to the given StateManagerInternal
+     */
+    public Object createObjectId(StateManagerInternal sm,
+                                 PersistenceManagerInternal pm);
+
+    /**
+     * Returns an Object Id that can be given to user/client code and which is
+     * a <em>copy or external representation</em> of the given objectId. 
+     * @param objectId Object Id for which an external Object Id is needed.
+     * @param pc PersistenceCapable instance associated with this Object Id.
+     * @return An Object Id that can be given to user/client code.
+     */
+    public Object getExternalObjectId(Object objectId, PersistenceCapable pc);
+
+    /**
+     * Returns an Object Id that can be used by the runtime code and which is
+     * a <em>an internal representation</em> of the given objectId. 
+     * @param objectId Object Id for which an internal Object Id is needed.
+     * @param pm PersistenceManagerInternal which requested the Object Id.
+     * @return An Object Id that can be given to user/client code.
+     */
+    public Object getInternalObjectId(Object objectId, 
+                                 PersistenceManagerInternal pm);
+
+    /**
+    * Returns the Class of the PersistenceCapable instance identified by the
+    * given oid.
+    * @param oid object id whose java.lang.Class is wanted.
+    * @param pm PersistenceManagerInternal to use in loading the oid's
+    * Class.
+    * @return java.lang.Class of the PersistenceCapable instance identified with
+    * this oid.
+    */
+    public Class getPCClassForOid(Object oid, PersistenceManagerInternal pm);
+
+    /**  
+    * Returns true if actual Class for a PersistenceCapable instance can be
+    * resolved only in the database.
+    * @param objectId Object Id whose java.lang.Class needs to be resolved.
+    * @return true if the request needs to be resolved in the back end.
+    */  
+    public boolean hasActualPCClass(Object objectId);
+
+    /** 
+     * This method returns an object id instance corresponding to the Class 
+     * and String arguments. The String argument might have been the 
+     * result of executing toString on an object id instance. 
+     * @param pcClass the Class of the persistence-capable instance
+     * @param str the String form of the object id
+     * @return an instance of the object identity class
+     */
+    public Object newObjectIdInstance (Class pcClass, String str);
+
+    /**
+     * This method copies PK field values from internal Object Id into the
+     * Hollow instance.
+     * @param sm StateManagerInternal for which an operation is needed.
+     * @param pcClass the Class of the persistence-capable instance
+     */  
+    public void copyKeyFieldsFromObjectId(StateManagerInternal sm, Class pcClass);
+
+    //
+    // Assorted other methods.
+    //
+
+    /**
+    * Flushes all elements in the given iterator.
+    * @param it Iterator of StateManagerInternal instances to be flushed.
+    * @param pm PersistenceManagerInternal on whose behalf instances are being
+    * flushed.
+    * @throws JDOFatalDataStoreException if instances could not all be flushed
+    * as determined by <code>sm.isFlushed()</code>.
+    */
+    public void flush(Iterator it, PersistenceManagerInternal pm);
+
+    /**
+     * Returns a QueryResult instance which is then returned as the result of 
+     * Query.execute(...). This method allows support for datastore specific 
+     * query execution strategies, since each StoreManager can have its own
+     * implementation of the QueryResult interface.
+     * @param qrh the helper providing the query tree, the candidates 
+     * and the actual parameters.
+     * @return a datastore specific query result instance
+     */
+    public QueryResult newQueryResult(QueryResultHelper qrh);
+}

Added: incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManagerImpl.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManagerImpl.java (added)
+++ incubator/jdo/trunk/ri11/src/java/org/apache/jdo/store/StoreManagerImpl.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+package org.apache.jdo.store;
+
+import java.util.Iterator;
+
+import javax.jdo.JDOFatalInternalException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jdo.jdoql.BasicQueryResult;
+import org.apache.jdo.jdoql.QueryResult;
+import org.apache.jdo.jdoql.QueryResultHelper;
+import org.apache.jdo.pm.PersistenceManagerInternal;
+import org.apache.jdo.state.StateManagerInternal;
+import org.apache.jdo.util.I18NHelper;
+
+/**
+* StoreManagerImpl provides a base for fully implementing the StoreManager
+* interface. 
+*
+* @author Dave Bristor
+*/
+public abstract class StoreManagerImpl implements StoreManager {
+
+    /** Indicates whether current transaction is optimistic or not.  See
+     * {@link #flush}. */
+    protected boolean optimistic;
+
+    /** Logger instance */
+    private static final Log logger = LogFactory.getFactory().getInstance(
+        "org.apache.jdo.store"); // NOI18N
+
+    /** I18N support. */
+    private static final I18NHelper msg =
+        I18NHelper.getInstance(StoreManagerImpl.class);
+
+    /** Default constructor. */
+    protected StoreManagerImpl() { }
+
+    
+    /**
+     * Perform any actions required before StateManager's are flushed.
+     */
+    abstract protected  void preFlush();
+
+    /**
+    * Flushes all StateManagerInternals in the given Iterator.  This will in
+    * turn cause invocations of insert, delete, and update on this
+    * StoreManager. Update, in particular, must be done after this flush
+    * method is invoked, so that the value of <code>optimistic</code> is set
+    * correctly.
+    * @see org.apache.jdo.store.StoreManager#flush */
+    public void flush(Iterator it, PersistenceManagerInternal pm) {
+        this.optimistic = pm.currentTransaction().getOptimistic();
+
+        if (debugging()) {
+            logger.debug(
+                "SRMImpl.flush: begin, optimistic=" + optimistic); // NOI18N
+        }
+
+        preFlush();
+        
+        if (debugging()) {
+            logger.debug(
+                "SRMImpl.flush: completed flush commit"); // NOI18N
+        }
+
+        boolean err = false;
+
+        while (it.hasNext()) {
+            StateManagerInternal sm = (StateManagerInternal)it.next();
+            sm.preStore();
+
+            sm.replaceSCOFields();
+            sm.flush(this);
+            if ( ! sm.isFlushed()) {
+                err = true;
+                break;
+            }
+        }
+
+        if (debugging()) {
+            logger.debug("SRMImpl.flush: end, err=" + err); // NOI18N
+        }
+
+        if (err) {
+            throw new JDOFatalInternalException(
+                msg.msg("EXC_UnableToFlushAll")); // NOI18N
+        }
+    }
+
+    /**
+     * Returns a QueryResult instance which is then returned as the result of 
+     * Query.execute(...). This method allows support for datastore specific 
+     * query execution strategies, since each StoreManager can have its own
+     * implementation of the QueryResult interface. 
+     * @param qrh the helper providing the query tree, the candidates 
+     * and the actual parameters.
+     * @return a datastore specific query result instance
+     */
+    public QueryResult newQueryResult(QueryResultHelper qrh) {
+        return new BasicQueryResult(qrh);
+    }
+
+    private boolean debugging() {
+        return logger.isDebugEnabled();
+    }
+}



Mime
View raw message