it);
-
- /**
- * Don't use this method directly; use closeAll()
instead. It is intended for use
- * with try-with-resources.
- *
- * @throws Exception if this resource cannot be closed
- */
- void close() throws Exception;
-
- /**
- * Get the fetch plan associated with this Extent.
- *
- * @return the fetch plan
- * @since 2.0
- */
- FetchPlan getFetchPlan();
+ /** Get the fetch plan associated with this Extent.
+ * @return the fetch plan
+ * @since 2.0
+ */
+ FetchPlan getFetchPlan();
}
+
diff --git a/api/src/main/java/javax/jdo/FetchGroup.java b/api/src/main/java/javax/jdo/FetchGroup.java
index 2e7827bce..ca4d2acec 100644
--- a/api/src/main/java/javax/jdo/FetchGroup.java
+++ b/api/src/main/java/javax/jdo/FetchGroup.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -19,269 +19,265 @@
* FetchGroup.java
*
*/
-
+
package javax.jdo;
import java.util.Set;
/**
- * FetchGroup represents a named fetch group for a specific class or interface. A fetch group
- * instance identifies the name of the class or interface, the list of members (fields or
- * properties) to be fetched when the fetch group is active, and the recursion depth for each
- * member.
- *
- * Fetch groups are updated using methods on this interface. An instance of a class implementing
- * this interface can be obtained from {@link PersistenceManager#getFetchGroup} or {@link
- * PersistenceManagerFactory#getFetchGroup}.
- *
- *
A FetchGroup can be unscoped or can be in one of two scopes (the {@link PersistenceManager} or
- * the {@link PersistenceManagerFactory} scope). Unscoped FetchGroups do not affect any behavior. A
- * FetchGroup in PersistenceManager scope hides the corresponding FetchGroup in the
- * PersistenceManagerFactory scope.
- *
- *
- * - When a FetchGroup is obtained via {@link PersistenceManager#getFetchGroup}, it is
- * immediately in scope of its
PersistenceManager
. Subsequent modifications of
- * the FetchGroup immediately affect FetchPlan
s that contain the FetchGroup
- *
.
- * - When a FetchGroup is obtained via {@link PersistenceManagerFactory#getFetchGroup}, it is
- * unscoped.
- *
- When a FetchGroup is added to the set of active FetchGroups via {@link
- * PersistenceManagerFactory#addFetchGroups}, it is put in scope of the
- * PersistenceManagerFactory
.
- * - When a FetchGroup is removed from the set of active FetchGroups via {@link
- * PersistenceManagerFactory#removeFetchGroups}, {@link
- * PersistenceManagerFactory#removeAllFetchGroups}, or replaced via {@link
- * PersistenceManagerFactory#addFetchGroups}, it is unscoped.
- *
- *
+ * FetchGroup represents a named fetch group for a specific class or
+ * interface. A fetch group instance identifies the name of the class or
+ * interface, the list of members (fields or properties) to be fetched when
+ * the fetch group is active, and the recursion depth for each member.
+ *
+ * Fetch groups are updated using methods on this interface. An instance of
+ * a class implementing this interface can be obtained from
+ * {@link PersistenceManager#getFetchGroup} or
+ * {@link PersistenceManagerFactory#getFetchGroup}.
+ *
+ * A FetchGroup can be unscoped or can be in one of two scopes (the
+ * {@link PersistenceManager} or the {@link PersistenceManagerFactory} scope).
+ * Unscoped FetchGroups do not affect any behavior.
+ * A FetchGroup in PersistenceManager scope hides the corresponding
+ * FetchGroup in the PersistenceManagerFactory scope.
+ *
- When a FetchGroup is obtained via
+ * {@link PersistenceManager#getFetchGroup},
+ * it is immediately in scope of its
PersistenceManager
.
+ * Subsequent modifications of the FetchGroup
+ * immediately affect FetchPlan
s that contain the
+ * FetchGroup
.
+ * - When a FetchGroup is obtained via
+ * {@link PersistenceManagerFactory#getFetchGroup}, it is unscoped.
+ *
- When a FetchGroup is added to the set of active FetchGroups via
+ * {@link PersistenceManagerFactory#addFetchGroups}, it is put in scope of the
+ *
PersistenceManagerFactory
.
+ * - When a FetchGroup is removed from the set of active FetchGroups via
+ * {@link PersistenceManagerFactory#removeFetchGroups},
+ * {@link PersistenceManagerFactory#removeAllFetchGroups}, or replaced via
+ * {@link PersistenceManagerFactory#addFetchGroups}, it is unscoped.
+ *
* @version 2.2
* @since 2.2
*/
public interface FetchGroup {
- /**
- * For use with {@link #addCategory} and {@link #removeCategory} calls. This category includes
- * members defined in the default fetch group in xml or annotations. Redefining the default fetch
- * group via the API does not affect the members defined by this category.
- *
- * Using this category also sets the fetch-depth for the members in the default fetch group.
- *
- * @since 2.2
- */
- public static final String DEFAULT = "default";
+ /**
+ * For use with {@link #addCategory} and {@link #removeCategory} calls.
+ * This category includes members defined in the default fetch group
+ * in xml or annotations. Redefining the default fetch group via the API
+ * does not affect the members defined by this category.
+ *
+ * Using this category also sets the fetch-depth for the members in the
+ * default fetch group.
+ * @since 2.2
+ */
+ public static final String DEFAULT = "default";
- /**
- * For use with {@link #addCategory} and {@link #removeCategory} calls. This category includes
- * members of all relationship types.
- *
- * @since 2.2
- */
- public static final String RELATIONSHIP = "relationship";
+ /**
+ * For use with {@link #addCategory} and {@link #removeCategory} calls.
+ * This category includes members of all relationship types.
+ * @since 2.2
+ */
+ public static final String RELATIONSHIP = "relationship";
- /**
- * For use with {@link #addCategory} and {@link #removeCategory} calls. This category includes
- * members of all multi-valued types, including Collection, array, and Map types of basic and
- * relationship types.
- *
- * @since 2.2
- */
- public static final String MULTIVALUED = "multivalued";
+ /**
+ * For use with {@link #addCategory} and {@link #removeCategory} calls.
+ * This category includes members of all multi-valued types, including
+ * Collection, array, and Map types of basic and relationship types.
+ * @since 2.2
+ */
+ public static final String MULTIVALUED = "multivalued";
- /**
- * For use with {@link #addCategory} and {@link #removeCategory} calls. This category includes
- * members of all primitive and immutable object class types as defined in section 6.4 of the
- * specification, including String, Locale, Currency, BigDecimal, and BigInteger; as well as Date
- * and its jdbc subtypes and Enum types.
- *
- * @since 2.2
- */
- public static final String BASIC = "basic";
+ /**
+ * For use with {@link #addCategory} and {@link #removeCategory} calls.
+ * This category includes members of all primitive and immutable
+ * object class types as defined in section 6.4 of the specification,
+ * including String, Locale, Currency, BigDecimal, and BigInteger;
+ * as well as Date and its jdbc subtypes and Enum types.
+ * @since 2.2
+ */
+ public static final String BASIC = "basic";
- /**
- * For use with {@link #addCategory} and {@link #removeCategory} calls. This category includes all
- * members in the persistent type.
- *
- * Using this category also sets the fetch-depth for the members in the default fetch group.
- *
- * @since 2.2
- */
- public static final String ALL = "all";
+ /**
+ * For use with {@link #addCategory} and {@link #removeCategory} calls.
+ * This category includes all members in the persistent type.
+ *
+ * Using this category also sets the fetch-depth for the members in the
+ * default fetch group.
+ * @since 2.2
+ */
+ public static final String ALL = "all";
- /**
- * Return the hashCode for this instance. The hash code should combine both the class and fetch
- * group name. The hash codes for two equal instances must be identical.
- *
- * @return the hash code
- * @since 2.2
- */
- int hashCode();
+ /**
+ * Return the hashCode for this instance. The hash code should combine both
+ * the class and fetch group name. The hash codes for two equal instances
+ * must be identical.
+ * @return the hash code
+ * @since 2.2
+ */
+ int hashCode();
- /**
- * Return whether this instance is equal to the other. The equals method must compare the class
- * for identity and the fetch group name for equality.
- *
- * @return whether this instance is equal to the other
- * @since 2.2
- */
- boolean equals(Object other);
+ /**
+ * Return whether this instance is equal to the other. The equals method
+ * must compare the class for identity and the fetch group name for
+ * equality.
+ * @return whether this instance is equal to the other
+ * @since 2.2
+ */
+ boolean equals(Object other);
- /**
- * Get the name of this FetchGroup. The name is set only in the factory method.
- *
- * @return the name
- * @since 2.2
- */
- String getName();
+ /**
+ * Get the name of this FetchGroup. The name is set only in the
+ * factory method.
+ * @return the name
+ * @since 2.2
+ */
+ String getName();
- /**
- * Get the persistent type (class or interface) of this FetchGroup. The persistent type is set
- * only in the factory method(s).
- *
- * @return the persistent type
- * @since 2.2
- */
- Class getType();
+ /**
+ * Get the persistent type (class or interface) of this FetchGroup.
+ * The persistent type is set only in the factory method(s).
+ * @return the persistent type
+ * @since 2.2
+ */
+ Class getType();
- /**
- * Get the post-load property of this FetchGroup.
- *
- * @return the post-load property
- * @since 2.2
- */
- boolean getPostLoad();
+ /**
+ * Get the post-load property of this FetchGroup.
+ * @return the post-load property
+ * @since 2.2
+ */
+ boolean getPostLoad();
- /**
- * Set the post-load property of this FetchGroup.
- *
- * @param postLoad Whether to post load this fetch group
- * @return the FetchGroup
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup setPostLoad(boolean postLoad);
+ /**
+ * Set the post-load property of this FetchGroup.
+ * @param postLoad Whether to post load this fetch group
+ * @return the FetchGroup
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup setPostLoad(boolean postLoad);
- /**
- * Add the member (field or property) to the set of members in this FetchGroup.
- *
- * @param memberName the name of a member to add to the FetchGroup
- * @return the FetchGroup
- * @throws JDOUserException if the parameter is not a member of the persistent type
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup addMember(String memberName);
+ /**
+ * Add the member (field or property) to the set of members in this
+ * FetchGroup.
+ * @param memberName the name of a member to add to the FetchGroup
+ * @return the FetchGroup
+ * @throws JDOUserException if the parameter is not a member of the
+ * persistent type
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup addMember(String memberName);
- /**
- * Add the member (field or property) to the set of members in this FetchGroup. Duplicates are
- * ignored.
- *
- * @param memberNames the names of members to add to the FetchGroup
- * @return the FetchGroup
- * @throws JDOUserException if any parameter is not a member of the persistent type
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup addMembers(String... memberNames);
+ /**
+ * Add the member (field or property) to the set of members in this
+ * FetchGroup. Duplicates are ignored.
+ * @param memberNames the names of members to add to the FetchGroup
+ * @return the FetchGroup
+ * @throws JDOUserException if any parameter is not a member of the
+ * persistent type
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup addMembers(String... memberNames);
- /**
- * Remove the member (field or property) from the set of members in this FetchGroup.
- *
- * @param memberName Name of the member of the class to remove from the FetchGroup.
- * @return the FetchGroup
- * @throws JDOUserException if the parameter is not a member of the persistent type
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup removeMember(String memberName);
+ /**
+ * Remove the member (field or property) from the set of members in this FetchGroup.
+ * @param memberName Name of the member of the class to remove from the FetchGroup.
+ * @return the FetchGroup
+ * @throws JDOUserException if the parameter is not a member of the persistent type
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup removeMember(String memberName);
- /**
- * Remove the member (field or property) from the set of members in this FetchGroup. Duplicates in
- * the parameter list are eliminated before removing them from the membership.
- *
- * @param memberNames Member names of the class to remove from this FetchGroup.
- * @return the FetchGroup
- * @throws JDOUserException if any parameter is not a member of the persistent type
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup removeMembers(String... memberNames);
+ /**
+ * Remove the member (field or property) from the set of members in this
+ * FetchGroup. Duplicates in the parameter list are eliminated before
+ * removing them from the membership.
+ * @param memberNames Member names of the class to remove from this FetchGroup.
+ * @return the FetchGroup
+ * @throws JDOUserException if any parameter is not a member of the persistent type
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup removeMembers(String... memberNames);
- /**
- * Add the members (fields or properties) of the named category to the set of members in this
- * FetchGroup. This method first resolves the category name to a set of members and then adds the
- * members as if {@link #addMembers} was called. After this method executes, the category is not
- * remembered.
- *
- * @param categoryName Category to add to this FetchGroup.
- * @return the FetchGroup
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup addCategory(String categoryName);
+ /**
+ * Add the members (fields or properties) of the named category
+ * to the set of members in this FetchGroup. This method first
+ * resolves the category name to a set of members and then adds
+ * the members as if {@link #addMembers} was called. After this
+ * method executes, the category is not remembered.
+ * @param categoryName Category to add to this FetchGroup.
+ * @return the FetchGroup
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup addCategory(String categoryName);
- /**
- * Remove the members (fields or properties) of the named category from the set of members in this
- * FetchGroup. This method first resolves the category name to a set of members and then removes
- * the members as if {@link #removeMembers} was called. After this method executes, the category
- * is not remembered.
- *
- * @param categoryName Category to remove from this FetchGroup.
- * @return the FetchGroup
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup removeCategory(String categoryName);
+ /**
+ * Remove the members (fields or properties) of the named category
+ * from the set of members in this FetchGroup. This method first
+ * resolves the category name to a set of members and then removes
+ * the members as if {@link #removeMembers} was called. After this
+ * method executes, the category is not remembered.
+ * @param categoryName Category to remove from this FetchGroup.
+ * @return the FetchGroup
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup removeCategory(String categoryName);
- /**
- * Set the recursion-depth for this member. The default is 1. A value of 0 means don't fetch the
- * member (as if the member were omitted entirely). A value of -1 means fetch all instances
- * reachable via this member.
- *
- * @return the FetchGroup
- * @param memberName the name of the field or property
- * @param recursionDepth the value for the recursion-depth property
- * @throws JDOUserException if the member does not exist
- * @throws JDOUserException if the FetchGroup is unmodifiable
- * @since 2.2
- */
- FetchGroup setRecursionDepth(String memberName, int recursionDepth);
+ /**
+ * Set the recursion-depth for this member. The default is 1. A value of 0
+ * means don't fetch the member (as if the member were omitted entirely).
+ * A value of -1 means fetch all instances reachable via this member.
+ * @return the FetchGroup
+ * @param memberName the name of the field or property
+ * @param recursionDepth the value for the recursion-depth property
+ * @throws JDOUserException if the member does not exist
+ * @throws JDOUserException if the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ FetchGroup setRecursionDepth(String memberName, int recursionDepth);
- /**
- * Get the recursion-depth for this member.
- *
- * @param memberName the name of the field or property
- * @return the recursion-depth for this member
- * @throws JDOUserException if the member is not in the FetchGroup
- * @since 2.2
- */
- int getRecursionDepth(String memberName);
+ /**
+ * Get the recursion-depth for this member.
+ * @param memberName the name of the field or property
+ * @return the recursion-depth for this member
+ * @throws JDOUserException if the member is not in the FetchGroup
+ * @since 2.2
+ */
+ int getRecursionDepth(String memberName);
- /**
- * Return an immutable Set of String containing the names of all members. The Set is a copy of the
- * currently defined members and will not change based on subsequent changes to the membership in
- * the FetchGroup.
- *
- * @return an immutable Set containing the names of all members in the FetchGroup
- * @since 2.2
- */
- Set getMembers();
+ /**
+ * Return an immutable Set of String containing the names of all members.
+ * The Set is a copy of the currently defined members and will not change
+ * based on subsequent changes to the membership in the FetchGroup.
+ * @return an immutable Set containing the names of all members
+ * in the FetchGroup
+ * @since 2.2
+ */
+ Set getMembers();
- /**
- * Make this FetchGroup unmodifiable. If already unmodifiable, this method has no effect.
- *
- * @return the FetchGroup
- * @since 2.2
- */
- FetchGroup setUnmodifiable();
+ /**
+ * Make this FetchGroup unmodifiable. If already unmodifiable, this method
+ * has no effect.
+ * @return the FetchGroup
+ * @since 2.2
+ */
+ FetchGroup setUnmodifiable();
- /**
- * Return whether this FetchGroup is unmodifiable. If so, methods {@link #setPostLoad}, {@link
- * #addMember}, {@link #removeMember}, {@link #addMembers}, {@link #removeMembers}, {@link
- * #addCategory}, and {@link #removeCategory} will throw {@link JDOUserException}.
- *
- * @return whether the FetchGroup is unmodifiable
- * @since 2.2
- */
- boolean isUnmodifiable();
+ /**
+ * Return whether this FetchGroup is unmodifiable. If so, methods
+ * {@link #setPostLoad}, {@link #addMember}, {@link #removeMember},
+ * {@link #addMembers}, {@link #removeMembers},
+ * {@link #addCategory}, and {@link #removeCategory}
+ * will throw {@link JDOUserException}.
+ * @return whether the FetchGroup is unmodifiable
+ * @since 2.2
+ */
+ boolean isUnmodifiable();
}
diff --git a/api/src/main/java/javax/jdo/FetchPlan.java b/api/src/main/java/javax/jdo/FetchPlan.java
index 0548b5cd2..85ea6722e 100644
--- a/api/src/main/java/javax/jdo/FetchPlan.java
+++ b/api/src/main/java/javax/jdo/FetchPlan.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -19,221 +19,211 @@
* FetchPlan.java
*
*/
-
+
package javax.jdo;
import java.util.Collection;
import java.util.Set;
/**
- * Fetch groups are activated using methods on this interface. An instance of this interface can be
- * obtained from {@link PersistenceManager#getFetchPlan}, {@link Extent#getFetchPlan}, and {@link
- * Query#getFetchPlan}. When a Query
or Extent
is retrieved from a
- * PersistenceManager
, its FetchPlan
is initialized to the same settings as that
- * of the PersistenceManager
. Subsequent modifications of the Query
or
- * Extent
's FetchPlan
are not reflected in the FetchPlan
of
- * the PersistenceManager
.
- *
+ * Fetch groups are activated using methods on this interface. An
+ * instance of this interface can be obtained from {@link
+ * PersistenceManager#getFetchPlan}, {@link Extent#getFetchPlan}, and
+ * {@link Query#getFetchPlan}. When a Query
or
+ * Extent
is retrieved from a
+ * PersistenceManager
, its FetchPlan
is
+ * initialized to the same settings as that of the
+ * PersistenceManager
. Subsequent modifications of the
+ * Query
or Extent
's FetchPlan
+ * are not reflected in the FetchPlan
of the
+ * PersistenceManager
.
* @version 2.0
* @since 2.0
*/
public interface FetchPlan {
- /**
- * For use with {@link #addGroup}, {@link #removeGroup}, and the various {@link #setGroups} calls.
- * Value: default
.
- *
- * @since 2.0
- */
- public static final String DEFAULT = "default";
-
- /**
- * For use with {@link #addGroup}, {@link #removeGroup}, and the various {@link #setGroups} calls.
- * Value: all
.
- *
- * @since 2.0
- */
- public static final String ALL = "all";
-
- /**
- * For use with {@link PersistenceManager#detachCopy} and {@link #setDetachmentOptions}. Specifies
- * that fields that are loaded but not in the current fetch plan should be unloaded prior to
- * detachment.
- *
- * @since 2.0
- */
- public static final int DETACH_UNLOAD_FIELDS = 2;
-
- /**
- * For use with {@link PersistenceManager#detachCopy} and {@link #setDetachmentOptions}. Specifies
- * that fields that are not loaded but are in the current fetch plan should be loaded prior to
- * detachment.
- *
- * @since 2.0
- */
- public static final int DETACH_LOAD_FIELDS = 1;
-
- /**
- * For use with {@link #setFetchSize}. Value: -1.
- *
- * @since 2.0
- */
- public static final int FETCH_SIZE_GREEDY = -1;
-
- /**
- * For use with {@link #setFetchSize}. Value: 0.
- *
- * @since 2.0
- */
- public static final int FETCH_SIZE_OPTIMAL = 0;
-
- /**
- * Add the fetch group to the set of active fetch groups.
- *
- * @param fetchGroupName Name of the FetchGroup to add
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan addGroup(String fetchGroupName);
-
- /**
- * Remove the fetch group from the set active fetch groups.
- *
- * @param fetchGroupName Name of the FetchGroup to remove
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan removeGroup(String fetchGroupName);
-
- /**
- * Remove all active groups leaving no active fetch group.
- *
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan clearGroups();
-
- /**
- * Return an immutable Set containing the names of all active fetch groups. The Set is a copy of
- * the currently active groups and will not change based on subsequent changes to the groups.
- *
- * @return an immutable Set containing the names of all currently active fetch groups
- * @since 2.0
- */
- Set getGroups();
-
- /**
- * Set a collection of groups.
- *
- * @param fetchGroupNames a collection of names of fetch groups
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan setGroups(Collection fetchGroupNames);
-
- /**
- * Set a collection of groups.
- *
- * @param fetchGroupNames a String array of names of fetch groups
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan setGroups(String... fetchGroupNames);
-
- /**
- * Set the active fetch groups to the single named fetch group.
- *
- * @param fetchGroupName the single fetch group
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan setGroup(String fetchGroupName);
-
- /**
- * Set the maximum fetch depth when fetching. A value of 0 has no meaning and will throw a
- * JDOUserException. A value of -1 means that no limit is placed on fetching. A positive integer
- * will result in that number of references from the initial object to be fetched.
- *
- * @param fetchDepth the depth
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan setMaxFetchDepth(int fetchDepth);
-
- /**
- * Return the maximum fetch depth used when fetching instances.
- *
- * @return the maximum fetch depth
- * @since 2.0
- */
- int getMaxFetchDepth();
-
- /**
- * Set the roots for DetachAllOnCommit.
- *
- * @param roots Collection of the detachment roots.
- * @return This FetchPlan
- * @since 2.0
- */
- FetchPlan setDetachmentRoots(Collection roots);
-
- /**
- * Get the roots for DetachAllOnCommit.
- *
- * @return Collection of detachment roots.
- * @since 2.0
- */
- Collection getDetachmentRoots();
-
- /**
- * Set the root classes for DetachAllOnCommit.
- *
- * @param rootClasses The root classes.
- * @return This FetchPlan
- * @since 2.0
- */
- FetchPlan setDetachmentRootClasses(Class... rootClasses);
-
- /**
- * Get the root classes for DetachAllOnCommit.
- *
- * @return The detachment root classes
- * @since 2.0
- */
- Class[] getDetachmentRootClasses();
-
- /**
- * Set the fetch size for large result set support. Use {@link #FETCH_SIZE_OPTIMAL} to unset, and
- * {@link #FETCH_SIZE_GREEDY} to force loading of everything.
- *
- * @param fetchSize the fetch size
- * @return the FetchPlan
- * @since 2.0
- */
- FetchPlan setFetchSize(int fetchSize);
-
- /**
- * Return the fetch size, or {@link #FETCH_SIZE_OPTIMAL} if not set, or {@link #FETCH_SIZE_GREEDY}
- * to fetch all.
- *
- * @return the fetch size
- * @since 2.0
- */
- int getFetchSize();
-
- /**
- * Set options to be used during detachment. Options are {@link #DETACH_LOAD_FIELDS} and {@link
- * #DETACH_UNLOAD_FIELDS}.
- *
- * @param options Options for use during detachment.
- * @return This FetchPlan
- */
- FetchPlan setDetachmentOptions(int options);
-
- /**
- * Get options used during detachment.
- *
- * @return Options to use during detachment.
- */
- int getDetachmentOptions();
+ /**
+ * For use with {@link #addGroup}, {@link #removeGroup}, and the
+ * various {@link #setGroups} calls. Value: default
.
+ * @since 2.0
+ */
+ public static final String DEFAULT = "default";
+
+ /**
+ * For use with {@link #addGroup}, {@link #removeGroup}, and the
+ * various {@link #setGroups} calls. Value: all
.
+ * @since 2.0
+ */
+ public static final String ALL = "all";
+
+ /**
+ * For use with {@link PersistenceManager#detachCopy} and
+ * {@link #setDetachmentOptions}. Specifies that
+ * fields that are loaded but not in the current fetch plan should
+ * be unloaded prior to detachment.
+ * @since 2.0
+ */
+ public static final int DETACH_UNLOAD_FIELDS = 2;
+
+ /**
+ * For use with {@link PersistenceManager#detachCopy} and
+ * {@link #setDetachmentOptions}. Specifies that
+ * fields that are not loaded but are in the current fetch plan should
+ * be loaded prior to detachment.
+ * @since 2.0
+ */
+ public static final int DETACH_LOAD_FIELDS = 1;
+
+ /**
+ * For use with {@link #setFetchSize}. Value: -1.
+ * @since 2.0
+ */
+ public static final int FETCH_SIZE_GREEDY = -1;
+
+ /**
+ * For use with {@link #setFetchSize}. Value: 0.
+ * @since 2.0
+ */
+ public static final int FETCH_SIZE_OPTIMAL = 0;
+
+ /**
+ * Add the fetch group to the set of active fetch groups.
+ * @param fetchGroupName Name of the FetchGroup to add
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan addGroup(String fetchGroupName);
+
+ /**
+ * Remove the fetch group from the set active fetch groups.
+ * @param fetchGroupName Name of the FetchGroup to remove
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan removeGroup(String fetchGroupName);
+
+ /**
+ * Remove all active groups leaving no active fetch group.
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan clearGroups();
+
+ /**
+ * Return an immutable Set containing the names
+ * of all active fetch groups. The Set is a copy of
+ * the currently active groups and will not change
+ * based on subsequent changes to the groups.
+ * @return an immutable Set containing the names
+ * of all currently active fetch groups
+ * @since 2.0
+ */
+ Set getGroups();
+
+ /**
+ * Set a collection of groups.
+ * @param fetchGroupNames a collection of names of fetch groups
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setGroups(Collection fetchGroupNames);
+
+ /**
+ * Set a collection of groups.
+ * @param fetchGroupNames a String array of names of fetch groups
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setGroups(String... fetchGroupNames);
+
+ /**
+ * Set the active fetch groups to the single named fetch group.
+ * @param fetchGroupName the single fetch group
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setGroup(String fetchGroupName);
+
+ /**
+ * Set the maximum fetch depth when fetching.
+ * A value of 0 has no meaning and will throw a JDOUserException.
+ * A value of -1 means that no limit is placed on fetching.
+ * A positive integer will result in that number of references from the
+ * initial object to be fetched.
+ * @param fetchDepth the depth
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setMaxFetchDepth(int fetchDepth);
+
+ /**
+ * Return the maximum fetch depth used when fetching instances.
+ * @return the maximum fetch depth
+ * @since 2.0
+ */
+ int getMaxFetchDepth();
+
+ /**
+ * Set the roots for DetachAllOnCommit.
+ * @param roots Collection of the detachment roots.
+ * @return This FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setDetachmentRoots(Collection roots);
+
+ /**
+ * Get the roots for DetachAllOnCommit.
+ * @return Collection of detachment roots.
+ * @since 2.0
+ */
+ Collection getDetachmentRoots();
+
+ /**
+ * Set the root classes for DetachAllOnCommit.
+ * @param rootClasses The root classes.
+ * @return This FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setDetachmentRootClasses(Class... rootClasses);
+
+ /**
+ * Get the root classes for DetachAllOnCommit.
+ * @return The detachment root classes
+ * @since 2.0
+ */
+ Class[] getDetachmentRootClasses();
+
+ /**
+ * Set the fetch size for large result set support. Use
+ * {@link #FETCH_SIZE_OPTIMAL} to unset, and {@link #FETCH_SIZE_GREEDY}
+ * to force loading of everything.
+ * @param fetchSize the fetch size
+ * @return the FetchPlan
+ * @since 2.0
+ */
+ FetchPlan setFetchSize(int fetchSize);
+
+ /**
+ * Return the fetch size, or {@link #FETCH_SIZE_OPTIMAL} if not set,
+ * or {@link #FETCH_SIZE_GREEDY} to fetch all.
+ * @return the fetch size
+ * @since 2.0
+ */
+ int getFetchSize();
+
+ /**
+ * Set options to be used during detachment. Options are {@link
+ * #DETACH_LOAD_FIELDS} and {@link #DETACH_UNLOAD_FIELDS}.
+ * @param options Options for use during detachment.
+ * @return This FetchPlan
+ */
+ FetchPlan setDetachmentOptions(int options);
+
+ /**
+ * Get options used during detachment.
+ * @return Options to use during detachment.
+ */
+ int getDetachmentOptions();
+
}
+
diff --git a/api/src/main/java/javax/jdo/InstanceCallbacks.java b/api/src/main/java/javax/jdo/InstanceCallbacks.java
index 2aad32ab8..640e963ee 100644
--- a/api/src/main/java/javax/jdo/InstanceCallbacks.java
+++ b/api/src/main/java/javax/jdo/InstanceCallbacks.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -19,44 +19,53 @@
* InstanceCallbacks.java
*
*/
-
+
package javax.jdo;
-/**
- * A PersistenceCapable
class that provides callback methods for life cycle events
- * implements this interface.
+/** A PersistenceCapable
class that provides callback methods for life
+ * cycle events implements this interface.
*
- * For JDO 2.0, InstanceCallbacks
has been refactored to extend four other
- * interfaces, without changing any of the methods or semantics. This allows fine-grained control
- * over callbacks, for example to allow a class to implement the load callback without implementing
- * any of the other callbacks. For backward compatibility with JDO 1.0, the InstanceCallbacks
- *
interface is preserved.
+ *
For JDO 2.0, InstanceCallbacks
has been refactored to extend
+ * four other interfaces, without changing any of the methods or semantics.
+ * This allows fine-grained control over callbacks, for
+ * example to allow a class to implement the load callback without
+ * implementing any of the other callbacks. For backward compatibility
+ * with JDO 1.0, the InstanceCallbacks
interface is preserved.
*
- *
Classes which include non-persistent fields whose values depend on the values of persistent
- * fields require callbacks on specific JDO instance life cycle events in order to correctly
- * populate the values in these fields.
+ *
Classes which include non-persistent fields whose values depend
+ * on the values of persistent fields require callbacks on specific
+ * JDO instance life cycle events in order to correctly populate the
+ * values in these fields.
*
- *
The callbacks might also be used if the persistent instances need to be put into the runtime
- * infrastructure of the application. For example, a persistent instance might notify other
- * instances on changes to state. The persistent instance might be in a list of managed instances.
- * When the persistent instance is made hollow, it can no longer generate change events, and the
- * persistent instance should be removed from the list of managed instances.
+ *
The callbacks might also be used if the persistent instances
+ * need to be put into the runtime infrastructure of the application.
+ * For example, a persistent instance might notify other instances
+ * on changes to state. The persistent instance might be in a list of
+ * managed instances. When the persistent instance is made hollow,
+ * it can no longer generate change events, and the persistent
+ * instance should be removed from the list of managed instances.
*
- *
To implement this, the application programmer would implement jdoPostLoad
to put
- * itself into the list of managed instances, and implement jdoPreClear
to remove
- * itself from the list. With JDO 1.0, the domain class would be declared to implement
- * InstanceCallbacks
. With JDO 2.0, the domain class would be declared to implement
- * javax.jdo.listener.LoadCallback
and javax.jdo.listener.ClearCallback
.
+ *
To implement this, the application programmer would implement
+ * jdoPostLoad
to put itself into the list of managed
+ * instances, and implement jdoPreClear
to remove itself from
+ * the list. With JDO 1.0, the domain class would be declared to implement
+ * InstanceCallbacks
. With JDO 2.0, the domain class
+ * would be declared to implement
+ * javax.jdo.listener.LoadCallback
and
+ * javax.jdo.listener.ClearCallback
.
*
- *
Note that JDO does not manage the state of non-persistent fields, and when a JDO instance
- * transitions to hollow, JDO clears the persistent fields. It is the programmer's responsibility to
- * clear non-persistent fields so that garbage collection of referred instances can occur.
+ *
Note that JDO does not manage the state of non-persistent
+ * fields, and when a JDO instance transitions to hollow, JDO clears
+ * the persistent fields. It is the programmer's responsibility to
+ * clear non-persistent fields so that garbage collection of
+ * referred instances can occur.
*
* @since 1.0
* @version 2.0
*/
-public interface InstanceCallbacks
- extends javax.jdo.listener.ClearCallback,
+public interface InstanceCallbacks
+ extends javax.jdo.listener.ClearCallback,
javax.jdo.listener.DeleteCallback,
javax.jdo.listener.LoadCallback,
- javax.jdo.listener.StoreCallback {}
+ javax.jdo.listener.StoreCallback {
+}
diff --git a/api/src/main/java/javax/jdo/JDOCanRetryException.java b/api/src/main/java/javax/jdo/JDOCanRetryException.java
index 59d10e5aa..8296fc394 100644
--- a/api/src/main/java/javax/jdo/JDOCanRetryException.java
+++ b/api/src/main/java/javax/jdo/JDOCanRetryException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,81 +22,74 @@
package javax.jdo;
-/**
- * This is the base class for exceptions that can be retried.
+/** This is the base class for exceptions that can be retried.
*
* @version 1.0
*/
public class JDOCanRetryException extends JDOException {
- private static final long serialVersionUID = 3046202905626157173L;
-
- /** Constructs a new JDOCanRetryException
without a detail message. */
- public JDOCanRetryException() {}
-
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOCanRetryException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOCanRetryException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ private static final long serialVersionUID = 3046202905626157173L;
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOCanRetryException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOCanRetryException
without a detail message.
+ */
+ public JDOCanRetryException() {
+ }
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message and failed
- * object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOCanRetryException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDOCanRetryException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOCanRetryException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOCanRetryException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOCanRetryException
with the specified detail
+ * message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOCanRetryException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
+
+ /**
+ * Constructs a new JDOCanRetryException
with the specified detail
+ * message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOCanRetryException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
+
+ /** Constructs a new JDOCanRetryException
with the specified detail message
+ * and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOCanRetryException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /** Constructs a new JDOCanRetryException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOCanRetryException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
- /**
- * Constructs a new JDOCanRetryException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOCanRetryException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /** Constructs a new JDOCanRetryException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOCanRetryException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
diff --git a/api/src/main/java/javax/jdo/JDODataStoreException.java b/api/src/main/java/javax/jdo/JDODataStoreException.java
index b08c47036..4437d10a8 100644
--- a/api/src/main/java/javax/jdo/JDODataStoreException.java
+++ b/api/src/main/java/javax/jdo/JDODataStoreException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,81 +22,78 @@
package javax.jdo;
-/**
- * This class represents data store exceptions that can be retried.
+/** This class represents data store exceptions that can be retried.
*
* @version 1.0
*/
public class JDODataStoreException extends JDOCanRetryException {
- private static final long serialVersionUID = -8728485891077403354L;
+ private static final long serialVersionUID = -8728485891077403354L;
- /** Constructs a new JDODataStoreException
without a detail message. */
- public JDODataStoreException() {}
+ /**
+ * Constructs a new JDODataStoreException
without a detail message.
+ */
+ public JDODataStoreException() {
+ }
- /**
- * Constructs a new JDODataStoreException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDODataStoreException(String msg) {
- super(msg);
- }
+ /**
+ * Constructs a new JDODataStoreException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDODataStoreException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDODataStoreException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDODataStoreException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDODataStoreException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDODataStoreException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDODataStoreException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDODataStoreException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDODataStoreException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDODataStoreException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDODataStoreException
with the specified detail message and
- * failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDODataStoreException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDODataStoreException
with the specified detail message
+ * and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDODataStoreException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /**
+ * Constructs a new JDODataStoreException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDODataStoreException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
- /**
- * Constructs a new JDODataStoreException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDODataStoreException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
-
- /**
- * Constructs a new JDODataStoreException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDODataStoreException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDODataStoreException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDODataStoreException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
+
diff --git a/api/src/main/java/javax/jdo/JDODetachedFieldAccessException.java b/api/src/main/java/javax/jdo/JDODetachedFieldAccessException.java
index 72fd5b2ec..011f6cda3 100644
--- a/api/src/main/java/javax/jdo/JDODetachedFieldAccessException.java
+++ b/api/src/main/java/javax/jdo/JDODetachedFieldAccessException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,67 +22,61 @@
package javax.jdo;
-/**
- * This class represents exceptions caused by access of an unloaded field while the instance is
- * detached.
+/** This class represents exceptions caused by access of an unloaded field while
+ * the instance is detached.
*
* @version 2.0
* @since 2.0
*/
public class JDODetachedFieldAccessException extends JDOUserException {
- private static final long serialVersionUID = 5035418119865472625L;
-
- /**
- * Constructs a new JDODetachedFieldAccessException
without a detail message.
- *
- * @since 2.0
- */
- public JDODetachedFieldAccessException() {}
+ private static final long serialVersionUID = 5035418119865472625L;
- /**
- * Constructs a new JDODetachedFieldAccessException
with the specified detail
- * message.
- *
- * @param msg the detail message.
- * @since 2.0
- */
- public JDODetachedFieldAccessException(String msg) {
- super(msg);
- }
+ /**
+ * Constructs a new JDODetachedFieldAccessException
without a detail message.
+ * @since 2.0
+ */
+ public JDODetachedFieldAccessException() {
+ }
- /**
- * Constructs a new JDODetachedFieldAccessException
with the specified detail message
- * and failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDODetachedFieldAccessException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDODetachedFieldAccessException
with the
+ * specified detail message.
+ * @param msg the detail message.
+ * @since 2.0
+ */
+ public JDODetachedFieldAccessException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDODetachedFieldAccessException
with the specified detail message
- * and nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @since 2.0
- */
- public JDODetachedFieldAccessException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /** Constructs a new JDODetachedFieldAccessException
+ * with the specified detail message and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDODetachedFieldAccessException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /**
+ * Constructs a new JDODetachedFieldAccessException
with the
+ * specified detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @since 2.0
+ */
+ public JDODetachedFieldAccessException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDODetachedFieldAccessException
with the specified detail message
- * and nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @since 2.0
- */
- public JDODetachedFieldAccessException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDODetachedFieldAccessException
with the
+ * specified detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @since 2.0
+ */
+ public JDODetachedFieldAccessException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
}
diff --git a/api/src/main/java/javax/jdo/JDOEnhanceException.java b/api/src/main/java/javax/jdo/JDOEnhanceException.java
index 56afd05c2..dc8ed5353 100644
--- a/api/src/main/java/javax/jdo/JDOEnhanceException.java
+++ b/api/src/main/java/javax/jdo/JDOEnhanceException.java
@@ -18,43 +18,49 @@
/**
* Exception thrown when an error occurs during enhancement.
- *
* @since 3.0
*/
-public class JDOEnhanceException extends JDOException {
- private static final long serialVersionUID = 7953336394264555958L;
+public class JDOEnhanceException extends JDOException
+{
+ private static final long serialVersionUID = 7953336394264555958L;
- /** Constructs a new JDOEnhanceException
without a detail message. */
- public JDOEnhanceException() {}
+ /**
+ * Constructs a new JDOEnhanceException
without a
+ * detail message.
+ */
+ public JDOEnhanceException()
+ {
+ }
- /**
- * Constructs a new JDOEnhanceException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOEnhanceException(String msg) {
- super(msg);
- }
+ /**
+ * Constructs a new JDOEnhanceException
with the
+ * specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOEnhanceException(String msg)
+ {
+ super(msg);
+ }
- /**
- * Constructs a new JDOEnhanceException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOEnhanceException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOEnhanceException
with the
+ * specified detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOEnhanceException(String msg, Throwable[] nested)
+ {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDOEnhanceException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOEnhanceException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOEnhanceException
with the
+ * specified detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOEnhanceException(String msg, Throwable nested)
+ {
+ super(msg, nested);
+ }
}
diff --git a/api/src/main/java/javax/jdo/JDOEnhancer.java b/api/src/main/java/javax/jdo/JDOEnhancer.java
index 1c6306f17..08deb8091 100644
--- a/api/src/main/java/javax/jdo/JDOEnhancer.java
+++ b/api/src/main/java/javax/jdo/JDOEnhancer.java
@@ -18,144 +18,135 @@
import java.lang.instrument.ClassFileTransformer;
import java.util.Properties;
+
import javax.jdo.metadata.JDOMetadata;
/**
* Interface for a JDO Enhancer.
- *
* @since 3.0
*/
-public interface JDOEnhancer extends ClassFileTransformer {
- /**
- * Return non-configurable properties of this JDOEnhancer. Properties with keys "VendorName" and
- * "VersionNumber" are required. Other keys are optional.
- *
- * @return the non-configurable properties of this JDOEnhancer.
- */
- Properties getProperties();
-
- /**
- * Whether to provide verbose output
- *
- * @param flag Verbose?
- * @return The enhancer
- */
- JDOEnhancer setVerbose(boolean flag);
-
- /**
- * Mutator to set the location where enhanced classes are written. Mutator to set the location
- * where enhanced classes are written. If this method is not called, classes will be enhanced in
- * place, overwriting the existing classes. If overwriting classes in a jar file, the existing
- * files in the jar file will be written unchanged except for the enhanced classes. The directory
- * name can be absolute or relative.
- *
- * @param dirName Name of the directory
- * @return The enhancer
- */
- JDOEnhancer setOutputDirectory(String dirName);
-
- /**
- * Mutator to set the class loader to use for loading classes.
- *
- * @param loader ClassLoader to use
- * @return The enhancer
- */
- JDOEnhancer setClassLoader(ClassLoader loader);
-
- /**
- * Add a persistence-unit to the items to be enhanced.
- *
- * @param persistenceUnit Name of the persistence unit
- * @return The enhancer
- */
- JDOEnhancer addPersistenceUnit(String persistenceUnit);
-
- /**
- * Add an in-memory class to the items to be enhanced. The class name should be of the form
- * "mydomain.MyClass".
- *
- * @param className Name of the class
- * @param bytes The bytes of the class
- * @return The enhancer
- */
- JDOEnhancer addClass(String className, byte[] bytes);
-
- /**
- * Add class(es) to the items to be enhanced. The class names can be absolute file names, relative
- * file names, or names of CLASSPATH resources.
- *
- * @param classNames Names of the classes
- * @return The enhancer
- */
- JDOEnhancer addClasses(String... classNames);
-
- /**
- * Add metadata file(s) to the items to be enhanced. The metadata file names can be absolute file
- * names, relative file names, or names of CLASSPATH resources. They should be JDO XML metadata
- * files.
- *
- * @param metadataFiles Names of the files
- * @return The enhancer
- */
- JDOEnhancer addFiles(String... metadataFiles);
-
- /**
- * Add a jar file to the items to be enhanced. The jar file name can be absolute, or relative or a
- * CLASSPATH resource.
- *
- * @param jarFileName Name of the jar file
- * @return The enhancer
- */
- JDOEnhancer addJar(String jarFileName);
-
- /**
- * Method to enhance the items specified using addJar, addFiles, addClasses, addClass,
- * addPersistenceUnit.
- *
- * @return Number of classes enhanced
- * @throws JDOEnhanceException if an error occurs during enhancement. If multiple errors occur
- * then the nested exceptions provides this detail.
- */
- int enhance();
-
- /**
- * Method to validate the items specified using addJar, addFiles, addClasses, addClass,
- * addPersistenceUnit.
- *
- * @return Number of classes validated
- * @throws JDOEnhanceException if an error occurs during validation. If multiple errors occur then
- * the nested exceptions provides this detail.
- */
- int validate();
-
- /**
- * Method to retrieve the (enhanced) bytes of the specified class. Only applies to the classes
- * enhanced in the most recent enhance() call. If no enhance has yet been performed will throw a
- * JDOEnhanceException. If the specified class hasn't been enhanced then will throw a
- * JDOEnhanceException.
- *
- * @param className Name of the class (of the form "mydomain.MyClass")
- * @return Enhanced bytes
- */
- byte[] getEnhancedBytes(String className);
-
- /**
- * Method to register metadata with the enhancement process managed by this JDOEnhancer
- *
. Metadata can be created using the method {@link #newMetadata}. If there is already
- * metadata registered for a class contained in this metadata object then a JDOUserException will
- * be thrown.
- *
- * @param metadata The Metadata to register.
- * @since 3.0
- */
- void registerMetadata(JDOMetadata metadata);
-
- /**
- * Method to return a new metadata object that can be subsequently modified and registered with
- * the enhancement process using the method {@link #registerMetadata}.
- *
- * @return The metadata
- * @since 3.0
- */
- JDOMetadata newMetadata();
+public interface JDOEnhancer extends ClassFileTransformer
+{
+ /**
+ * Return non-configurable properties of this JDOEnhancer.
+ * Properties with keys "VendorName" and "VersionNumber" are required.
+ * Other keys are optional.
+ * @return the non-configurable properties of this JDOEnhancer.
+ */
+ Properties getProperties();
+
+ /**
+ * Whether to provide verbose output
+ * @param flag Verbose?
+ * @return The enhancer
+ */
+ JDOEnhancer setVerbose(boolean flag);
+
+ /**
+ * Mutator to set the location where enhanced classes are written.
+ * Mutator to set the location where enhanced classes are written.
+ * If this method is not called, classes will be enhanced in place,
+ * overwriting the existing classes. If overwriting classes in a jar file,
+ * the existing files in the jar file will be written unchanged except
+ * for the enhanced classes. The directory name can be absolute or relative.
+ * @param dirName Name of the directory
+ * @return The enhancer
+ */
+ JDOEnhancer setOutputDirectory(String dirName);
+
+ /**
+ * Mutator to set the class loader to use for loading classes.
+ * @param loader ClassLoader to use
+ * @return The enhancer
+ */
+ JDOEnhancer setClassLoader(ClassLoader loader);
+
+ /**
+ * Add a persistence-unit to the items to be enhanced.
+ * @param persistenceUnit Name of the persistence unit
+ * @return The enhancer
+ */
+ JDOEnhancer addPersistenceUnit(String persistenceUnit);
+
+ /**
+ * Add an in-memory class to the items to be enhanced.
+ * The class name should be of the form "mydomain.MyClass".
+ * @param className Name of the class
+ * @param bytes The bytes of the class
+ * @return The enhancer
+ */
+ JDOEnhancer addClass(String className, byte[] bytes);
+
+ /**
+ * Add class(es) to the items to be enhanced.
+ * The class names can be absolute file names, relative file names, or
+ * names of CLASSPATH resources.
+ * @param classNames Names of the classes
+ * @return The enhancer
+ */
+ JDOEnhancer addClasses(String... classNames);
+
+ /**
+ * Add metadata file(s) to the items to be enhanced.
+ * The metadata file names can be absolute file names, relative file names, or
+ * names of CLASSPATH resources. They should be JDO XML metadata files.
+ * @param metadataFiles Names of the files
+ * @return The enhancer
+ */
+ JDOEnhancer addFiles(String... metadataFiles);
+
+ /**
+ * Add a jar file to the items to be enhanced.
+ * The jar file name can be absolute, or relative or a CLASSPATH resource.
+ * @param jarFileName Name of the jar file
+ * @return The enhancer
+ */
+ JDOEnhancer addJar(String jarFileName);
+
+ /**
+ * Method to enhance the items specified using addJar, addFiles, addClasses, addClass,
+ * addPersistenceUnit.
+ * @return Number of classes enhanced
+ * @throws JDOEnhanceException if an error occurs during enhancement. If multiple
+ * errors occur then the nested exceptions provides this detail.
+ */
+ int enhance();
+
+ /**
+ * Method to validate the items specified using addJar, addFiles, addClasses, addClass,
+ * addPersistenceUnit.
+ * @return Number of classes validated
+ * @throws JDOEnhanceException if an error occurs during validation. If multiple
+ * errors occur then the nested exceptions provides this detail.
+ */
+ int validate();
+
+ /**
+ * Method to retrieve the (enhanced) bytes of the specified class.
+ * Only applies to the classes enhanced in the most recent enhance() call.
+ * If no enhance has yet been performed will throw a JDOEnhanceException.
+ * If the specified class hasn't been enhanced then will throw a JDOEnhanceException.
+ * @param className Name of the class (of the form "mydomain.MyClass")
+ * @return Enhanced bytes
+ */
+ byte[] getEnhancedBytes(String className);
+
+ /**
+ * Method to register metadata with the enhancement process managed by this
+ * JDOEnhancer
.
+ * Metadata can be created using the method {@link #newMetadata}.
+ * If there is already metadata registered for a class contained in this metadata
+ * object then a JDOUserException will be thrown.
+ * @param metadata The Metadata to register.
+ * @since 3.0
+ */
+ void registerMetadata(JDOMetadata metadata);
+
+ /**
+ * Method to return a new metadata object that can be subsequently modified
+ * and registered with the enhancement process using the method {@link #registerMetadata}.
+ * @return The metadata
+ * @since 3.0
+ */
+ JDOMetadata newMetadata();
}
diff --git a/api/src/main/java/javax/jdo/JDOException.java b/api/src/main/java/javax/jdo/JDOException.java
index 3ea68ec9c..18007f6cb 100644
--- a/api/src/main/java/javax/jdo/JDOException.java
+++ b/api/src/main/java/javax/jdo/JDOException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -24,291 +24,275 @@
import javax.jdo.spi.I18NHelper;
-/**
- * This is the root of all JDO Exceptions. It contains an optional detail message, an optional
- * nested Throwable
array and an optional failed object.
- *
+/** This is the root of all JDO Exceptions. It contains an optional detail
+ * message, an optional nested Throwable
array and an optional failed object.
* @author Craig Russell
* @version 1.0.2
*/
public class JDOException extends java.lang.RuntimeException {
- private static final long serialVersionUID = 1950979275859696534L;
-
- /**
- * This exception was generated because of an exception in the runtime library.
- *
- * @serial the nested Throwable
array
- */
- Throwable[] nested;
-
- /**
- * This exception may be the result of incorrect parameters supplied to an API. This is the object
- * from which the user can determine the cause of the problem.
- *
- * @serial the failed Object
- */
- Object failed;
-
- /** The Internationalization message helper. */
- private static I18NHelper msg = I18NHelper.getInstance("javax.jdo.Bundle"); // NOI18N
-
- /** Flag indicating whether printStackTrace is being executed. */
- private boolean inPrintStackTrace = false;
-
- /** Constructs a new JDOException
without a detail message. */
- public JDOException() {}
-
- /**
- * Constructs a new JDOException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a new JDOException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOException(String msg, Throwable[] nested) {
- super(msg);
- this.nested = nested;
- }
-
- /**
- * Constructs a new JDOException
with the specified detail message and nested
- * Throwable
.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOException(String msg, Throwable nested) {
- super(msg);
- this.nested = new Throwable[] {nested};
- }
-
- /**
- * Constructs a new JDOException
with the specified detail message and failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOException(String msg, Object failed) {
- super(msg);
- this.failed = failed;
- }
-
- /**
- * Constructs a new JDOException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOException(String msg, Throwable[] nested, Object failed) {
- super(msg);
- this.nested = nested;
- this.failed = failed;
- }
-
- /**
- * Constructs a new JDOException
with the specified detail message, nested
- * Throwable
, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOException(String msg, Throwable nested, Object failed) {
- super(msg);
- this.nested = new Throwable[] {nested};
- this.failed = failed;
- }
+ private static final long serialVersionUID = 1950979275859696534L;
- /**
- * The exception may include a failed object.
- *
- * @return the failed object.
- */
- public Object getFailedObject() {
- return failed;
- }
+ /** This exception was generated because of an exception in the runtime library.
+ * @serial the nested Throwable
array
+ */
+ Throwable[] nested;
+
+ /** This exception may be the result of incorrect parameters supplied to an API.
+ * This is the object from which the user can determine the cause of the problem.
+ * @serial the failed Object
+ */
+ Object failed;
- /**
- * The exception may have been caused by multiple exceptions in the runtime. If multiple objects
- * caused the problem, each failed object will have its own Exception
.
- *
- * @return the nested Throwable array.
- */
- public Throwable[] getNestedExceptions() {
- return nested;
- }
+ /**
+ * The Internationalization message helper.
+ */
+ private static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
- /**
- * Often there is only one nested exception, and this method returns it. If there are more than
- * one, then this method returns the first nested exception. If there is no nested exception, then
- * null is returned.
- *
- * @return the first or only nested Throwable.
- * @since 1.0.1
- */
- public synchronized Throwable getCause() {
- // super.printStackTrace calls getCause to handle the cause.
- // Returning null prevents the superclass from handling the cause;
- // instead the local implementation of printStackTrace should
- // handle the cause. Otherwise, the cause is printed twice.
- if (nested == null || nested.length == 0 || inPrintStackTrace) {
- return null;
- } else {
- return nested[0];
+ /**
+ * Flag indicating whether printStackTrace is being executed.
+ */
+ private boolean inPrintStackTrace = false;
+
+ /**
+ * Constructs a new JDOException
without a detail message.
+ */
+ public JDOException() {
}
- }
- /**
- * JDK 1.4 includes a new chaining mechanism for Throwable, but since JDO has its own "legacy"
- * chaining mechanism, the "standard" mechanism cannot be used. This method always throws a
- * JDOFatalInternalException.
- *
- * @param cause ignored.
- * @return never.
- */
- public Throwable initCause(Throwable cause) {
- throw new JDOFatalInternalException(msg.msg("ERR_CannotInitCause"));
- }
+ /**
+ * Constructs a new JDOException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOException(String msg) {
+ super(msg);
+ }
- /**
- * The String
representation includes the name of the class, the descriptive comment
- * (if any), the String
representation of the failed Object
(if any),
- * and the String
representation of the nested Throwable
s (if any).
- *
- * @return the String
.
- */
- public synchronized String toString() {
- int len = nested == null ? 0 : nested.length;
- // calculate approximate size of the String to return
- StringBuffer sb = new StringBuffer(10 + 100 * len);
- sb.append(super.toString());
- // include failed object information
- if (failed != null) {
- sb.append("\n").append(msg.msg("MSG_FailedObject"));
- String failedToString = null;
- try {
- failedToString = failed.toString();
- } catch (Exception ex) {
- // include the information from the exception thrown by failed.toString
- Object objectId = JDOHelper.getObjectId(failed);
- if (objectId == null) {
- failedToString =
- msg.msg(
- "MSG_ExceptionGettingFailedToString", // NOI18N
- exceptionToString(ex));
+ /** Constructs a new JDOException
with the specified detail message
+ * and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOException(String msg, Throwable[] nested) {
+ super(msg);
+ this.nested = nested;
+ }
+
+ /** Constructs a new JDOException
with the specified detail message
+ * and nested Throwable
.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOException(String msg, Throwable nested) {
+ super(msg);
+ this.nested = new Throwable[] {nested};
+ }
+
+ /** Constructs a new JDOException
with the specified detail message
+ * and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOException(String msg, Object failed) {
+ super(msg);
+ this.failed = failed;
+ }
+
+ /** Constructs a new JDOException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOException(String msg, Throwable[] nested, Object failed) {
+ super(msg);
+ this.nested = nested;
+ this.failed = failed;
+ }
+
+ /** Constructs a new JDOException
with the specified detail message,
+ * nested Throwable
, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOException(String msg, Throwable nested, Object failed) {
+ super(msg);
+ this.nested = new Throwable[] {nested};
+ this.failed = failed;
+ }
+
+ /**
+ * The exception may include a failed object.
+ * @return the failed object.
+ */
+ public Object getFailedObject() {
+ return failed;
+ }
+
+ /** The exception may have been caused by multiple exceptions in the runtime.
+ * If multiple objects caused the problem, each failed object will have
+ * its own Exception
.
+ * @return the nested Throwable array.
+ */
+ public Throwable[] getNestedExceptions() {
+ return nested;
+ }
+
+ /** Often there is only one nested exception, and this method returns it.
+ * If there are more than one, then this method returns the first nested
+ * exception. If there is no nested exception, then null is returned.
+ * @return the first or only nested Throwable.
+ * @since 1.0.1
+ */
+ public synchronized Throwable getCause() {
+ // super.printStackTrace calls getCause to handle the cause.
+ // Returning null prevents the superclass from handling the cause;
+ // instead the local implementation of printStackTrace should
+ // handle the cause. Otherwise, the cause is printed twice.
+ if (nested == null || nested.length == 0 || inPrintStackTrace) {
+ return null;
} else {
- // include the ObjectId information
- String objectIdToString = null;
- try {
- objectIdToString = objectId.toString();
- } catch (Exception ex2) {
- objectIdToString = exceptionToString(ex2);
- }
- failedToString =
- msg.msg(
- "MSG_ExceptionGettingFailedToStringObjectId", // NOI18N
- exceptionToString(ex),
- objectIdToString);
+ return nested[0];
}
- }
- sb.append(failedToString);
}
- // include nested Throwable information, but only if not called by
- // printStackTrace; the stacktrace will include the cause anyway.
- if (len > 0 && !inPrintStackTrace) {
- sb.append("\n").append(msg.msg("MSG_NestedThrowables")).append("\n");
- Throwable exception = nested[0];
- sb.append(exception == null ? "null" : exception.toString()); // NOI18N
- for (int i = 1; i < len; ++i) {
- sb.append("\n"); // NOI18N
- exception = nested[i];
- sb.append(exception == null ? "null" : exception.toString()); // NOI18N
- }
+
+ /** JDK 1.4 includes a new chaining mechanism for Throwable, but since
+ * JDO has its own "legacy" chaining mechanism, the "standard" mechanism
+ * cannot be used. This method always throws a JDOFatalInternalException.
+ * @param cause ignored.
+ * @return never.
+ */
+ public Throwable initCause(Throwable cause) {
+ throw new JDOFatalInternalException(msg.msg("ERR_CannotInitCause"));
+ }
+
+ /** The String
representation includes the name of the class,
+ * the descriptive comment (if any),
+ * the String
representation of the failed Object
(if any),
+ * and the String
representation of the nested Throwable
s (if any).
+ * @return the String
.
+ */
+ public synchronized String toString() {
+ int len = nested==null?0:nested.length;
+ // calculate approximate size of the String to return
+ StringBuffer sb = new StringBuffer (10 + 100 * len);
+ sb.append (super.toString());
+ // include failed object information
+ if (failed != null) {
+ sb.append ("\n").append (msg.msg ("MSG_FailedObject"));
+ String failedToString = null;
+ try {
+ failedToString = failed.toString();
+ } catch (Exception ex) {
+ // include the information from the exception thrown by failed.toString
+ Object objectId = JDOHelper.getObjectId(failed);
+ if (objectId == null) {
+ failedToString = msg.msg("MSG_ExceptionGettingFailedToString", //NOI18N
+ exceptionToString(ex));
+ }
+ else {
+ // include the ObjectId information
+ String objectIdToString = null;
+ try {
+ objectIdToString = objectId.toString();
+ }
+ catch (Exception ex2) {
+ objectIdToString = exceptionToString(ex2);
+ }
+ failedToString = msg.msg("MSG_ExceptionGettingFailedToStringObjectId", //NOI18N
+ exceptionToString(ex), objectIdToString);
+ }
+ }
+ sb.append (failedToString);
+ }
+ // include nested Throwable information, but only if not called by
+ // printStackTrace; the stacktrace will include the cause anyway.
+ if (len > 0 && !inPrintStackTrace) {
+ sb.append ("\n").append (msg.msg ("MSG_NestedThrowables")).append ("\n");
+ Throwable exception = nested[0];
+ sb.append (exception==null?"null":exception.toString()); //NOI18N
+ for (int i=1; iJDOException and its backtrace to the
+ * standard error output.
+ * Print nested Throwables' stack trace as well.
+ */
+ public void printStackTrace() {
+ printStackTrace (System.err);
}
- return sb.toString();
- }
-
- /**
- * Prints this JDOException
and its backtrace to the standard error output. Print
- * nested Throwables' stack trace as well.
- */
- public void printStackTrace() {
- printStackTrace(System.err);
- }
- /**
- * Prints this JDOException
and its backtrace to the specified print stream. Print
- * nested Throwables' stack trace as well.
- *
- * @param s PrintStream
to use for output
- */
- public synchronized void printStackTrace(java.io.PrintStream s) {
- int len = nested == null ? 0 : nested.length;
- synchronized (s) {
- inPrintStackTrace = true;
- super.printStackTrace(s);
- if (len > 0) {
- s.println(msg.msg("MSG_NestedThrowablesStackTrace"));
- for (int i = 0; i < len; ++i) {
- Throwable exception = nested[i];
- if (exception != null) {
- exception.printStackTrace(s);
- }
+ /**
+ * Prints this JDOException
and its backtrace to the
+ * specified print stream.
+ * Print nested Throwables' stack trace as well.
+ * @param s PrintStream
to use for output
+ */
+ public synchronized void printStackTrace(java.io.PrintStream s) {
+ int len = nested==null?0:nested.length;
+ synchronized (s) {
+ inPrintStackTrace = true;
+ super.printStackTrace(s);
+ if (len > 0) {
+ s.println (msg.msg ("MSG_NestedThrowablesStackTrace"));
+ for (int i=0; iJDOException and its backtrace to the specified print writer. Print
- * nested Throwables' stack trace as well.
- *
- * @param s PrintWriter
to use for output
- */
- public synchronized void printStackTrace(java.io.PrintWriter s) {
- int len = nested == null ? 0 : nested.length;
- synchronized (s) {
- inPrintStackTrace = true;
- super.printStackTrace(s);
- if (len > 0) {
- s.println(msg.msg("MSG_NestedThrowablesStackTrace"));
- for (int i = 0; i < len; ++i) {
- Throwable exception = nested[i];
- if (exception != null) {
- exception.printStackTrace(s);
- }
+ /**
+ * Prints this JDOException
and its backtrace to the specified
+ * print writer.
+ * Print nested Throwables' stack trace as well.
+ * @param s PrintWriter
to use for output
+ */
+ public synchronized void printStackTrace(java.io.PrintWriter s) {
+ int len = nested==null?0:nested.length;
+ synchronized (s) {
+ inPrintStackTrace = true;
+ super.printStackTrace(s);
+ if (len > 0) {
+ s.println (msg.msg ("MSG_NestedThrowablesStackTrace"));
+ for (int i=0; iJDOFatalDataStoreException without a detail message. */
- public JDOFatalDataStoreException() {}
+ private static final long serialVersionUID = 8953679366316248154L;
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOFatalDataStoreException(String msg) {
- super(msg);
- }
+ /**
+ * Constructs a new JDOFatalDataStoreException
without a detail message.
+ */
+ public JDOFatalDataStoreException() {
+ }
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message and
- * failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOFatalDataStoreException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDOFatalDataStoreException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOFatalDataStoreException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOFatalDataStoreException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /** Constructs a new JDOFatalDataStoreException
with the specified detail message
+ * and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOFatalDataStoreException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /**
+ * Constructs a new JDOFatalDataStoreException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOFatalDataStoreException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOFatalDataStoreException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalDataStoreException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOFatalDataStoreException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
+
+ /**
+ * Constructs a new JDOFatalDataStoreException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOFatalDataStoreException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message,
- * nested Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOFatalDataStoreException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
-
- /**
- * Constructs a new JDOFatalDataStoreException
with the specified detail message,
- * nested Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOFatalDataStoreException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOFatalDataStoreException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOFatalDataStoreException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
+
diff --git a/api/src/main/java/javax/jdo/JDOFatalException.java b/api/src/main/java/javax/jdo/JDOFatalException.java
index eb39889ed..6247306c5 100644
--- a/api/src/main/java/javax/jdo/JDOFatalException.java
+++ b/api/src/main/java/javax/jdo/JDOFatalException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,82 +22,75 @@
package javax.jdo;
-/**
- * This class represents exceptions that are fatal; that is, the condition that caused it cannot be
- * bypassed even if the operation is retried.
+/** This class represents exceptions that are fatal; that is, the condition
+ * that caused it cannot be bypassed even if the operation is retried.
*
* @version 1.0
*/
public class JDOFatalException extends JDOException {
- private static final long serialVersionUID = -414371106009364006L;
-
- /** Constructs a new JDOFatalException
without a detail message. */
- public JDOFatalException() {}
-
- /**
- * Constructs a new JDOFatalException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOFatalException(String msg) {
- super(msg);
- }
-
- /**
- * Constructs a new JDOFatalException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOFatalException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ private static final long serialVersionUID = -414371106009364006L;
- /**
- * Constructs a new JDOFatalException
with the specified detail message and nested
- * Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOFatalException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalException
without a detail message.
+ */
+ public JDOFatalException() {
+ }
- /**
- * Constructs a new JDOFatalException
with the specified detail message and failed
- * object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOFatalException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDOFatalException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOFatalException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDOFatalException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOFatalException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOFatalException
with the specified detail
+ * message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOFatalException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
+
+ /**
+ * Constructs a new JDOFatalException
with the specified detail
+ * message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOFatalException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
+
+ /** Constructs a new JDOFatalException
with the specified detail message
+ * and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOFatalException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /** Constructs a new JDOFatalException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOFatalException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
- /**
- * Constructs a new JDOFatalException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOFatalException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /** Constructs a new JDOFatalException
with the specified detail message,
+ * nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOFatalException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
diff --git a/api/src/main/java/javax/jdo/JDOFatalInternalException.java b/api/src/main/java/javax/jdo/JDOFatalInternalException.java
index b239d6387..5ba042e5b 100644
--- a/api/src/main/java/javax/jdo/JDOFatalInternalException.java
+++ b/api/src/main/java/javax/jdo/JDOFatalInternalException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,82 +22,79 @@
package javax.jdo;
-/**
- * This class represents errors in the implementation for which no user error handling is possible.
- * The error should be reported to the JDO vendor for corrective action.
+/** This class represents errors in the implementation for which no user
+ * error handling is possible. The error should be reported to the JDO
+ * vendor for corrective action.
*
* @version 1.0
*/
public class JDOFatalInternalException extends JDOFatalException {
- private static final long serialVersionUID = -2315924677228266735L;
+ private static final long serialVersionUID = -2315924677228266735L;
- /** Constructs a new JDOFatalInternalException
without a detail message. */
- public JDOFatalInternalException() {}
+ /**
+ * Constructs a new JDOFatalInternalException
without a detail message.
+ */
+ public JDOFatalInternalException() {
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOFatalInternalException(String msg) {
- super(msg);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOFatalInternalException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOFatalInternalException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOFatalInternalException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOFatalInternalException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOFatalInternalException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message and
- * failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOFatalInternalException(String msg, Object failed) {
- super(msg, failed);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
+ * with the specified detail message and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOFatalInternalException(String msg, Object failed) {
+ super(msg, failed);
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message,
- * nested Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOFatalInternalException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOFatalInternalException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
- /**
- * Constructs a new JDOFatalInternalException
with the specified detail message,
- * nested Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOFatalInternalException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOFatalInternalException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOFatalInternalException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
diff --git a/api/src/main/java/javax/jdo/JDOFatalUserException.java b/api/src/main/java/javax/jdo/JDOFatalUserException.java
index f43cfd2cf..8dc1434d7 100644
--- a/api/src/main/java/javax/jdo/JDOFatalUserException.java
+++ b/api/src/main/java/javax/jdo/JDOFatalUserException.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -22,81 +22,75 @@
package javax.jdo;
-/**
- * This class represents user errors that cannot be retried.
+/** This class represents user errors that cannot be retried.
*
* @version 1.0
*/
public class JDOFatalUserException extends JDOFatalException {
- private static final long serialVersionUID = -7451285498620809419L;
-
- /** Constructs a new JDOFatalUserException
without a detail message. */
- public JDOFatalUserException() {}
-
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message.
- *
- * @param msg the detail message.
- */
- public JDOFatalUserException(String msg) {
- super(msg);
- }
+ private static final long serialVersionUID = -7451285498620809419L;
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- */
- public JDOFatalUserException(String msg, Throwable[] nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalUserException
without a detail message.
+ */
+ public JDOFatalUserException() {
+ }
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message and
- * nested Throwable
s.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- */
- public JDOFatalUserException(String msg, Throwable nested) {
- super(msg, nested);
- }
+ /**
+ * Constructs a new JDOFatalUserException
with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOFatalUserException(String msg) {
+ super(msg);
+ }
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message and
- * failed object.
- *
- * @param msg the detail message.
- * @param failed the failed object.
- */
- public JDOFatalUserException(String msg, Object failed) {
- super(msg, failed);
- }
-
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable[]
.
- * @param failed the failed object.
- */
- public JDOFatalUserException(String msg, Throwable[] nested, Object failed) {
- super(msg, nested, failed);
- }
-
- /**
- * Constructs a new JDOFatalUserException
with the specified detail message, nested
- * Throwable
s, and failed object.
- *
- * @param msg the detail message.
- * @param nested the nested Throwable
.
- * @param failed the failed object.
- */
- public JDOFatalUserException(String msg, Throwable nested, Object failed) {
- super(msg, nested, failed);
- }
+ /**
+ * Constructs a new JDOFatalUserException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ */
+ public JDOFatalUserException(String msg, Throwable[] nested) {
+ super(msg, nested);
+ }
+
+ /**
+ * Constructs a new JDOFatalUserException
with the specified
+ * detail message and nested Throwable
s.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ */
+ public JDOFatalUserException(String msg, Throwable nested) {
+ super(msg, nested);
+ }
+
+ /** Constructs a new JDOFatalUserException
with the specified
+ * detail message and failed object.
+ * @param msg the detail message.
+ * @param failed the failed object.
+ */
+ public JDOFatalUserException(String msg, Object failed) {
+ super(msg, failed);
+ }
+
+ /** Constructs a new JDOFatalUserException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable[]
.
+ * @param failed the failed object.
+ */
+ public JDOFatalUserException(String msg, Throwable[] nested, Object failed) {
+ super(msg, nested, failed);
+ }
+
+ /** Constructs a new JDOFatalUserException
with the specified
+ * detail message, nested Throwable
s, and failed object.
+ * @param msg the detail message.
+ * @param nested the nested Throwable
.
+ * @param failed the failed object.
+ */
+ public JDOFatalUserException(String msg, Throwable nested, Object failed) {
+ super(msg, nested, failed);
+ }
}
+
diff --git a/api/src/main/java/javax/jdo/JDOHelper.java b/api/src/main/java/javax/jdo/JDOHelper.java
index 0b68680b4..892d46834 100644
--- a/api/src/main/java/javax/jdo/JDOHelper.java
+++ b/api/src/main/java/javax/jdo/JDOHelper.java
@@ -5,13 +5,13 @@
* The ASF licenses this file to You 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
- *
+ *
* https://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
+ *
+ * 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.
*/
@@ -19,7 +19,7 @@
* JDOHelper.java
*
*/
-
+
package javax.jdo;
import java.io.BufferedReader;
@@ -44,6 +44,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
+
import javax.jdo.spi.I18NHelper;
import javax.jdo.spi.JDOImplHelper;
import javax.jdo.spi.JDOImplHelper.StateInterrogationBooleanReturn;
@@ -58,6 +59,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -67,1614 +69,1806 @@
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+
/**
- * This class can be used by a JDO-aware application to call the JDO behavior of
- * PersistenceCapable
instances without declaring them to be PersistenceCapable
.
- *
- * It is also used to acquire a PersistenceManagerFactory
via various methods.
- *
- *
This helper class defines static methods that allow a JDO-aware application to examine the
- * runtime state of instances. For example, an application can discover whether the instance is
- * persistent, transactional, dirty, new, deleted, or detached; and to get its associated
- * PersistenceManager
if it has one.
- *
+ * This class can be used by a JDO-aware application to call the JDO behavior
+ * of PersistenceCapable
instances without declaring them to be
+ * PersistenceCapable
.
+ *
It is also used to acquire a PersistenceManagerFactory
via
+ * various methods.
+ *
This helper class defines static methods that allow a JDO-aware
+ * application to examine the runtime state of instances. For example,
+ * an application can discover whether the instance is persistent,
+ * transactional, dirty, new, deleted, or detached; and to get its associated
+ * PersistenceManager
if it has one.
+ *
* @version 2.1
*/
public class JDOHelper implements Constants {
- /** A mapping from jdoconfig.xsd element attributes to PMF properties. */
- static final Map ATTRIBUTE_PROPERTY_XREF = createAttributePropertyXref();
-
- /** The Internationalization message helper. */
- private static final I18NHelper msg = I18NHelper.getInstance("javax.jdo.Bundle"); // NOI18N
-
- /**
- * Creates a map from jdoconfig.xsd element attributes to PMF properties.
- *
- * @return An unmodifiable Map of jdoconfig.xsd element attributes to PMF properties.
- */
- static Map createAttributePropertyXref() {
- Map xref = new HashMap();
-
- xref.put(PMF_ATTRIBUTE_CLASS, PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS);
- xref.put(PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME, PROPERTY_CONNECTION_DRIVER_NAME);
- xref.put(PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME, PROPERTY_CONNECTION_FACTORY_NAME);
- xref.put(PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME, PROPERTY_CONNECTION_FACTORY2_NAME);
- xref.put(PMF_ATTRIBUTE_CONNECTION_PASSWORD, PROPERTY_CONNECTION_PASSWORD);
- xref.put(PMF_ATTRIBUTE_CONNECTION_URL, PROPERTY_CONNECTION_URL);
- xref.put(PMF_ATTRIBUTE_CONNECTION_USER_NAME, PROPERTY_CONNECTION_USER_NAME);
- xref.put(PMF_ATTRIBUTE_IGNORE_CACHE, PROPERTY_IGNORE_CACHE);
- xref.put(PMF_ATTRIBUTE_MAPPING, PROPERTY_MAPPING);
- xref.put(PMF_ATTRIBUTE_MULTITHREADED, PROPERTY_MULTITHREADED);
- xref.put(PMF_ATTRIBUTE_NONTRANSACTIONAL_READ, PROPERTY_NONTRANSACTIONAL_READ);
- xref.put(PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE, PROPERTY_NONTRANSACTIONAL_WRITE);
- xref.put(PMF_ATTRIBUTE_OPTIMISTIC, PROPERTY_OPTIMISTIC);
- xref.put(PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME, PROPERTY_PERSISTENCE_UNIT_NAME);
- xref.put(PMF_ATTRIBUTE_NAME, PROPERTY_NAME);
- xref.put(PMF_ATTRIBUTE_RESTORE_VALUES, PROPERTY_RESTORE_VALUES);
- xref.put(PMF_ATTRIBUTE_RETAIN_VALUES, PROPERTY_RETAIN_VALUES);
- xref.put(PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT, PROPERTY_DETACH_ALL_ON_COMMIT);
- xref.put(PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID, PROPERTY_SERVER_TIME_ZONE_ID);
- xref.put(PMF_ATTRIBUTE_DATASTORE_READ_TIMEOUT_MILLIS, PROPERTY_DATASTORE_READ_TIMEOUT_MILLIS);
- xref.put(PMF_ATTRIBUTE_DATASTORE_WRITE_TIMEOUT_MILLIS, PROPERTY_DATASTORE_WRITE_TIMEOUT_MILLIS);
-
- return Collections.unmodifiableMap(xref);
- }
-
- /** The JDOImplHelper instance used for handling non-binary-compatible implementations. */
- private static JDOImplHelper implHelper =
- (JDOImplHelper)
- doPrivileged(
- new PrivilegedAction() {
- public JDOImplHelper run() {
- return JDOImplHelper.getInstance();
+ /**
+ * A mapping from jdoconfig.xsd element attributes to PMF properties.
+ */
+ static final Map ATTRIBUTE_PROPERTY_XREF
+ = createAttributePropertyXref();
+
+ /** The Internationalization message helper.
+ */
+ private final static I18NHelper msg =
+ I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N
+
+ /**
+ * Creates a map from jdoconfig.xsd element attributes to PMF properties.
+ * @return An unmodifiable Map of jdoconfig.xsd element attributes to PMF
+ * properties.
+ */
+ static Map createAttributePropertyXref() {
+ Map xref = new HashMap();
+
+ xref.put(
+ PMF_ATTRIBUTE_CLASS,
+ PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME,
+ PROPERTY_CONNECTION_DRIVER_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME,
+ PROPERTY_CONNECTION_FACTORY_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME,
+ PROPERTY_CONNECTION_FACTORY2_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_PASSWORD,
+ PROPERTY_CONNECTION_PASSWORD);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_URL,
+ PROPERTY_CONNECTION_URL);
+ xref.put(
+ PMF_ATTRIBUTE_CONNECTION_USER_NAME,
+ PROPERTY_CONNECTION_USER_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_IGNORE_CACHE,
+ PROPERTY_IGNORE_CACHE);
+ xref.put(
+ PMF_ATTRIBUTE_MAPPING,
+ PROPERTY_MAPPING);
+ xref.put(
+ PMF_ATTRIBUTE_MULTITHREADED,
+ PROPERTY_MULTITHREADED);
+ xref.put(
+ PMF_ATTRIBUTE_NONTRANSACTIONAL_READ,
+ PROPERTY_NONTRANSACTIONAL_READ);
+ xref.put(
+ PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE,
+ PROPERTY_NONTRANSACTIONAL_WRITE);
+ xref.put(
+ PMF_ATTRIBUTE_OPTIMISTIC,
+ PROPERTY_OPTIMISTIC);
+ xref.put(
+ PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME,
+ PROPERTY_PERSISTENCE_UNIT_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_NAME,
+ PROPERTY_NAME);
+ xref.put(
+ PMF_ATTRIBUTE_RESTORE_VALUES,
+ PROPERTY_RESTORE_VALUES);
+ xref.put(
+ PMF_ATTRIBUTE_RETAIN_VALUES,
+ PROPERTY_RETAIN_VALUES);
+ xref.put(
+ PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT,
+ PROPERTY_DETACH_ALL_ON_COMMIT);
+ xref.put(
+ PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID,
+ PROPERTY_SERVER_TIME_ZONE_ID);
+ xref.put(
+ PMF_ATTRIBUTE_DATASTORE_READ_TIMEOUT_MILLIS,
+ PROPERTY_DATASTORE_READ_TIMEOUT_MILLIS);
+ xref.put(
+ PMF_ATTRIBUTE_DATASTORE_WRITE_TIMEOUT_MILLIS,
+ PROPERTY_DATASTORE_WRITE_TIMEOUT_MILLIS);
+
+ return Collections.unmodifiableMap(xref);
+ }
+
+ /** The JDOImplHelper instance used for handling non-binary-compatible
+ * implementations.
+ */
+ private static JDOImplHelper implHelper = (JDOImplHelper)
+ doPrivileged(
+ new PrivilegedAction () {
+ public JDOImplHelper run () {
+ return JDOImplHelper.getInstance();
}
- });
-
- /**
- * The singleton instance of JDOHelper.
- *
- * @since 2.1
- */
- private static JDOHelper instance = new JDOHelper();
-
- /**
- * Return the singleton instance of JDOHelper. This instance is thread-safe.
- *
- * @since 2.1
- * @return the thread-safe singleton JDOHelper
- */
- public static JDOHelper getInstance() {
- return instance;
- }
-
- /**
- * Some applications might prefer to use instance methods instead of static methods.
- *
- * @since 2.1
- */
- public JDOHelper() {}
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of
- * getPersistenceManager.
- */
- static StateInterrogationObjectReturn getPersistenceManager =
- new StateInterrogationObjectReturn() {
- public Object get(Object pc, StateInterrogation si) {
- return si.getPersistenceManager(pc);
- }
- };
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of getObjectId.
- */
- static StateInterrogationObjectReturn getObjectId =
- new StateInterrogationObjectReturn() {
- public Object get(Object pc, StateInterrogation si) {
- return si.getObjectId(pc);
- }
- };
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of
- * getTransactionalObjectId.
- */
- static StateInterrogationObjectReturn getTransactionalObjectId =
- new StateInterrogationObjectReturn() {
- public Object get(Object pc, StateInterrogation si) {
- return si.getTransactionalObjectId(pc);
- }
- };
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of getVersion.
- */
- static StateInterrogationObjectReturn getVersion =
- new StateInterrogationObjectReturn() {
- public Object get(Object pc, StateInterrogation si) {
- return si.getVersion(pc);
+ }
+ );
+
+ /** The singleton instance of JDOHelper.
+ * @since 2.1
+ */
+ private static JDOHelper instance = new JDOHelper();
+
+ /**
+ * Return the singleton instance of JDOHelper. This instance is
+ * thread-safe.
+ * @since 2.1
+ * @return the thread-safe singleton JDOHelper
+ */
+ public static JDOHelper getInstance() {
+ return instance;
+ }
+
+ /** Some applications might prefer to use instance
+ * methods instead of static methods.
+ * @since 2.1
+ */
+ public JDOHelper() {}
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of getPersistenceManager.
+ */
+ static StateInterrogationObjectReturn getPersistenceManager =
+ new StateInterrogationObjectReturn() {
+ public Object get(Object pc, StateInterrogation si) {
+ return si.getPersistenceManager(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of getObjectId.
+ */
+ static StateInterrogationObjectReturn getObjectId =
+ new StateInterrogationObjectReturn() {
+ public Object get(Object pc, StateInterrogation si) {
+ return si.getObjectId(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of getTransactionalObjectId.
+ */
+ static StateInterrogationObjectReturn getTransactionalObjectId =
+ new StateInterrogationObjectReturn() {
+ public Object get(Object pc, StateInterrogation si) {
+ return si.getTransactionalObjectId(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of getVersion.
+ */
+ static StateInterrogationObjectReturn getVersion =
+ new StateInterrogationObjectReturn() {
+ public Object get(Object pc, StateInterrogation si) {
+ return si.getVersion(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isPersistent.
+ */
+ static StateInterrogationBooleanReturn isPersistent =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isPersistent(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isTransactional.
+ */
+ static StateInterrogationBooleanReturn isTransactional =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isTransactional(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isDirty.
+ */
+ static StateInterrogationBooleanReturn isDirty =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isDirty(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isNew.
+ */
+ static StateInterrogationBooleanReturn isNew =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isNew(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isDeleted.
+ */
+ static StateInterrogationBooleanReturn isDeleted =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isDeleted(pc);
+ }
+ };
+
+ /** The stateless instance used for handling non-binary-compatible
+ * implementations of isDetached.
+ */
+ static StateInterrogationBooleanReturn isDetached =
+ new StateInterrogationBooleanReturn() {
+ public Boolean is(Object pc, StateInterrogation si) {
+ return si.isDetached(pc);
+ }
+ };
+
+ /** Return the associated PersistenceManager
if there is one.
+ * Transactional and persistent instances return the associated
+ * PersistenceManager
.
+ *
+ * Transient non-transactional instances and instances of classes
+ * that do not implement PersistenceCapable
return
+ * null
.
+ * @see PersistenceCapable#jdoGetPersistenceManager()
+ * @param pc the PersistenceCapable
instance.
+ * @return the PersistenceManager
associated with the parameter
+ * instance.
+ */
+ public static PersistenceManager getPersistenceManager(Object pc) {
+ if (pc instanceof PersistenceCapable) {
+ return ((PersistenceCapable)pc).jdoGetPersistenceManager();
+ } else {
+ return (PersistenceManager)
+ implHelper.nonBinaryCompatibleGet(pc, getPersistenceManager);
}
- };
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of isPersistent.
- */
- static StateInterrogationBooleanReturn isPersistent =
- new StateInterrogationBooleanReturn() {
- public Boolean is(Object pc, StateInterrogation si) {
- return si.isPersistent(pc);
+ }
+
+ /** Explicitly mark the parameter instance and field dirty.
+ * Normally, PersistenceCapable
classes are able to detect
+ * changes made to their fields. However, if a reference to an array is
+ * given to a method outside the class, and the array is modified, then the
+ * persistent instance is not aware of the change. This API allows the
+ * application to notify the instance that a change was made to a field.
+ *
+ *
Transient instances and instances of classes
+ * that do not implement PersistenceCapable
ignore this method.
+ * @see PersistenceCapable#jdoMakeDirty(String fieldName)
+ * @param pc the PersistenceCapable
instance.
+ * @param fieldName the name of the field to be marked dirty.
+ */
+ public static void makeDirty(Object pc, String fieldName) {
+ if (pc instanceof PersistenceCapable) {
+ ((PersistenceCapable)pc).jdoMakeDirty(fieldName);
+ } else {
+ implHelper.nonBinaryCompatibleMakeDirty(pc, fieldName);
}
- };
-
- /**
- * The stateless instance used for handling non-binary-compatible implementations of
- * isTransactional.
- */
- static StateInterrogationBooleanReturn isTransactional =
- new StateInterrogationBooleanReturn() {
- public Boolean is(Object pc, StateInterrogation si) {
- return si.isTransactional(pc);
+ }
+
+ /** Return a copy of the JDO identity associated with the parameter
+ * instance.
+ *
+ *
Persistent instances of PersistenceCapable
classes have a
+ * JDO identity managed by the PersistenceManager
. This method
+ * returns a copy of the ObjectId that represents the JDO identity.
+ *
+ *
Transient instances and instances of classes that do not implement
+ * PersistenceCapable
return null
.
+ *
+ *
The ObjectId may be serialized
+ * and later restored, and used with a PersistenceManager
from
+ * the same JDO implementation to locate a persistent instance with the same
+ * data store identity.
+ *
+ *
If the JDO identity is managed by the application, then the ObjectId
+ * may be used with a PersistenceManager
from any JDO
+ * implementation that supports the PersistenceCapable
class.
+ *
+ *
If the JDO identity is not managed by the application or the data
+ * store, then the ObjectId returned is only valid within the current
+ * transaction.
+ *
+ * @see PersistenceManager#getObjectId(Object pc)
+ * @see PersistenceCapable#jdoGetObjectId()
+ * @see PersistenceManager#getObjectById(Object oid, boolean validate)
+ * @param pc the PersistenceCapable instance.
+ * @return a copy of the ObjectId of the parameter instance as of the
+ * beginning of the transaction.
+ */
+ public static Object getObjectId(Object pc) {
+ if (pc instanceof PersistenceCapable) {
+ return ((PersistenceCapable)pc).jdoGetObjectId();
+ } else {
+ return implHelper.nonBinaryCompatibleGet(pc, getObjectId);
}
- };
+ }
- /** The stateless instance used for handling non-binary-compatible implementations of isDirty. */
- static StateInterrogationBooleanReturn isDirty =
- new StateInterrogationBooleanReturn() {
- public Boolean is(Object pc, StateInterrogation si) {
- return si.isDirty(pc);
+ /** Get object ids for a collection of instances. For each instance
+ * in the parameter, the getObjectId method is called. This method
+ * returns one identity instance for each element
+ * in the parameter. The order of iteration of the returned
+ * Collection exactly matches the order of iteration of the
+ * parameter Collection.
+ * @param pcs the persistence-capable instances
+ * @return the object ids of the parameters
+ * @see #getObjectId(Object pc)
+ * @see #getObjectIds(Object[] pcs)
+ * @since 2.0
+ */
+ public static Collection