jdo2-api-2.2/ 40755 0 0 0 11073716464 10025 5ustar 0 0 jdo2-api-2.2/src/ 40755 0 0 0 11073716464 10614 5ustar 0 0 jdo2-api-2.2/src/java/ 40755 0 0 0 11073716464 11535 5ustar 0 0 jdo2-api-2.2/src/java/javax/ 40755 0 0 0 11073716464 12646 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/ 40755 0 0 0 11073716465 13423 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/annotations/ 40755 0 0 0 11073716465 15760 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/datastore/ 40755 0 0 0 11073716464 15410 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/identity/ 40755 0 0 0 11073716465 15254 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/listener/ 40755 0 0 0 11073716465 15250 5ustar 0 0 jdo2-api-2.2/src/java/javax/jdo/spi/ 40755 0 0 0 11073716465 14216 5ustar 0 0 jdo2-api-2.2/src/schema/ 40755 0 0 0 11073716464 12054 5ustar 0 0 jdo2-api-2.2/src/schema/javax/ 40755 0 0 0 11073716464 13165 5ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/ 40755 0 0 0 11073716465 13742 5ustar 0 0 lib/ 40755 0 0 0 11072775131 6662 5ustar 0 0 lib/ext/ 40755 0 0 0 11072775131 7462 5ustar 0 0 jdo2-api-2.2/build.xml100644 0 0 16122 11073716464 11765 0ustar 0 0 ================================= WARNING ================================ Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed. ========================================================================== jdo2-api-2.2/maven.xml100644 0 0 2656 11073716464 11763 0ustar 0 0 jdo2-api-2.2/project.properties100644 0 0 2137 11073716464 13711 0ustar 0 0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. maven.junit.sysproperties = basedir maven.compile.source = 1.5 maven.compile.target = 1.5 junit.jarfile = ${pom.getDependencyPath('junit:junit')} # Manifest seed file maven.jar.manifest = ${basedir}/API2.MF # Maven test reports directory maven.test.reportsDirectory = ${basedir}/target/test-reports jdo2-api-2.2/project.xml100644 0 0 10465 11073716464 12340 0ustar 0 0 3 ../project.xml JDO2 API javax.jdo jdo2-api ${currentVersion} javax.jdo Java Data Objects 2 (JDO) API The Java Data Objects 2 (JDO) API is a standard interface-based Java model abstraction of persistence, developed as Java Specification Request 243 under the auspices of the Java Community Process. javax.transaction transaction-api 1.1 org.apache.ant ant 1.7.0 junit junit 3.8.1 org.apache.geronimo.specs geronimo-jpa_3.0_spec 1.0 src/java test/java **/*Test.java javax/jdo/util/AbstractTest.java javax/jdo/pc/*.java ${basedir}/test/schema **/*.jdo **/*.jdoquery **/*.orm **/jdoconfig.xml jar:install ${basedir}/.. META-INF NOTICE.txt ${basedir}/src/java javax/jdo/*.properties ${basedir}/src/schema javax/jdo/*.dtd javax/jdo/*.xsd jdo2-api-2.2/src/java/javax/jdo/annotations/Cacheable.java100644 0 0 2566 11073716464 20557 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to specify that this class/field/property is cacheable * in a Level 2 cache. * This corresponds to the xml attribute "cacheable" of the "class", "field" * and "property" elements. * @version 2.2 * @since 2.2 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Cacheable { String value() default "true"; }jdo2-api-2.2/src/java/javax/jdo/annotations/Column.java100644 0 0 6213 11073716464 20156 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a column in the database. * Corresponds to the xml element "column". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Column { /** * Name of the column. * @return the name of the column */ String name() default ""; /** * Target column for this column in the other table when part of a * foreign key relation. * @return the target column in the other table for this column * when part of a foreign key relation. */ String target() default ""; /** * Target member in the other class or interface for this column * when part of a bidirectional relation. * @return the target member for this column when part of * a bidirectional relation. */ String targetMember() default ""; /** * JDBC Type for this column. * @return JDBC type for this column */ String jdbcType() default ""; /** * SQL Type for this column. * @return SQL type for this column */ String sqlType() default ""; /** * Maximum length of data stored in this column. * @return the maximum length of data stored in this column */ int length() default -1; /** * Scale for the column when handling floating point values. * @return the scale for the column when handling floating point values */ int scale() default -1; /** * Whether the column allows null values to be inserted. * @return whether the column allows null values to be inserted */ String allowsNull() default ""; /** * Default value for this column. * @return the default value for this column */ String defaultValue() default ""; /** * Value to be inserted when this is an "unmapped" column * @return the value to be inserted when this is an "unmapped" column */ String insertValue() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Columns.java100644 0 0 2505 11073716465 20342 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of columns. * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface Columns { /** The columns annotation information. * @return the columns */ Column[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/DatastoreIdentity.java100644 0 0 4605 11073716465 22365 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the datastore identity of the class. * Corresponds to the xml element "datastore-identity" of the "class" element. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface DatastoreIdentity { /** * Strategy to use when generating datastore identities * @return Strategy to use when generating datastore identities */ IdGeneratorStrategy strategy() default IdGeneratorStrategy.UNSPECIFIED; /** Custom strategy to use to generate the value for the identity. * If customStrategy is non-empty, then strategy must be UNSPECIFIED. * @return the custom strategy */ String customStrategy() default ""; /** * Name of sequence to use when the strategy involves sequences * @return Name of sequence to use when the strategy involves sequences */ String sequence() default ""; /** * Name of the column for the datastore identity * @return Name of the column for the datastore identity */ String column() default ""; /** * The column(s) making up the datastore identity. * @return The column(s) making up the datastore identity. */ Column[] columns() default {}; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Discriminator.java100644 0 0 5022 11073716464 21525 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the discriminator of the class. * Corresponds to the xml element "discriminator" of the "inheritance" element. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Discriminator { /** * Strategy to use for the discriminator. The discriminator determines * the class associated with a row in the datastore. * @return the strategy to use for the discriminator */ DiscriminatorStrategy strategy() default DiscriminatorStrategy.UNSPECIFIED; /** Custom strategy to use for the discriminator. * If customStrategy is non-empty, then strategy must be UNSPECIFIED. * @return the custom strategy */ String customStrategy() default ""; /** * Whether the discriminator is indexed. * @return whether the discriminator is indexed */ String indexed() default ""; /** * Name of the column for the discriminator * @return the name of the column for the discriminator */ String column() default ""; /** * The value for the discriminator for objects of this class * when using "value-map" strategy. * @return The value for the discriminator for objects of this class * when using "value-map" strategy */ String value() default ""; /** * The column(s) making up the discriminator. * @return the column(s) making up the discriminator */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/DiscriminatorStrategy.java100644 0 0 2037 11073716465 23254 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the discriminator strategy values. * * @version 2.1 * @since 2.1 */ public enum DiscriminatorStrategy { UNSPECIFIED, NONE, VALUE_MAP, CLASS_NAME } jdo2-api-2.2/src/java/javax/jdo/annotations/Element.java100644 0 0 11344 11073716464 20333 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the element of a collection/array relation. * Corresponds to the xml element "element". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Element { /** * Types of the elements. This can be determined if using JDK1.5 generics * but is required otherwise. Multiple types can be specified if the * implementation supports multiple types. * @return the types of elements */ Class[] types() default {}; /** * Whether the element is to be stored serialized (into a join table) * @return whether the element is to be stored serialized * (into a join table) */ String serialized() default ""; /** Whether this element is embedded. * @return whether this element is embedded */ String embedded() default ""; /** * The embedded mapping for the element. * @return the embedded mapping for the element */ Embedded[] embeddedMapping() default {}; /** * Whether the element is dependent on the owner, and will be deleted * when the owner is deleted. * @return whether the element is dependent on the owner, and will be * deleted when the owner is deleted */ String dependent() default ""; /** * Name of the table for the element. * @return name of the table for the element */ String table() default ""; /** * Name of the column to store the element in. * @return name of the column to store the element in */ String column() default ""; /** * Delete action to apply to any foreign key for the element. * @return delete action to apply to any foreign key for the element */ ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED; /** * Update action to apply to any foreign key for the element * @return update action to apply to any foreign key for the element */ ForeignKeyAction updateAction() default ForeignKeyAction.UNSPECIFIED; /** * Whether the value column(s) should be indexed. * @return whether the value column(s) should be indexed. */ String indexed() default ""; /** The name of the index to generate. * @return the name of the index */ String index() default ""; /** * Whether a unique constraint should be generated or assumed. * @return whether a unique constraint should be generated or assumed */ String unique() default ""; /** * The name of the unique key constraint to generate. * @return the name of the unique key constraint */ String uniqueKey() default ""; /** * Name of the member in the target class that forms a bidirectional * relationship with this member. * @return name of the member in the target class that forms a bidirectional * relationship with this member */ String mappedBy() default ""; /** * The column(s) for the element. * @return the column(s) for the element */ Column[] columns() default {}; /** Generate or assume a foreign key constraint exists on the column * or columns associated with this join. Specify "true" or "false". * @return whether to generate or assume a primary key constraint */ String generateForeignKey() default ""; /** Name for a generated foreign key constraint. * @return the name of the generated foreign key constraint */ String foreignKey() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Embedded.java100644 0 0 4063 11073716465 20414 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to define that the object is embedded into the table of the * owning object. * Corresponds to the xml element "embedded". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Embedded { /** The member in the embedded object that links back to the owning object * where it has a bidirectional relationship. * @return the member that refers to the owner */ String ownerMember() default ""; /** The column in the embedded object used to judge if the embedded object * is null. * @return the null indicator column */ String nullIndicatorColumn() default ""; /** The value in the null column to interpret the object as being null. * @return the null indicator value */ String nullIndicatorValue() default ""; /** Members for this embedding. * @return the members embedded in the field or property being annotated */ Persistent[] members() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/EmbeddedOnly.java100644 0 0 2461 11073716464 21255 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for whether the class is only for persisting embedded into * another object. * Same as specifying @PersistenceCapable(embeddedOnly="true"). * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface EmbeddedOnly { } jdo2-api-2.2/src/java/javax/jdo/annotations/Extension.java100644 0 0 3134 11073716465 20675 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a JDO vendor extension. * Corresponds to the xml element "extension". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Extension { /** Vendor that the extension applies to (required). * @return the vendor */ String vendorName(); /** The key for the extension (required). * @return the key */ String key(); /** The value for the extension (required). * @return the value */ String value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/Extensions.java100644 0 0 2504 11073716465 21060 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of extensions * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Extensions { /** * The extensions. * @return the extensions */ Extension[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/FetchGroup.java100644 0 0 3647 11073716464 20777 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the fetch group of a class. * Corresponds to the xml element "fetch-group". * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface FetchGroup { /** * Name of the fetch group. * @return the name of the fetch group */ String name() default ""; /** * Whether we should load this group as part of the post load process. * @return whether we should load this group as part of the post load * process. */ String postLoad() default ""; /** * Members (fields and properties) of the fetch group. The members * should contain only name and recursionDepth. * @return members for the fetch group */ Persistent[] members(); /** * Fetch groups to be nested (included) in this fetch group. */ String[] fetchGroups() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/FetchGroups.java100644 0 0 2451 11073716465 21153 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of fetch-group objects * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface FetchGroups { /** * The Fetch Groups * @return The Fetch Groups */ FetchGroup[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/FetchPlan.java100644 0 0 3451 11073716464 20566 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the fetch plan of a persistence manager, query, or extent. * Corresponds to the xml element "fetch-plan". * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface FetchPlan { /** * Name of the fetch plan. * @return the name of the fetch plan */ String name() default ""; /** * The fetch groups in this fetch plan. * @return the fetch groups */ String[] fetchGroups() default {}; /** * The depth of references to instantiate, starting with the root object. * @return the maxium fetch depth */ int maxFetchDepth() default 1; /** * The number of instances of multi-valued fields retrieved by queries. * @return the fetch size */ int fetchSize() default 0; } jdo2-api-2.2/src/java/javax/jdo/annotations/FetchPlans.java100644 0 0 2374 11073716464 20754 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of FetchPlan objects * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface FetchPlans { /** * The Fetch Plans * @return The Fetch Plans */ FetchPlan[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/ForeignKey.java100644 0 0 5235 11073716465 20767 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a database foreign-key. * Corresponds to the xml element "foreign-key". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface ForeignKey { /** Name of the foreign key. * @return the name of the foreign key */ String name() default ""; /** Table for the foreign key. This is needed iff annotating a type where * the foreign key is not defined on the primary table for the type. * @return the table on which the foreign key is defined */ String table() default ""; /** Whether this foreign key is deferred * (constraint is checked only at commit). * @return whether this foreign key is deferred */ String deferred() default ""; /** Whether this foreign key is unique. * @return whether this foreign key is unique */ String unique() default ""; /** The delete action of this foreign key. * @return the delete action of this foreign key */ ForeignKeyAction deleteAction() default ForeignKeyAction.RESTRICT; /** The update action of this foreign key. * @return the update action of this foreign key */ ForeignKeyAction updateAction() default ForeignKeyAction.RESTRICT; /** Member (field and property) names that compose this foreign key. * @return the member names that compose this foreign key */ String[] members() default {}; /** Columns that compose this foreign key. * @return the columns that compose this foreign key */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/ForeignKeyAction.java100644 0 0 2071 11073716465 22120 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the foreign-key delete/update action values. * * @version 2.1 * @since 2.1 */ public enum ForeignKeyAction { UNSPECIFIED, RESTRICT, CASCADE, NULL, DEFAULT, NONE } jdo2-api-2.2/src/java/javax/jdo/annotations/ForeignKeys.java100644 0 0 2457 11073716465 21155 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of foreign-key constraints. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface ForeignKeys { /** * The foreign keys. * @return The foreign keys */ ForeignKey[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/IdentityType.java100644 0 0 2024 11073716465 21351 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the identity type values. * * @version 2.1 * @since 2.1 */ public enum IdentityType { UNSPECIFIED, APPLICATION, DATASTORE, NONDURABLE } jdo2-api-2.2/src/java/javax/jdo/annotations/IdGeneratorStrategy.java100644 0 0 2112 11073716465 22642 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the id generator strategy values. * * @version 2.1 * @since 2.1 */ public enum IdGeneratorStrategy { UNSPECIFIED, NATIVE, SEQUENCE, IDENTITY, INCREMENT, UUIDSTRING, UUIDHEX } jdo2-api-2.2/src/java/javax/jdo/annotations/Index.java100644 0 0 4107 11073716465 17771 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a database index. Used for database schema * generation to create indexes. * Corresponds to the xml element "index". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Index { /** Name of the index * @return the name of the index */ String name() default ""; /** Table for the index. This is needed iff annotating a type where * the index is not defined on the primary table for the type. * @return the table on which the index is defined */ String table() default ""; /** Whether this index is unique * @return whether this index is unique */ String unique() default ""; /** Member (field and property) names that compose this index. * @return member names that compose this index */ String[] members() default {}; /** Columns that compose this index. * @return columns that compose this index */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Indices.java100644 0 0 2425 11073716465 20301 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of index constraints. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Indices { /** * The indices * @return The indices */ Index[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/Inheritance.java100644 0 0 3350 11073716465 21152 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the inheritance of the class. * Corresponds to the xml element "inheritance" of the "class" * and "interface" elements. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Inheritance { /** Strategy to use for inheritance. Specifies in which table(s) * the members for the class are stored. * @return the inheritance strategy */ InheritanceStrategy strategy() default InheritanceStrategy.UNSPECIFIED; /** Custom inheritance strategy. If customStrategy is non-empty, then * strategy must be UNSPECIFIED. * @return the custom inheritance strategy */ String customStrategy() default ""; } jdo2-api-2.2/src/java/javax/jdo/annotations/InheritanceStrategy.java100644 0 0 2053 11073716464 22673 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the inheritance strategy values. * * @version 2.1 * @since 2.1 */ public enum InheritanceStrategy { UNSPECIFIED, NEW_TABLE, SUBCLASS_TABLE, SUPERCLASS_TABLE } jdo2-api-2.2/src/java/javax/jdo/annotations/Join.java100644 0 0 7124 11073716464 17622 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the join of a relation. * Corresponds to the xml element "join". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Join { /** Table to join to (used when joining to secondary tables). * @return the table */ String table() default ""; /** Name of the column in the join table. * @return the name of the column in the join table */ String column() default ""; /** Whether the join column is indexed. * @return whether the join column(s) is(are) indexed */ String indexed() default ""; /** The name of the index to generate. * @return the name of the index */ String index() default ""; /** Whether the join column is unique. * @return whether the join column(s) is(are) is unique */ String unique() default ""; /** * The name of the unique key constraint to generate. * @return the name of the unique key constraint */ String uniqueKey() default ""; /** Whether to use an outer join. * @return whether to use an outer join */ String outer() default ""; /** Delete action to be applied to any ForeignKey on this join. * @return the delete action */ ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED; /** Detail definition of the join column(s). This is needed for * more than one join column. * @return the join columns */ Column[] columns() default {}; /** Generate or assume a primary key constraint exists on the column * or columns associated with this join. Specify "true" or "false". * @return whether to generate or assume a primary key constraint */ String generatePrimaryKey() default ""; /** Name for a generated primary key constraint. * @return the name of the generated primary key constraint */ String primaryKey() default ""; /** Generate or assume a foreign key constraint exists on the column * or columns associated with this join. Specify "true" or "false". * @return whether to generate or assume a foreign key constraint */ String generateForeignKey() default ""; /** Name for a generated foreign key constraint. * @return the name of the generated foreign key constraint */ String foreignKey() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Joins.java100644 0 0 3036 11073716465 20004 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of joins. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Joins { /** * The join definitions used for the mapping of this type. Joins for * secondary tables are usually defined at the type level and not the * field or property level. This allows multiple fields and properties * to share the same join definition and avoid redundancies. * @return the join definitions */ Join[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/Key.java100644 0 0 10775 11073716464 17501 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the key of a map relation. * Corresponds to the xml element "key". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Key { /** * Types of the keys. This can be determined if using JDK1.5 generics * but is required otherwise. Multiple types can be specified if the * implementation supports multiple types. * @return the types of keys */ Class[] types() default {}; /** * Whether the key is to be stored serialized (into a single column of a * join table). * @return whether the key is to be stored serialized */ String serialized() default ""; /** Whether this key is embedded. * @return whether this key is embedded */ String embedded() default ""; /** * The embedded mapping for the key. * @return the embedded mapping for the key */ Embedded[] embeddedMapping() default {}; /** * Whether the key is dependent on the owner (and will be deleted * when the owner is deleted). * @return whether the key is dependent on the owner */ String dependent() default ""; /** * Name of the table for the key. * @return name of the table for the key */ String table() default ""; /** * Name of the column to store the key in. * @return name of the column to store the key in */ String column() default ""; /** * Delete action to apply to the foreign key for the key. * @return delete action to apply to the foreign key for the key */ ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED; /** * Update action to apply to the foreign key for the key. * @return update action to apply to the foreign key for the key */ ForeignKeyAction updateAction() default ForeignKeyAction.UNSPECIFIED; /** * Whether the value column(s) should be indexed. * @return whether the value column(s) should be indexed. */ String indexed() default ""; /** The name of the index to generate. * @return the name of the index */ String index() default ""; /** * Whether the element column(s) contents should be considered unique * @return whether the element column(s) contents should be considered unique */ String unique() default ""; /** * The name of the unique key constraint to generate. * @return the name of the unique key constraint */ String uniqueKey() default ""; /** * Name of a member in the value class where this key is stored. * @return the name of a member in the value class where this key is stored */ String mappedBy() default ""; /** * The column(s) for the key * @return the column(s) for the key */ Column[] columns() default {}; /** Generate or assume a foreign key constraint exists on the column * or columns associated with this join. Specify "true" or "false". * @return whether to generate or assume a foreign key constraint */ String generateForeignKey() default ""; /** Name for a generated foreign key constraint. * @return the name of the generated foreign key constraint */ String foreignKey() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/NotPersistent.java100644 0 0 2625 11073716464 21545 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to specify that the member is not persistent. If used, this is * the only JDO annotation allowed on a member. * This corresponds to the xml attribute persistence-modifier="none" of the * "field" and "property" elements. * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface NotPersistent { } jdo2-api-2.2/src/java/javax/jdo/annotations/NullValue.java100644 0 0 2133 11073716465 20626 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the "null-value" behavior values. * This corresponds to the "null-value" attribute of the "field" * and "property" elements. * * @version 2.1 * @since 2.1 */ public enum NullValue { NONE, EXCEPTION, DEFAULT } jdo2-api-2.2/src/java/javax/jdo/annotations/Order.java100644 0 0 3656 11073716465 20005 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the ordering component of an ordered container member, * such as Java Collections Framework Array and List types and Java native * array types. * Corresponds to the xml element "order". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Order { /** The name of the column to use for ordering the elements of the member. * @return the name of the ordering column */ String column() default ""; /** Name of a field or property in the target class that acts as the * ordering field or property for this member. * Return the name of the field or property in the target class */ String mappedBy() default ""; /** The definition of the column(s) to use for ordering. * @return the columns to use for ordering */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/PersistenceAware.java100644 0 0 2602 11073716465 22164 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to specify that the class is persistence-aware. If used, this is * the only JDO annotation allowed on the class. * This corresponds to the xml attribute * persistence-modifier="persistence-aware" of the "class" element. * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface PersistenceAware { } jdo2-api-2.2/src/java/javax/jdo/annotations/PersistenceCapable.java100644 0 0 5217 11073716464 22460 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for whether the class or interface is persistence-capable. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface PersistenceCapable { /** Member declarations. Annotations for persistent members of this * class or interface can be specifed either here or on each member. * Annotations for inherited members can only be specified here. * @return member declarations */ Persistent[] members() default {}; /** Table to use for persisting this class or interface. */ String table() default ""; /** Catalog to use for persisting this class or interface. */ String catalog() default ""; /** Schema to use for persisting this class or interface. */ String schema() default ""; /** Whether this class or interface manages an extent. */ String requiresExtent() default ""; /** Whether objects of this class or interface can only be embedded. */ String embeddedOnly() default ""; /** Whether this class or interface is detachable. */ String detachable() default ""; /** Type of identity for this class or interface. */ IdentityType identityType() default IdentityType.UNSPECIFIED; /** Primary key class when using application identity and using own PK. */ Class objectIdClass() default void.class; /** Whether this class is cacheable in a Level2 cache. * @since 2.2 */ String cacheable() default "true"; /** Any vendor extensions. */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/PersistenceModifier.java100644 0 0 2240 11073716465 22661 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the persistence-modifier values for a field or property. * This corresponds to the "persistence-modifier" attribute of the * "field" and "property" elements. * * @version 2.1 * @since 2.1 */ public enum PersistenceModifier { UNSPECIFIED, PERSISTENT, TRANSACTIONAL, NONE } jdo2-api-2.2/src/java/javax/jdo/annotations/Persistent.java100644 0 0 17567 11073716465 21120 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for defining the persistence of a member. * This corresponds to the xml elements "field" and "property". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Persistent { /** Modifier for this field. This is normally not specified, and the * defaults are used, or the @Transactional or @NotPersistent * annotation is specified directly on the member. One possible use * for specifying persistenceModifier is for embedded instances in which * a member is not persistent but in the non-embedded instances the * member is persistent. Note that it is not portable to specify a * member to be not persistent in the non-embedded case and persistent * in the embedded usage. * @return the persistence modifier */ PersistenceModifier persistenceModifier() default PersistenceModifier.UNSPECIFIED; /** Table to use for persisting this member. * @return the table to use for persisting this member */ String table() default ""; /** Whether this member is in the default fetch group. * @return whether this member is in the default fetch group */ String defaultFetchGroup() default ""; /** Behavior when this member contains a null value. * @return the behavior when this member contains a null value */ NullValue nullValue() default NullValue.NONE; /** Whether this member is embedded. * @return whether this member is embedded */ String embedded() default ""; /** Whether the elements of this member are embedded. * @return whether the elements of this member are embedded */ String embeddedElement() default ""; /** Whether the keys of this member are embedded. * @return whether the keys of this member are embedded */ String embeddedKey() default ""; /** Whether the values of this member are embedded. * @return whether the values of this member are embedded */ String embeddedValue() default ""; /** Whether this member is serialized into a single column. * @return whether this member is serialized into a single column */ String serialized() default ""; /** Whether the elements of this member are serialized. * @return whether the elements of this member are serialized */ String serializedElement() default ""; /** Whether the keys of this member are serialized. * @return whether the keys of this member are serialized */ String serializedKey() default ""; /** Whether the values of this member are serialized. * @return whether the values of this member are serialized */ String serializedValue() default ""; /** Whether related object(s) of this member are dependent * and so deleted when this object is deleted. * @return whether the related object(s) of this member * are dependent */ String dependent() default ""; /** Whether the elements of this member are dependent. * @return whether the elements of this member are dependent */ String dependentElement() default ""; /** Whether the keys of this member are dependent. * @return whether the keys of this member are dependent */ String dependentKey() default ""; /** Whether the values of this member are dependent. * @return whether the values of this member are dependent */ String dependentValue() default ""; /** Whether this member is part of the primary key for application * identity. This is equivalent to specifying @PrimaryKey as * a separate annotation on the member. * @return whether this member is part of the primary key */ String primaryKey() default ""; /** Value strategy to use to generate the value for this field * or property (if any). * @return the generated value strategy */ IdGeneratorStrategy valueStrategy() default IdGeneratorStrategy.UNSPECIFIED; /** Custom value strategy to use to generate the value for this field * or property (if any). If customValueStrategy is non-empty, then * valueStrategy must be UNSPECIFIED. * @return the custom value strategy */ String customValueStrategy() default ""; /** Name of the sequence to use with particular value strategies. * @return the name of the sequence */ String sequence() default ""; /** Name of the fetch-group to use when this member is loaded * due to being referenced when not already loaded. * @return the name of the load fetch group */ String loadFetchGroup() default ""; /** Types of the member. Used when the declared * member type is a supertype of the actual type that is stored in the * member. For example, the declared member type might be an interface type * that must contain an object of a concrete type when used * for persistence. * @return the types */ Class[] types() default {}; /** Name of the related member in the other class * where this value is mapped (bidirectional relationship). * @return the related member in the other class */ String mappedBy() default ""; /** Column definition(s) for this member. Used for mapping * multiple columns * to the same member, for example relationships with * multiple column foreign keys. * @return the columns for this member */ Column[] columns() default {}; /** Column name where the values are stored for this member. * @return the name of the column */ String column() default ""; /** Null indicator column for this member. Used for nested * embedded fields or properties to indicate whether the embedded * instance should have a null value. * @return the null indicator column */ String nullIndicatorColumn() default ""; /** Name of the member when this is embedded in another object. * The fully-qualified member name is used. For example, * "line.point1.x" refers to the member x in class Point * that is embedded as member point1 in class Line that is embedded * in a member called line. * @return the name of the member */ String name() default ""; /** Recursion depth for this member. Used only when * the annotation is used within the definition of a FetchGroup. * @return the recursion depth */ int recursionDepth() default 1; /** Whether this field/property is cacheable in a Level2 cache. * @since 2.2 */ String cacheable() default "true"; /** Vendor extensions for this member. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/PrimaryKey.java100644 0 0 3610 11073716464 21013 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation on a member to define it as a primary key member of a class or * persistent interface using application identity. * Also used to define the primary key columns of a secondary table. * Corresponds to the xml element "primary-key". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface PrimaryKey { /** * Name of the primary key constraint * @return the name of the primary key constraint */ String name() default ""; /** * Name of the column to use for the primary key * @return the name of the column to use for the primary key */ String column() default ""; /** * The column(s) for the primary key * @return the column(s) for the primary key */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Queries.java100644 0 0 2435 11073716464 20340 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of named queries. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Queries { /** * The named queries * @return The named queries */ Query[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/Query.java100644 0 0 4344 11073716465 20032 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a named query. * Corresponds to the xml element "query". * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Query { /** Name of the query (mandatory) * @return the name of the query */ String name(); /** The query string (mandatory) * @return the query string */ String value(); /** The query language * @return the query language */ String language() default "JDOQL"; /** Whether the query is unmodifiable. * @return whether the query is unmodifiable */ String unmodifiable() default ""; /** Whether the query returns a single unique result. * @return whether the query returns a single unique result */ String unique() default ""; /** Result class into which to put the results. * @return the class of the result */ Class resultClass() default void.class; /** The name of the fetch plan used by this query * @return the fetch plan */ String fetchPlan() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Sequence.java100644 0 0 3702 11073716465 20472 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a datastore sequence. * Maps across to the JDO2 element "sequence". * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Sequence { /** The symbolic name of the datastore sequence. * @return the name of the sequence */ String name(); /** Strategy for the sequence. * @return the strategy for the sequence */ SequenceStrategy strategy(); /** Name of the sequence in the datastore. * @return the name of the datastore sequence */ String datastoreSequence() default ""; /** Name of a factory class for generating the sequence values. * @return the name of the factory class for the sequence */ Class factoryClass() default void.class; /** Vendor extensions for this sequence. * @return vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/SequenceStrategy.java100644 0 0 2023 11073716465 22210 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the sequence strategy values. * * @version 2.1 * @since 2.1 */ public enum SequenceStrategy { NONTRANSACTIONAL, CONTIGUOUS, NONCONTIGUOUS } jdo2-api-2.2/src/java/javax/jdo/annotations/Serialized.java100644 0 0 2726 11073716464 21021 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation on a member (field or property) to indicate that * the member is stored serialized. Such a member cannot be queried using * JDOQL. * Corresponds to xml attribute "serialized" in "field" and "property" * elements. * This is the same as specifying @Persistent(serialized="true"). * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Serialized { } jdo2-api-2.2/src/java/javax/jdo/annotations/Transactional.java100644 0 0 2575 11073716465 21533 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation to indicate that a member (field or property) * is transactional but not persistent. * This corresponds to xml attribute persistence-modifier="transactional" of * "field" and "property" elements. * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Transactional { } jdo2-api-2.2/src/java/javax/jdo/annotations/Unique.java100644 0 0 4615 11073716465 20174 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a database unique constraint. Used for database schema * generation to create unique constraints. Also used to reorder database * operations when flushing changes to avoid unique constraint violations. * Corresponds to the xml element "unique". * * @version 2.1 * @since 2.1 */ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Unique { /** Name of the unique constraint. * @return the name of the unique constraint */ String name() default ""; /** Table for the unique constraint. This is needed iff annotating a type * where this unique constraint is not for the primary table for * the persistent class or interface. * @return the table on which the unique constraint is defined */ String table() default ""; /** Whether this unique constraint is deferred until commit. * @return whether this unique constraint is deferred until commit */ String deferred() default ""; /** Member (field and property) names that compose this unique constraint. * @return member names that compose this unique constraint */ String[] members() default {}; /** Columns that compose this unique constraint. * @return columns that compose this unique constraint */ Column[] columns() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Uniques.java100644 0 0 2456 11073716465 20360 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for a group of unique constraints. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Uniques { /** * The unique constraints. * @return The unique constraints */ Unique[] value(); } jdo2-api-2.2/src/java/javax/jdo/annotations/Value.java100644 0 0 11107 11073716465 20014 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the value of a map relation. * Corresponds to the xml element "value". * * @version 2.1 * @since 2.1 */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface Value { /** * Types of the values. This can be determined if using JDK1.5 generics * but is required otherwise. Multiple types can be specified if the * implementation supports multiple types. * @return the types of values */ Class[] types() default {}; /** * Whether the value is to be stored serialized (into a single column of a * join table). * @return Whether the value is to be stored serialized (into a join table) */ String serialized() default ""; /** Whether this value is embedded. * @return whether this value is embedded */ String embedded() default ""; /** * The embedded mapping for the value. * @return the embedded mapping for the value */ Embedded[] embeddedMapping() default {}; /** * Whether the value is dependent on the owner (and will be deleted * when the owner is deleted). * @return whether the value is dependent on the owner */ String dependent() default ""; /** * Name of the table for the value. * @return the name of the table for the value */ String table() default ""; /** * Name of the column to store the value in. * @return the name of the column to store the value in */ String column() default ""; /** * Delete action to apply to any foreign key for the value. * @return delete action to apply to any foreign key for the value */ ForeignKeyAction deleteAction() default ForeignKeyAction.UNSPECIFIED; /** * Update action to apply to any foreign key for the value. * @return update action to apply to any foreign key for the value */ ForeignKeyAction updateAction() default ForeignKeyAction.UNSPECIFIED; /** * Whether the value column(s) should be indexed. * @return whether the value column(s) should be indexed. */ String indexed() default ""; /** The name of the index to generate. * @return the name of the index */ String index() default ""; /** * Whether the element column(s) contents should be considered unique * @return whether the element column(s) contents should be considered unique */ String unique() default ""; /** * The name of the unique key constraint to generate. * @return the name of the unique key constraint */ String uniqueKey() default ""; /** * Name of a member in the key class where this value is stored. * @return the name of a member in the key class where this value is stored */ String mappedBy() default ""; /** * The column(s) for the value. * @return the column(s) for the value */ Column[] columns() default {}; /** Generate or assume a foreign key constraint exists on the column * or columns associated with this join. Specify "true" or "false". * @return whether to generate or assume a foreign key constraint */ String generateForeignKey() default ""; /** Name for a generated foreign key constraint. * @return the name of the generated foreign key constraint */ String foreignKey() default ""; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/Version.java100644 0 0 4512 11073716465 20347 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the versioning of the class. * Corresponds to the xml element "version" of the "class" and "property" * elements. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Version { /** * Strategy for versioning of objects of this class. * @return the strategy for versioning objects of this class */ VersionStrategy strategy() default VersionStrategy.UNSPECIFIED; /** * Custom strategy for versioning of objects of this class. * If customStrategy is non-empty, strategy must be UNSPECIFIED. * @return the custom strategy for versioning objects of this class */ String customStrategy() default ""; /** * Name of the column for the version. * @return the name of the column for the version */ String column() default ""; /** * Whether the version column(s) is(are) indexed. * @return whether the version column(s) is(are) indexed */ String indexed() default ""; /** * The column(s) making up the version. * @return the column(s) making up the version */ Column[] columns() default {}; /** Vendor extensions. * @return the vendor extensions */ Extension[] extensions() default {}; } jdo2-api-2.2/src/java/javax/jdo/annotations/VersionStrategy.java100644 0 0 2051 11073716464 22065 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.annotations; /** * Enumeration of the version strategy values. * * @version 2.1 * @since 2.1 */ public enum VersionStrategy { UNSPECIFIED, NONE, STATE_IMAGE, DATE_TIME, VERSION_NUMBER } jdo2-api-2.2/src/java/javax/jdo/Bundle.properties100644 0 0 17267 11073716464 17103 0ustar 0 0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ResourceBundle properties file for JDO ERR_AbstractClassNoIdentity=Abstract class {0} does not implement key field helper methods ERR_CannotInitCause=The initCause method cannot be used. To set the cause of this exception, \ use a constructor with a Throwable[] argument. ERR_StateManagerClassCast=An element of the parameter collection is of class {0}. \ The parameter collection must contain only elements that are instances of java.lang.Class. ERR_NoMetadata=No metadata has been registered for class {0}. EXC_GetPMFNoSuchMethod=Method getPersistenceManagerFactory(Map) on class {0} does not exist or is not public. EXC_GetPMFNoSuchMethod2=Method getPersistenceManagerFactory(Map,Map) on class {0} does not exist or is not public. EXC_GetPMFInvocationTargetException=Method getPersistenceManagerFactory(..) on class {0} threw exception. EXC_GetPMFUnexpectedException=Unexpected exception caught. EXC_GetPMFClassNotFound=Class {0} was not found. EXC_GetPMFIllegalAccess=Illegal Access for class {0}. EXC_GetPMFNoPMFClassNamePropertyOrPUNameProperty=A property named javax.jdo.PersistenceManagerFactoryClass must be specified, \ or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, \ or a property named javax.jdo.option.PersistenceUnitName must be specified. EXC_IOExceptionDuringServiceLookup=IO error while attempting to lookup PMF name \ via META-INF/services/javax.jdo.PersistenceManagerFactory MSG_FailedObject=FailedObject: MSG_NestedThrowables=NestedThrowables: MSG_NestedThrowablesStackTrace=NestedThrowablesStackTrace: MSG_ExceptionGettingFailedToString=Exception getting failed.toString(): ''{0}''. MSG_ExceptionGettingFailedToStringObjectId=Exception getting failed.toString(): ''{0}''. ObjectId of failed instance: ''{1}''. ERR_NullClass=JDO implementation error: the parameter class object must not be null. EXC_GetPMFNullResource: The resource name argument to this method cannot be null. EXC_GetPMFNullLoader: The class loader argument to this method cannot be null. EXC_GetPMFNullPropsLoader: The class loader argument to this method cannot be null. EXC_GetPMFNullPMFLoader: The class loader argument to this method cannot be null. EXC_GetPMFNullStream: The stream argument to this method cannot be null. EXC_GetPMFNullPMF: The PMF {0} returned null to getPersistenceManagerFactory. EXC_GetPMFNoResource: The resource named "{0}" could not be found in the class loader "{1}". EXC_GetPMFIOExceptionRsrc: An IOException was thrown while loading the resource \ named "{0}" into a java.util.Properties object. EXC_GetPMFIOExceptionStream: An IOException was thrown while loading the stream \ into a java.util.Properties object. EXC_GetPMFNullFile: The file argument to this method cannot be null. EXC_GetPMFNoFile: The file named "{0}" could not be found. EXC_GetPMFIOExceptionFile: An IOException was thrown while loading the file \ named "{0}" into a java.util.Properties object. EXC_GetPMFNullJndiLoc: The JNDI location argument to this method cannot be null. EXC_GetPMFNamingException: A NamingException was thrown while obtaining the \ PersistenceManagerFactory at "{0}" from JNDI. EXC_GetPMFNullPointerException: The PersistenceManagerFactory class must define a static \ method \nPersistenceManagerFactory getPersistenceManagerFactory(Map props). \nThe class "{0}"\n\ defines a non-static getPersistenceManagerFactory(Map props) method. EXC_GetPMFClassCastException: The PersistenceManagerFactory class must define a static \ method \nPersistenceManagerFactory getPersistenceManagerFactory(Map props). \nThe class "{0}"\n\ has the wrong return type for the getPersistenceManagerFactory(Map props) method. EXC_StringWrongLength: There must be exactly one character in the id in the input String for CharIdentity. EXC_IllegalEventType:The event type is outside the range of valid event types. EXC_SingleFieldIdentityNullParameter: The identity must not be null. EXC_ObjectIdentityStringConstruction: The identity instance could not be constructed. \ \nThe exception thrown was: "{0}". \ \nParsed the class name as "{1}" and key as "{2}". EXC_ObjectIdentityStringConstructionNoDelimiter: Missing delimiter ":". EXC_ObjectIdentityStringConstructionTooShort: Parameter is too short. EXC_ObjectIdentityStringConstructionUsage: The instance could not be constructed \ from the parameter String "{0}". \ \nThe parameter String is of the form ":". EXC_CreateKeyAsObjectMustNotBeCalled: The method createKeyAsObject must not be called \ because the keyAsObject field must never be null for this class. EXC_CurrencyStringConstructorIllegalArgument: The instance could not be constructed \ with the argument "{0}". Try "USD". EXC_CurrencyStringConstructorException: An exception was thrown during construction \ of the Currency instance. EXC_LocaleStringConstructorException: An exception was thrown during construction \ of the Locale instance. EXC_DateStringConstructor: Error parsing Date string "{0}" at position {1} \ using date format "{2}". MSG_unknown: unknown EXC_DuplicateRequestedNamedPMFFoundInDifferentConfigs: Duplicate \ PMF name "{0}" found in {1} and {2}. EXC_DuplicateRequestedNamedPMFFoundInSameConfig: Duplicate PMF \ name "{0}" found in {1}. EXC_UnableToInvokeCreateEMFMethod: Unable to invoke \ javax.persistence.Persistence.createEntityManagerFactory(String). EXC_UnableToCastEMFToPMF: Unable to cast EntityManagerFactory class {0} \ to javax.jdo.PersistenceManagerFactory. ERR_NoDocumentBuilderFactory: Unable to instantiate \ javax.xml.parsers.DocumentBuilderFactory. EXC_ParserConfigException: Encountered parser configuration exception while \ getting javax.xml.parsers.DocumentBuilder. EXC_SAXParseException: Exception parsing configuration {0}\ at line {1}, column {2}. EXC_SAXException: Exception parsing configuration {0}. EXC_DuplicatePropertyFound: Duplicate property name "{0}" found in PMF \ configuration with name "{1}" found in {2}. EXC_DuplicatePMFNamePropertyFoundWithinConfig: Duplicate \ PMF name found in {2}: attribute is "{0}", element is "{1}". EXC_PropertyElementHasNoNameAttribute: Found element with no \ "name" attribute in {0}. EXC_PropertyElementNameAttributeHasNoValue: Found element name \ attribute "{0}" with no value in {1}. EXC_DuplicatePropertyNameGivenInPropertyElement: Duplicate property name given \ in property element: name {0} in {1}. EXC_MissingListenerAttribute: Required \ attribute "listener" missing in {0}. EXC_MissingListenerAttributeValue: attribute \ "listener" missing value in {0}. EXC_InvalidJDOConfigNoRoot: No root element found in {0}. EXC_NoPMFConfigurableViaPropertiesOrXML: No PersistenceManagerFactory \ configurable via properties resource "{0}" or no named PMF or persistence unit \ named "{0}" found. EXC_JavaxPersistencePersistenceAbsentOrNoPUFound=\ Class javax.persistence.Persistence or one of its dependencies was not found, \ or the given persistence unit name "{0}" was not found. jdo2-api-2.2/src/java/javax/jdo/Constants.java100644 0 0 72356 11073716464 16373 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo; /** * Constant values used in JDO. * * @since 2.1 * @version 2.2 */ public interface Constants { /** * The name of the standard service configuration resource text file containing * the name of an implementation of {@link PersistenceManagerFactory}. * Constant value is META-INF/services/javax.jdo.PersistenceManagerFactory. * * @since 2.1 */ static String SERVICE_LOOKUP_PMF_RESOURCE_NAME = "META-INF/services/javax.jdo.PersistenceManagerFactory"; /** * The name of the standard JDO configuration resource file(s). * Constant value is META-INF/jdoconfig.xml. * * @since 2.1 */ static String JDOCONFIG_RESOURCE_NAME = "META-INF/jdoconfig.xml"; /** * The standard JDO configuration schema namespace. * Constant value is http://java.sun.com/xml/ns/jdo/jdoconfig. * * @since 2.1 */ static String JDOCONFIG_XSD_NS = "http://java.sun.com/xml/ns/jdo/jdoconfig"; /** * The standard JDO metadata schema namespace. * Constant value is http://java.sun.com/xml/ns/jdo/jdo. * * @since 2.1 */ static String JDO_XSD_NS = "http://java.sun.com/xml/ns/jdo/jdo"; /** * The standard JDO object-repository mapping schema namespace. * Constant value is http://java.sun.com/xml/ns/jdo/orm. * * @since 2.1 */ static String ORM_XSD_NS = "http://java.sun.com/xml/ns/jdo/orm"; /** * The standard JDO query schema namespace. * Constant value is http://java.sun.com/xml/ns/jdo/jdoquery. * * @since 2.1 */ static String JDOQUERY_XSD_NS = "http://java.sun.com/xml/ns/jdo/jdoquery"; /** * The name of the persistence manager factory element in the JDO * configuration file. * Constant value is persistence-manager-factory. * * @since 2.1 */ static String ELEMENT_PERSISTENCE_MANAGER_FACTORY = "persistence-manager-factory"; /** * The name of the persistence manager factory element's "class" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CLASS = "class"; /** * The name of the persistence manager factory element's * "name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_NAME = "name"; /** * The name of the persistence manager factory element's * "persistence-unit-name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME = "persistence-unit-name"; /** * The name of the persistence manager factory element's "optimistic" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_OPTIMISTIC = "optimistic"; /** * The name of the persistence manager factory element's "readonly" * attribute. * * @since 2.2 */ static String PMF_ATTRIBUTE_READONLY = "readonly"; /** * The name of the persistence manager factory element's "retain-values" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_RETAIN_VALUES = "retain-values"; /** * The name of the persistence manager factory element's "restore-values" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_RESTORE_VALUES = "restore-values"; /** * The name of the persistence manager factory element's "ignore-cache" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_IGNORE_CACHE = "ignore-cache"; /** * The name of the persistence manager factory element's * "nontransactional-read" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_NONTRANSACTIONAL_READ = "nontransactional-read"; /** * The name of the persistence manager factory element's * "nontransactional-write" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE = "nontransactional-write"; /** * The name of the persistence manager factory element's "multithreaded" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_MULTITHREADED = "multithreaded"; /** * The name of the persistence manager factory element's * "connection-driver-name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME = "connection-driver-name"; /** * The name of the persistence manager factory element's * "connection-user-name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_USER_NAME = "connection-user-name"; /** * The name of the persistence manager factory element's * "connection-password" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_PASSWORD = "connection-password"; /** * The name of the persistence manager factory element's "connection-url" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_URL = "connection-url"; /** * The name of the persistence manager factory element's * "connection-factory-name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME = "connection-factory-name"; /** * The name of the persistence manager factory element's * "connection-factory2-name" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME = "connection-factory2-name"; /** * The name of the persistence manager factory element's * "detach-all-on-commit" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT = "detach-all-on-commit"; /** * The name of the persistence manager factory element's * "copy-on-attach" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_COPY_ON_ATTACH = "copy-on-attach"; /** * The name of the persistence manager factory element's "mapping" * attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_MAPPING = "mapping"; /** * The name of the persistence manager factory element's * "server-time-zone-id" attribute. * * @since 2.1 */ static String PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID = "server-time-zone-id"; /** * The name of the persistence manager factory property elements in the JDO * configuration file. */ static String ELEMENT_PROPERTY = "property"; /** * The name of the persistence manager factory property element's "name" * attribute. */ static String PROPERTY_ATTRIBUTE_NAME = "name"; /** * The name of the persistence manager factory property element's "value" * attribute. */ static String PROPERTY_ATTRIBUTE_VALUE = "value"; /** * The name of the instance lifecycle listener element in the JDO * configuration file. */ static String ELEMENT_INSTANCE_LIFECYCLE_LISTENER = "instance-lifecycle-listener"; /** * The name of the instance lifecycle listener element's "listener" * attribute. */ static String INSTANCE_LIFECYCLE_LISTENER_ATTRIBUTE_LISTENER = "listener"; /** * The name of the instance lifecycle listener element's "classes" * attribute. */ static String INSTANCE_LIFECYCLE_LISTENER_ATTRIBUTE_CLASSES = "classes"; /** * "javax.jdo.option.TransientTransactional" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_TRANSACTIONAL_TRANSIENT = "javax.jdo.option.TransientTransactional"; /** * "javax.jdo.option.NontransactionalRead" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_NONTRANSACTIONAL_READ = "javax.jdo.option.NontransactionalRead"; /** * "javax.jdo.option.NontransactionalWrite" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_NONTRANSACTIONAL_WRITE = "javax.jdo.option.NontransactionalWrite"; /** * "javax.jdo.option.RetainValues" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_RETAIN_VALUES = "javax.jdo.option.RetainValues"; /** * "javax.jdo.option.Optimistic" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_OPTIMISTIC = "javax.jdo.option.Optimistic"; /** * "javax.jdo.option.ApplicationIdentity" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_APPLICATION_IDENTITY = "javax.jdo.option.ApplicationIdentity"; /** * "javax.jdo.option.DatastoreIdentity" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_DATASTORE_IDENTITY = "javax.jdo.option.DatastoreIdentity"; /** * "javax.jdo.option.NonDurableIdentity" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_NONDURABLE_IDENTITY = "javax.jdo.option.NonDurableIdentity"; /** * "javax.jdo.option.ArrayList" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_ARRAYLIST = "javax.jdo.option.ArrayList"; /** * "javax.jdo.option.LinkedList" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_LINKEDLIST = "javax.jdo.option.LinkedList"; /** * "javax.jdo.option.TreeMap" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_TREEMAP = "javax.jdo.option.TreeMap"; /** * "javax.jdo.option.TreeSet" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_TREESET = "javax.jdo.option.TreeSet"; /** * "javax.jdo.option.Vector" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_VECTOR = "javax.jdo.option.Vector"; /** * "javax.jdo.option.Array" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_ARRAY = "javax.jdo.option.Array"; /** * "javax.jdo.option.NullCollection" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_NULL_COLLECTION = "javax.jdo.option.NullCollection"; /** * "javax.jdo.option.ChangeApplicationIdentity" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_CHANGE_APPLICATION_IDENTITY = "javax.jdo.option.ChangeApplicationIdentity"; /** * "javax.jdo.option.BinaryCompatibility" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_BINARY_COMPATIBILITY = "javax.jdo.option.BinaryCompatibility"; /** * "javax.jdo.option.GetDataStoreConnection" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_GET_DATASTORE_CONNECTION = "javax.jdo.option.GetDataStoreConnection"; /** * "javax.jdo.option.GetJDBCConnection" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_GET_JDBC_CONNECTION = "javax.jdo.option.GetJDBCConnection"; /** * "javax.jdo.query.SQL" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_QUERY_SQL = "javax.jdo.query.SQL"; /** * "javax.jdo.option.UnconstrainedQueryVariables" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_UNCONSTRAINED_QUERY_VARIABLES = "javax.jdo.option.UnconstrainedQueryVariables"; /** * "javax.jdo.option.version.DateTime" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_VERSION_DATETIME = "javax.jdo.option.version.DateTime"; /** * "javax.jdo.option.version.StateImage" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_VERSION_STATE_IMAGE = "javax.jdo.option.version.StateImage"; /** * "javax.jdo.option.PreDirtyEvent" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_PREDIRTY_EVENT = "javax.jdo.option.PreDirtyEvent"; /** * "javax.jdo.option.mapping.HeterogeneousObjectType" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_HETEROGENEOUS_OBJECT_TYPE = "javax.jdo.option.mapping.HeterogeneousObjectType"; /** * "javax.jdo.option.mapping.HeterogeneousInterfaceType" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_HETEROGENEOUS_INTERFACE_TYPE = "javax.jdo.option.mapping.HeterogeneousInterfaceType"; /** * "javax.jdo.option.mapping.JoinedTablePerClass" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_JOINED_TABLE_PER_CLASS = "javax.jdo.option.mapping.JoinedTablePerClass"; /** * "javax.jdo.option.mapping.JoinedTablePerConcreteClass" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_JOINED_TABLE_PER_CONCRETE_CLASS = "javax.jdo.option.mapping.JoinedTablePerConcreteClass"; /** * "javax.jdo.option.mapping.NonJoinedTablePerConcreteClass" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_NON_JOINED_TABLE_PER_CONCRETE_CLASS = "javax.jdo.option.mapping.NonJoinedTablePerConcreteClass"; /** * "javax.jdo.option.mapping.RelationSubclassTable" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.1 */ static String OPTION_MAPPING_RELATION_SUBCLASS_TABLE = "javax.jdo.option.mapping.RelationSubclassTable"; /** * "javax.jdo.PersistenceManagerFactoryClass" * * @see JDOHelper#getPersistenceManagerFactory(java.util.Map) * @since 2.1 */ static String PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS = "javax.jdo.PersistenceManagerFactoryClass"; /** * "javax.jdo.option.Optimistic" * * @see PersistenceManagerFactory#getOptimistic() * @since 2.1 */ static String PROPERTY_OPTIMISTIC = "javax.jdo.option.Optimistic"; /** * "javax.jdo.option.ReadOnly" * * @see PersistenceManagerFactory#getReadOnly() * @since 2.2 */ static String PROPERTY_READONLY = "javax.jdo.option.ReadOnly"; /** * "javax.jdo.option.RetainValues" * * @see PersistenceManagerFactory#getRetainValues() * @since 2.1 */ static String PROPERTY_RETAIN_VALUES = "javax.jdo.option.RetainValues"; /** * "javax.jdo.option.RestoreValues" * * @see PersistenceManagerFactory#getRestoreValues() * @since 2.1 */ static String PROPERTY_RESTORE_VALUES = "javax.jdo.option.RestoreValues"; /** * "javax.jdo.option.IgnoreCache" * * @see PersistenceManagerFactory#getIgnoreCache() * @since 2.1 */ static String PROPERTY_IGNORE_CACHE = "javax.jdo.option.IgnoreCache"; /** * "javax.jdo.option.NontransactionalRead" * * @see PersistenceManagerFactory#getNontransactionalRead() * @since 2.1 */ static String PROPERTY_NONTRANSACTIONAL_READ = "javax.jdo.option.NontransactionalRead"; /** * "javax.jdo.option.NontransactionalWrite" * * @see PersistenceManagerFactory#getNontransactionalWrite() * @since 2.1 */ static String PROPERTY_NONTRANSACTIONAL_WRITE = "javax.jdo.option.NontransactionalWrite"; /** * "javax.jdo.option.Multithreaded" * * @see PersistenceManagerFactory#getMultithreaded() * @since 2.1 */ static String PROPERTY_MULTITHREADED = "javax.jdo.option.Multithreaded"; /** * "javax.jdo.option.TransactionIsolationLevel" * * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL = "javax.jdo.option.TransactionIsolationLevel"; /** * "javax.jdo.option.TransactionIsolationLevel.read-uncommitted" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL_READ_UNCOMMITTED = "javax.jdo.option.TransactionIsolationLevel.read-uncommitted"; /** * "javax.jdo.option.TransactionIsolationLevel.read-committed" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL_READ_COMMITTED = "javax.jdo.option.TransactionIsolationLevel.read-committed"; /** * "javax.jdo.option.TransactionIsolationLevel.repeatable-read" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL_REPEATABLE_READ = "javax.jdo.option.TransactionIsolationLevel.repeatable-read"; /** * "javax.jdo.option.TransactionIsolationLevel.snapshot" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL_SNAPSHOT = "javax.jdo.option.TransactionIsolationLevel.snapshot"; /** * "javax.jdo.option.TransactionIsolationLevel.serializable" * * @see PersistenceManagerFactory#supportedOptions() * @since 2.2 */ static String PROPERTY_TRANSACTION_ISOLATION_LEVEL_SERIALIZABLE = "javax.jdo.option.TransactionIsolationLevel.serializable"; /** * "javax.jdo.option.DetachAllOnCommit" * * @see PersistenceManagerFactory#getDetachAllOnCommit() * @since 2.1 */ static String PROPERTY_DETACH_ALL_ON_COMMIT = "javax.jdo.option.DetachAllOnCommit"; /** * "javax.jdo.option.CopyOnAttach" * * @see PersistenceManagerFactory#getCopyOnAttach() * @since 2.1 */ static String PROPERTY_COPY_ON_ATTACH = "javax.jdo.option.CopyOnAttach"; /** * "javax.jdo.option.ConnectionDriverName" * * @see PersistenceManagerFactory#getConnectionDriverName() * @since 2.1 */ static String PROPERTY_CONNECTION_DRIVER_NAME = "javax.jdo.option.ConnectionDriverName"; /** * "javax.jdo.option.ConnectionUserName" * * @see PersistenceManagerFactory#getConnectionUserName() * @since 2.1 */ static String PROPERTY_CONNECTION_USER_NAME = "javax.jdo.option.ConnectionUserName"; /** * "javax.jdo.option.Password" * * @since 2.1 */ static String PROPERTY_CONNECTION_PASSWORD = "javax.jdo.option.ConnectionPassword"; /** * "javax.jdo.option.ConnectionURL" * * @see PersistenceManagerFactory#getConnectionURL() * @since 2.1 */ static String PROPERTY_CONNECTION_URL = "javax.jdo.option.ConnectionURL"; /** * "javax.jdo.option.ConnectionFactoryName" * * @see PersistenceManagerFactory#getConnectionFactoryName() * @since 2.1 */ static String PROPERTY_CONNECTION_FACTORY_NAME = "javax.jdo.option.ConnectionFactoryName"; /** * "javax.jdo.option.ConnectionFactory2Name" * * @see PersistenceManagerFactory#getConnectionFactory2Name() * @since 2.1 */ static String PROPERTY_CONNECTION_FACTORY2_NAME = "javax.jdo.option.ConnectionFactory2Name"; /** * "javax.jdo.option.Mapping" * * @see PersistenceManagerFactory#getMapping() * @since 2.1 */ static String PROPERTY_MAPPING = "javax.jdo.option.Mapping"; /** * "javax.jdo.option.PersistenceUnitName" * * @see PersistenceManagerFactory#getPersistenceUnitName() * @since 2.1 */ static String PROPERTY_PERSISTENCE_UNIT_NAME = "javax.jdo.option.PersistenceUnitName"; /** * "javax.jdo.option.Name" * * @see PersistenceManagerFactory#getName() * @since 2.1 */ static String PROPERTY_NAME = "javax.jdo.option.Name"; /** * "javax.jdo.option.spi.ResourceName" * @since 2.1 */ static String PROPERTY_SPI_RESOURCE_NAME = "javax.jdo.option.spi.ResourceName"; /** * "javax.jdo.listener.InstanceLifecycleListener" * * @see PersistenceManagerFactory#addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener,Class[]) * @see PersistenceManagerFactory#removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener) */ static String PROPERTY_INSTANCE_LIFECYCLE_LISTENER = "javax.jdo.listener.InstanceLifecycleListener"; /** * Prefix used to configure * {@link javax.jdo.listener.InstanceLifecycleListener} instances * externally. * To configure an InstanceLifecycleListener via properties, * create a property name with the prefix of * this constant and append the fully qualified listener class name, then * set its value to the comma- or whitespace-delimited list * of persistence-capable classes whose instances are to be observed. * Use no value to indicate that instances of * all persistence-capable classes are to be observed.
* For example,
* javax.jdo.option.InstanceLifecycleListener.com.example.MyListener=com.example.Foo,com.example.Bar
* is equivalent to calling
* pmf.addInstanceLifecycleListener(new com.example.MyListener(), new Class[] {com.example.Foo.class, com.example.Bar.class});
* where pmf is an instance of type * PersistenceManagerFactory. * * @see javax.jdo.PersistenceManagerFactory#addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener,Class[]) * @since 2.1 */ static String PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER = PROPERTY_INSTANCE_LIFECYCLE_LISTENER + "."; /** * Mapping "javax.jdo.mapping.Catalog" * * @since 2.1 */ static String PROPERTY_MAPPING_CATALOG = "javax.jdo.mapping.Catalog"; /** * Mapping "javax.jdo.mapping.Schema" * * @since 2.1 */ static String PROPERTY_MAPPING_SCHEMA = "javax.jdo.mapping.Schema"; /** * Mapping "javax.jdo.option.ServerTimeZoneID" * * @since 2.1 */ static String PROPERTY_SERVER_TIME_ZONE_ID = "javax.jdo.option.ServerTimeZoneID"; /** * Nonconfigurable property constanct "VendorName" * * @see PersistenceManagerFactory#getProperties() * @since 2.1 */ static String NONCONFIGURABLE_PROPERTY_VENDOR_NAME = "VendorName"; /** * Nonconfigurable property constanct "VersionNumber" * * @see PersistenceManagerFactory#getProperties() * @since 2.1 */ static String NONCONFIGURABLE_PROPERTY_VERSION_NUMBER = "VersionNumber"; /** * The value for TransactionType to specify that transactions * are managed by the Java Transactions API, as documented in * JSR-220. * * @since 2.1 */ static String JTA = "JTA"; /** * The value for TransactionType to specify that transactions * are managed by the javax.jdo.Transaction instance, similar * to the usage as documented in JSR-220. * * @since 2.1 */ static String RESOURCE_LOCAL = "RESOURCE_LOCAL"; /** * The name of the resource for the DTD of the standard JDO configuration * file. * * @since 2.1 */ static String JDOCONFIG_DTD_RESOURCE = "javax/jdo/jdoconfig_2_2.dtd"; /** * The name of the resource for the XML schema of the standard JDO * configuration file. * * @since 2.1 */ static String JDOCONFIG_XSD_RESOURCE = "javax/jdo/jdoconfig_2_2.xsd"; /** * The name of the resource for the DTD of the standard JDO metadata file. * * @since 2.1 */ static String JDO_DTD_RESOURCE = "javax/jdo/jdo_2_2.dtd"; /** * The name of the resource for the XML schema of the standard JDO * metadata file. * * @since 2.1 */ static String JDO_XSD_RESOURCE = "javax/jdo/jdo_2_2.xsd"; /** * The name of the resource for the DTD of the standard JDO * object-relational mapping metadata file. * * @since 2.1 */ static String ORM_DTD_RESOURCE = "javax/jdo/orm_2_2.dtd"; /** * The name of the resource for the XML schema of the standard JDO * object-relational mapping metadata file. * * @since 2.1 */ static String ORM_XSD_RESOURCE = "javax/jdo/orm_2_2.xsd"; /** * The name of the resource for the DTD of the standard JDO query * metadata file. * * @since 2.1 */ static String JDOQUERY_DTD_RESOURCE = "javax/jdo/jdoquery_2_2.dtd"; /** * The name of the resource for the XML schema of the standard JDO query * metadata file. * * @since 2.1 */ static String JDOQUERY_XSD_RESOURCE = "javax/jdo/jdoquery_2_2.xsd"; /** * The name of the anonymous PersistenceManagerFactory, which * is the empty string. * * @since 2.1 */ static String ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME = ""; /** * Transaction isolation level representing the ability to read * uncommitted data. * @see PersistenceManagerFactory#getTransactionIsolationLevel() * @see Transaction#getIsolationLevel() * @since 2.2 */ public static final String TX_READ_UNCOMMITTED = "read-uncommitted"; /** * Transaction isolation level representing the requirement to read * committed data only. * @see PersistenceManagerFactory#getTransactionIsolationLevel() * @see Transaction#getIsolationLevel() * @since 2.2 */ public static final String TX_READ_COMMITTED = "read-committed"; /** * Transaction isolation level representing the requirement to read * the same data in the same transaction. * @see PersistenceManagerFactory#getTransactionIsolationLevel() * @see Transaction#getIsolationLevel() * @since 2.2 */ public static final String TX_REPEATABLE_READ = "repeatable-read"; /** * Transaction isolation level representing the requirement to keep * a snapshot for reading data. * @see PersistenceManagerFactory#getTransactionIsolationLevel() * @see Transaction#getIsolationLevel() * @since 2.2 */ public static final String TX_SNAPSHOT = "snapshot"; /** * Transaction isolation level representing the requirement to serialize * transactions. * @see PersistenceManagerFactory#getTransactionIsolationLevel() * @see Transaction#getIsolationLevel() * @since 2.2 */ public static final String TX_SERIALIZABLE = "serializable"; } jdo2-api-2.2/src/java/javax/jdo/datastore/DataStoreCache.java100644 0 0 14346 11073716464 21212 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DataStoreCache.java * */ package javax.jdo.datastore; import java.util.Collection; /** * Many JDO implementations allow instances to be cached in a * second-level cache, and allow direct management of the cache by * knowledgeable applications. This interface standardizes this * behavior. * @since 2.0 * @version 2.0 */ public interface DataStoreCache { /** Evict the parameter instance from the second-level cache. * @param oid the object id of the instance to evict. * @since 2.0 */ void evict (Object oid); /** Evict the parameter instances from the second-level cache. * All instances in the PersistenceManager's cache are evicted * from the second-level cache. * @since 2.0 */ void evictAll (); /** Evict the parameter instances from the second-level cache. * @param oids the object ids of the instance to evict. * @since 2.0 */ void evictAll (Object... oids); /** Evict the parameter instances from the second-level cache. * @param oids the object ids of the instance to evict. * @since 2.0 */ void evictAll (Collection oids); /** Evict the parameter instances from the second-level cache. * @param pcClass the class of instances to evict * @param subclasses if true, evict instances of subclasses also * @since 2.0 * @deprecated use evictAll (boolean subclasses, Class pcClass) */ void evictAll (Class pcClass, boolean subclasses); /** Evict the parameter instances from the second-level cache. * @param pcClass the class of instances to evict * @param subclasses if true, evict instances of subclasses also * @since 2.1 */ void evictAll (boolean subclasses, Class pcClass); /** Pin the parameter instance in the second-level cache. * @param oid the object id of the instance to pin. * @since 2.0 */ void pin (Object oid); /** Pin the parameter instances in the second-level cache. * @param oids the object ids of the instances to pin. * @since 2.0 */ void pinAll (Collection oids); /** Pin the parameter instances in the second-level cache. * @param oids the object ids of the instances to pin. * @since 2.0 */ void pinAll (Object... oids); /** Pin instances in the second-level cache. * @param pcClass the class of instances to pin * @param subclasses if true, pin instances of subclasses also * @since 2.0 * @deprecated use pinAll (boolean subclasses, Class pcClass) */ void pinAll (Class pcClass, boolean subclasses); /** Pin instances in the second-level cache. * @param pcClass the class of instances to pin * @param subclasses if true, pin instances of subclasses also * @since 2.1 */ void pinAll (boolean subclasses, Class pcClass); /** Unpin the parameter instance from the second-level cache. * @param oid the object id of the instance to unpin. * @since 2.0 */ void unpin(Object oid); /** Unpin the parameter instances from the second-level cache. * @param oids the object ids of the instance to evict. * @since 2.0 */ void unpinAll(Collection oids); /** Unpin the parameter instance from the second-level cache. * @param oids the object id of the instance to evict. * @since 2.0 */ void unpinAll(Object... oids); /** Unpin instances from the second-level cache. * @param pcClass the class of instances to unpin * @param subclasses if true, unpin instances of subclasses also * @since 2.0 * @deprecated use unpinAll(boolean subclasses, Class pcClass) */ void unpinAll(Class pcClass, boolean subclasses); /** Unpin instances from the second-level cache. * @param pcClass the class of instances to unpin * @param subclasses if true, unpin instances of subclasses also * @since 2.1 */ void unpinAll(boolean subclasses, Class pcClass); /** * This class is an empty implementation of the DataStoreCache * interface. It can be used by an implementation that does not * support a second-level cache. * @since 2.0 */ public class EmptyDataStoreCache implements DataStoreCache { public EmptyDataStoreCache() { } public void evict(Object oid) { } public void evictAll() { } public void evictAll(Object... oids) { } public void evictAll(Collection oids) { } public void evictAll(Class pcClass, boolean subclasses) { } public void evictAll(boolean subclasses, Class pcClass) { } public void pin(Object oid) { } public void pinAll(Object... oids) { } public void pinAll(Collection oids) { } public void pinAll(Class pcClass, boolean subclasses) { } public void pinAll(boolean subclasses, Class pcClass) { } public void unpin(Object oid) { } public void unpinAll(Object... oids) { } public void unpinAll(Collection oids) { } public void unpinAll(Class pcClass, boolean subclasses) { } public void unpinAll(boolean subclasses, Class pcClass) { } } } jdo2-api-2.2/src/java/javax/jdo/datastore/JDOConnection.java100644 0 0 4012 11073716464 21001 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOConnection.java * */ package javax.jdo.datastore; /** * The underlying connection that is being used by a * {@link javax.jdo.PersistenceManager}. * @version 2.0 * @since 2.0 */ public interface JDOConnection { /** * Returns the native, datastore-specific connection that this * connection wraps. In general, it is not recommended that this * native connection be used directly, since the JDO * implementation has no way to intercept calls to it, so it is * quite possible to put the PersistenceManager's * connection into an invalid state. * @return the native connection * @since 2.0 */ Object getNativeConnection (); /** * Returns this connection to the JDO implementation. * The object must be returned to the JDO implementation prior to * calling any JDO method or performing any action on any persistent * instance that might require the JDO implementation to use a * connection. If the object has not been returned and the JDO * implementation needs a connection, a JDOUserException * is thrown. * @since 2.0 */ void close(); } jdo2-api-2.2/src/java/javax/jdo/datastore/package.html100644 0 0 1773 11073716464 17776 0ustar 0 0 Datastore package This package contains the JDO specification datastore interfaces. jdo2-api-2.2/src/java/javax/jdo/datastore/Sequence.java100644 0 0 5336 11073716464 20127 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Sequence.java * */ package javax.jdo.datastore; /** * Implementations of this interface can be used to obtain * sequences. The behavior with regard to the transaction and * rollover behavior are defined in the metadata. * * @version 2.0 * @since 2.0 */ public interface Sequence { /** * Returns the fully qualified name of the Sequence. * @return the name of the sequence */ String getName (); /** * Returns the next sequence value as an Object. If the next * sequence value is not available, throw JDODataStoreException. * @return the next value */ Object next (); /** * Provides a hint to the implementation that the application * will need additional sequence value objects in * short order. There is no externally visible behavior of this * method. It is used to potentially improve the efficiency of * the algorithm of obtaining additional sequence value objects. * @param additional the number of additional values to allocate */ void allocate (int additional); /** * Returns the current sequence value object if it is * available. It is intended to return a sequence value object * previously used. If the current sequence value is not available, * throw JDODataStoreException. * @return the current value */ Object current (); /** * Returns the next sequence value as a long. If the next * sequence value is not available or is not numeric, throw * JDODataStoreException. * @return the next value */ long nextValue(); /** * Returns the current sequence value as a long. If the current * sequence value is not available or is not numeric, throw * JDODataStoreException. * @return the current value */ long currentValue(); } jdo2-api-2.2/src/java/javax/jdo/Extent.java100644 0 0 7641 11073716465 15642 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Extent.java * */ package javax.jdo; import java.lang.Iterable; import java.util.Iterator; /** Instances of the Extent class represent the entire collection * of instances in the data store of the candidate class or interface * possibly including its subclasses or subinterfaces. *

The Extent instance has two possible uses: *

    *
  1. to iterate all instances of a particular class or interface *
  2. to execute a Query in the data store over all instances * of a particular class or interface *
* @version 2.1 */ public interface Extent extends Iterable { /** Returns an iterator over all the instances in the Extent. * The behavior of the returned iterator might depend on the setting of the * ignoreCache flag in the owning PersistenceManager. * @return an iterator over all instances in the Extent */ Iterator iterator(); /** Returns whether this Extent was defined to contain subclasses. * @return true if this Extent was defined to contain instances * that are of a subclass type. */ boolean hasSubclasses(); /** An Extent contains all instances of a particular class * or interface in the data * store; this method returns the Class of the instances * represented by this Extent. * @return the Class of instances of this Extent. */ Class getCandidateClass(); /** An Extent is managed by a PersistenceManager; * this method gives access to the owning PersistenceManager. * @return the owning PersistenceManager */ PersistenceManager getPersistenceManager(); /** Close all Iterators associated with this Extent instance. * Iterators closed by this method will return false * to hasNext() and will throw * NoSuchElementException on next(). * The Extent instance can still be used * as a parameter of Query.setExtent, and to get an Iterator. */ void closeAll (); /** Close an Iterator associated with this Extent instance. * Iterators closed by this method will return false * to hasNext() and will throw NoSuchElementException * on next(). The Extent instance can still be used * as a parameter of Query.setExtent, and to get an Iterator. * @param it an Iterator obtained by the method * iterator() on this Extent instance. */ void close (Iterator it); /** Get the fetch plan associated with this Extent. * @return the fetch plan * @since 2.0 */ FetchPlan getFetchPlan(); } jdo2-api-2.2/src/java/javax/jdo/FetchGroup.java100644 0 0 24555 11073716464 16463 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * 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 FetchPlans 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 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 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"; /** * 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); /** * 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 post-load property of this FetchGroup. * @return the post-load property * @since 2.2 */ boolean getPostLoad(); /** * Set the post-load property of this FetchGroup. * @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. 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. * @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. * @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. * @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. * @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); /** * 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(); /** * 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(); } jdo2-api-2.2/src/java/javax/jdo/FetchPlan.java100644 0 0 15400 11073716464 16246 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * 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. * @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. * @return the FetchPlan * @since 2.0 */ FetchPlan addGroup(String fetchGroupName); /** * Remove the fetch group from the set active fetch groups. * @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. * @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. * @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}. */ FetchPlan setDetachmentOptions(int options); /** * Get options used during detachment. */ int getDetachmentOptions(); } jdo2-api-2.2/src/java/javax/jdo/identity/ByteIdentity.java100644 0 0 10454 11073716464 20654 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ByteIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** This class is for identity with a single byte field. * @version 2.0 */ public class ByteIdentity extends SingleFieldIdentity { /** The key. */ private byte key; /** Construct this instance with the key value. */ private void construct(byte key) { this.key = key; hashCode = super.hashClassName() ^ key; } /** Constructor with class and key. * @param pcClass the target class * @param key the key */ public ByteIdentity(Class pcClass, byte key) { super(pcClass); construct(key); } /** Constructor with class and key. * @param pcClass the target class * @param key the key */ public ByteIdentity(Class pcClass, Byte key) { super(pcClass); setKeyAsObject(key); construct(key.byteValue()); } /** Constructor with class and key. * @param pcClass the target class * @param str the key */ public ByteIdentity(Class pcClass, String str) { super(pcClass); assertKeyNotNull(str); construct(Byte.parseByte(str)); } /** Constructor only for Externalizable. */ public ByteIdentity() { } /** Return the key. * @return the key */ public byte getKey() { return key; } /** Return the String version of the key. * @return the key. */ public String toString() { return Byte.toString(key); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals(Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { ByteIdentity other = (ByteIdentity)obj; return key == other.key; } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof ByteIdentity) { ByteIdentity other = (ByteIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Create the key as an Object. * @return the key as an Object * @since 2.0 */ protected Object createKeyAsObject() { return new Byte(key); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeByte (key); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readByte (); } } jdo2-api-2.2/src/java/javax/jdo/identity/CharIdentity.java100644 0 0 11325 11073716465 20625 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * CharIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import javax.jdo.spi.I18NHelper; /** This class is for identity with a single character field. * @version 2.0 */ public class CharIdentity extends SingleFieldIdentity { /** The Internationalization message helper. */ private static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N /** The key. */ private char key; private void construct(char key) { this.key = key; hashCode = hashClassName() ^ key; } /** Constructor with class and key. * @param pcClass the target class * @param key the key */ public CharIdentity (Class pcClass, char key) { super (pcClass); construct(key); } /** Constructor with class and key. * @param pcClass the target class * @param key the key */ public CharIdentity (Class pcClass, Character key) { super (pcClass); setKeyAsObject(key); construct(key.charValue()); } /** Constructor with class and key. The String must have exactly one * character. * @param pcClass the target class * @param str the key */ public CharIdentity (Class pcClass, String str) { super(pcClass); assertKeyNotNull(str); if (str.length() != 1) throw new IllegalArgumentException( msg.msg("EXC_StringWrongLength")); //NOI18N construct(str.charAt(0)); } /** Constructor only for Externalizable. */ public CharIdentity () { } /** Return the key. * @return the key */ public char getKey () { return key; } /** Return the String form of the key. * @return the String form of the key */ public String toString () { return String.valueOf(key); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { CharIdentity other = (CharIdentity) obj; return key == other.key; } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof CharIdentity) { CharIdentity other = (CharIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Create the key as an Object. * @return the key as an Object * @since 2.0 */ protected Object createKeyAsObject() { return new Character(key); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeChar(key); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readChar(); } private void computeHashCode() { hashCode = hashClassName() ^ key; } } jdo2-api-2.2/src/java/javax/jdo/identity/IntIdentity.java100644 0 0 10264 11073716464 20502 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * IntIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** This class is for identity with a single int field. * @version 2.0 */ public class IntIdentity extends SingleFieldIdentity { private int key; private void construct(int key) { this.key = key; hashCode = hashClassName() ^ key; } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public IntIdentity (Class pcClass, int key) { super(pcClass); construct(key); } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public IntIdentity (Class pcClass, Integer key) { super(pcClass); setKeyAsObject(key); construct(key.intValue ()); } /** Constructor with class and key. * @param pcClass the class * @param str the key */ public IntIdentity (Class pcClass, String str) { super(pcClass); assertKeyNotNull(str); construct(Integer.parseInt(str)); } /** Constructor only for Externalizable. */ public IntIdentity () { } /** Return the key. * @return the key */ public int getKey () { return key; } /** Return the String form of the key. * @return the String form of the key */ public String toString () { return Integer.toString(key); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { IntIdentity other = (IntIdentity) obj; return key == other.key; } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof IntIdentity) { IntIdentity other = (IntIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Create the key as an Object. * @return the key as an Object * @since 2.0 */ protected Object createKeyAsObject() { return new Integer(key); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeInt(key); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readInt(); } } jdo2-api-2.2/src/java/javax/jdo/identity/LongIdentity.java100644 0 0 10763 11073716465 20654 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * LongIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** This class is for identity with a single long field. * @version 2.0 */ public class LongIdentity extends SingleFieldIdentity { /** The key. */ private long key; private void construct(long key) { this.key = key; hashCode = hashClassName() ^ (int)key; } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public LongIdentity (Class pcClass, long key) { super (pcClass); construct(key); } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public LongIdentity (Class pcClass, Long key) { super(pcClass); setKeyAsObject(key); construct(key.longValue()); } /** Constructor with class and key. * @param pcClass the class * @param str the key */ public LongIdentity (Class pcClass, String str) { super(pcClass); assertKeyNotNull(str); construct(Long.parseLong(str)); } /** Constructor only for Externalizable. */ public LongIdentity () { } /** Return the key. * @return the key */ public long getKey () { return key; } /** Return the String form of the key. * @return the String form of the key */ public String toString () { return Long.toString(key); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { LongIdentity other = (LongIdentity) obj; return key == other.key; } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof LongIdentity) { LongIdentity other = (LongIdentity)o; int result = super.compare(other); if (result == 0) { long diff = key - other.key; if (diff == 0) { return 0; } else { if (diff < 0) { return -1; } else { return 1; } } } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Create the key as an Object. * @return the key as an Object * @since 2.0 */ protected Object createKeyAsObject() { return new Long(key); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeLong(key); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readLong(); } } jdo2-api-2.2/src/java/javax/jdo/identity/ObjectIdentity.java100644 0 0 14642 11073716465 21163 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ObjectIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.security.AccessController; import java.security.PrivilegedAction; import javax.jdo.JDOUserException; import javax.jdo.spi.JDOImplHelper; /** This class is for identity with a single Object type field. * @version 2.0 */ public class ObjectIdentity extends SingleFieldIdentity { /** The key is stored in the superclass field keyAsObject. */ /** The JDOImplHelper instance used for parsing the String to an Object. */ private static JDOImplHelper helper = (JDOImplHelper) AccessController.doPrivileged( new PrivilegedAction () { public Object run () { return JDOImplHelper.getInstance(); } } ); /** The delimiter for String constructor. */ private static final String STRING_DELIMITER = ":"; //NOI18N /** Constructor with class and key. * @param pcClass the class * @param param the key */ public ObjectIdentity (Class pcClass, Object param) { super (pcClass); assertKeyNotNull(param); String paramString = null; String keyString = null; String className = null; if (param instanceof String) { /* The paramString is of the form ":" */ paramString = (String)param; if (paramString.length() < 3) { throw new JDOUserException( msg.msg("EXC_ObjectIdentityStringConstructionTooShort") + //NOI18N msg.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N paramString)); } int indexOfDelimiter = paramString.indexOf(STRING_DELIMITER); if (indexOfDelimiter < 0) { throw new JDOUserException( msg.msg("EXC_ObjectIdentityStringConstructionNoDelimiter") + //NOI18N msg.msg("EXC_ObjectIdentityStringConstructionUsage", //NOI18N paramString)); } keyString = paramString.substring(indexOfDelimiter+1); className = paramString.substring(0, indexOfDelimiter); keyAsObject = helper.construct(className, keyString); } else { keyAsObject = param; } hashCode = hashClassName() ^ keyAsObject.hashCode(); } /** Constructor only for Externalizable. */ public ObjectIdentity () { } /** Return the key. * @return the key */ public Object getKey () { return keyAsObject; } /** Return the String form of the object id. The class of the * object id is written as the first part of the result so that * the class can be reconstructed later. Then the toString * of the key instance is appended. During construction, * this process is reversed. The class is extracted from * the first part of the String, and the String constructor * of the key is used to construct the key itself. * @return the String form of the key */ public String toString () { return keyAsObject.getClass().getName() + STRING_DELIMITER + keyAsObject.toString(); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { ObjectIdentity other = (ObjectIdentity) obj; return keyAsObject.equals(other.keyAsObject); } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof ObjectIdentity) { ObjectIdentity other = (ObjectIdentity)o; int result = super.compare(other); if (result == 0) { if (other.keyAsObject instanceof Comparable && keyAsObject instanceof Comparable) { return ((Comparable)keyAsObject).compareTo( (Comparable)other.keyAsObject); } else { throw new ClassCastException("The key class (" + keyAsObject.getClass().getName() + ") does not implement Comparable"); } } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeObject(keyAsObject); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); keyAsObject = in.readObject(); } } jdo2-api-2.2/src/java/javax/jdo/identity/package.html100644 0 0 2005 11073716465 17627 0ustar 0 0 Identity package This package contains the JDO specification identity interfaces and classes. jdo2-api-2.2/src/java/javax/jdo/identity/ShortIdentity.java100644 0 0 10324 11073716464 21044 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ShortIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** This class is for identity with a single short field. * @version 2.0 */ public class ShortIdentity extends SingleFieldIdentity { private short key; private void construct(short key) { this.key = key; hashCode = hashClassName() ^ key; } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public ShortIdentity (Class pcClass, short key) { super(pcClass); construct(key); } /** Constructor with class and key. * @param pcClass the class * @param key the key */ public ShortIdentity (Class pcClass, Short key) { super(pcClass); setKeyAsObject(key); construct(key.shortValue()); } /** Constructor with class and key. * @param pcClass the class * @param str the key */ public ShortIdentity (Class pcClass, String str) { super(pcClass); assertKeyNotNull(str); construct(Short.parseShort (str)); } /** Constructor only for Externalizable. */ public ShortIdentity () { } /** Return the key. * @return the key */ public short getKey () { return key; } /** Return the String form of the key. * @return the String form of the key */ public String toString () { return Short.toString(key); } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { ShortIdentity other = (ShortIdentity) obj; return key == other.key; } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof ShortIdentity) { ShortIdentity other = (ShortIdentity)o; int result = super.compare(other); if (result == 0) { return (key - other.key); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Create the key as an Object. * @return the key as an Object * @since 2.0 */ protected Object createKeyAsObject() { return new Short(key); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeShort(key); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); key = in.readShort(); } } jdo2-api-2.2/src/java/javax/jdo/identity/SingleFieldIdentity.java100644 0 0 14121 11073716465 22132 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * SingleFieldIdentity.java * */ package javax.jdo.identity; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import javax.jdo.JDOFatalInternalException; import javax.jdo.JDONullIdentityException; import javax.jdo.spi.I18NHelper; /** This class is the abstract base class for all single field identity * classes. A common case of application identity uses exactly one * persistent field in the class to represent identity. In this case, * the application can use a standard JDO class instead of creating * a new user-defined class for the purpose. * @version 2.0 */ public abstract class SingleFieldIdentity implements Externalizable, Comparable { /** The Internationalization message helper. */ protected static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N /** The class of the target object. */ transient private Class targetClass; /** The name of the class of the target object. */ private String targetClassName; /** The hashCode. */ protected int hashCode; /** The key as an Object. */ protected Object keyAsObject; /** Constructor with target class. * @param pcClass the class of the target * @since 2.0 */ protected SingleFieldIdentity(Class pcClass) { if (pcClass == null) throw new NullPointerException(); targetClass = pcClass; targetClassName = pcClass.getName(); } /** Constructor only for Externalizable. * @since 2.0 */ public SingleFieldIdentity () { } /** Set the given key as the key for this instance. * Compute the hash code for the instance. * @since 2.0 */ protected void setKeyAsObject(Object key) { assertKeyNotNull(key); keyAsObject = key; } /** Assert that the key is not null. Throw a JDONullIdentityException * if the given key is null. * @since 2.0 */ protected void assertKeyNotNull(Object key) { if (key == null) { throw new JDONullIdentityException( msg.msg("EXC_SingleFieldIdentityNullParameter")); //NOI18N } } /** Return the target class. * @return the target class. * @since 2.0 */ public Class getTargetClass() { return targetClass; } /** Return the target class name. * @return the target class name. * @since 2.0 */ public String getTargetClassName() { return targetClassName; } /** Return the key as an Object. The method is synchronized to avoid * race conditions in multi-threaded environments. * @return the key as an Object. * @since 2.0 */ public synchronized Object getKeyAsObject() { if (keyAsObject == null) { keyAsObject = createKeyAsObject(); } return keyAsObject; } /** Create the key as an Object. * @return the key as an Object; * @since 2.0 */ protected Object createKeyAsObject() { throw new JDOFatalInternalException (msg.msg("EXC_CreateKeyAsObjectMustNotBeCalled")); } /** Check the class and class name and object type. If restored * from serialization, class will be null so compare class name. * @param obj the other object * @return true if the class or class name is the same */ public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null || this.getClass() != obj.getClass()) { return false; } else { SingleFieldIdentity other = (SingleFieldIdentity) obj; if (targetClass != null && targetClass == other.targetClass) return true; return targetClassName.equals (other.targetClassName); } } /** Return the hash code of the class name. * @return the hash code of the class name * @since 2.0 */ protected int hashClassName() { return targetClassName.hashCode(); } /** Return the cached hash code. * @return the cached hash code. */ public int hashCode() { return hashCode; } /** Write to the output stream. * @param out the stream */ public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(targetClassName); out.writeInt(hashCode); } /** Read from the input stream. * Creates a new instance with the target class name set */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { targetClass = null; targetClassName = (String)in.readObject(); hashCode = in.readInt(); } /** Determine the ordering of identity objects. Only the class name * is compared. This method is only used by subclasses. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ protected int compare(SingleFieldIdentity o) { return targetClassName.compareTo(o.targetClassName); } } jdo2-api-2.2/src/java/javax/jdo/identity/StringIdentity.java100644 0 0 7161 11073716465 21201 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * StringIdentity.java * */ package javax.jdo.identity; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; /** This class is for identity with a single String field. * @version 2.0 */ public class StringIdentity extends SingleFieldIdentity { /** The key is stored in the superclass field keyAsObject. */ /** Constructor with class and key. * @param pcClass the class * @param key the key */ public StringIdentity (Class pcClass, String key) { super (pcClass); setKeyAsObject(key); hashCode = hashClassName() ^ key.hashCode(); } /** Constructor only for Externalizable. */ public StringIdentity () { } /** Return the key. * @return the key */ public String getKey () { return (String)keyAsObject; } /** Return the String form of the key. * @return the String form of the key */ public String toString () { return (String)keyAsObject; } /** Determine if the other object represents the same object id. * @param obj the other object * @return true if both objects represent the same object id */ public boolean equals (Object obj) { if (this == obj) { return true; } else if (!super.equals (obj)) { return false; } else { StringIdentity other = (StringIdentity) obj; return keyAsObject.equals(other.keyAsObject); } } /** Determine the ordering of identity objects. * @param o Other identity * @return The relative ordering between the objects * @since 2.2 */ public int compareTo(Object o) { if (o instanceof StringIdentity) { StringIdentity other = (StringIdentity)o; int result = super.compare(other); if (result == 0) { return ((String)keyAsObject).compareTo((String)other.keyAsObject); } else { return result; } } else if (o == null) { throw new ClassCastException("object is null"); } throw new ClassCastException(this.getClass().getName() + " != " + o.getClass().getName()); } /** Write this object. Write the superclass first. * @param out the output */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal (out); out.writeObject(keyAsObject); } /** Read this object. Read the superclass first. * @param in the input */ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); keyAsObject = (String)in.readObject(); } } jdo2-api-2.2/src/java/javax/jdo/InstanceCallbacks.java100644 0 0 6256 11073716465 17740 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * InstanceCallbacks.java * */ package javax.jdo; /** 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. * *

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. * *

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. * * @since 1.0 * @version 2.0 */ public interface InstanceCallbacks extends javax.jdo.listener.ClearCallback, javax.jdo.listener.DeleteCallback, javax.jdo.listener.LoadCallback, javax.jdo.listener.StoreCallback { } jdo2-api-2.2/src/java/javax/jdo/JDOCanRetryException.java100644 0 0 6166 11073716464 20336 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOCanRetryException.java * */ package javax.jdo; /** This is the base class for exceptions that can be retried. * * @version 1.0 */ public class JDOCanRetryException extends JDOException { /** * 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 Throwables. * @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 Throwables. * @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 Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDODataStoreException.java100644 0 0 6220 11073716465 20465 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDODataStoreException.java * */ package javax.jdo; /** This class represents data store exceptions that can be retried. * * @version 1.0 */ public class JDODataStoreException extends JDOCanRetryException { /** * 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 and nested Throwables. * @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 Throwables. * @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, * nested Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDODetachedFieldAccessException.java100644 0 0 5140 11073716465 22366 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDODetachedFieldAccessException.java * */ package javax.jdo; /** 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 { /** * Constructs a new JDODetachedFieldAccessException without a * detail message. * @since 2.0 */ public JDODetachedFieldAccessException() { } /** * 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 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 Throwables. * @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 Throwables. * @param msg the detail message. * @param nested the nested Throwable. * @since 2.0 */ public JDODetachedFieldAccessException(String msg, Throwable nested) { super(msg, nested); } } jdo2-api-2.2/src/java/javax/jdo/JDOEntityManager.java100644 0 0 2551 11073716464 17471 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo; import javax.persistence.EntityManager; /* * JDOEntityManager.java * * @since 2.1 */ public interface JDOEntityManager extends EntityManager, PersistenceManager { /** This method returns the JDOEntityManagerFactory used to * create this JDOEntityManager. It overrides the * getPersistenceManagerFactory method in PersistenceManager. * @return the JDOEntityManagerFactory that created * this JDOEntityManager */ JDOEntityManagerFactory getPersistenceManagerFactory(); } jdo2-api-2.2/src/java/javax/jdo/JDOEntityManagerFactory.java100644 0 0 6504 11073716465 21024 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo; import javax.persistence.EntityManagerFactory; /* * JDOEntityManagerFactory.java * * @since 2.1 * */ public interface JDOEntityManagerFactory extends EntityManagerFactory, PersistenceManagerFactory { /** Get an instance of JDOEntityManager from this factory. * The instance has default values for options. This method overrides * the getPersistenceManager method from PersistenceManagerFactory. * *

After the first use of getPersistenceManager, no "set" * methods will succeed. * * @return a JDOEntityManager instance with default options. */ JDOEntityManager getPersistenceManager(); /** Get a thread-safe instance of a proxy that dynamically binds * on each method call to an instance of JDOEntityManager. *

When used with a JDOEntityManagerFactory * that uses TransactionType JTA, * the proxy can be used in a server to dynamically bind to an instance * from this factory associated with the thread's current transaction. * In this case, the close method is ignored, as the * PersistenceManager is automatically closed when the * transaction completes. *

When used with a JDOEntityManagerFactory * that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable * ThreadLocal to bind to an instance of JDOEntityManager * associated with the thread. In this case, the close method executed * on the proxy closes the JDOEntityManager and then * clears the ThreadLocal. * Use of this method does not affect the configurability of the * JDOEntityManagerFactory. * * @since 2.1 * @return a PersistenceManager proxy. */ JDOEntityManager getPersistenceManagerProxy(); /** Get an instance of JDOEntityManager from this factory. * The instance has default values for options. * The parameters userid and password are used * when obtaining datastore connections from the connection pool. * *

After the first use of getPersistenceManager, no "set" * methods will succeed. * * @return a JDOEntityManager instance with default options. * @param userid the userid for the connection * @param password the password for the connection */ JDOEntityManager getPersistenceManager(String userid, String password); } jdo2-api-2.2/src/java/javax/jdo/JDOException.java100644 0 0 25362 11073716465 16706 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOException.java * */ package javax.jdo; 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. * @author Craig Russell * @version 1.0.2 */ public class JDOException extends java.lang.RuntimeException { /** 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 Throwables. * @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 Throwables, 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 { return nested[0]; } } /** 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 Throwables (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); } /** * 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; iJDOFatalDataStoreException without a detail message. */ public JDOFatalDataStoreException() { } /** * 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 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 Throwables. * @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 Throwables. * @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 Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDOFatalException.java100644 0 0 6234 11073716464 17632 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOFatalException.java * */ 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. * * @version 1.0 */ public class JDOFatalException extends JDOException { /** * 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 Throwables. * @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 Throwables. * @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 Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDOFatalInternalException.java100644 0 0 6512 11073716464 21326 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOFatalInternalException.java * */ 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. * * @version 1.0 */ public class JDOFatalInternalException extends JDOFatalException { /** * 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 and nested Throwables. * @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 Throwables. * @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, nested Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDOFatalUserException.java100644 0 0 6206 11073716465 20471 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOUserException.java * */ package javax.jdo; /** This class represents user errors that cannot be retried. * * @version 1.0 */ public class JDOFatalUserException extends JDOFatalException { /** * 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); } /** * Constructs a new JDOFatalUserException with the specified * detail message and nested Throwables. * @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 Throwables. * @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 Throwables, 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 Throwables, 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); } } jdo2-api-2.2/src/java/javax/jdo/JDOHelper.java100644 0 0 240754 11073716464 16212 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOHelper.java * */ package javax.jdo; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.ErrorHandler; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.NamedNodeMap; import javax.jdo.spi.I18NHelper; import javax.jdo.spi.JDOImplHelper; import javax.jdo.spi.JDOImplHelper.StateInterrogationBooleanReturn; import javax.jdo.spi.JDOImplHelper.StateInterrogationObjectReturn; import javax.jdo.spi.PersistenceCapable; import javax.jdo.spi.StateInterrogation; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.rmi.PortableRemoteObject; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Map; import java.util.HashMap; import java.util.Collections; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.util.Properties; import java.util.Enumeration; import java.io.IOException; import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; /** * 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 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); return Collections.unmodifiableMap(xref); } /** The JDOImplHelper instance used for handling non-binary-compatible * implementations. */ private static JDOImplHelper implHelper = (JDOImplHelper) AccessController.doPrivileged( new PrivilegedAction () { public Object 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 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); } } /** 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); } } /** 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); } } /** 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 getObjectIds(Collection pcs) { ArrayList result = new ArrayList(); for (Iterator it = pcs.iterator(); it.hasNext();) { result.add(getObjectId(it.next())); } return result; } /** Get object ids for an array 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 instances of the returned * array exactly matches the order of instances of the * parameter array. * @param pcs the persistence-capable instances * @return the object ids of the parameters * @see #getObjectId(Object pc) * @see #getObjectIds(Collection pcs) * @since 2.0 */ public static Object[] getObjectIds(Object[] pcs) { Object[] result = new Object[pcs.length]; for (int i = 0; i < pcs.length; ++i) { result[i] = getObjectId(pcs[i]); } return result; } /** Return a copy of the JDO identity associated with the parameter * instance. * * @see PersistenceCapable#jdoGetTransactionalObjectId() * @see PersistenceManager#getObjectById(Object oid, boolean validate) * @param pc the PersistenceCapable instance. * @return a copy of the ObjectId of the parameter instance as modified in * this transaction. */ public static Object getTransactionalObjectId(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoGetTransactionalObjectId(); } else { return implHelper.nonBinaryCompatibleGet( pc, getTransactionalObjectId); } } /** * Return the version of the instance. * @since 2.0 * @param pc the instance * @return the version of the instance */ public static Object getVersion (Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoGetVersion(); } else { return implHelper.nonBinaryCompatibleGet(pc, getVersion); } } /** Tests whether the parameter instance is dirty. * * Instances that have been modified, deleted, or newly * made persistent in the current transaction return true. * *

Transient instances and instances of classes that do not implement * PersistenceCapable return false. *

* @see javax.jdo.spi.StateManager#makeDirty(PersistenceCapable pc, * String fieldName) * @see PersistenceCapable#jdoIsDirty() * @param pc the PersistenceCapable instance. * @return true if the parameter instance has been modified in * the current transaction. */ public static boolean isDirty(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsDirty(); } else { return implHelper.nonBinaryCompatibleIs(pc, isDirty); } } /** Tests whether the parameter instance is transactional. * * Instances whose state is associated with the current transaction * return true. * *

Transient instances and instances of classes that do not implement * PersistenceCapable return false. * @see PersistenceCapable#jdoIsTransactional() * @param pc the PersistenceCapable instance. * @return true if the parameter instance is transactional. */ public static boolean isTransactional(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsTransactional(); } else { return implHelper.nonBinaryCompatibleIs(pc, isTransactional); } } /** Tests whether the parameter instance is persistent. * * Instances that represent persistent objects in the data store * return true. * *

Transient instances and instances of classes that do not implement * PersistenceCapable return false. *

* @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsPersistent() * @param pc the PersistenceCapable instance. * @return true if the parameter instance is persistent. */ public static boolean isPersistent(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsPersistent(); } else { return implHelper.nonBinaryCompatibleIs(pc, isPersistent); } } /** Tests whether the parameter instance has been newly made persistent. * * Instances that have been made persistent in the current transaction * return true. * *

Transient instances and instances of classes that do not implement * PersistenceCapable return false. *

* @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsNew() * @param pc the PersistenceCapable instance. * @return true if the parameter instance was made persistent * in the current transaction. */ public static boolean isNew(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsNew(); } else { return implHelper.nonBinaryCompatibleIs(pc, isNew); } } /** Tests whether the parameter instance has been deleted. * * Instances that have been deleted in the current transaction return * true. * *

Transient instances and instances of classes that do not implement * PersistenceCapable return false. *

* @see PersistenceManager#deletePersistent(Object pc) * @see PersistenceCapable#jdoIsDeleted() * @param pc the PersistenceCapable instance. * @return true if the parameter instance was deleted * in the current transaction. */ public static boolean isDeleted(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsDeleted(); } else { return implHelper.nonBinaryCompatibleIs(pc, isDeleted); } } /** * Tests whether the parameter instance has been detached. * * Instances that have been detached return true. * *

Transient instances return false. *

* @see PersistenceCapable#jdoIsDetached() * @return true if this instance is detached. * @since 2.0 * @param pc the instance */ public static boolean isDetached(Object pc) { if (pc instanceof PersistenceCapable) { return ((PersistenceCapable)pc).jdoIsDetached(); } else { return implHelper.nonBinaryCompatibleIs(pc, isDetached); } } /** Accessor for the state of the passed object. * @param pc The object * @return The object state * @since 2.1 */ public static ObjectState getObjectState(Object pc) { if (pc == null) { return null; } if (isDetached(pc)) { if (isDirty(pc)) { // Detached Dirty return ObjectState.DETACHED_DIRTY; } else { // Detached Not Dirty return ObjectState.DETACHED_CLEAN; } } else { if (isPersistent(pc)) { if (isTransactional(pc)) { if (isDirty(pc)) { if (isNew(pc)) { if (isDeleted(pc)) { // Persistent Transactional Dirty New Deleted return ObjectState.PERSISTENT_NEW_DELETED; } else { // Persistent Transactional Dirty New Not Deleted return ObjectState.PERSISTENT_NEW; } } else { if (isDeleted(pc)) { // Persistent Transactional Dirty Not New Deleted return ObjectState.PERSISTENT_DELETED; } else { // Persistent Transactional Dirty Not New Not Deleted return ObjectState.PERSISTENT_DIRTY; } } } else { // Persistent Transactional Not Dirty return ObjectState.PERSISTENT_CLEAN; } } else { if (isDirty(pc)) { // Persistent Nontransactional Dirty return ObjectState.PERSISTENT_NONTRANSACTIONAL_DIRTY; } else { // Persistent Nontransactional Not Dirty return ObjectState.HOLLOW_PERSISTENT_NONTRANSACTIONAL; } } } else { if (isTransactional(pc)) { if (isDirty(pc)) { // Not Persistent Transactional Dirty return ObjectState.TRANSIENT_DIRTY; } else { // Not Persistent Transactional Not Dirty return ObjectState.TRANSIENT_CLEAN; } } else { // Not Persistent Not Transactional return ObjectState.TRANSIENT; } } } } /** Get the anonymous PersistenceManagerFactory configured via * the standard configuration file resource "META-INF/jdoconfig.xml", using * the current thread's context class loader * to locate the configuration file resource(s). * @return the anonymous PersistenceManagerFactory. * @since 2.1 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory() { ClassLoader cl = getContextClassLoader(); return getPersistenceManagerFactory( null, ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME, cl, cl); } /** Get the anonymous PersistenceManagerFactory configured via * the standard configuration file resource "META-INF/jdoconfig.xml", using * the given class loader. * @return the anonymous PersistenceManagerFactory. * @param pmfClassLoader the ClassLoader used to load resources and classes * @since 2.1 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory( ClassLoader pmfClassLoader) { return getPersistenceManagerFactory( null, ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME, pmfClassLoader, pmfClassLoader); } /** Get a PersistenceManagerFactory based on a Properties * instance, using the current thread's context class loader to locate the * PersistenceManagerFactory class. * @return the PersistenceManagerFactory. * @param props a Properties instance with properties of the * PersistenceManagerFactory. * @see #getPersistenceManagerFactory(java.util.Map,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (Map props) { return getPersistenceManagerFactory( null, props, getContextClassLoader()); } /** Get a PersistenceManagerFactory based on a * Map and a class loader. * This method delegates to the getPersistenceManagerFactory * method that takes a Map of overrides and a Map of properties, * passing null as the overrides parameter. * @see #getPersistenceManagerFactory(java.util.Map, java.util.Map, ClassLoader) * @return the PersistenceManagerFactory. * @param props a Map with properties of the * PersistenceManagerFactory. * @param pmfClassLoader the class loader used to load the * PersistenceManagerFactory class * @since 1.0 */ public static PersistenceManagerFactory getPersistenceManagerFactory (Map props, ClassLoader pmfClassLoader) { return getPersistenceManagerFactory( null, props, pmfClassLoader); } /** * Get a PersistenceManagerFactory based on a * Map of overrides, a Map of * properties, and a class loader. * The following are standard key names: *
"javax.jdo.PersistenceManagerFactoryClass" *
"javax.jdo.option.Optimistic", *
"javax.jdo.option.RetainValues", *
"javax.jdo.option.RestoreValues", *
"javax.jdo.option.IgnoreCache", *
"javax.jdo.option.NontransactionalRead", *
"javax.jdo.option.NontransactionalWrite", *
"javax.jdo.option.Multithreaded", *
"javax.jdo.option.ConnectionUserName", *
"javax.jdo.option.ConnectionPassword", *
"javax.jdo.option.ConnectionURL", *
"javax.jdo.option.ConnectionFactoryName", *
"javax.jdo.option.ConnectionFactory2Name", *
"javax.jdo.option.Mapping", *
"javax.jdo.mapping.Catalog", *
"javax.jdo.mapping.Schema", *
"javax.jdo.option.PersistenceUnitName", *
"javax.jdo.option.DetachAllOnCommit", *
"javax.jdo.option.CopyOnAttach", *
"javax.jdo.option.ReadOnly", *
"javax.jdo.option.TransactionIsolationLevel", *
"javax.jdo.option.TransactionType", *
"javax.jdo.option.ServerTimeZoneID", *
"javax.jdo.option.Name". *
* and properties of the form *
javax.jdo.option.InstanceLifecycleListener.{listenerClass}[=[{pcClasses}]] * where {listenerClass} is the fully qualified name of a * class that implements * {@link javax.jdo.listener.InstanceLifecycleListener}, and * {pcClasses} is an optional comma- or whitespace-delimited * list of persistence-capable classes to be observed; the absence of a * value for a property of this form means that instances of all * persistence-capable classes will be observed by an instance of the given * listener class. *

JDO implementations * are permitted to define key values of their own. Any key values not * recognized by the implementation must be ignored. Key values that are * recognized but not supported by an implementation must result in a * JDOFatalUserException thrown by the method. *

The returned PersistenceManagerFactory is not * configurable (the setXXX methods will throw an * exception). *

JDO implementations might manage a map of instantiated * PersistenceManagerFactory instances based on specified * property key values, and return a previously instantiated * PersistenceManagerFactory instance. In this case, the * properties of the returned instance must exactly match the requested * properties. * @return the PersistenceManagerFactory. * @param props a Properties instance with properties of the * PersistenceManagerFactory. * @param pmfClassLoader the class loader to use to load the * PersistenceManagerFactory class * @throws JDOFatalUserException if *

  • the pmfClassLoader passed is invalid; or *
  • a valid class name cannot be obtained from * either props or system resources * (an entry in META-INF/services/javax.jdo.PersistenceManagerFactory); or *
  • all implementations throw an exception. *
* @since 2.1 */ protected static PersistenceManagerFactory getPersistenceManagerFactory (Map overrides, Map props, ClassLoader pmfClassLoader) { List exceptions = new ArrayList(); if (pmfClassLoader == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullLoader")); //NOI18N // first try to get the class name from the properties object. String pmfClassName = (String) props.get ( PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS); if (!isNullOrBlank(pmfClassName)) { // a valid name was returned from the properties. return invokeGetPersistenceManagerFactoryOnImplementation( pmfClassName, overrides, props, pmfClassLoader); } else { /* * If you have a jar file that provides the jdo implementation, * a file naming the implementation goes into the file * packaged into the jar file, called * META-INF/services/javax.jdo.PersistenceManagerFactory. * The contents of the file is a string that is the PMF class name, * null or blank. * For each file in pmfClassLoader named * META-INF/services/javax.jdo.PersistenceManagerFactory, * this method will try to invoke the getPersistenceManagerFactory * method of the implementation class. * Return the factory if a valid class name is extracted from * resources and the invocation returns an instance. * Otherwise add the exception thrown to * an exception list. */ Enumeration urls = null; try { urls = getResources(pmfClassLoader, SERVICE_LOOKUP_PMF_RESOURCE_NAME); } catch (Throwable ex) { exceptions.add(ex); } if (urls != null){ while (urls.hasMoreElements()) { try { pmfClassName = getClassNameFromURL( (URL) urls.nextElement()); // return the implementation that is valid. PersistenceManagerFactory pmf = invokeGetPersistenceManagerFactoryOnImplementation( pmfClassName, overrides, props, pmfClassLoader); return pmf; } catch (Throwable ex) { // remember exceptions from failed pmf invocations exceptions.add(ex); } } } } // no PMF class name in props and no services. throw new JDOFatalUserException(msg.msg( "EXC_GetPMFNoPMFClassNamePropertyOrPUNameProperty"), (Throwable[]) exceptions.toArray(new Throwable[exceptions.size()])); } /** Get a class name from a URL. The URL is from getResources with * e.g. META-INF/services/javax.jdo.PersistenceManagerFactory as the * parameter. Parse the file, removing blank lines, comment lines, * and comments. * @param url the URL of the services file * @return the name of the class contained in the file * @throws java.io.IOException * @since 2.1 */ protected static String getClassNameFromURL (URL url) throws IOException { InputStream is = openStream(url); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line = null; try { while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() == 0 || line.startsWith("#")) { continue; } // else assume first line of text is the PMF class name String[] tokens = line.split("\\s"); String pmfClassName = tokens[0]; int indexOfComment = pmfClassName.indexOf("#"); if (indexOfComment == -1) { return pmfClassName; } // else pmfClassName has a comment at the end of it -- remove return pmfClassName.substring(0, indexOfComment); } return null; } finally { try { reader.close(); } catch (IOException x) { // gulp } } } /** * Returns a named {@link PersistenceManagerFactory} or persistence * unit. * * @since 2.1 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (String name) { ClassLoader cl = getContextClassLoader(); return getPersistenceManagerFactory(null, name, cl, cl); } /** * Returns a named {@link PersistenceManagerFactory} or persistence * unit. * * @since 1.0 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (String name, ClassLoader loader) { return getPersistenceManagerFactory(null, name, loader, loader); } /** * Returns a named {@link PersistenceManagerFactory} or persistence * unit. * * @since 2.0 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (String name, ClassLoader resourceLoader, ClassLoader pmfLoader) { return getPersistenceManagerFactory( null, name, resourceLoader, pmfLoader); } /** * Returns a named {@link PersistenceManagerFactory} or persistence * unit. * * @since 2.1 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (Map overrides, String name) { ClassLoader cl = getContextClassLoader(); return getPersistenceManagerFactory(overrides, name, cl, cl); } /** * Returns a named {@link PersistenceManagerFactory} or persistence * unit. * * @since 2.1 * @see #getPersistenceManagerFactory(Map,String,ClassLoader,ClassLoader) */ public static PersistenceManagerFactory getPersistenceManagerFactory (Map overrides, String name, ClassLoader resourceLoader) { return getPersistenceManagerFactory( overrides, name, resourceLoader, resourceLoader); } /** * Returns a {@link PersistenceManagerFactory} configured based * on the properties stored in the resource at * name, or, if not found, returns a * {@link PersistenceManagerFactory} with the given * name or, if not found, returns a * javax.persistence.EntityManagerFactory cast to a * {@link PersistenceManagerFactory}. If the name given is null or consists * only of whitespace, it is interpreted as * {@link Constants#ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME}. * The following are standard key names: *
"javax.jdo.PersistenceManagerFactoryClass" *
"javax.jdo.option.Optimistic", *
"javax.jdo.option.RetainValues", *
"javax.jdo.option.RestoreValues", *
"javax.jdo.option.IgnoreCache", *
"javax.jdo.option.NontransactionalRead", *
"javax.jdo.option.NontransactionalWrite", *
"javax.jdo.option.Multithreaded", *
"javax.jdo.option.ConnectionUserName", *
"javax.jdo.option.ConnectionPassword", *
"javax.jdo.option.ConnectionURL", *
"javax.jdo.option.ConnectionFactoryName", *
"javax.jdo.option.ConnectionFactory2Name", *
"javax.jdo.option.Mapping", *
"javax.jdo.mapping.Catalog", *
"javax.jdo.mapping.Schema", *
"javax.jdo.option.PersistenceUnitName". *
"javax.jdo.option.DetachAllOnCommit". *
"javax.jdo.option.CopyOnAttach". *
"javax.jdo.option.TransactionType". *
"javax.jdo.option.ServerTimeZoneID". *
"javax.jdo.option.Name". *
* and properties of the form *
javax.jdo.option.InstanceLifecycleListener.{listenerClass}[=[{pcClasses}]] * where {listenerClass} is the fully qualified name of a * class that implements * {@link javax.jdo.listener.InstanceLifecycleListener}, and * {pcClasses} is an optional comma- or whitespace-delimited * list of persistence-capable classes to be observed; the absence of a * value for a property of this form means that instances of all * persistence-capable classes will be observed by an instance of the given * listener class. *

JDO implementations * are permitted to define key values of their own. Any key values not * recognized by the implementation must be ignored. Key values that are * recognized but not supported by an implementation must result in a * JDOFatalUserException thrown by the method. *

The returned PersistenceManagerFactory is not * configurable (the setXXX methods will throw an * exception). * * This method loads the properties found at name, if any, via * resourceLoader, and creates a {@link * PersistenceManagerFactory} with pmfLoader. Any * exceptions thrown during resource loading will * be wrapped in a {@link JDOFatalUserException}. * If multiple PMFs with the requested name are found, a * {@link JDOFatalUserException} is thrown. * @since 2.1 * @param overrides a Map containing properties that override properties * defined in any resources loaded according to the "name" parameter * @param name interpreted as the name of the resource containing the PMF * properties, the name of the PMF, or the persistence unit name, in that * order; if name is null, blank or whitespace, it is interpreted as * indicating the anonymous {@link PersistenceManagerFactory}. * @param resourceLoader the class loader to use to load properties file * resources; must be non-null if name is non-null or blank * @param pmfLoader the class loader to use to load the * {@link PersistenceManagerFactory} or * javax.persistence.EntityManagerFactory classes * @return the {@link PersistenceManagerFactory} with properties in the * given resource, with the given name, or with the given persitence unit * name * @see Constants#ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME */ public static PersistenceManagerFactory getPersistenceManagerFactory( Map overrides, String name, ClassLoader resourceLoader, ClassLoader pmfLoader) { if (pmfLoader == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullPMFLoader")); //NOI18N if (resourceLoader == null) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFNullPropsLoader")); //NOI18N } Map props = null; // trim spaces from name and ensure non-null name = (name == null?ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME:name.trim()); if (!ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME.equals(name)) { props = loadPropertiesFromResource(resourceLoader, name); } if (props != null) { // add the SPI property to inform the implementation that // the PMF was configured by the given resource name // and not via named PMF for proper deserialization props.put(PROPERTY_SPI_RESOURCE_NAME, name); props.remove(PROPERTY_NAME); return getPersistenceManagerFactory(overrides, props, pmfLoader); } // props were null; try getting from jdoconfig.xml props = getPropertiesFromJdoconfig(name, pmfLoader); if (props != null) { // inform the impl that the config came from a jdoconfig.xml // element with the given name props.put(PROPERTY_NAME, name); props.remove(PROPERTY_SPI_RESOURCE_NAME); // we have loaded a Properties, delegate to implementation return getPersistenceManagerFactory(overrides, props, pmfLoader); } // no properties found; last try to see if name is a JPA PU name if (!ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME.equals(name)) { props = new Properties(); props.put(PROPERTY_PERSISTENCE_UNIT_NAME, name); return getPersistenceManagerFactory(overrides, props, pmfLoader); } // no PMF found; give up throw new JDOFatalUserException (msg.msg ( "EXC_NoPMFConfigurableViaPropertiesOrXML", name)); //NOI18N } /** Invoke the getPersistenceManagerFactory method on the implementation. * If the overrides parameter to this method is not null, the static method * with Map overrides, Map properties parameters will be invoked. * If the overrides parameter to this method is null, the static method * with Map properties parameter will be invoked. * @param pmfClassName the name of the implementation factory class * @param overrides a Map of overrides * @param properties a Map of properties * @param cl the class loader to use to load the implementation class * @return the PersistenceManagerFactory */ protected static PersistenceManagerFactory invokeGetPersistenceManagerFactoryOnImplementation( String pmfClassName, Map overrides, Map properties, ClassLoader cl) { if (overrides != null) { // overrides is not null; use getPersistenceManagerFactory(Map overrides, Map props) try { Class implClass = forName(pmfClassName, true, cl); Method m = getMethod(implClass, "getPersistenceManagerFactory", //NOI18N new Class[]{Map.class, Map.class}); PersistenceManagerFactory pmf = (PersistenceManagerFactory) invoke(m, null, new Object[]{overrides, properties}); if (pmf == null) { throw new JDOFatalInternalException(msg.msg ( "EXC_GetPMFNullPMF", pmfClassName)); //NOI18N } return pmf; } catch (ClassNotFoundException e) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N } catch (NoSuchMethodException e) { throw new JDOFatalInternalException(msg.msg( "EXC_GetPMFNoSuchMethod2", pmfClassName), e); //NOI18N } catch (NullPointerException e) { throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N } catch (IllegalAccessException e) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N } catch (ClassCastException e) { throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N } catch (InvocationTargetException ite) { Throwable nested = ite.getTargetException(); if (nested instanceof JDOException) { throw (JDOException)nested; } else throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFUnexpectedException"), ite); //NOI18N } } else { // overrides is null; use getPersistenceManagerFactory(Map props) try { Class implClass = forName(pmfClassName, true, cl); Method m = getMethod(implClass, "getPersistenceManagerFactory", //NOI18N new Class[]{Map.class}); PersistenceManagerFactory pmf = (PersistenceManagerFactory) invoke(m, null, new Object[]{properties}); if (pmf == null) { throw new JDOFatalInternalException(msg.msg ( "EXC_GetPMFNullPMF", pmfClassName)); //NOI18N } return pmf; } catch (ClassNotFoundException e) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFClassNotFound", pmfClassName), e); //NOI18N } catch (NoSuchMethodException e) { throw new JDOFatalInternalException(msg.msg( "EXC_GetPMFNoSuchMethod", pmfClassName), e); //NOI18N } catch (NullPointerException e) { throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFNullPointerException", pmfClassName), e); //NOI18N } catch (IllegalAccessException e) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFIllegalAccess", pmfClassName), e); //NOI18N } catch (ClassCastException e) { throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFClassCastException", pmfClassName), e); //NOI18N } catch (InvocationTargetException ite) { Throwable nested = ite.getTargetException(); if (nested instanceof JDOException) { throw (JDOException)nested; } else throw new JDOFatalInternalException (msg.msg( "EXC_GetPMFUnexpectedException"), ite); //NOI18N } } } /** Load a Properties instance by name from the class loader. * * @param resourceLoader the class loader from which to load the properties * @param name the name of the resource * @return a Properties instance or null if no resource is found */ protected static Map loadPropertiesFromResource( ClassLoader resourceLoader, String name) { InputStream in = null; Properties props = null; // try to load resources from properties file try { in = getResourceAsStream(resourceLoader, name); if (in != null) { // then some kind of resource was found by the given name; // assume that it's a properties file props = new Properties(); ((Properties) props).load(in); } } catch (IOException ioe) { throw new JDOFatalUserException(msg.msg( "EXC_GetPMFIOExceptionRsrc", name), ioe); //NOI18N } finally { if (in != null) { try { in.close(); } catch (IOException ioe) { } } } return props; } /** * @see #getNamedPMFProperties(String,ClassLoader,String) * @since 2.1 */ protected static Map getPropertiesFromJdoconfig( String name, ClassLoader resourceLoader) { return getNamedPMFProperties( name, resourceLoader, JDOCONFIG_RESOURCE_NAME); } /** * Find and return the named {@link PersistenceManagerFactory}'s properties, * or null if not found. * If multiple named PMF property sets with * the given name are found (including anonymous ones), throw * {@link JDOFatalUserException}. * This method is here only to facilitate testing; the parameter * "jdoconfigResourceName" in public usage should always have the value * given in the constant {@link Constants#JDOCONFIG_RESOURCE_NAME}. * * @param name The persistence unit name; null is disallowed. * @param resourceLoader The ClassLoader used to load the standard JDO * configuration file. * @param jdoconfigResourceName The name of the configuration file to read. * In public usage, this should always be the value of * {@link Constants#JDOCONFIG_RESOURCE_NAME}. * @return The named PersistenceManagerFactory properties if * found, null if not. * @since 2.1 * @throws JDOFatalUserException if multiple named PMF property sets are * found with the given name, or any other exception is encountered. */ protected static Map getNamedPMFProperties( String name, ClassLoader resourceLoader, String jdoconfigResourceName) { // key is PU name, value is Map of PU properties Map/**/ propertiesByNameInAllConfigs = new HashMap/**/(); try { URL firstFoundConfigURL = null; // get all JDO configurations Enumeration resources = getResources(resourceLoader, jdoconfigResourceName); if (resources.hasMoreElements()) { ArrayList processedResources = new ArrayList(); // get ready to parse XML DocumentBuilderFactory factory = getDocumentBuilderFactory(); do { URL currentConfigURL = (URL) resources.nextElement(); if (processedResources.contains(currentConfigURL)) { continue; } else { processedResources.add(currentConfigURL); } Map/**/ propertiesByNameInCurrentConfig = readNamedPMFProperties( currentConfigURL, name, factory); // try to detect duplicate requested PU if (propertiesByNameInCurrentConfig.containsKey(name)) { // possible dup -- check for it if (firstFoundConfigURL == null) { firstFoundConfigURL = currentConfigURL; } if (propertiesByNameInAllConfigs.containsKey(name)) throw new JDOFatalUserException (msg.msg( "EXC_DuplicateRequestedNamedPMFFoundInDifferentConfigs", "".equals(name) ? "(anonymous)" : name, firstFoundConfigURL.toExternalForm(), currentConfigURL.toExternalForm())); //NOI18N } // no dups -- add found PUs to all PUs and keep going propertiesByNameInAllConfigs .putAll(propertiesByNameInCurrentConfig); } while (resources.hasMoreElements()); } } catch (FactoryConfigurationError e) { throw new JDOFatalUserException( msg.msg("ERR_NoDocumentBuilderFactory"), e); } catch (IOException ioe) { throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFIOExceptionRsrc", name), ioe); //NOI18N } // done with reading all config resources; // return what we found, which may very well be null return (Map) propertiesByNameInAllConfigs.get(name); } protected static DocumentBuilderFactory getDocumentBuilderFactory() { DocumentBuilderFactory factory = implHelper.getRegisteredDocumentBuilderFactory(); if (factory == null) { factory = getDefaultDocumentBuilderFactory(); } return factory; } protected static DocumentBuilderFactory getDefaultDocumentBuilderFactory() { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments(true); factory.setNamespaceAware(true); factory.setValidating(false); factory.setIgnoringElementContentWhitespace(true); factory.setExpandEntityReferences(true); return factory; } protected static ErrorHandler getErrorHandler() { ErrorHandler handler = implHelper.getRegisteredErrorHandler(); if (handler == null) { handler = getDefaultErrorHandler(); } return handler; } protected static ErrorHandler getDefaultErrorHandler() { return new ErrorHandler() { public void error(SAXParseException exception) throws SAXException { throw exception; } public void fatalError(SAXParseException exception) throws SAXException { throw exception; } public void warning(SAXParseException exception) throws SAXException { // gulp: ignore warnings } }; } /** Reads JDO configuration file, creates a Map for each * persistence-manager-factory, then returns the map. * @param url URL of a JDO configuration file compliant with * javax/jdo/jdoconfig.xsd. * @param requestedPMFName The name of the requested * persistence unit (allows for fail-fast). * @param factory The DocumentBuilderFactory to use for XML * parsing. * @return a Map holding persistence unit configurations; for * the anonymous persistence unit, the * value of the String key is the empty string, "". */ protected static Map/**/ readNamedPMFProperties( URL url, String requestedPMFName, DocumentBuilderFactory factory) { requestedPMFName = requestedPMFName == null ? "" : requestedPMFName.trim(); Map propertiesByName = new HashMap(); InputStream in = null; try { DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(getErrorHandler()); in = openStream(url); Document doc = builder.parse(in); Element root = doc.getDocumentElement(); if (root == null) { throw new JDOFatalUserException( msg.msg("EXC_InvalidJDOConfigNoRoot", url.toExternalForm()) ); } NodeList pmfs = root.getElementsByTagName( ELEMENT_PERSISTENCE_MANAGER_FACTORY); for(int i = 0; i < pmfs.getLength(); i++) { Node pmfElement = pmfs.item(i); Properties pmfPropertiesFromAttributes = readPropertiesFromPMFElementAttributes(pmfElement); Properties pmfPropertiesFromElements = readPropertiesFromPMFSubelements(pmfElement, url); // for informative error handling, get name (or names) now String pmfNameFromAtts = pmfPropertiesFromAttributes.getProperty(PROPERTY_NAME); String pmfNameFromElem = pmfPropertiesFromElements.getProperty(PROPERTY_NAME); String pmfName = null; if (isNullOrBlank(pmfNameFromAtts)) { // no PMF name attribute given if (!isNullOrBlank(pmfNameFromElem)) { // PMF name element was given pmfName = pmfNameFromElem; } else { // PMF name not given at all, means the "anonymous" PMF pmfName = ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME; } } else { // PMF name given in an attribute if (!isNullOrBlank(pmfNameFromElem)) { // exception -- PMF name given as both att & elem throw new JDOFatalUserException( msg.msg( "EXC_DuplicatePMFNamePropertyFoundWithinConfig", pmfNameFromAtts, pmfNameFromElem, url.toExternalForm())); } pmfName = pmfNameFromAtts; } pmfName = pmfName == null ? "" : pmfName.trim(); // check for duplicate properties among atts & elems if (requestedPMFName.equals(pmfName)) { Iterator it = pmfPropertiesFromAttributes.keySet().iterator(); while (it.hasNext()) { String property = (String) it.next(); if (pmfPropertiesFromElements.contains(property)) { throw new JDOFatalUserException( msg.msg( "EXC_DuplicatePropertyFound", property, pmfName, url.toExternalForm())); } } } // at this point, we're guaranteed not to have duplicate // properties -- merge them Properties pmfProps = new Properties(); pmfProps.putAll(pmfPropertiesFromAttributes); pmfProps.putAll(pmfPropertiesFromElements); // check for duplicate requested PMF name if (pmfName.equals(requestedPMFName) && propertiesByName.containsKey(pmfName)) { throw new JDOFatalUserException(msg.msg( "EXC_DuplicateRequestedNamedPMFFoundInSameConfig", pmfName, url.toExternalForm())); } propertiesByName.put(pmfName, pmfProps); } return propertiesByName; } catch (IOException ioe) { throw new JDOFatalUserException( msg.msg("EXC_GetPMFIOExceptionRsrc", url.toString()), ioe); //NOI18N } catch (ParserConfigurationException e) { throw new JDOFatalInternalException( msg.msg("EXC_ParserConfigException"), e); } catch (SAXParseException e) { throw new JDOFatalUserException( msg.msg( "EXC_SAXParseException", url.toExternalForm(), new Integer(e.getLineNumber()), new Integer(e.getColumnNumber())), e); } catch (SAXException e) { throw new JDOFatalUserException( msg.msg("EXC_SAXException", url.toExternalForm()), e); } catch (JDOException e) { throw e; } catch (RuntimeException e) { throw new JDOFatalUserException( msg.msg("EXC_SAXException", url.toExternalForm()), e); } finally { if (in != null) { try { in.close(); } catch (IOException ioe) { /* gulp */ } } } } protected static Properties readPropertiesFromPMFElementAttributes( Node pmfElement) { Properties p = new Properties(); NamedNodeMap attributes = pmfElement.getAttributes(); if (attributes == null) { return p; } for(int i = 0; i < attributes.getLength(); i++) { Node att = attributes.item(i); String attName = att.getNodeName(); String attValue = att.getNodeValue().trim(); String jdoPropertyName = (String) ATTRIBUTE_PROPERTY_XREF.get(attName); p.put( jdoPropertyName != null ? jdoPropertyName : attName, attValue); } return p; } protected static Properties readPropertiesFromPMFSubelements( Node pmfElement, URL url) { Properties p = new Properties(); NodeList elements = pmfElement.getChildNodes(); if (elements == null) { return p; } for(int i = 0; i < elements.getLength(); i++) { Node element = elements.item(i); if (element.getNodeType() != Node.ELEMENT_NODE) { continue; } String elementName = element.getNodeName(); NamedNodeMap attributes = element.getAttributes(); if (ELEMENT_PROPERTY.equalsIgnoreCase(elementName)) { // // get the "name" attribute's value (required) Node nameAtt = attributes.getNamedItem(PROPERTY_ATTRIBUTE_NAME); if (nameAtt == null) { throw new JDOFatalUserException( msg.msg("EXC_PropertyElementHasNoNameAttribute", url)); } String name = nameAtt.getNodeValue().trim(); if ("".equals(name)) { throw new JDOFatalUserException( msg.msg( "EXC_PropertyElementNameAttributeHasNoValue", name, url)); } // The next call allows users to use either the // attribute names or the // "javax.jdo" property names in element "name" // attributes. Handy-dandy. String jdoPropertyName = (String) ATTRIBUTE_PROPERTY_XREF.get(name); String propertyName = jdoPropertyName != null ? jdoPropertyName : name; if (p.containsKey(propertyName)) { throw new JDOFatalUserException( msg.msg( "EXC_DuplicatePropertyNameGivenInPropertyElement", propertyName, url)); } // get the "value" attribute's value (optional) Node valueAtt = attributes.getNamedItem( PROPERTY_ATTRIBUTE_VALUE); String value = valueAtt == null ? null : valueAtt.getNodeValue().trim(); p.put(propertyName, value); } else if (ELEMENT_INSTANCE_LIFECYCLE_LISTENER.equals(elementName)) { // // get the "listener" attribute's value Node listenerAtt = attributes.getNamedItem( INSTANCE_LIFECYCLE_LISTENER_ATTRIBUTE_LISTENER); if (listenerAtt == null) { throw new JDOFatalUserException( msg.msg( "EXC_MissingListenerAttribute", url)); } String listener = listenerAtt.getNodeValue().trim(); if ("".equals(listener)) { throw new JDOFatalUserException( msg.msg( "EXC_MissingListenerAttributeValue", url)); } // listener properties are of the form // "javax.jdo.option.InstanceLifecycleListener." + listener listener = PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER + listener; // get the "classes" attribute's value (optional) Node classesAtt = attributes.getNamedItem( INSTANCE_LIFECYCLE_LISTENER_ATTRIBUTE_CLASSES); String value = classesAtt == null ? "" : classesAtt.getNodeValue().trim(); p.put(listener, value); } } return p; } protected static boolean isNullOrBlank(String s) { return s == null || "".equals(s.trim()); } /** * Returns a {@link PersistenceManagerFactory} configured based * on the properties stored in the file at * propsFile. This method is equivalent to * invoking {@link * #getPersistenceManagerFactory(File,ClassLoader)} with * Thread.currentThread().getContextClassLoader() as * the loader argument. * @since 2.0 * @param propsFile the file containing the Properties * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (File propsFile) { return getPersistenceManagerFactory( propsFile, getContextClassLoader()); } /** * Returns a {@link PersistenceManagerFactory} configured based * on the properties stored in the file at * propsFile. Creates a {@link * PersistenceManagerFactory} with loader. Any * IOExceptions or * FileNotFoundExceptions thrown during resource * loading will be wrapped in a {@link JDOFatalUserException}. * @since 2.0 * @param propsFile the file containing the Properties * @param loader the class loader to use to load the * PersistenceManagerFactory class * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (File propsFile, ClassLoader loader) { if (propsFile == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullFile")); //NOI18N Properties props = new Properties(); InputStream in = null; try { in = new FileInputStream(propsFile); return getPersistenceManagerFactory(in, loader); } catch (FileNotFoundException fnfe) { throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNoFile", propsFile), fnfe); //NOI18N } finally { if (in != null) try { in.close (); } catch (IOException ioe) { } } } /** * Returns a {@link PersistenceManagerFactory} at the JNDI * location specified by jndiLocation in the context * context. If context is * null, new InitialContext() will be * used. This method is equivalent to invoking {@link * #getPersistenceManagerFactory(String,Context,ClassLoader)} * with Thread.currentThread().getContextClassLoader() as * the loader argument. * @since 2.0 * @param jndiLocation the JNDI location containing the * PersistenceManagerFactory * @param context the context in which to find the named * PersistenceManagerFactory * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (String jndiLocation, Context context) { return getPersistenceManagerFactory (jndiLocation, context, getContextClassLoader()); } /** * Returns a {@link PersistenceManagerFactory} at the JNDI * location specified by jndiLocation in the context * context. If context is * null, new InitialContext() will be * used. Creates a {@link PersistenceManagerFactory} with * loader. Any NamingExceptions thrown * will be wrapped in a {@link JDOFatalUserException}. * @since 2.0 * @param jndiLocation the JNDI location containing the * PersistenceManagerFactory * @param context the context in which to find the named * PersistenceManagerFactory * @param loader the class loader to use to load the * PersistenceManagerFactory class * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (String jndiLocation, Context context, ClassLoader loader) { if (jndiLocation == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullJndiLoc")); //NOI18N if (loader == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullLoader")); //NOI18N try { if (context == null) context = new InitialContext (); Object o = context.lookup (jndiLocation); return (PersistenceManagerFactory) PortableRemoteObject.narrow (o, PersistenceManagerFactory.class); } catch (NamingException ne) { throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNamingException", jndiLocation, loader), ne); //NOI18N } } /** * Returns a {@link PersistenceManagerFactory} configured based * on the Properties stored in the input stream at * stream. This method is equivalent to * invoking {@link * #getPersistenceManagerFactory(InputStream,ClassLoader)} with * Thread.currentThread().getContextClassLoader() as * the loader argument. * @since 2.0 * @param stream the stream containing the Properties * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (InputStream stream) { return getPersistenceManagerFactory( stream, getContextClassLoader()); } /** * Returns a {@link PersistenceManagerFactory} configured based * on the Properties stored in the input stream at * stream. Creates a {@link * PersistenceManagerFactory} with loader. Any * IOExceptions thrown during resource * loading will be wrapped in a {@link JDOFatalUserException}. * @since 2.0 * @param stream the stream containing the Properties * @param loader the class loader to use to load the * PersistenceManagerFactory class * @return the PersistenceManagerFactory */ public static PersistenceManagerFactory getPersistenceManagerFactory (InputStream stream, ClassLoader loader) { if (stream == null) throw new JDOFatalUserException (msg.msg ( "EXC_GetPMFNullStream")); //NOI18N Properties props = new Properties (); try { props.load (stream); } catch (IOException ioe) { throw new JDOFatalUserException (msg.msg ("EXC_GetPMFIOExceptionStream"), ioe); //NOI18N } return getPersistenceManagerFactory (props, loader); } /** Get the context class loader associated with the current thread. * This is done in a doPrivileged block because it is a secure method. * @return the current thread's context class loader. * @since 2.0 */ private static ClassLoader getContextClassLoader() { return (ClassLoader)AccessController.doPrivileged( new PrivilegedAction () { public Object run () { return Thread.currentThread().getContextClassLoader(); } } ); } /** Get the named resource as a stream from the resource loader. * Perform this operation in a doPrivileged block. */ private static InputStream getResourceAsStream( final ClassLoader resourceLoader, final String name) { return (InputStream)AccessController.doPrivileged( new PrivilegedAction() { public Object run() { return resourceLoader.getResourceAsStream(name); } } ); } /** Get the named Method from the named class. * Perform this operation in a doPrivileged block. * * @param implClass the class * @param methodName the name of the method * @param parameterTypes the parameter types of the method * @return the Method instance */ private static Method getMethod( final Class implClass, final String methodName, final Class[] parameterTypes) throws NoSuchMethodException { try { return (Method) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws NoSuchMethodException { return implClass.getMethod(methodName, parameterTypes); } } ); } catch (PrivilegedActionException ex) { throw (NoSuchMethodException)ex.getException(); } } /** Invoke the method. * Perform this operation in a doPrivileged block. */ private static Object invoke(final Method method, final Object instance, final Object[] parameters) throws IllegalAccessException, InvocationTargetException { try { return (Object) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws IllegalAccessException, InvocationTargetException { return method.invoke (instance, parameters); } } ); } catch (PrivilegedActionException ex) { Exception cause = (Exception)ex.getException(); if (cause instanceof IllegalAccessException) throw (IllegalAccessException)cause; else //if (cause instanceof InvocationTargetException) throw (InvocationTargetException)cause; } } /** Get resources of the resource loader. * Perform this operation in a doPrivileged block. * @param resourceLoader * @param resourceName * @return the resources */ protected static Enumeration getResources( final ClassLoader resourceLoader, final String resourceName) throws IOException { try { return (Enumeration) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws IOException { return resourceLoader.getResources(resourceName); } } ); } catch (PrivilegedActionException ex) { throw (IOException)ex.getException(); } } /** Get the named class. * Perform this operation in a doPrivileged block. * * @param name the name of the class * @param init whether to initialize the class * @param loader which class loader to use * @return the class */ private static Class forName( final String name, final boolean init, final ClassLoader loader) throws ClassNotFoundException { try { return (Class) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws ClassNotFoundException { return Class.forName(name, init, loader); } } ); } catch (PrivilegedActionException ex) { throw (ClassNotFoundException)ex.getException(); } } /** Open an input stream on the url. * Perform this operation in a doPrivileged block. * * @param url * @return the input stream */ private static InputStream openStream(final URL url) throws IOException { try { return (InputStream) AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws IOException { return url.openStream(); } } ); } catch (PrivilegedActionException ex) { throw (IOException)ex.getException(); } } } jdo2-api-2.2/src/java/javax/jdo/JDONullIdentityException.java100644 0 0 5077 11073716464 21233 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDONullIdentityException.java * */ package javax.jdo; /** An instance of this class is thrown when attempting to create an object id * when the object id constructor parameter is null. This might occur when * creating an object id instance from a transient instance where an identity * field is null. * * @since 2.0 * @version 2.0 */ public class JDONullIdentityException extends JDOUserException { /** * Constructs a new JDONullIdentityException without a detail message. */ public JDONullIdentityException() { } /** * Constructs a new JDONullIdentityException with the specified detail message. * @param msg the detail message. */ public JDONullIdentityException(String msg) { super(msg); } /** Constructs a new JDONullIdentityException with the specified detail message * and failed object. * @param msg the detail message. * @param failed the failed object. */ public JDONullIdentityException(String msg, Object failed) { super(msg, failed); } /** * Constructs a new JDONullIdentityException with the specified * detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDONullIdentityException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDONullIdentityException with the specified detail message * and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. */ public JDONullIdentityException(String msg, Throwable nested) { super(msg, nested); } } jdo2-api-2.2/src/java/javax/jdo/JDOObjectNotFoundException.java100644 0 0 6476 11073716465 21477 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOObjectNotFoundException.java * */ package javax.jdo; /** This class represents exceptions caused by the user accessing * an object that does not exist in the datastore. * * @since 1.0.1 * @version 1.0.1 */ public class JDOObjectNotFoundException extends JDODataStoreException { /** * Constructs a new JDOObjectNotFoundException * without a detail message. */ public JDOObjectNotFoundException() { } /** * Constructs a new JDOObjectNotFoundException * with the specified detail message. * @param msg the detail message. */ public JDOObjectNotFoundException(String msg) { super(msg); } /** Constructs a new JDOObjectNotFoundException with the specified detail message * and failed object. * @param msg the detail message. * @param failed the failed object. */ public JDOObjectNotFoundException(String msg, Object failed) { super(msg, failed); } /** * Constructs a new JDOObjectNotFoundException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. */ public JDOObjectNotFoundException(String msg, Throwable nested) { super(msg, nested); } /** * Constructs a new JDOObjectNotFoundException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDOObjectNotFoundException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOObjectNotFoundException with the specified * detail message, nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable[]. * @param failed the failed object. */ public JDOObjectNotFoundException(String msg, Throwable[] nested, Object failed) { super(msg, nested, failed); } /** * Constructs a new JDOFatalInternalException with the specified * detail message, nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable. * @param failed the failed object. */ public JDOObjectNotFoundException(String msg, Throwable nested, Object failed) { super(msg, nested, failed); } } jdo2-api-2.2/src/java/javax/jdo/JDOOptimisticVerificationException.java100644 0 0 6232 11073716464 23270 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOOptimisticVerificationException.java * */ package javax.jdo; /** This class represents optimistic verification failures. The nested * exception array contains an exception for each instance that failed * the optimistic verification. * * @since 1.0.1 * @version 1.0.1 */ public class JDOOptimisticVerificationException extends JDOFatalDataStoreException { /** * Constructs a new JDOOptimisticVerificationException without a * detail message. */ public JDOOptimisticVerificationException() { } /** * Constructs a new JDOOptimisticVerificationException with the * specified detail message. * @param msg the detail message. */ public JDOOptimisticVerificationException(String msg) { super(msg); } /** Constructs a new JDOOptimisticVerificationException with the * specified detail message and failed object. * @param msg the detail message. * @param failed the failed object. */ public JDOOptimisticVerificationException(String msg, Object failed) { super(msg, failed); } /** * Constructs a new JDOOptimisticVerificationException with the * specified detail message and nested Throwable[]s. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDOOptimisticVerificationException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOOptimisticVerificationException with the specified * detail message, nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable[]. * @param failed the failed object. */ public JDOOptimisticVerificationException(String msg, Throwable[] nested, Object failed) { super(msg, nested, failed); } /** * Constructs a new JDOOptimisticVerificationException with the specified * detail message, nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable. * @param failed the failed object. */ public JDOOptimisticVerificationException(String msg, Throwable nested, Object failed) { super(msg, nested, failed); } } jdo2-api-2.2/src/java/javax/jdo/JDOReadOnlyException.java100644 0 0 4155 11073716464 20320 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOReadOnlyException.java */ package javax.jdo; /** This class represents exceptions caused by an attempt to update a datastore * when the PMF was created as "read-only". * * @version 2.2 * @since 2.2 */ public class JDOReadOnlyException extends JDOUserException { /** * Constructs a new JDOReadOnlyException without a * detail message. * @since 2.2 */ public JDOReadOnlyException() { } /** * Constructs a new JDOReadOnlyException with the * specified detail message. * @param msg the detail message. * @since 2.2 */ public JDOReadOnlyException(String msg) { super(msg); } /** * Constructs a new JDOReadOnlyException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. * @since 2.2 */ public JDOReadOnlyException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOReadOnlyException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. * @since 2.2 */ public JDOReadOnlyException(String msg, Throwable nested) { super(msg, nested); } }jdo2-api-2.2/src/java/javax/jdo/JDOUnsupportedOptionException.java100644 0 0 4261 11073716464 22322 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOUnsupportedOptionException.java * */ package javax.jdo; /** This class represents exceptions caused by the use of optional features * not supported by the JDO implementation. * * @version 1.0 */ public class JDOUnsupportedOptionException extends JDOUserException { /** * Constructs a new JDOUnsupportedOptionException without a detail message. */ public JDOUnsupportedOptionException() { } /** * Constructs a new JDOUnsupportedOptionException with the specified detail message. * @param msg the detail message. */ public JDOUnsupportedOptionException(String msg) { super(msg); } /** * Constructs a new JDOUnsupportedOptionException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDOUnsupportedOptionException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOUnsupportedOptionException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. */ public JDOUnsupportedOptionException(String msg, Throwable nested) { super(msg, nested); } } jdo2-api-2.2/src/java/javax/jdo/JDOUserCallbackException.java100644 0 0 6353 11073716464 21140 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOUserCallbackException.java * */ package javax.jdo; /** This class represents exceptions caused by exceptions thrown * during execution of callbacks or listeners. * * @version 2.0 */ public class JDOUserCallbackException extends JDOUserException { /** * Constructs a new JDOUserCallbackException * without a detail message. */ public JDOUserCallbackException() { } /** * Constructs a new JDOUserCallbackException * with the specified detail message. * @param msg the detail message. */ public JDOUserCallbackException(String msg) { super(msg); } /** * Constructs a new JDOUserCallbackException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDOUserCallbackException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOUserCallbackException with the * specified detail message and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. */ public JDOUserCallbackException(String msg, Throwable nested) { super(msg, nested); } /** Constructs a new JDOUserCallbackException with the specified detail message * and failed object. * @param msg the detail message. * @param failed the failed object. */ public JDOUserCallbackException(String msg, Object failed) { super(msg, failed); } /** Constructs a new JDOUserCallbackException with the specified detail message, * nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable[]. * @param failed the failed object. */ public JDOUserCallbackException(String msg, Throwable[] nested, Object failed) { super(msg, nested, failed); } /** Constructs a new JDOUserException with the specified detail message, * nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable. * @param failed the failed object. */ public JDOUserCallbackException(String msg, Throwable nested, Object failed) { super(msg, nested, failed); } } jdo2-api-2.2/src/java/javax/jdo/JDOUserException.java100644 0 0 6100 11073716464 17511 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOUserException.java * */ package javax.jdo; /** This class represents user errors that can possibly be retried. * * @version 1.0 */ public class JDOUserException extends JDOCanRetryException { /** * Constructs a new JDOUserException without a detail message. */ public JDOUserException() { } /** * Constructs a new JDOUserException with the specified detail message. * @param msg the detail message. */ public JDOUserException(String msg) { super(msg); } /** * Constructs a new JDOUserException with the specified detail message * and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable[]. */ public JDOUserException(String msg, Throwable[] nested) { super(msg, nested); } /** * Constructs a new JDOUserException with the specified detail message * and nested Throwables. * @param msg the detail message. * @param nested the nested Throwable. */ public JDOUserException(String msg, Throwable nested) { super(msg, nested); } /** Constructs a new JDOUserException with the specified detail message * and failed object. * @param msg the detail message. * @param failed the failed object. */ public JDOUserException(String msg, Object failed) { super(msg, failed); } /** Constructs a new JDOUserException with the specified detail message, * nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable[]. * @param failed the failed object. */ public JDOUserException(String msg, Throwable[] nested, Object failed) { super(msg, nested, failed); } /** Constructs a new JDOUserException with the specified detail message, * nested Throwables, and failed object. * @param msg the detail message. * @param nested the nested Throwable. * @param failed the failed object. */ public JDOUserException(String msg, Throwable nested, Object failed) { super(msg, nested, failed); } } jdo2-api-2.2/src/java/javax/jdo/listener/AttachCallback.java100644 0 0 3271 11073716465 21034 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * AttachCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of attach events. * @version 2.0 * @since 2.0 */ public interface AttachCallback { /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#makePersistent} on the detached * instance before the copy is made. * @since 2.0 */ public void jdoPreAttach(); /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#makePersistent} on the persistent * instance after the copy is made. * @param attached The corresponding (non-attached) instance that was * attached in the call to * {@link javax.jdo.PersistenceManager#makePersistent}. * @since 2.0 */ public void jdoPostAttach(Object attached); } jdo2-api-2.2/src/java/javax/jdo/listener/AttachLifecycleListener.java100644 0 0 4112 11073716465 22740 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * AttachLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * attach events. * @version 2.0 * @since 2.0 */ public interface AttachLifecycleListener extends InstanceLifecycleListener { /** * This method is called before a detached instance is attached, via the * {@link javax.jdo.PersistenceManager#makePersistent} method. The source * instance is the detached instance. This method is called before the * corresponding {@link AttachCallback#jdoPreAttach} on the detached * instance. * @param event the attach event. * @since 2.0 */ void preAttach (InstanceLifecycleEvent event); /** * This method is called after a detached instance is attached, via the * {@link javax.jdo.PersistenceManager#makePersistent} method. The source * instance is the corresponding persistent instance in the cache; the * target instance is the detached instance. This method is called after * the corresponding {@link AttachCallback#jdoPostAttach} on the * persistent instance. * @param event the attach event. * @since 2.0 */ void postAttach (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/ClearCallback.java100644 0 0 2564 11073716464 20661 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ClearCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of clear events. * @version 2.0 * @since 2.0 */ public interface ClearCallback { /** * Called before the values in the instance are cleared. * *

Transient fields should be cleared in this method. * Associations between this * instance and others in the runtime environment should be cleared. * *

This method is not modified by the enhancer. */ void jdoPreClear(); } jdo2-api-2.2/src/java/javax/jdo/listener/ClearLifecycleListener.java100644 0 0 4413 11073716465 22566 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ClearLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * clear events. * @version 2.0 * @since 2.0 */ public interface ClearLifecycleListener extends InstanceLifecycleListener { /** * This method is called before the implementation calls the instance * method {@link ClearCallback#jdoPreClear} and before it clears the values * in the instance to their Java default values. This happens during * an application call to evict, and in afterCompletion for commit * with RetainValues false and rollback with RestoreValues false. *

The method is called during any state transition to hollow. * Non-persistent, non-transactional fields should be cleared * in this method. Associations between this instance and others * in the runtime environment should be cleared. *

This method is not modified by the enhancer, so access to fields * is not mediated. * @param event the clear event. * @since 2.0 */ void preClear (InstanceLifecycleEvent event); /** * This method is called after the {@link ClearCallback#jdoPreClear} * method is invoked on the instance and the fields have been cleared * by the JDO implementation. * @param event the clear event. * @since 2.0 */ void postClear (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/CreateLifecycleListener.java100644 0 0 2621 11073716464 22741 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * CreateLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * create events. * @version 2.0 * @since 2.0 */ public interface CreateLifecycleListener extends InstanceLifecycleListener { /** * Invoked whenever an instance is made persistent via a * call to {@link javax.jdo.PersistenceManager#makePersistent} or during * persistence by reachability. * @param event the create event. * @since 2.0 */ void postCreate (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/DeleteCallback.java100644 0 0 2740 11073716464 21031 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DeleteCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of delete events. * @version 2.0 * @since 2.0 */ public interface DeleteCallback { /** * Called before the instance is deleted. * This method is called before the state transition to persistent-deleted * or persistent-new-deleted. Access to field values within this call * are valid. Access to field values after this call are disallowed. *

This method is modified by the enhancer so that fields referenced * can be used in the business logic of the method. */ void jdoPreDelete(); } jdo2-api-2.2/src/java/javax/jdo/listener/DeleteLifecycleListener.java100644 0 0 3661 11073716464 22745 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DeleteLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * delete events. * @version 2.0 * @since 2.0 */ public interface DeleteLifecycleListener extends InstanceLifecycleListener { /** * Invoked whenever a persistent instance is deleted, for example * during {@link javax.jdo.PersistenceManager#deletePersistent}. * Access to field values within this call are permitted. *

This method is called before the instance callback * {@link DeleteCallback#jdoPreDelete}. * @param event the delete event. * @since 2.0 */ void preDelete (InstanceLifecycleEvent event); /** * Invoked whenever a persistent instance is deleted, for example * during {@link javax.jdo.PersistenceManager#deletePersistent}. *

This method is called after the instance transitions * to persistent-deleted. Access to field values is not permitted. * @param event the delete event. * @since 2.0 */ void postDelete (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/DetachCallback.java100644 0 0 3121 11073716465 21012 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DetachCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of detach events. * @version 2.0 * @since 2.0 */ public interface DetachCallback { /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#detachCopy} on the * persistent instance before the copy is made. * @since 2.0 */ public void jdoPreDetach(); /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#detachCopy} on the * detached instance after the copy is made. * @param detached The corresponding (attached) persistent instance. * @since 2.0 */ public void jdoPostDetach(Object detached); } jdo2-api-2.2/src/java/javax/jdo/listener/DetachLifecycleListener.java100644 0 0 3622 11073716465 22731 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DetachLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * detach events. * @version 2.0 * @since 2.0 */ public interface DetachLifecycleListener extends InstanceLifecycleListener { /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#detachCopy} before the * detached copy is made. It is called before the method * {@link DetachCallback#jdoPreDetach} is called on the * instance to be detached. * @param event the detach event. * @since 2.0 */ void preDetach (InstanceLifecycleEvent event); /** * This method is called during the execution of * {@link javax.jdo.PersistenceManager#detachCopy} after the * detached copy is made. It is called after the method * {@link DetachCallback#jdoPreDetach} is called on * the detached instance. * @param event the detach event. * @since 2.0 */ void postDetach (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/DirtyLifecycleListener.java100644 0 0 3246 11073716465 22636 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * DirtyLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * dirty events. * @version 2.0 * @since 2.0 */ public interface DirtyLifecycleListener extends InstanceLifecycleListener { /** * Invoked whenever a persistent instance is first made dirty, * during an operation that modifies the value of a persistent or * transactional field. Called before the value is changed. * @since 2.0 */ void preDirty (InstanceLifecycleEvent event); /** * Invoked whenever a persistent instance is first made dirty, * during an operation that modifies the value of a persistent or * transactional field. Called after the value is changed. * @since 2.0 */ void postDirty (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/InstanceLifecycleEvent.java100644 0 0 15076 11073716465 22627 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * InstanceLifecycleEvent.java * */ package javax.jdo.listener; import javax.jdo.spi.I18NHelper; /** * This is the event class used in life cycle event notifications. *

Note that although InstanceLifecycleEvent inherits Serializable interface * from EventObject, it is not intended to be Serializable. Appropriate * serialization methods are implemented to throw NotSerializableException. * @version 2.0 * @since 2.0 */ public class InstanceLifecycleEvent extends java.util.EventObject { private static final int FIRST_EVENT_TYPE = 0; public static final int CREATE = 0; public static final int LOAD = 1; public static final int STORE = 2; public static final int CLEAR = 3; public static final int DELETE = 4; public static final int DIRTY = 5; public static final int DETACH = 6; public static final int ATTACH = 7; private static final int LAST_EVENT_TYPE = 7; /** The Internationalization message helper. */ private final static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N /** * The event type that triggered the construction of this event object. */ private final int eventType; /** * The "other" object associated with the event. */ private final Object target; /** * Creates a new event object with the specified * source and type. * @param source the instance that triggered the event * @param type the event type * @since 2.0 */ public InstanceLifecycleEvent (Object source, int type) { this(source, type, null); } /** * Creates a new event object with the specified * source, type, and target. * @param source the instance that triggered the event * @param type the event type * @param target the "other" instance * @since 2.0 */ public InstanceLifecycleEvent (Object source, int type, Object target) { super (source); if (type < FIRST_EVENT_TYPE || type > LAST_EVENT_TYPE) { throw new IllegalArgumentException(msg.msg("EXC_IllegalEventType")); } eventType = type; this.target = target; } /** * Returns the event type that triggered this event. * @return the event type * @since 2.0 */ public int getEventType () { return eventType; } /** * The source object of the Event. Although not deprecated, * it is recommended that the the methods * getPersistentInstance() and * getDetachedInstance() be used instead. * * @return The persistent instance on any pre- callback except preAttach, * or the detached instance for a postDetach or preAttach callback. * * @see #getPersistentInstance() * @see #getDetachedInstance() * @see "Section 12.15, Java Data Objects 2.0 Specification" */ public Object getSource() { return super.getSource(); } /** * The target object of the Event. Although not deprecated, * it is recommended that the the methods * getPersistentInstance() and * getDetachedInstance() be used instead. * * @return The detached instance for preDetach and postAttach, * the persistent instance otherwise. * * @since 2.0 * @see #getPersistentInstance() * @see #getDetachedInstance() * @see "Section 12.15, Java Data Objects 2.0 Specification" */ public Object getTarget () { return target; } /** * Returns the persistent instance involved in the event. * * @return The persistent instance involved in the event, or null if there * was none. * * @see "Section 12.15, Java Data Objects 2.0 Specification" */ public Object getPersistentInstance() { switch (getEventType()) { case DETACH: return target == null ? getSource() // preDetach: source is persistent instance : getTarget(); // postDetach: target is persistent instance case ATTACH: return target == null ? null // preAttach: no persistent instance yet : getSource(); // postAttach: source is persistent instance } // for all other events, source is persistent instance return getSource(); } /** * Returns the detached instance involved in the event. * * @return The detached instance involved in the event, or null if there was none. * * @see "Section 12.15, Java Data Objects 2.0 Specification" */ public Object getDetachedInstance() { switch (getEventType()) { case DETACH: return target == null ? null // preDetach: no detached instance yet : getSource(); // postDetach: source is detached instance case ATTACH: return target == null ? getSource() // preAttach: source is detached instance : getTarget(); // postAttach: target is detached instance } // for all other events, there is no detached instance return null; } /** * Serialization is not supported for InstanceLifecycleEvents. * param out the output stream * @since 2.0 */ private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { throw new java.io.NotSerializableException(); } } jdo2-api-2.2/src/java/javax/jdo/listener/InstanceLifecycleListener.java100644 0 0 2367 11073716465 23312 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * InstanceLifecycleListener.java * */ package javax.jdo.listener; /** * All lifecycle listeners extend from this base interface. * In order to minimize the impact on domain classes, instance callbacks * can be defined to use a life-cycle listener pattern instead of * having the domain class implement the callback interface(s). * * @version 2.0 * @since 2.0 */ public interface InstanceLifecycleListener { } jdo2-api-2.2/src/java/javax/jdo/listener/LoadCallback.java100644 0 0 2611 11073716465 20504 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * LoadCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of load events. * @version 2.0 * @since 2.0 */ public interface LoadCallback { /** * Called after the values are loaded from the data store into * this instance. * *

This method is not modified by the enhancer. *

Derived fields should be initialized in this method. * The context in which this call is made does not allow access to * other persistent JDO instances. */ void jdoPostLoad(); } jdo2-api-2.2/src/java/javax/jdo/listener/LoadLifecycleListener.java100644 0 0 2632 11073716465 22420 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * LoadLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * load events. * @version 2.0 * @since 2.0 */ public interface LoadLifecycleListener extends InstanceLifecycleListener { /** * Invoked whenever a persistent instance is loaded from the data * store. It is called after the method {@link LoadCallback#jdoPostLoad} * is invoked on the persistent instance. * @param event the load event. * @since 2.0 */ void postLoad (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/listener/package.html100644 0 0 4566 11073716464 17640 0ustar 0 0 Listener package This package contains the JDO specification listener interfaces and classes.

There are two kinds of interfaces defined to allow an application to manage life cycle changes to persistent objects.

The first kind is defined on the persistent domain class itself. This allows methods in the domain class to be called during life cycle events. The domain class implements one or more of the interfaces {@link javax.jdo.listener.AttachCallback}, {@link javax.jdo.listener.ClearCallback}, {@link javax.jdo.listener.DeleteCallback}, {@link javax.jdo.listener.DetachCallback}, {@link javax.jdo.listener.LoadCallback}, or {@link javax.jdo.listener.StoreCallback}. The methods in the interfaces are called during life cycle events.

The second kind is defined on an external class using the listener pattern. Instances of classes that implement one or more of the listener interfaces {@link javax.jdo.listener.AttachLifecycleListener}, {@link javax.jdo.listener.ClearLifecycleListener}, {@link javax.jdo.listener.CreateLifecycleListener}, {@link javax.jdo.listener.DeleteLifecycleListener}, {@link javax.jdo.listener.DetachLifecycleListener}, {@link javax.jdo.listener.DirtyLifecycleListener}, {@link javax.jdo.listener.LoadLifecycleListener}, or {@link javax.jdo.listener.StoreLifecycleListener} are registered with the PersistenceManager or PersistenceManagerFactory and receive callbacks during life cycle events of the persistent instances of interest. jdo2-api-2.2/src/java/javax/jdo/listener/StoreCallback.java100644 0 0 3111 11073716465 20715 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * StoreCallback.java * */ package javax.jdo.listener; /** * This interface is used to notify instances of store events. * @version 2.0 * @since 2.0 */ public interface StoreCallback { /** * Called before the values are stored from this instance to the * data store. * *

Data store fields that might have been affected by modified * non-persistent fields should be updated in this method. * *

This method is modified by the enhancer so that changes to * persistent fields will be reflected in the data store. * The context in which this call is made allows access to the * PersistenceManager and other persistent JDO instances. */ void jdoPreStore(); } jdo2-api-2.2/src/java/javax/jdo/listener/StoreLifecycleListener.java100644 0 0 3525 11073716465 22637 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * StoreLifecycleListener.java * */ package javax.jdo.listener; /** * This interface is implemented by listeners to be notified of * store events. * @version 2.0 * @since 2.0 */ public interface StoreLifecycleListener extends InstanceLifecycleListener { /** * Invoked whenever a persistent instance is stored, for example during * {@link javax.jdo.PersistenceManager#flush} or * {@link javax.jdo.Transaction#commit}. It is called before the * method {@link StoreCallback#jdoPreStore} is invoked. * @param event the store event. * @since 2.0 */ void preStore (InstanceLifecycleEvent event); /** * Invoked whenever a persistent instance is stored, for example during * {@link javax.jdo.PersistenceManager#flush} or * {@link javax.jdo.Transaction#commit}. It is called after the * field values have been stored. * @param event the store event. * @since 2.0 */ void postStore (InstanceLifecycleEvent event); } jdo2-api-2.2/src/java/javax/jdo/ObjectState.java100644 0 0 3242 11073716464 16572 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * ObjectState.java * */ package javax.jdo; /** * This class defines the object states for JDO instances. * * @version 2.1 */ public enum ObjectState { TRANSIENT("transient"), TRANSIENT_CLEAN("transient-clean"), TRANSIENT_DIRTY("transient-dirty"), PERSISTENT_NEW("persistent-new"), HOLLOW_PERSISTENT_NONTRANSACTIONAL("hollow/persistent-nontransactional"), PERSISTENT_NONTRANSACTIONAL_DIRTY("persistent-nontransactional-dirty"), PERSISTENT_CLEAN("persistent-clean"), PERSISTENT_DIRTY("persistent-dirty"), PERSISTENT_DELETED("persistent-deleted"), PERSISTENT_NEW_DELETED("persistent-new-deleted"), DETACHED_CLEAN("detached-clean"), DETACHED_DIRTY("detached-dirty"); private final String value; private ObjectState(String value) { this.value = value; } public String toString() { return value; } } jdo2-api-2.2/src/java/javax/jdo/package.html100644 0 0 11657 11073716464 16032 0ustar 0 0 JDO package This package contains the JDO specification interfaces and classes.

There are two major objectives of the JDO architecture: first, to provide application programmers a transparent, Java-centric view of persistent information, including enterprise data and locally stored data; and second, to enable pluggable implementations of data stores into application servers. Data stored in data stores is presented as instances of persistence-capable classes.

JDO defines interfaces and classes to be used by application programmers when using classes whose instances are to be stored in persistent storage (persistence-capable classes), and specifies the contracts between suppliers of persistence-capable classes and the runtime environment (which is part of the JDO implementation).

The JDO architecture defines a standard set of contracts between an application programmer and an JDO vendor. These contracts focus on the view of the Java instances of persistence capable classes.

The JDO PersistenceManagerFactory is the boostrap class for a JDO application. The application gets an instance of the PersistenceManagerFactory by construction or via JDNI lookup.

The application acquires an instance of the JDO PersistenceManager by calling the getPersistenceManager method on an instance of JDO PersistenceManagerFactory.

The JDO PersistenceManager is the primary interface for JDO-aware application components:

  • it gives access to the current Transaction interface;
  • it is the factory for the Query interface;
  • it contains methods for managing the life cycle of persistent instances.

A JDO PersistenceManager instance supports any number of JDO instances at a time. It is responsible for managing the identity of its associated JDO instances. A JDO instance is associated with either zero or one JDO PersistenceManager. It will be zero if and only if the JDO instance is transient nontransactional. As soon as the instance is made persistent or transactional, it will be associated with exactly one JDO PersistenceManager.

A JDO PersistenceManager instance supports one transaction at a time, and uses one connection to the underlying data source at a time. The JDO PersistenceManager instance might use multiple transactions serially, and might use multiple connections serially.

Normally, cache management is automatic and transparent. When instances are queried, navigated to, or modified, instantiation of instances and their fields and garbage collection of unreferenced instances occurs without any explicit control. When the transaction in which persistent instances are created, deleted, or modified commits, eviction is automatically done by the transaction completion mechanisms.

Operations on persistent JDO instances at the user's choice might be performed in the context of a transaction. That is, the view of data in the data store is transactionally consistent, according to the standard definition of ACID transactions.

The Transaction interface is used to mark the beginning and end of a application-defined unit of work. The PersistenceManager allows the application to get the instance that manages these transactional boundaries via the currentTransaction method.

The persistent manager instance is a factory for query instances, and queries are executed in the context of the persistent manager instance. The actual query execution might be performed by the JDO PersistenceManager or might be delegated by the JDO PersistenceManager to its data store. The actual query executed thus might be implemented in a very different language from Java, and might be optimized to take advantage of particular query language implementations.

Extents are collections of data store objects managed by the data store, not by explicit user operations on collections. Extent capability is a boolean property of classes that are persistence capable. If an instance of a class that has a managed extent is made persistent via reachability, the instance is put into the extent implicitly. jdo2-api-2.2/src/java/javax/jdo/PersistenceManager.java100644 0 0 163542 11073716464 20214 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * PersistenceManager.java * */ package javax.jdo; import java.util.Collection; import java.util.Date; import java.util.EnumSet; import java.util.Set; import javax.jdo.datastore.JDOConnection; import javax.jdo.datastore.Sequence; import javax.jdo.listener.InstanceLifecycleListener; /** PersistenceManager is the primary interface for JDO-aware * application components. It is the factory for Query and * Transaction instances, and contains methods to manage the * life cycle of PersistenceCapable instances. * *

A PersistenceManager is obtained from the * {@link PersistenceManagerFactory} * (recommended) or by construction. * @version 2.1 */ public interface PersistenceManager { /** * A PersistenceManager instance can be used until it is * closed. * @return true if this PersistenceManager has * been closed. * @see #close() */ boolean isClosed (); /** Close this PersistenceManager so that no further requests * may be made on it. A PersistenceManager instance can be * used only until it is closed. * *

Closing a PersistenceManager might release it to the pool * of available PersistenceManagers, or might be garbage * collected, at the option of the JDO implementation. Before being used * again to satisfy a getPersistenceManager() request, the * default values for options will be restored to their values as specified * in the PersistenceManagerFactory. * *

This method closes the PersistenceManager. */ void close (); /** Return the Transaction instance associated with a * PersistenceManager. There is one Transaction * instance associated with each PersistenceManager instance. * The Transaction instance supports options as well as * transaction completion requests. * @return the Transaction associated with this * PersistenceManager. */ Transaction currentTransaction(); /** Mark an instance as no longer needed in the cache. Eviction is normally * done automatically by the PersistenceManager at transaction * completion. This method allows the application to explicitly provide a * hint to the PersistenceManager that the instance is no * longer needed in the cache. * @param pc the instance to evict from the cache. */ void evict (Object pc); /** Mark an array of instances as no longer needed in the cache. * @see #evict(Object pc) * @param pcs the array of instances to evict from the cache. */ void evictAll (Object... pcs); /** Mark a Collection of instances as no longer needed in the * cache. * @see #evict(Object pc) * @param pcs the Collection of instances to evict from the * cache. */ void evictAll (Collection pcs); /** Mark the parameter instances as no longer needed in the cache. * @param pcClass the class of instances to evict * @param subclasses if true, mark instances of subclasses also * @since 2.1 */ void evictAll (boolean subclasses, Class pcClass); /** Mark all persistent-nontransactional instances as no longer needed * in the cache. It transitions * all persistent-nontransactional instances to hollow. Transactional * instances are subject to eviction based on the RetainValues setting. * @see #evict(Object pc) */ void evictAll (); /** Refresh the state of the instance from the data store. * *

In an optimistic transaction, the state of instances in the cache * might not match the state in the data store. This method is used to * reload the state of the instance from the data store so that a subsequent * commit is more likely to succeed. *

Outside a transaction, this method will refresh nontransactional * state. * @param pc the instance to refresh. */ void refresh (Object pc); /** Refresh the state of an array of instances from the data store. * * @see #refresh(Object pc) * @param pcs the array of instances to refresh. */ void refreshAll (Object... pcs); /** Refresh the state of a Collection of instances from the * data store. * * @see #refresh(Object pc) * @param pcs the Collection of instances to refresh. */ void refreshAll (Collection pcs); /** Refresh the state of all applicable instances from the data store. *

If called with an active transaction, all transactional instances * will be refreshed. If called outside an active transaction, all * nontransactional instances will be refreshed. * @see #refresh(Object pc) */ void refreshAll (); /** * Refreshes all instances in the exception that failed verification. * * @since 2.0 */ void refreshAll (JDOException jdoe); /** Create a new Query with no elements. * @return the new Query. */ Query newQuery (); /** Create a new Query using elements from another * Query. The other Query must have been created * by the same JDO implementation. It might be active in a different * PersistenceManager or might have been serialized and * restored. *

All of the settings of the other Query are copied to this * Query, except for the candidate Collection or * Extent. * @return the new Query * @param compiled another Query from the same JDO * implementation */ Query newQuery (Object compiled); /** Create a Construct a new query instance using the specified String * as the single-string representation of the query. * @param query the single-string query * @return the new Query * @since 2.0 */ Query newQuery (String query); /** Create a new Query using the specified language. * @param language the language of the query parameter * @param query the query, which is of a form determined by the language * @return the new Query */ Query newQuery (String language, Object query); /** Create a new Query specifying the Class of the * candidate instances. * @param cls the Class of the candidate instances * @return the new Query */ Query newQuery (Class cls); /** Create a new Query with the Class of the * candidate instances and candidate Extent. * @param cln the Extent of candidate instances * @return the new Query */ Query newQuery (Extent cln); /** Create a new Query with the candidate Class * and Collection. * @param cls the Class of results * @param cln the Collection of candidate instances * @return the new Query */ Query newQuery (Class cls, Collection cln); /** Create a new Query with the Class of the * candidate instances and filter. * @param cls the Class of results * @param filter the filter for candidate instances * @return the new Query */ Query newQuery (Class cls, String filter); /** Create a new Query with the Class of the * candidate instances, * candidate Collection, and filter. * @param cls the Class of candidate instances * @param cln the Collection of candidate instances * @param filter the filter for candidate instances * @return the new Query */ Query newQuery (Class cls, Collection cln, String filter); /** Create a new Query with the * candidate Extent and filter; the class * is taken from the Extent. * @param cln the Extent of candidate instances * @param filter the filter for candidate instances * @return the new Query */ Query newQuery (Extent cln, String filter); /** * Create a new Query with the given candidate class * from a named query. The query name given must be the name of a * query defined in metadata. * @param cls the Class of candidate instances * @param queryName the name of the query to look up in metadata * @return the new Query */ Query newNamedQuery (Class cls, String queryName); /** The PersistenceManager manages a collection of instances in * the data store based on the class of the instances. This method returns * an Extent of instances in the data store that might be * iterated or given to a Query. The Extent * itself might not reference any instances, but only hold the class name * and an indicator as to whether subclasses are included in the * Extent. *

Note that the Extent might be very large. * @param persistenceCapableClass Class of instances * @param subclasses whether to include instances of subclasses * @return an Extent of the specified Class * @see Query */ Extent getExtent (Class persistenceCapableClass, boolean subclasses); /** * Equivalent to getExtent (persistenceCapableClass, * true). * @see #getExtent(Class,boolean) * @since 2.0 */ Extent getExtent (Class persistenceCapableClass); /** This method locates a persistent instance in the cache of instances * managed by this PersistenceManager. * The getObjectById method attempts * to find an instance in the cache with the specified JDO identity. * The oid parameter object might have been returned by an * earlier call to getObjectId or * getTransactionalObjectId, or might have been constructed by * the application. *

If the PersistenceManager is unable to resolve the * oid parameter to an ObjectId instance, then it throws a * JDOUserException. *

If the validate flag is false, and there is * already an instance in the cache with the same JDO identity as the * oid parameter, then this method returns it. There is no * change made to the state of the returned instance. *

If there is not an instance already in the cache with the same JDO * identity as the oid parameter, then this method creates an * instance with the specified JDO identity and returns it. If there is no * transaction in progress, the returned instance will be hollow or * persistent-nontransactional, at the choice of the implementation. *

If there is a transaction in progress, the returned instance will * be hollow, persistent-nontransactional, or persistent-clean, at the * choice of the implementation. *

It is an implementation decision whether to access the data store, * if required to determine the exact class. This will be the case of * inheritance, where multiple PersistenceCapable classes share * the same ObjectId class. *

If the validate flag is false, and the instance does not * exist in the data store, then this method might not fail. It is an * implementation choice whether to fail immediately with a * JDOObjectNotFoundException. But a subsequent access * of the fields of the * instance will throw a JDOObjectNotFoundException * if the instance does not * exist at that time. Further, if a relationship is established to this * instance, then the transaction in which the association was made will * fail. *

If the validate flag is true, and there is * already a transactional instance in the cache with the same JDO identity * as the oid parameter, then this method returns it. There is * no change made to the state of the returned instance. *

If there is an instance already in the cache with the same JDO * identity as the oid parameter, but the instance is not * transactional, then it must be verified in the data store. If the * instance does not exist in the datastore, then a * JDOObjectNotFoundException is thrown. *

If there is not an instance already in the cache with the same JDO * identity as the oid parameter, then this method creates an * instance with the specified JDO identity, verifies that it exists in the * data store, and returns it. If there is no transaction in progress, the * returned instance will be hollow or persistent-nontransactional, * at the choice of the implementation. *

If there is a data store transaction in progress, the returned * instance will be persistent-clean. * If there is an optimistic transaction in progress, the returned * instance will be persistent-nontransactional. * @see #getObjectId(Object pc) * @see #getTransactionalObjectId(Object pc) * @return the PersistenceCapable instance with the specified * ObjectId * @param oid an ObjectId * @param validate if the existence of the instance is to be validated */ Object getObjectById (Object oid, boolean validate); /** * Looks up the instance of the given type with the given key. * @param cls The type of object to load * @param key either the string representation of the object id, or * an object representation of a single field identity key * @return the corresponding persistent instance * @since 2.0 */ T getObjectById (Class cls, Object key); /** * Looks up the instance corresponding to the specified oid. This is * equivalent to getObjectById(oid, true); * @param oid The object id of the object to load * @return the corresponding persistent instance */ Object getObjectById (Object oid); /** The ObjectId returned by this method represents the JDO identity of * the instance. The ObjectId is a copy (clone) of the internal state * of the instance, and changing it does not affect the JDO identity of * the instance. *

The getObjectId method returns an ObjectId instance that * represents the object identity of the specified JDO instance. The * identity is guaranteed to be unique only in the context of the JDO * PersistenceManager that created the identity, and only for * two types of JDO Identity: those that are managed by the application, and * those that are managed by the data store. *

If the object identity is being changed in the transaction, by the * application modifying one or more of the application key fields, * then this method returns the identity as of the beginning of the * transaction. The value returned by getObjectId will be * different following afterCompletion processing for * successful transactions.

Within a transaction, the ObjectId returned * will compare equal to the ObjectId returned by only one among all JDO * instances associated with the PersistenceManager regardless * of the type of ObjectId. *

The ObjectId does not necessarily contain any internal state of the * instance, nor is it necessarily an instance of the class used to * manage identity internally. Therefore, if the application makes a * change to the ObjectId instance returned by this method, there is * no effect on the instance from which the ObjectId was obtained. *

The getObjectById method can be used between instances of * PersistenceManager of different JDO vendors only for * instances of persistence capable classes using application-managed * (primary key) JDO identity. If it is used for instances of classes using * datastore identity, the method might succeed, but there are no guarantees * that the parameter and return instances are related in any way. * @see #getTransactionalObjectId(Object pc) * @see #getObjectById(Object oid, boolean validate) * @param pc the PersistenceCapable instance * @return the ObjectId of the instance */ Object getObjectId (Object pc); /** The ObjectId returned by this method represents the JDO identity of * the instance. The ObjectId is a copy (clone) of the internal state * of the instance, and changing it does not affect the JDO identity of * the instance. *

If the object identity is being changed in the transaction, by the * application modifying one or more of the application key fields, * then this method returns the current identity in the transaction. *

If there is no transaction in progress, or if none of the key fields * is being modified, then this method will return the same value as * getObjectId. * @see #getObjectId(Object pc) * @see #getObjectById(Object oid, boolean validate) * @param pc a PersistenceCapable instance * @return the ObjectId of the instance */ Object getTransactionalObjectId (Object pc); /** * This method returns an object id instance corresponding to the pcClass * and key arguments. * @param pcClass the Class of the persistence-capable instance * @param key for single-field identity, the parameter for the * constructor; for non-single-field application identity, the result * of toString() on the object id instance. * @return an instance of the object identity class */ Object newObjectIdInstance (Class pcClass, Object key); /** * Return the objects with the given oids. * @param oids the oids of the objects to return * @param validate if true, the existance of the objects in * the datastore will be validated. * @return the objects that were looked up, in the * same order as the oids parameter. * @see #getObjectById(Object,boolean) * @since 2.0 */ Collection getObjectsById (Collection oids, boolean validate); /** * Return the objects with the given oids. This method is equivalent * to calling {@link #getObjectsById(Collection, boolean)} * with the validate flag true. * @param oids the oids of the objects to return * @return the objects that were looked up, in the * same order as the oids parameter. * @see #getObjectsById(Collection,boolean) * @since 2.0 */ Collection getObjectsById (Collection oids); /** * Return the objects with the given oids. * @param oids the oids of the objects to return * @param validate if true, the existance of the objects in * the datastore will be validated. * @return the objects that were looked up, in the * same order as the oids parameter. * @see #getObjectById(Object,boolean) * @see #getObjectsById(boolean,Object...) * @deprecated * @since 2.0 */ Object[] getObjectsById (Object[] oids, boolean validate); /** * Return the objects with the given oids. * @param oids the oids of the objects to return * @param validate if true, the existance of the objects in * the datastore will be validated. * @return the objects that were looked up, in the * same order as the oids parameter. * @see #getObjectById(Object,boolean) * @since 2.1 */ Object[] getObjectsById (boolean validate, Object... oids); /** * Return the objects with the given oids. This method is equivalent * to calling {@link #getObjectsById(boolean,Object...)} * with the validate flag true. * @param oids the oids of the objects to return * @return the objects that were looked up, in the * same order as the oids parameter. * @see #getObjectsById(boolean,Object...) * @since 2.0 */ Object[] getObjectsById (Object... oids); /** Make the parameter instance persistent in this * PersistenceManager. * This method makes transient instances persistent and applies detached * instance changes to the cache. It must be called in the context of * an active transaction, or a JDOUserException is thrown. For a transient * instance, it assigns an object identity to the instance and transitions * it to persistent-new. Any transient instances reachable from this * instance via persistent fields of this instance become provisionally * persistent, transitively. That is, they behave as persistent-new * instances (return true to isPersistent, isNew, and isDirty). * But at commit time, the reachability algorithm is run again, * and instances made provisionally persistent that are not then * reachable from persistent instances will revert to transient. *

During makePersistent of transient instances, the create life cycle * listener is called. *

For detached instances, it locates or instantiates a persistent * instance with the same JDO identity as the detached instance, * and merges the persistent state of the detached instance into the * persistent instance. Only the state of persistent fields is merged. * If non-persistent state needs to be copied, the application should * use the jdoPostAttach callback or the postAttach lifecycle event * listener. Any references to the detached instances from instances * in the closure of the parameter instances are modified to refer to * the corresponding persistent instance instead of to the * detached instance. *

During attachment of detached instances, the attach callbacks * and attach life cycle listeners are called. *

During application of changes of the detached state, if the JDO * implementation can determine that there were no changes made during * detachment, then the implementation is not required to mark the * corresponding instance dirty. If it cannot determine if changes * were made, then it must mark the instance dirty. * No consistency checking is done during makePersistent of detached * instances. If consistency checking is required by the application, * then flush or checkConsistency should be called after attaching the * instances. *

These methods have no effect on parameter persistent instances * already managed by this PersistenceManager. They will throw a * JDOUserException if the parameter instance is managed by a * different PersistenceManager. * If an instance is of a class whose identity type (application, * datastore, or none) is not supported by the JDO implementation, * then a JDOUserException will be thrown for that instance. * The return value for parameter instances in the transient or persistent * states is the same as the parameter value. The return value for * parameter instances in the detached state is the persistent instance * corresponding to the detached instance. * The return values for makePersistentAll methods correspond by position * to the parameter instances. * @param pc an instance of a Class that is persistent * capable. * @return the parameter instance for parameters in the transient or * persistent state, or the corresponding persistent instance * for detached parameter instances */ T makePersistent (T pc); /** Make an array of instances persistent. * @param pcs an array of instances * @return the parameter instances for parameters in the transient or * persistent state, or the corresponding persistent instance * for detached parameter instances, in the same order as in the * parameter array * @see #makePersistent(Object pc) */ T[] makePersistentAll (T... pcs); /** Make a Collection of instances persistent. * @param pcs a Collection of instances * @return the parameter instance for parameters in the transient or * persistent state, or the corresponding persistent instance * for detached parameter instances, with an iteration in the same order * as in the parameter Collection * @see #makePersistent(Object pc) */ Collection makePersistentAll (Collection pcs); /** Delete the persistent instance from the data store. * This method must be called in an active transaction. * The data store object will be removed at commit. * Unlike makePersistent, which makes the closure of the * instance persistent, the closure of the instance is not deleted from the * data store. This method has no effect if the instance is already deleted * in the current transaction. * This method throws JDOUserException if the instance is * transient or is managed by another PersistenceManager. * * @param pc a persistent instance */ void deletePersistent (Object pc); /** Delete an array of instances from the data store. * @param pcs a Collection of persistent instances * @see #deletePersistent(Object pc) */ void deletePersistentAll (Object... pcs); /** Delete a Collection of instances from the data store. * @param pcs a Collection of persistent instances * @see #deletePersistent(Object pc) */ void deletePersistentAll (Collection pcs); /** Make an instance transient, removing it from management by this * PersistenceManager. * *

The instance loses its JDO identity and it is no longer associated * with any PersistenceManager. The state of fields is * preserved unchanged. * @param pc the instance to make transient. */ void makeTransient (Object pc); /** Make an array of instances transient, removing them from management by * this PersistenceManager. * *

The instances lose their JDO identity and they are no longer * associated with any PersistenceManager. The state of fields * is preserved unchanged. * @param pcs the instances to make transient. */ void makeTransientAll (Object... pcs); /** Make a Collection of instances transient, removing them * from management by this PersistenceManager. * *

The instances lose their JDO identity and they are no longer * associated with any PersistenceManager. The state of fields * is preserved unchanged. * @param pcs the instances to make transient. */ void makeTransientAll (Collection pcs); /** Make an instance transient, removing it from management by this * PersistenceManager. If the useFetchPlan parameter is * false, this method behaves exactly as makeTransient(Object pc). *

The affected instance(s) lose their JDO identity and are no longer * associated with any PersistenceManager. The state * of fields is unchanged. *

If the useFetchPlan parameter is true, then the current FetchPlan * is applied to the pc parameter, as if detachCopy(Object) had been * called. After the graph of instances is loaded, the instances * reachable via loaded fields is made transient. The state of fields * in the affected instances is as specified by the FetchPlan. *

Unlike detachCopy, the instances are not detached; there is no * detachment information in the instances. *

The instances to be made transient do not need to * implement the javax.jdo.spi.Detachable interface. * @param pc the root instance to make transient. * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to make transient * @since 2.0 */ void makeTransient (Object pc, boolean useFetchPlan); /** Make instances transient, removing them from management * by this PersistenceManager. If the useFetchPlan parameter * is false, this method behaves exactly as makeTransientAll(Object[] pcs). *

The affected instance(s) lose their JDO identity and are no longer * associated with any PersistenceManager. The state * of fields is unchanged. *

If the useFetchPlan parameter is true, then the current FetchPlan * is applied to the pcs parameters and the entire graph of instances * reachable via loaded fields is made transient. The state of fields * in the affected instances is as specified by the FetchPlan. *

Unlike detachCopy, the instances are not detached; there is no * detachment information in the instances. *

The instances to be made transient do not need to * implement the javax.jdo.spi.Detachable interface. * @param pcs the root instances to make transient. * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to make transient * @see #makeTransientAll(boolean,Object...) * @deprecated * @since 2.0 */ void makeTransientAll (Object[] pcs, boolean useFetchPlan); /** Make instances transient, removing them from management * by this PersistenceManager. If the useFetchPlan parameter * is false, this method behaves exactly as makeTransientAll(Object[] pcs). *

The affected instance(s) lose their JDO identity and are no longer * associated with any PersistenceManager. The state * of fields is unchanged. *

If the useFetchPlan parameter is true, then the current FetchPlan * is applied to the pcs parameters and the entire graph of instances * reachable via loaded fields is made transient. The state of fields * in the affected instances is as specified by the FetchPlan. *

Unlike detachCopy, the instances are not detached; there is no * detachment information in the instances. *

The instances to be made transient do not need to * implement the javax.jdo.spi.Detachable interface. * @param pcs the root instances to make transient. * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to make transient * @since 2.1 */ void makeTransientAll (boolean useFetchPlan, Object... pcs); /** Make instances transient, removing them from management * by this PersistenceManager. If the useFetchPlan parameter * is false, this method behaves exactly as * makeTransientAll(Collection pcs). *

The affected instance(s) lose their JDO identity and are no longer * associated with any PersistenceManager. The state * of fields is unchanged. *

If the useFetchPlan parameter is true, then the current FetchPlan * is applied to the pcs parameters and the entire graph of instances * reachable via loaded fields is made transient. The state of fields * in the affected instances is as specified by the FetchPlan. *

Unlike detachCopy, the instances are not detached; there is no * detachment information in the instances. *

The instances to be made transient do not need to * implement the javax.jdo.spi.Detachable interface. * @param pcs the root instances to make transient. * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to make transient * @since 2.0 */ void makeTransientAll (Collection pcs, boolean useFetchPlan); /** Make an instance subject to transactional boundaries. * *

Transient instances normally do not observe transaction boundaries. * This method makes transient instances sensitive to transaction * completion. If an instance is modified in a transaction, and the * transaction rolls back, the state of the instance is restored to the * state before the first change in the transaction. * *

For persistent instances read in optimistic transactions, this method * allows the application to make the state of the instance part of the * transactional state. At transaction commit, the state of the instance in * the cache is compared to the state of the instance in the data store. If * they are not the same, then an exception is thrown. * @param pc the instance to make transactional. */ void makeTransactional (Object pc); /** Make an array of instances subject to transactional boundaries. * @param pcs the array of instances to make transactional. * @see #makeTransactional(Object pc) */ void makeTransactionalAll (Object... pcs); /** Make a Collection of instances subject to transactional * boundaries. * @param pcs the Collection of instances to make * transactional. * @see #makeTransactional(Object pc) */ void makeTransactionalAll (Collection pcs); /** Make an instance non-transactional after commit. * *

Normally, at transaction completion, instances are evicted from the * cache. This method allows an application to identify an instance as * not being evicted from the cache at transaction completion. Instead, * the instance remains in the cache with nontransactional state. * * @param pc the instance to make nontransactional. */ void makeNontransactional (Object pc); /** Make an array of instances non-transactional after commit. * * @param pcs the array of instances to make nontransactional. * @see #makeNontransactional(Object pc) */ void makeNontransactionalAll (Object... pcs); /** Make a Collection of instances non-transactional after * commit. * * @param pcs the Collection of instances to make * nontransactional. * @see #makeNontransactional(Object pc) */ void makeNontransactionalAll (Collection pcs); /** Retrieve field values of an instance from the store. This tells * the PersistenceManager that the application intends to use * the instance, and its field values must be retrieved. *

The PersistenceManager might use policy information about * the class to retrieve associated instances. * @param pc the instance */ void retrieve (Object pc); /** Retrieve field values of an instance from the store. This tells * the PersistenceManager that the application intends to use * the instance, and its field values must be retrieved. *

If the useFetchPlan parameter is false, this method behaves exactly * as the corresponding method without the useFetchPlan parameter. * If the useFetchPlan parameter is true, and the fetch plan has not been * modified from its default setting, all fields in the current fetch plan * are fetched, and other fields might be fetched lazily by the * implementation. If the useFetchPlan parameter is true, and the fetch * plan has been changed from its default setting, then the fields * specified by the fetch plan are loaded, along with related instances * specified by the fetch plan. * @param pc the instance * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to retrieve. * @since 2.0 */ void retrieve (Object pc, boolean useFetchPlan); /** Retrieve field values of instances from the store. This tells * the PersistenceManager that the application intends to use * the instances, and all field values must be retrieved. *

The PersistenceManager might use policy information about * the class to retrieve associated instances. * @param pcs the instances */ void retrieveAll (Collection pcs); /** Retrieve field values of instances from the store. This tells * the PersistenceManager that the application intends to use * the instances, and their field values should be retrieved. The fields * in the current fetch group must be retrieved, and the implementation * might retrieve more fields than the current fetch group. *

If the useFetchPlan parameter is false, this method behaves exactly * as the corresponding method without the useFetchPlan parameter. * If the useFetchPlan parameter is true, and the fetch plan has not been * modified from its default setting, all fields in the current fetch plan * are fetched, and other fields might be fetched lazily by the * implementation. If the useFetchPlan parameter is true, and the fetch * plan has been changed from its default setting, then the fields * specified by the fetch plan are loaded, along with related instances * specified by the fetch plan. * @param pcs the instances * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to retrieve. * @since 1.0.1 */ void retrieveAll (Collection pcs, boolean useFetchPlan); /** Retrieve field values of instances from the store. This tells * the PersistenceManager that the application intends to use * the instances, and all field values must be retrieved. *

The PersistenceManager might use policy information about * the class to retrieve associated instances. * @param pcs the instances */ void retrieveAll (Object... pcs); /** Retrieve field values of instances from the store. This tells * the PersistenceManager that the application intends to use * the instances, and their field values should be retrieved. The fields * in the current fetch group must be retrieved, and the implementation * might retrieve more fields than the current fetch group. *

If the useFetchPlan parameter is false, this method behaves exactly * as the corresponding method without the useFetchPlan parameter. * If the useFetchPlan parameter is true, and the fetch plan has not been * modified from its default setting, all fields in the current fetch plan * are fetched, and other fields might be fetched lazily by the * implementation. If the useFetchPlan parameter is true, and the fetch * plan has been changed from its default setting, then the fields * specified by the fetch plan are loaded, along with related instances * specified by the fetch plan. * @param pcs the instances * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to retrieve. * @deprecated * @see #retrieveAll(boolean,Object...) * @since 1.0.1 */ void retrieveAll (Object[] pcs, boolean useFetchPlan); /** Retrieve field values of instances from the store. This tells * the PersistenceManager that the application intends to use * the instances, and their field values should be retrieved. The fields * in the current fetch group must be retrieved, and the implementation * might retrieve more fields than the current fetch group. *

If the useFetchPlan parameter is false, this method behaves exactly * as the corresponding method without the useFetchPlan parameter. * If the useFetchPlan parameter is true, and the fetch plan has not been * modified from its default setting, all fields in the current fetch plan * are fetched, and other fields might be fetched lazily by the * implementation. If the useFetchPlan parameter is true, and the fetch * plan has been changed from its default setting, then the fields * specified by the fetch plan are loaded, along with related instances * specified by the fetch plan. * @param pcs the instances * @param useFetchPlan whether to use the current fetch plan to determine * which fields to load and which instances to retrieve. * @since 2.1 */ void retrieveAll (boolean useFetchPlan, Object... pcs); /** The application can manage the PersistenceManager instances * more easily by having an application object associated with each * PersistenceManager instance. * @param o the user instance to be remembered by the * PersistenceManager * @see #getUserObject */ void setUserObject (Object o); /** The application can manage the PersistenceManager instances * more easily by having an application object associated with each * PersistenceManager instance. * @return the user object associated with this * PersistenceManager * @see #setUserObject */ Object getUserObject (); /** This method returns the PersistenceManagerFactory used to * create this PersistenceManager. * @return the PersistenceManagerFactory that created * this PersistenceManager */ PersistenceManagerFactory getPersistenceManagerFactory(); /** Return the Class that implements the JDO Identity for the * specified PersistenceCapable class. The application can use * the returned Class to construct a JDO Identity instance for * application identity PersistenceCapable classes. This JDO * Identity instance can then be used to get an instance of the * PersistenceCapable class for use in the application. * *

In order for the application to construct an instance of the ObjectId * class it needs to know the class being used by the JDO implementation. * @param cls the PersistenceCapable Class * @return the Class of the ObjectId of the parameter * @see #getObjectById */ Class getObjectIdClass(Class cls); /** Set the Multithreaded flag for this PersistenceManager. * Applications that use multiple threads to invoke methods or access fields * from instances managed by this PersistenceManager must set * this flag to true. * Instances managed by this PersistenceManager include * persistent or transactional instances of PersistenceCapable * classes, as well as helper instances such as Query, * Transaction, or Extent. * @param flag the Multithreaded setting. */ void setMultithreaded (boolean flag); /** Get the current Multithreaded flag for this * PersistenceManager. * @see #setMultithreaded * @return the Multithreaded setting. */ boolean getMultithreaded(); /** Set the ignoreCache parameter for queries. * *

IgnoreCache set to true specifies that for all * Query instances created by this * PersistenceManager, the default is the cache should be * ignored for queries. * @param flag the ignoreCache setting. */ void setIgnoreCache(boolean flag); /** Get the ignoreCache setting for queries. * *

IgnoreCache set to true specifies that for all * Query instances created by this * PersistenceManager, the default is the cache should be * ignored for queries. * @return the ignoreCache setting. */ boolean getIgnoreCache(); /** Gets the detachAllOnCommit setting. * @see #setDetachAllOnCommit(boolean) * @since 2.0 * @return the detachAllOnCommit setting. */ boolean getDetachAllOnCommit(); /** Sets the detachAllOnCommit setting. * *

DetachAllOnCommit set to false specifies that the * state of persistent instances in the cache after commit is defined * by the retainValues flag. With this flag set to true, * during beforeCompletion all cached instances are prepared for * detachment according to the fetch plan in effect at commit. Loading * fields and unloading fields required by the fetch plan is done after * calling the user's beforeCompletion callback. During * afterCompletion, before calling the user's * afterCompletion callback, all detachable persistent * instances in the cache transition to detached; non-detachable * persistent instances transition to transient; and detachable * instances can be serialized as detached instances. Transient * transactional instances are unaffected by this flag. * * @see #getDetachAllOnCommit() * @since 2.0 */ void setDetachAllOnCommit(boolean flag); /** Gets the copyOnAttach setting. * @see #setCopyOnAttach(boolean) * @since 2.1 * @return the copyOnAttach setting. */ boolean getCopyOnAttach(); /** Sets the copyOnAttach setting. * *

CopyOnAttach set to true specifies that during * makePersistent, copies are made of detached parameter instances. * With this flag set to false, detached parameter * instances are attached directly and change their state from * detached-clean to persistent-clean or from detached-dirty to * persistent-dirty. * * @see #getCopyOnAttach() * @since 2.1 */ void setCopyOnAttach(boolean flag); /** * Detach the specified instance from the PersistenceManager. * The flags for detachment (DETACH_LOAD_FIELDS and DETACH_UNLOAD_FIELDS) * and the active fetch groups determine the scope of fetching for the * graph of instances reachable from the pc parameter. The state of fields * in the affected instances is as specified by the FetchPlan. * @param pc the instance to detach * @return the detached instance * @see #detachCopyAll(Object[]) * @since 2.0 */ T detachCopy (T pc); /** * Detach the specified instances from the PersistenceManager. * The flags for detachment (DETACH_LOAD_FIELDS and DETACH_UNLOAD_FIELDS) * and the active fetch groups determine the scope of fetching for the * graph of instances reachable from the pcs parameter. The state of fields * in the affected instances is as specified by the FetchPlan. * @param pcs the instances to detach * @return the detached instances * @see #detachCopyAll(Object[]) * @since 2.0 */ Collection detachCopyAll (Collection pcs); /** * Detach the specified instances from the PersistenceManager. * The flags for detachment (DETACH_LOAD_FIELDS and DETACH_UNLOAD_FIELDS) * and the active fetch groups determine the scope of fetching for the * graph of instances reachable from the pcs parameter. The state of fields * in the affected instances is as specified by the FetchPlan. * The objects returned can be manipulated and re-attached with * {@link #makePersistentAll(Object[])}. * The detached instances will be * unmanaged copies of the specified parameters, and are suitable * for serialization and manipulation outside of a JDO * environment. When detaching instances, only fields in the * current {@link FetchPlan} will be traversed. Thus, to detach a * graph of objects, relations to other persistent instances must * either be in the default-fetch-group, or in the * current custom {@link FetchPlan}. * @param pcs the instances to detach * @return the detached instances * @throws JDOUserException if any of the instances to be detached do not * implement the javax.jdo.spi.Detachable interface. * @see #makePersistentAll(Object[]) * @see #getFetchPlan * @since 2.0 */ T[] detachCopyAll (T... pcs); /** * Put the specified key-value pair into the map of user objects. * @since 2.0 */ Object putUserObject (Object key, Object val); /** * Get the value for the specified key from the map of user objects. * @param key the key of the object to be returned * @return the object * @since 2.0 */ Object getUserObject (Object key); /** * Remove the specified key and its value from the map of user objects. * @param key the key of the object to be removed * @since 2.0 */ Object removeUserObject (Object key); /** * Flushes all dirty, new, and deleted instances to the data * store. It has no effect if a transaction is not active. *

If a datastore transaction is active, this method * synchronizes the cache with the datastore and reports any * exceptions.

*

If an optimistic transaction is active, this method obtains * a datastore connection, synchronizes the cache with the * datastore using this connection and reports any * exceptions. The connection obtained by this method is held * until the end of the transaction.

*

If exceptions occur during flush, the implementation will * set the current transaction's RollbackOnly flag * (see {@link Transaction#setRollbackOnly}).

* @since 2.0 */ void flush (); /** * Validates the PersistenceManager cache with the * datastore. This method has no effect if a transaction is not * active. *

If a datastore transaction is active, this method verifies * the consistency of instances in the cache against the * datastore. An implementation might flush instances as if * {@link #flush} were called, but it is not required to do * so.

*

If an optimistic transaction is active, this method obtains * a datastore connection and verifies the consistency of the * instances in the cache against the datastore. If any * inconsistencies are detected, a {@link * JDOOptimisticVerificationException} is thrown. This exception * contains a nested {@link JDOOptimisticVerificationException} * for each object that failed the consistency check. No * datastore resources acquired during the execution of this * method are held beyond the scope of this method.

* @since 2.0 */ void checkConsistency (); /** * Returns the FetchPlan used by this * PersistenceManager. * @return the FetchPlan * @since 2.0 */ FetchPlan getFetchPlan (); /** * Creates an instance of a persistence-capable interface, * or of a concrete or abstract class. * The returned instance is transient. * @param pcClass Must be a persistence-capable interface, * or a concrete or abstract class that is declared in the metadata. * @return the created instance * @since 2.0 */ T newInstance (Class pcClass); /** * Returns the sequence identified by name. * @param name the name of the Sequence * @return the Sequence * @since 2.0 */ Sequence getSequence (String name); /** * If this method is called while a datastore transaction is * active, the object returned will be enlisted in the current * transaction. If called in an optimistic transaction or outside * an active transaction, the object returned will not be * enlisted in any transaction. * @return the JDOConnection instance * @since 2.0 */ JDOConnection getDataStoreConnection (); /** * Adds the listener instance to the list of lifecycle event * listeners. The classes parameter identifies all * of the classes of interest. If the classes * parameter is specified as null, events for all * persistent classes and interfaces will be sent to * listenerInstance. *

The listenerInstance will be called for each event for which it * implements the corresponding listenerInstance interface.

* @param listener the lifecycle listener * @param classes the classes of interest to the listener * @since 2.0 */ void addInstanceLifecycleListener (InstanceLifecycleListener listener, Class... classes); /** * Removes the listener instance from the list of lifecycle event listeners. * @param listener the listener instance to be removed * @since 2.0 */ void removeInstanceLifecycleListener (InstanceLifecycleListener listener); /** * Get the Date as seen by the server. * Clients using this method can order their operations according to * a single time source. Implementations use the setting of the * server time zone to prepare a Date instance that represents * UTC time on the server. * @return a Date instance corresponding to the UTC Date * as seen by the server * @since 2.1 */ Date getServerDate(); /** * Get the objects managed by this persistence manager. * @return the objects * @since 2.1 */ Set getManagedObjects(); /** * Get the objects managed by this persistence manager having the * specified object states. * @param states The states of objects that we are interested in * @return the objects * @since 2.1 */ Set getManagedObjects(EnumSet states); /** * Get the objects managed by this persistence manager being instances of * the specified classes. * @param classes The classes of objects that we are interested in * @return the objects * @since 2.1 */ Set getManagedObjects(Class... classes); /** * Get the objects managed by this persistence manager having the * specified object states and being instances of the specified classes. * @param states The states of objects that we are interested in * @param classes The classes of objects that we are interested in * @return the objects * @since 2.1 */ Set getManagedObjects(EnumSet states, Class... classes); /** * Get a modifiable FetchGroup for the Class and name. * If a modifiable FetchGroup already exists in the * PersistenceManager scope, return it. * If not, create and populate a new FetchGroup from the * existing definition in the {@link PersistenceManager} or * {@link PersistenceManagerFactory}. If the definition for the * FetchGroup is not in scope in either the * PersistenceManager or * PersistenceManagerFactory, create it with no members. * The FetchGroup immediately * becomes active and in scope of the PersistenceManager, and hides * the corresponding fetch group in the PersistenceManagerFactory. * @param cls the class or interface for the FetchGroup * @param name the name of the fetch group * @return the FetchGroup * @throws JDOUserException if the class is not a persistence-capable * class or interface * @since 2.2 */ FetchGroup getFetchGroup(Class cls, String name); } jdo2-api-2.2/src/java/javax/jdo/PersistenceManagerFactory.java100644 0 0 70613 11073716464 21520 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * PersistenceManagerFactory.java * */ package javax.jdo; import javax.jdo.datastore.DataStoreCache; import javax.jdo.listener.InstanceLifecycleListener; import javax.jdo.spi.JDOPermission; // for getFetchGroups javadoc import java.io.Serializable; import java.util.Collection; import java.util.Map; import java.util.Properties; import java.util.Set; /** The PersistenceManagerFactory is the interface to use to obtain * PersistenceManager instances. * All PersistenceManager instances obtained from the same * PersistenceManagerFactory will have the same default properties. * *

PersistenceManagerFactory instances may be configured and * serialized for later use. They may be stored via JNDI and looked up * and used later. Any properties configured will be saved and restored. * *

Once the first PersistenceManager is obtained from the * PersistenceManagerFactory, the factory can no longer be * configured. *

If the ConnectionFactory property is set * (non-null) then all other Connection properties including * ConnectionFactoryName are ignored; * otherwise, if ConnectionFactoryName is set * (non-null) then all other Connection properties are ignored. * Similarly, if the ConnectionFactory2 property is set * (non-null) then ConnectionFactory2Name is ignored. *

Operational state (PersistenceManager pooling, connection * pooling, operational parameters) must not be serialized. * * @version 2.2 */ public interface PersistenceManagerFactory extends Serializable { /** Close this PersistenceManagerFactory. Check for * JDOPermission("closePersistenceManagerFactory") and if not authorized, * throw SecurityException. *

If the authorization check succeeds, check to see that all * PersistenceManager instances obtained from this PersistenceManagerFactory * have no active transactions. If any PersistenceManager instances have * an active transaction, throw a JDOUserException, with one nested * JDOUserException for each PersistenceManager with an active Transaction. *

If there are no active transactions, then close all PersistenceManager * instances obtained from this PersistenceManagerFactory, mark this * PersistenceManagerFactory as closed, disallow getPersistenceManager * methods, and allow all other get methods. If a set method or * getPersistenceManager method is called after close, then * JDOUserException is thrown. * @since 1.0.1 */ void close(); /** * A PersistenceManagerFactory instance can be used * until it is closed. * @return true if this PersistenceManagerFactory * has been closed. * @see #close() * @since 2.0 */ boolean isClosed(); /** Get an instance of PersistenceManager from this factory. * The instance has default values for options. * *

After the first use of getPersistenceManager, no "set" * methods will succeed. * * @return a PersistenceManager instance with default options. */ PersistenceManager getPersistenceManager(); /** Get a thread-safe instance of a proxy that dynamically binds * on each method call to an instance of PersistenceManager. *

When used with a PersistenceManagerFactory * that uses TransactionType JTA, * the proxy can be used in a server to dynamically bind to an instance * from this factory associated with the thread's current transaction. * In this case, the close method is ignored, as the * PersistenceManager is automatically closed when the * transaction completes. *

When used with a PersistenceManagerFactory * that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable * ThreadLocal to bind to an instance of PersistenceManager * associated with the thread. In this case, the close method executed * on the proxy closes the PersistenceManager and then * clears the ThreadLocal. * Use of this method does not affect the configurability of the * PersistenceManagerFactory. * * @since 2.1 * @return a PersistenceManager proxy. */ PersistenceManager getPersistenceManagerProxy(); /** Get an instance of PersistenceManager from this factory. * The instance has default values for options. * The parameters userid and password are used * when obtaining datastore connections from the connection pool. * *

After the first use of getPersistenceManager, no "set" * methods will succeed. * * @return a PersistenceManager instance with default options. * @param userid the userid for the connection * @param password the password for the connection */ PersistenceManager getPersistenceManager(String userid, String password); /** Set the user name for the data store connection. * @param userName the user name for the data store connection. */ void setConnectionUserName(String userName); /** Get the user name for the data store connection. * @return the user name for the data store connection. */ String getConnectionUserName (); /** Set the password for the data store connection. * @param password the password for the data store connection. */ void setConnectionPassword (String password); /** Set the URL for the data store connection. * @param url the URL for the data store connection. */ void setConnectionURL (String url); /** Get the URL for the data store connection. * @return the URL for the data store connection. */ String getConnectionURL (); /** Set the driver name for the data store connection. * @param driverName the driver name for the data store connection. */ void setConnectionDriverName (String driverName); /** Get the driver name for the data store connection. * @return the driver name for the data store connection. */ String getConnectionDriverName (); /** Set the name for the data store connection factory. * @param connectionFactoryName the name of the data store connection * factory. */ void setConnectionFactoryName (String connectionFactoryName); /** Get the name for the data store connection factory. * @return the name of the data store connection factory. */ String getConnectionFactoryName (); /** Set the data store connection factory. JDO implementations * will support specific connection factories. The connection * factory interfaces are not part of the JDO specification. * @param connectionFactory the data store connection factory. */ void setConnectionFactory (Object connectionFactory); /** Get the data store connection factory. * @return the data store connection factory. */ Object getConnectionFactory (); /** Set the name for the second data store connection factory. This is * needed for managed environments to get nontransactional connections for * optimistic transactions. * @param connectionFactoryName the name of the data store connection * factory. */ void setConnectionFactory2Name (String connectionFactoryName); /** Get the name for the second data store connection factory. This is * needed for managed environments to get nontransactional connections for * optimistic transactions. * @return the name of the data store connection factory. */ String getConnectionFactory2Name (); /** Set the second data store connection factory. This is * needed for managed environments to get nontransactional connections for * optimistic transactions. JDO implementations * will support specific connection factories. The connection * factory interfaces are not part of the JDO specification. * @param connectionFactory the data store connection factory. */ void setConnectionFactory2 (Object connectionFactory); /** Get the second data store connection factory. This is * needed for managed environments to get nontransactional connections for * optimistic transactions. * @return the data store connection factory. */ Object getConnectionFactory2 (); /** Set the default Multithreaded setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default Multithreaded setting. */ void setMultithreaded (boolean flag); /** Get the default Multithreaded setting for all * PersistenceManager instances obtained from this factory. * * @return the default Multithreaded setting. */ boolean getMultithreaded(); /** Set the Mapping setting for this factory. This is used to find the * object-datastore mapping file(s). * * @param mapping the Mapping setting. */ void setMapping (String mapping); /** Get the Mapping setting for this factory. This is used to find the * object-datastore mapping file(s). * * @return the Mapping setting. */ String getMapping (); /** Set the default Optimistic setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default Optimistic setting. */ void setOptimistic (boolean flag); /** Get the default Optimistic setting for all * PersistenceManager instances obtained from this factory. * * @return the default Optimistic setting. */ boolean getOptimistic(); /** Set the default RetainValues setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default RetainValues setting. */ void setRetainValues (boolean flag); /** Get the default RetainValues setting for all * PersistenceManager instances obtained from this factory. * * @return the default RetainValues setting. */ boolean getRetainValues (); /** Set the default value for the RestoreValues property. * If true, at rollback, fields of newly persistent instances * are restored to * their values as of the beginning of the transaction, and the instances * revert to transient. Additionally, fields of modified * instances of primitive types and immutable reference types * are restored to their values as of the beginning of the * transaction. *

If false, at rollback, the values of fields of * newly persistent instances are unchanged and the instances revert to * transient. Additionally, dirty instances transition to hollow. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param restoreValues the value of the restoreValues property */ void setRestoreValues(boolean restoreValues); /** Get the default value for the RestoreValues property. * @return the value of the restoreValues property */ boolean getRestoreValues(); /** Set the default NontransactionalRead setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default NontransactionalRead setting. */ void setNontransactionalRead (boolean flag); /** Get the default NontransactionalRead setting for all * PersistenceManager instances obtained from this factory. * * @return the default NontransactionalRead setting. */ boolean getNontransactionalRead (); /** Set the default NontransactionalWrite setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default NontransactionalWrite setting. */ void setNontransactionalWrite (boolean flag); /** Get the default NontransactionalWrite setting for all * PersistenceManager instances obtained from this factory. * * @return the default NontransactionalWrite setting. */ boolean getNontransactionalWrite (); /** Set the default IgnoreCache setting for all * PersistenceManager instances obtained from this factory. * * @param flag the default IgnoreCache setting. */ void setIgnoreCache (boolean flag); /** Get the default IgnoreCache setting for all * PersistenceManager instances obtained from this factory. * * @return the default IngoreCache setting. */ boolean getIgnoreCache (); /** Gets the detachAllOnCommit setting. * @see #setDetachAllOnCommit(boolean) * @since 2.0 * @return the default detachAllOnCommit setting. */ boolean getDetachAllOnCommit(); /** Sets the default detachAllOnCommit setting for all * PersistenceManager instances obtained from this * factory. * @see #getDetachAllOnCommit() * @since 2.0 * @param flag the default DetachAllOnCommit setting */ void setDetachAllOnCommit(boolean flag); /** Gets the default copyOnAttach setting for all * PersistenceManager instances obtained from this * factory. * @see #setCopyOnAttach(boolean) * @since 2.1 * @return the copyOnAttach setting. */ boolean getCopyOnAttach(); /** Sets the default copyOnAttach setting for all * PersistenceManager instances obtained from this * factory. * *

CopyOnAttach set to true specifies that during * makePersistent, copies are made of detached parameter instances. * With this flag set to false, detached parameter * instances are attached directly and change their state from * detached-clean to persistent-clean or from detached-dirty to * persistent-dirty. * * @see #getCopyOnAttach() * @since 2.1 */ void setCopyOnAttach(boolean flag); /** * Sets the name of this PersistenceManagerFactory. * @since 2.1 * @param name the name of this PMF */ void setName(String name); /** * Gets the name of this PersistenceManagerFactory. * @since 2.1 * @return the name of this PMF */ String getName(); /** * Sets the PersistenceUnitName for this PersistenceManagerFactory. * This has the same semantics as the same-named property in * JSR-220 PersistenceUnitInfo. * @see #getPersistenceUnitName() * @since 2.1 * @param name the PersistenceUnitName */ void setPersistenceUnitName(String name); /** * Gets the PersistenceUnitName for this PersistenceManagerFactory. * @see #setPersistenceUnitName(String) * @since 2.1 * @return the PersistenceUnitName */ String getPersistenceUnitName(); /** * Sets the TimeZone ID of the server associated with this * PersistenceManagerFactory. The parameter is a String * suitable for use with TimeZone.getTimeZone(). The String * must match an ID returned by TimeZone.getAvailableIDs(). * If the ServerTimeZoneID is not set, or set to the null String, * assume that the server has the same TimeZone ID as the client. * If incorrectly set, the result of PersistenceManager.getServerDate() * might be incorrect. * @see #getServerTimeZoneID() * @see java.util.TimeZone#getTimeZone(String) * @see java.util.TimeZone#getAvailableIDs() * @see PersistenceManager#getServerDate() * @since 2.1 * @param timezoneid the TimeZone ID of the server * @throws JDOUserException if the parameter does not match * an ID from TimeZone.getAvailableIDs() */ void setServerTimeZoneID(String timezoneid); /** * Gets the TimeZone ID of the server associated with this * PersistenceManagerFactory. If not set, assume that * the server has the same TimeZone ID as the client. * @see #setServerTimeZoneID(String) * @since 2.1 * @return the TimeZone of the server */ String getServerTimeZoneID(); /** * Sets the TransactionType for this PersistenceManagerFactory. * Permitted values are "JTA" and "RESOURCE_LOCAL". * This has the same semantics as the same-named property in * JSR-220 EntityManagerFactory. * @see #getTransactionType() * @see Constants#JTA * @see Constants#RESOURCE_LOCAL * @since 2.1 * @param name the TransactionType * @throws JDOUserException if the parameter is not a permitted value */ void setTransactionType(String name); /** * Gets the TransactionType for this PersistenceManagerFactory. * @see #setTransactionType(String) * @since 2.1 * @return the TransactionType */ String getTransactionType(); /** Gets the value for read-only for this PMF. * Indicates whether the datastore is read-only or writable. * @see #setReadOnly(boolean) * @since 2.2 * @return the readOnly setting. */ boolean getReadOnly(); /** Sets the value for whether the datastore is to be considered * read-only. * *

ReadOnly set to false specifies that no updates * can be performed to the datastore, and if updates are attempted * a JDOReadOnlyException is thrown. * * @see #getReadOnly() * @since 2.2 */ void setReadOnly(boolean flag); /** Get the value for transaction isolation level for this PMF. * @return the transaction isolation level * @see #setTransactionIsolationLevel(String) * @since 2.2 */ String getTransactionIsolationLevel(); /** Set the value for transaction isolation level for this PMF. * Transaction isolation levels are defined in javax.jdo.Constants. * If the requested level is not available, but a higher level is * available, the higher level is silently used. * If the requested level is not available, and no higher level is * available, then JDOUnsupportedOptionException is thrown. * Standard values in order from low to high are: *

  • read-uncommitted *
  • read-committed *
  • repeatable-read *
  • snapshot *
  • serializable *
* @param level the transaction isolation level * @see #getTransactionIsolationLevel() * @see Constants#TX_READ_UNCOMMITTED * @see Constants#TX_READ_COMMITTED * @see Constants#TX_REPEATABLE_READ * @see Constants#TX_SNAPSHOT * @see Constants#TX_SERIALIZABLE * @since 2.2 */ void setTransactionIsolationLevel(String level); /** Return non-configurable properties of this * PersistenceManagerFactory. * Properties with keys VendorName and * VersionNumber are required. Other keys are optional. * @return the non-configurable properties of this * PersistenceManagerFactory. */ Properties getProperties(); /** The application can determine from the results of this * method which optional features, and which query languages * are supported by the JDO implementation. *

Each supported JDO feature is represented by a * String with one of the following values: * *

javax.jdo.option.TransientTransactional *
javax.jdo.option.NontransactionalRead *
javax.jdo.option.NontransactionalWrite *
javax.jdo.option.RetainValues *
javax.jdo.option.Optimistic *
javax.jdo.option.ApplicationIdentity *
javax.jdo.option.DatastoreIdentity *
javax.jdo.option.NonDurableIdentity *
javax.jdo.option.ArrayList *
javax.jdo.option.HashMap *
javax.jdo.option.Hashtable *
javax.jdo.option.LinkedList *
javax.jdo.option.TreeMap *
javax.jdo.option.TreeSet *
javax.jdo.option.Vector *
javax.jdo.option.Map *
javax.jdo.option.List *
javax.jdo.option.Array *
javax.jdo.option.NullCollection *
javax.jdo.option.ChangeApplicationIdentity *
javax.jdo.option.BinaryCompatibility *
javax.jdo.option.GetDataStoreConnection *
javax.jdo.option.UnconstrainedQueryVariables *
javax.jdo.option.TransactionIsolationLevel.read-uncommitted *
javax.jdo.option.TransactionIsolationLevel.read-committed *
javax.jdo.option.TransactionIsolationLevel.repeatable-read *
javax.jdo.option.TransactionIsolationLevel.snapshot *
javax.jdo.option.TransactionIsolationLevel.serializable *
javax.jdo.query.SQL *
javax.jdo.query.JDOQL *
* *

The standard JDO query language is represented by a * String: *

javax.jdo.query.JDOQL * @return the Collection of Strings representing * the supported options. */ Collection supportedOptions(); /** * Return the {@link DataStoreCache} that this factory uses for * controlling a second-level cache. If this factory does not use * a second-level cache, the returned instance does nothing. This * method never returns null. * @since 2.0 * @return the DataStoreCache */ DataStoreCache getDataStoreCache (); /** * Add the parameter listener to the list of * instance lifecycle event listeners set as the initial listeners * for each PersistenceManager created by this PersistenceManagerFactory. * The addInstanceLifecycleListener and * removeInstanceLifecycleListener * methods are considered to be configuration methods and * can only be called when the PersistenceManagerFactory * is configurable (before the first time {@link #getPersistenceManager} * is called). *

The classes parameter identifies all * of the classes of interest. If the classes * parameter is specified as null, events for all * persistent classes and interfaces will be sent to the listener.

*

The listener will be called for each event for which it * implements the corresponding {@link InstanceLifecycleListener} * interface.

* @param listener the lifecycle listener * @param classes the classes of interest to the listener * @since 2.0 */ void addInstanceLifecycleListener (InstanceLifecycleListener listener, Class[] classes); /** * Remove the parameter listener instance from the list of * instance lifecycle event listeners set as the initial listeners * for each PersistenceManager created by this PersistenceManagerFactory. * The addInstanceLifecycleListener and * removeInstanceLifecycleListener * methods are considered to be configuration methods and * can only be called when the PersistenceManagerFactory * is configurable (before the first time {@link #getPersistenceManager} * is called). * @param listener the listener instance to be removed * @since 2.0 */ void removeInstanceLifecycleListener (InstanceLifecycleListener listener); /** * Add the FetchGroups to the set of active fetch groups. * FetchGroups are made unmodifiable before being added. * FetchGroups that match existing FetchGroups * replace the corresponding FetchGroups. * The replaced FetchGroups become unscoped. * Match is based on identical class and equal name. * The methods {@link #addFetchGroups}, {@link #removeFetchGroups}, * {@link #getFetchGroups}, and {@link #removeAllFetchGroups} * are internally serialized. * @param groups an array of FetchGroups * @throws SecurityException if the caller is not authorized for * {@link JDOPermission} ("manageMetadata") * @since 2.2 */ void addFetchGroups(FetchGroup... groups); /** * Remove the FetchGroups from the set of active * FetchGroups. Existing FetchGroups that match * parameter FetchGroups are removed. Parameter * FetchGroups that do not match any existing * FetchGroup are ignored. * Removed FetchGroups become unscoped. * Match is based on identical class and equal name. * The methods {@link #addFetchGroups}, {@link #removeFetchGroups}, * {@link #getFetchGroups}, and {@link #removeAllFetchGroups} * are internally serialized. * @param groups an array of FetchGroups * @throws SecurityException if the caller is not authorized for * {@link JDOPermission} ("manageMetadata") * @since 2.2 */ void removeFetchGroups(FetchGroup... groups); /** * Remove all FetchGroups from the set of active * FetchGroups. * All removed FetchGroups become unscoped. * The methods {@link #addFetchGroups}, {@link #removeFetchGroups}, * {@link #getFetchGroups}, and {@link #removeAllFetchGroups} * are internally serialized. * @throws SecurityException if the caller is not authorized for * {@link JDOPermission} ("manageMetadata") * @since 2.2 */ void removeAllFetchGroups(); /** * Create an unscoped, modifiable FetchGroup for the Class and * name. If a corresponding FetchGroup already exists in * PersistenceManagerFactory scope, copy its definition * to a new FetchGroup. * If the FetchGroup does not already exist, create it * with no members. The FetchGroup does not become * in scope until it is added to the current set via * {@link #addFetchGroups}. * @param cls the class or interface for the FetchGroup * @param name the name of the fetch group * @return the FetchGroup * @throws JDOUserException if the class is not a persistence-capable * class or interface * @since 2.2 */ FetchGroup getFetchGroup(Class cls, String name); /** * Get a modifiable Set containing a mutable copy of all currently active * (in scope) fetch groups. * The methods {@link #addFetchGroups}, {@link #removeFetchGroups}, * {@link #getFetchGroups}, and {@link #removeAllFetchGroups} * are internally serialized. * @return a copy of all currently active fetch groups * @throws SecurityException if the caller is not authorized for * {@link JDOPermission} ("getMetadata") * @since 2.2 */ Set getFetchGroups(); } jdo2-api-2.2/src/java/javax/jdo/Query.java100644 0 0 102241 11073716465 15530 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Query.java * */ package javax.jdo; import java.io.Serializable; import java.util.Collection; import java.util.Map; /** The Query interface allows applications to obtain persistent * instances, values, and aggregate data * from the data store. * * The {@link PersistenceManager} is the factory for Query * instances. There may be many Query instances associated with a * PersistenceManager. Multiple queries might be executed * simultaneously by different threads, but the implementation might choose to * execute them serially. In either case, the implementation must be thread * safe. * *

There are three required elements in a Query: the class of * the results, the candidate collection of instances, and the filter. * *

There are optional elements: parameter declarations, variable * declarations, import statements, ordering and grouping specifications, * result and result class, the range of results, * and flags indicating whether the query result * is unique and whether the query can be modified. *

The query namespace is modeled after methods in Java: *

    *
  • setClass corresponds to the class definition *
  • declareParameters corresponds to formal parameters of a * method *
  • declareVariables corresponds to local variables of a method *
  • setFilter and setOrdering correspond to the * method body *
*

There are two namespaces in queries. Type names have their own * namespace that is separate from the namespace for fields, variables * and parameters. *

The method setClass introduces the name of the candidate * class in the type namespace. The method declareImports * introduces the names of the imported class or interface types in the type * namespace. Imported type names must be unique. When used (e.g. in a parameter * declaration, cast expression, etc.) a type name must be the name of the * candidate class, the name of a class or interface imported by method * declareImports, or denote a class or interface from the same * package as the candidate class. *

The method setClass introduces the names of the candidate * class fields. *

The method declareParameters introduces the names of the * parameters. A name introduced by declareParameters hides the * name of a candidate class field of the same name. Parameter names must be * unique. *

The method declareVariables introduces the names of the * variables. A name introduced by declareVariables hides the name * of a candidate class field if equal. Variable names must be unique and must * not conflict with parameter names. *

The result of the query by default is a list of result class instances, * but might be specified via setResult. The class of the result * by default is the candidate class, but might be specified via * setResultClass. *

A hidden field may be accessed using the 'this' qualifier: * this.fieldName. *

The Query interface provides methods which execute the query * based on the parameters given. They return a single instance or a * List of result class instances which the * user can iterate to get results. The signature * of the execute methods specifies that they return an * Object which must be cast to the appropriate result by the user. *

Any parameters passed to the execute methods are used only * for this execution, and are not remembered for future execution. * @version 2.1 */ public interface Query extends Serializable { /** * The string constant used as the first argument to * {@link PersistenceManager#newQuery(String,Object)} to identify that the * created query should obey the JDOQL syntax and semantic rules. *

This is the default query language used when creating a query with any * of the other {@link PersistenceManager#newQuery} methods, except * {@link PersistenceManager#newQuery(Object)}, which uses the query * language of the compiled query template object passed to that method.

* @since 2.0 */ String JDOQL = "javax.jdo.query.JDOQL"; /** * The string constant used as the first argument to {@link * PersistenceManager#newQuery(String,Object)} to identify that * the created query should use SQL semantics. This is only * meaningful for relational JDO implementations. *

If this is used, the Object argument to the * {@link PersistenceManager#newQuery(String,Object)} method * should be a String containing a SQL * SELECT statement.

* @since 2.0 */ String SQL = "javax.jdo.query.SQL"; /** Set the class of the candidate instances of the query. *

The class specifies the class * of the candidates of the query. Elements of the candidate collection * that are of the specified class are filtered before being * put into the result Collection. * * @param cls the Class of the candidate instances. */ void setClass(Class cls); /** Set the candidate Extent to query. * @param pcs the candidate Extent. */ void setCandidates(Extent pcs); /** Set the candidate Collection to query. * @param pcs the candidate Collection. */ void setCandidates(Collection pcs); /** Set the filter for the query. * *

The filter specification is a String containing a Boolean * expression that is to be evaluated for each of the instances * in the candidate collection. If the filter is not specified, * then it defaults to "true", which has the effect of filtering * the input Collection only for class type. *

An element of the candidate collection is returned in the result if: *

  • it is assignment compatible to the candidate Class * of the Query; and *
  • for all variables there exists a value for which the filter * expression evaluates to true. *
*

The user may denote uniqueness in the filter expression by * explicitly declaring an expression (for example, e1 != e2). *

Rules for constructing valid expressions follow the Java * language, except for these differences: *

    *
  • Equality and ordering comparisons between primitives and instances * of wrapper classes are valid. *
  • Equality and ordering comparisons of Date fields and * Date parameters are valid. *
  • White space (non-printing characters space, tab, carriage * return, and line feed) is a separator and is otherwise ignored. *
  • The assignment operators =, +=, etc. and * pre- and post-increment and -decrement are not supported. Therefore, * there are no side effects from evaluation of any expressions. *
  • Methods, including object construction, are not supported, except * for Collection.contains(Object o), * Collection.isEmpty(), * String.startsWith(String s), and * String.endsWith(String e). Implementations might choose to * support non-mutating method calls as non-standard extensions. *
  • Navigation through a null-valued field, which would * throw NullPointerException, is treated as if the filter * expression returned false for the evaluation of the current * set of variable values. Other values for variables might still qualify * the candidate instance for inclusion in the result set. *
  • Navigation through multi-valued fields (Collection * types) is specified using a variable declaration and the * Collection.contains(Object o) method. *
*

Identifiers in the expression are considered to be in the name * space of the specified class, with the addition of declared imports, * parameters and variables. As in the Java language, this is a * reserved word which means the element of the collection being evaluated. *

Navigation through single-valued fields is specified by the Java * language syntax of field_name.field_name....field_name. *

A JDO implementation is allowed to reorder the filter expression * for optimization purposes. * @param filter the query filter. */ void setFilter(String filter); /** Set the import statements to be used to identify the fully qualified * name of variables or parameters. Parameters and unbound variables might * come from a different class from the candidate class, and the names * need to be declared in an import statement to eliminate ambiguity. * Import statements are specified as a String with * semicolon-separated statements. *

The String parameter to this method follows the syntax of * the import statement of the Java language. * @param imports import statements separated by semicolons. */ void declareImports(String imports); /** Declare the list of parameters query execution. * * The parameter declaration is a String containing one or more * query parameter declarations separated with commas. Each parameter named * in the parameter declaration must be bound to a value when * the query is executed. *

The String parameter to this method follows the syntax * for formal parameters in the Java language. * @param parameters the list of parameters separated by commas. */ void declareParameters(String parameters); /** Declare the unbound variables to be used in the query. Variables * might be used in the filter, and these variables must be declared * with their type. The unbound variable declaration is a * String containing one or more unbound variable declarations * separated with semicolons. It follows the syntax for local variables in * the Java language. * @param variables the variables separated by semicolons. */ void declareVariables(String variables); /** Set the ordering specification for the result Collection. * The ordering specification is a String containing one or * more ordering declarations separated by commas. * *

Each ordering declaration is the name of the field on which * to order the results followed by one of the following words: * "ascending" or "descending". * *

The field must be declared in the candidate class or must be * a navigation expression starting with a field in the candidate class. * *

Valid field types are primitive types except boolean; * wrapper types except Boolean; BigDecimal; * BigInteger; String; and Date. * @param ordering the ordering specification. */ void setOrdering(String ordering); /** Set the ignoreCache option. The default value for this option was * set by the PersistenceManagerFactory or the * PersistenceManager used to create this Query. * * The ignoreCache option setting specifies whether the query should execute * entirely in the back end, instead of in the cache. If this flag is set * to true, an implementation might be able to optimize the * query execution by ignoring changed values in the cache. For optimistic * transactions, this can dramatically improve query response times. * @param ignoreCache the setting of the ignoreCache option. */ void setIgnoreCache(boolean ignoreCache); /** Get the ignoreCache option setting. * @return the ignoreCache option setting. * @see #setIgnoreCache */ boolean getIgnoreCache(); /** Verify the elements of the query and provide a hint to the query to * prepare and optimize an execution plan. */ void compile(); /** Execute the query and return the filtered Collection. * @return the filtered Collection. * @see #executeWithArray(Object[] parameters) */ Object execute(); /** Execute the query and return the filtered Collection. * @return the filtered Collection. * @see #executeWithArray(Object[] parameters) * @param p1 the value of the first parameter declared. */ Object execute(Object p1); /** Execute the query and return the filtered Collection. * @return the filtered Collection. * @see #executeWithArray(Object[] parameters) * @param p1 the value of the first parameter declared. * @param p2 the value of the second parameter declared. */ Object execute(Object p1, Object p2); /** Execute the query and return the filtered Collection. * @return the filtered Collection. * @see #executeWithArray(Object[] parameters) * @param p1 the value of the first parameter declared. * @param p2 the value of the second parameter declared. * @param p3 the value of the third parameter declared. */ Object execute(Object p1, Object p2, Object p3); /** Execute the query and return the filtered Collection. The * query is executed with the parameters set by the Map values. * Each Map entry consists of a key which is the name of the * parameter in the declareParameters method, and a value which * is the value used in the execute method. The keys in the * Map and the declared parameters must exactly match or a * JDOUserException is thrown. * @return the filtered Collection. * @see #executeWithArray(Object[] parameters) * @param parameters the Map containing all of the parameters. */ Object executeWithMap (Map parameters); /** Execute the query and return the filtered Collection. * *

The execution of the query obtains the values of the parameters and * matches them against the declared parameters in order. The names * of the declared parameters are ignored. The type of * the declared parameters must match the type of the passed parameters, * except that the passed parameters might need to be unwrapped to get * their primitive values. * *

The filter, import, declared parameters, declared variables, and * ordering statements are verified for consistency. * *

Each element in the candidate Collection is examined to * see that it is assignment compatible to the Class of the * query. It is then evaluated by the Boolean expression of the filter. * The element passes the filter if there exist unique values for all * variables for which the filter expression evaluates to true. * @return the filtered Collection. * @param parameters the Object array with all of the * parameters. */ Object executeWithArray (Object... parameters); /** Get the PersistenceManager associated with this * Query. * *

If this Query was restored from a serialized form, it has * no PersistenceManager, and this method returns * null. * @return the PersistenceManager associated with this * Query. */ PersistenceManager getPersistenceManager(); /** Close a query result and release any resources associated with it. The * parameter is the return from execute(...) and might have * iterators open on it. Iterators associated with the query result are * invalidated: they return false to hasNext() * and throw NoSuchElementException to next(). * @param queryResult the result of execute(...) on this * Query instance. */ void close (Object queryResult); /** Close all query results associated with this Query * instance, and release all resources associated with them. The query * results might have iterators open on them. Iterators associated with the * query results are invalidated: * they return false to hasNext() and throw * NoSuchElementException to next(). */ void closeAll (); /** * Set the grouping expressions, optionally including a "having" * clause. When grouping is specified, each result expression * must either be an expression contained in the grouping, or an * aggregate evaluated once per group. * * @param group a comma-delimited list of expressions, optionally * followed by the "having" keyword and a boolean expression * @since 2.0 */ void setGrouping (String group); /** * Specify that only the first result of the query should be * returned, rather than a collection. The execute method will * return null if the query result size is 0. * @since 2.0 * @param unique if true, only one element is returned */ void setUnique (boolean unique); /** * Specifies what type of data this query should return. If this * is unset or set to null, this query returns * instances of the query's candidate class. If set, this query * will return expressions, including field values (projections) and * aggregate function results. * @param data a comma-delimited list of expressions * (fields, functions on fields, or aggregate functions) * to return from this query * @since 2.0 */ void setResult (String data); /** * Specify the type of object in which to return each element of * the result of invoking {@link #execute} or one of its siblings. * If the result is not set or set to null, the result class defaults * to the candidate class of the query. If the result consists of one * expression, the result class defaults to the type of that expression. * If the result consists of more than one expression, the result class * defaults to Object[]. * The result class may be specified to be one of the java.lang classes * Character, Boolean, Byte, Short, Integer, Long, Float, Double, String, * or Object[]; or one of the java.math classes BigInteger or BigDecimal; * or the java.util class Date; or one of the java.sql classes Date, * Time, or Timestamp; or a user-defined class. *

If there are multiple result expressions, the result class * must be able to hold all elements of the result specification * or a JDOUserException is thrown. *

If there is only one result expression, the result class must be * assignable from the type of the result expression or must be able * to hold all elements of the result specification. A single value * must be able to be coerced into the specified result class * (treating wrapper classes as equivalent to their unwrapped * primitive types) or by matching. If the result class does not satisfy * these conditions, a JDOUserException is thrown. *

A constructor of a result class specified in the setResult method * will be used if the results specification matches the parameters * of the constructor by position and type. If more than one constructor * satisfies the requirements, the JDO implementation chooses one of them. * If no constructor satisfies the results requirements, or if the result * class is specified via the setResultClass method, the following * requirements apply: *

    *
  • A user-defined result class must have a no-args constructor and * one or more public set or put methods or * fields. *
  • Each result expression must match one of: *
      *
    • a public field that matches the name of the result expression * and is of the type (treating wrapper types equivalent to primitive * types) of the result expression; *
    • or if no public field matches the name and type, a public * setor if neither of the above applies,a public method must be found * with the signature void put(Object, Object). * During processing of the results, * the first argument is the name of the result expression and * the second argument is the value from the query result. *
    *
* Portable result classes do not invoke any persistence behavior * during their no-args constructor or setsetRange("50, 70");
or * setRange(":from, :to"); or * setRange("50, :to");. * The execution of the query is * modified to return only a subset of results. If the filter would * normally return 100 instances, and fromIncl is set to 50, and * toExcl is set to 70, then the first 50 results that would have * been returned are skipped, the next 20 results are returned and the * remaining 30 results are ignored. An implementation should execute * the query such that the range algorithm is done at the data store. * @param fromInclToExcl comma-separated fromIncl and toExcl values * @see #setRange(long, long) * @since 2.0 */ void setRange (String fromInclToExcl); /** * Add a vendor-specific extension to this query. The key and value * are not standard. * An implementation must ignore keys that are not recognized. * @param key the key of the extension * @param value the value of the extension * @since 2.0 */ void addExtension (String key, Object value); /** * Set multiple extensions, or use null to clear all extensions. * Map keys and values are not standard. * An implementation must ignore entries that are not recognized. * @param extensions the map of extensions * @see #addExtension * @since 2.0 */ void setExtensions (Map extensions); /** * Returns the FetchPlan used by this * Query. Modifications of the returned fetch plan will not * cause this query's owning PersistenceManager's * FetchPlan to be modified. * @since 2.0 * @return the fetch plan used by this query */ FetchPlan getFetchPlan (); /** * Deletes all the instances of the candidate class that pass the * filter. * @see #deletePersistentAll() * @param parameters for the query * @return the number of instances of the candidate class that were deleted * @since 2.0 */ long deletePersistentAll (Object... parameters); /** * Deletes all the instances of the candidate class that pass the * filter. * @see #deletePersistentAll() * @param parameters for the query * @return the number of instances of the candidate class that were deleted * @since 2.0 */ long deletePersistentAll (Map parameters); /** * Deletes all the instances of the candidate class that pass the * filter. Returns the number of instances of the candidate * class that were deleted, specifically not including the number * of dependent and embedded instances. *

Dirty instances of affected classes in the cache are first * flushed to the datastore. Instances in the cache or brought into * the cache as a result of executing one of the * deletePersistentAll * methods undergo life cycle changes as if deletePersistent * were called on them. *

Specifically, if the class of deleted instances implements the * delete callback interface, the corresponding callback methods * are called on the deleted instances. Similarly, if there are * lifecycle listeners registered for delete events on affected * classes, the listener is called for each appropriate deleted instance. *

Before returning control to the application, instances of affected * classes in the cache are refreshed to reflect whether they were * deleted from the datastore. * * @return the number of instances of the candidate class that were deleted * @since 2.0 */ long deletePersistentAll (); /** * The unmodifiable flag, when set, disallows further * modification of the query, except for specifying the range, * result class, and ignoreCache option. * The unmodifiable flag can also be set in metadata. * @since 2.0 */ void setUnmodifiable(); /** * The unmodifiable flag, when set, disallows further * modification of the query, except for specifying the range, * result class, and ignoreCache option. * @return the current setting of the flag * @since 2.0 */ boolean isUnmodifiable(); /** * Add a subquery to this query. * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable in the outer query * to bind the results of the subquery * @param candidateCollectionExpression the candidate collection * of the subquery as an expression using terms of the outer query * @see #addSubquery(Query sub, String variableDeclaration, * String candidateCollectionExpression, String... parameters) * @since 2.1 */ void addSubquery (Query sub, String variableDeclaration, String candidateCollectionExpression); /** * Add a subquery to this query. * The String version of the method binds the named expression * to the parameter implictly or explicitly declared in the * subquery. * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable * to be used in this Query * @param candidateCollectionExpression the candidate collection * to apply to the subquery * @param parameter the expression from the outer query to bind * the parameter in the subquery * @see #addSubquery(Query sub, String variableDeclaration, * String candidateCollectionExpression, String... parameters) * @since 2.1 */ void addSubquery (Query sub, String variableDeclaration, String candidateCollectionExpression, String parameter); /** * Add a subquery to this query. * A subquery is composed as a Query and subsequently attached * to a different query (the outer query) by calling this method. * The query parameter instance is unmodified as a result of the * addSubquery or subsequent execution of the outer query. * Only some of the query parts are copied for use as the subquery. * The parts copied include the candidate class, filter, parameter * declarations, variable declarations, imports, ordering specification, * uniqueness, result specification, and grouping specification. * The association with a PersistenceManager, the candidate collection * or extent, result class, and range limits are not used. * The String parameters are trimmed of white space. * The variableDeclaration parameter is the name of the variable * containing the results of the subquery execution. If the same value * of variableDeclaration is used to add multiple subqueries, the * subquery replaces the previous subquery for the same named variable. * If the subquery parameter is null, the variable is unset, * effectively making the variable named in the variableDeclaration * unbound. If the trimmed value is the empty String, or the parameter * is null, then JDOUserException is thrown. * The candidateCollectionExpression is the expression from the * outer query that represents the candidates over which the subquery * is evaluated. If the trimmed value is the empty String, or the * parameter is null, then the candidate collection is the extent * of the candidate class. * The String... version of the method binds the named expressions in * turn to parameters in the order in which they are declared in the * subquery, or in the order they are found in the filter if not * explicitly declared in the subquery. * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable in the outer query * to bind the results of the subquery * @param candidateCollectionExpression the candidate collection * of the subquery as an expression using terms of the outer query * @param parameters the expressions from the outer query to bind * the parameters in the subquery * @since 2.1 */ void addSubquery (Query sub, String variableDeclaration, String candidateCollectionExpression, String... parameters); /** * Add a subquery to this query. * The Map version of the method treats the key of each map entry as * the name of the parameter in the subquery, with or without the * leading ":", and the value as the name of the expression in the * outer query. If the trimmed expression is the empty String for * either the parameter or the value of the String[], or for any * map key or value, that expression is ignored. * @param sub the subquery to add to this Query * @param variableDeclaration the name of the variable * to be used in this Query * @param candidateCollectionExpression the candidate collection * to apply to the subquery * @param parameters the expressions from the outer query to bind * the parameter in the subquery * @see #addSubquery(Query sub, String variableDeclaration, * String candidateCollectionExpression, String... parameters) * @since 2.1 */ void addSubquery (Query sub, String variableDeclaration, String candidateCollectionExpression, Map parameters); } jdo2-api-2.2/src/java/javax/jdo/spi/Detachable.java100644 0 0 4122 11073716464 17170 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.spi; /** * This interface is implemented by classes that can be detached from the * persistence context and later attached. The interface includes the * contract by which the StateManager can set the object id, version, * BitSet of loaded fields, and BitSet of modified fields * so they are preserved while outside the persistence environment. *

The detached state is stored as a field in each instance of Detachable. * The field is serialized so as to maintain the state of the instance * while detached. While detached, only the BitSet of modified fields * will be modified. The structure of the Object[] jdoDetachedState * is as follows: *

  • jdoDetachedState[0]: the Object Id of the instance *
  • jdoDetachedState[1]: the Version of the instance *
  • jdoDetachedState[2]: a BitSet of loaded fields *
  • jdoDetachedState[3]: a BitSet of modified fields *
* @version 2.0 */ public interface Detachable { /** This method calls the StateManager with the current detached * state instance as a parameter and replaces the current detached * state instance with the value provided by the StateManager. * @since 2.0 */ public void jdoReplaceDetachedState(); } jdo2-api-2.2/src/java/javax/jdo/spi/I18NHelper.java100644 0 0 34451 11073716464 17023 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.spi; import java.util.*; import java.text.MessageFormat; import java.security.AccessController; import java.security.PrivilegedAction; import javax.jdo.JDOFatalInternalException; /** Helper class for constructing messages from bundles. The intended usage * of this class is to construct a new instance bound to a bundle, as in *

* I18NHelper msg = I18NHelper.getInstance("javax.jdo.Bundle"); *

* This call uses the class loader that loaded the I18NHelper class to find * the specified Bundle. The class provides two overloaded getInstance * methods allowing to specify a different class loader: * {@link #getInstance(Class cls)} looks for a bundle * called "Bundle.properties" located in the package of the specified class * object and {@link #getInstance(String bundleName,ClassLoader loader)} * uses the specified class loader to find the bundle. *

* Subsequently, instance methods can be used to format message strings * using the text from the bundle, as in *

* throw new JDOFatalInternalException (msg.msg("ERR_NoMetadata", * cls.getName())); * @since 1.0.1 * @version 1.1 */ public class I18NHelper { /** Bundles that have already been loaded */ private static Hashtable bundles = new Hashtable(); /** Helper instances that have already been created */ private static Hashtable helpers = new Hashtable(); /** The default locale for this VM. */ private static Locale locale = Locale.getDefault(); /** The name of the bundle used by this instance of the helper. */ private final String bundleName; /** The bundle used by this instance of the helper. */ private ResourceBundle bundle = null; /** Throwable if ResourceBundle couldn't be loaded */ private Throwable failure = null; /** The unqualified standard name of a bundle. */ private static final String bundleSuffix = ".Bundle"; // NOI18N /** Constructor */ private I18NHelper() { this.bundleName = null; } /** Constructor for an instance bound to a bundle. * @param bundleName the name of the resource bundle * @param loader the class loader from which to load the resource * bundle */ private I18NHelper (String bundleName, ClassLoader loader) { this.bundleName = bundleName; try { bundle = loadBundle (bundleName, loader); } catch (Throwable e) { failure = e; } } /** An instance bound to a bundle. This method uses the current class * loader to find the bundle. * @param bundleName the name of the bundle * @return the helper instance bound to the bundle */ public static I18NHelper getInstance (String bundleName) { return getInstance (bundleName, I18NHelper.class.getClassLoader()); } /** An instance bound to a bundle. This method figures out the bundle name * for the class object's package and uses the class' class loader to * find the bundle. Note, the specified class object must not be * null. * @param cls the class object from which to load the resource bundle * @return the helper instance bound to the bundle */ public static I18NHelper getInstance (final Class cls) { ClassLoader classLoader = (ClassLoader) AccessController.doPrivileged ( new PrivilegedAction () { public Object run () { return cls.getClassLoader(); } } ); String bundle = getPackageName (cls.getName()) + bundleSuffix; return getInstance (bundle, classLoader); } /** An instance bound to a bundle. This method uses the specified class * loader to find the bundle. Note, the specified class loader must not * be null. * @param bundleName the name of the bundle * @param loader the class loader from which to load the resource * bundle * @return the helper instance bound to the bundle */ public static I18NHelper getInstance (String bundleName, ClassLoader loader) { I18NHelper helper = (I18NHelper) helpers.get (bundleName); if (helper != null) { return helper; } helper = new I18NHelper(bundleName, loader); helpers.put (bundleName, helper); // if two threads simultaneously create the same helper, return the first // one to be put into the Hashtable. The other will be garbage collected. return (I18NHelper) helpers.get (bundleName); } /** Message formatter * @param messageKey the message key * @return the resolved message text */ public String msg (String messageKey) { assertBundle (messageKey); return getMessage (bundle, messageKey); } /** Message formatter * @param messageKey the message key * @param arg1 the first argument * @return the resolved message text */ public String msg (String messageKey, Object arg1) { assertBundle (messageKey); return getMessage (bundle, messageKey, arg1); } /** Message formatter * @param messageKey the message key * @param arg1 the first argument * @param arg2 the second argument * @return the resolved message text */ public String msg (String messageKey, Object arg1, Object arg2) { assertBundle (messageKey); return getMessage (bundle, messageKey, arg1, arg2); } /** Message formatter * @param messageKey the message key * @param arg1 the first argument * @param arg2 the second argument * @param arg3 the third argument * @return the resolved message text */ public String msg (String messageKey, Object arg1, Object arg2, Object arg3) { assertBundle (messageKey); return getMessage (bundle, messageKey, arg1, arg2, arg3); } /** Message formatter * @param messageKey the message key * @param args the array of arguments * @return the resolved message text */ public String msg (String messageKey, Object[] args) { assertBundle (messageKey); return getMessage (bundle, messageKey, args); } /** Message formatter * @param messageKey the message key * @param arg the argument * @return the resolved message text */ public String msg (String messageKey, int arg) { assertBundle (messageKey); return getMessage(bundle, messageKey, arg); } /** Message formatter * @param messageKey the message key * @param arg the argument * @return the resolved message text */ public String msg (String messageKey, boolean arg) { assertBundle (messageKey); return getMessage(bundle, messageKey, arg); } /** Returns the resource bundle used by this I18NHelper. * @return the associated resource bundle * @since 1.1 */ public ResourceBundle getResourceBundle () { assertBundle (); return bundle; } //========= Internal helper methods ========== /** * Load ResourceBundle by bundle name * @param bundleName the name of the bundle * @param loader the class loader from which to load the resource bundle * @return the ResourceBundle */ final private static ResourceBundle loadBundle( String bundleName, ClassLoader loader) { ResourceBundle messages = (ResourceBundle)bundles.get(bundleName); if (messages == null) //not found as loaded - add { if (loader != null) { messages = ResourceBundle.getBundle(bundleName, locale, loader); } else { // the JDO library is loaded by the boostrap class loader messages = ResourceBundle.getBundle(bundleName, locale, getSystemClassLoaderPrivileged()); } bundles.put(bundleName, messages); } return messages; } /** Assert resources available * @since 1.1 * @throws JDOFatalInternalException if the resource bundle could not * be loaded during construction. */ private void assertBundle () { if (failure != null) throw new JDOFatalInternalException ( "No resources could be found for bundle:\"" + bundle + "\" ", failure); } /** Assert resources available * @param key the message key * @since 1.0.2 * @throws JDOFatalInternalException if the resource bundle could not * be loaded during construction. */ private void assertBundle (String key) { if (failure != null) throw new JDOFatalInternalException ( "No resources could be found to annotate error message key:\"" + key + "\"", failure); } /** * Returns message as String * @param messages the resource bundle * @param messageKey the message key * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey) { return messages.getString(messageKey); } /** * Formats message by adding array of arguments * @param messages the resource bundle * @param messageKey the message key * @param msgArgs an array of arguments to substitute into the message * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, Object[] msgArgs) { for (int i=0; iObject argument. * @param messages the resource bundle * @param messageKey the message key * @param arg the argument * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg) { Object []args = {arg}; return getMessage(messages, messageKey, args); } /** * Formats message by adding two Object arguments. * @param messages the resource bundle * @param messageKey the message key * @param arg1 the first argument * @param arg2 the second argument * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg1, Object arg2) { Object []args = {arg1, arg2}; return getMessage(messages, messageKey, args); } /** * Formats message by adding three Object arguments. * @param messages the resource bundle * @param messageKey the message key * @param arg1 the first argument * @param arg2 the second argument * @param arg3 the third argument * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, Object arg1, Object arg2, Object arg3) { Object []args = {arg1, arg2, arg3}; return getMessage(messages, messageKey, args); } /** * Formats message by adding an int as an argument. * @param messages the resource bundle * @param messageKey the message key * @param arg the argument * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, int arg) { Object []args = {new Integer(arg)}; return getMessage(messages, messageKey, args); } /** * Formats message by adding a boolean as an argument. * @param messages the resource bundle * @param messageKey the message key * @param arg the argument * @return the resolved message text */ final private static String getMessage(ResourceBundle messages, String messageKey, boolean arg) { Object []args = {String.valueOf(arg)}; return getMessage(messages, messageKey, args); } /** * Returns the package portion of the specified class. * @param className the name of the class from which to extract the * package * @return package portion of the specified class */ final private static String getPackageName(final String className) { final int index = className.lastIndexOf('.'); return ((index != -1) ? className.substring(0, index) : ""); // NOI18N } /** * Get the system class loader. This must be done in a doPrivileged * block because of security. */ private static ClassLoader getSystemClassLoaderPrivileged() { return (ClassLoader) AccessController.doPrivileged ( new PrivilegedAction () { public Object run () { return ClassLoader.getSystemClassLoader(); } } ); } } jdo2-api-2.2/src/java/javax/jdo/spi/JDOImplHelper.java100644 0 0 130703 11073716464 17617 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * JDOImplHelper.java * */ package javax.jdo.spi; import org.xml.sax.ErrorHandler; import java.lang.reflect.Constructor; import java.security.AccessController; import java.security.PrivilegedAction; import java.text.DateFormat; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Currency; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.WeakHashMap; import javax.jdo.JDOException; import javax.jdo.JDOFatalInternalException; import javax.jdo.JDOFatalUserException; import javax.jdo.JDOUserException; import javax.xml.parsers.DocumentBuilderFactory; /** This class is a helper class for JDO implementations. It contains methods * to register metadata for persistence-capable classes and to perform common * operations needed by implementations, not by end users. *

JDOImplHelper allows construction of instances of * persistence-capable classes without using reflection. *

Persistence-capable classes register themselves via a static method * at class load time. * There is no security restriction on this access. JDO implementations * get access to the functions provided by this class only if they are * authorized by the security manager. To avoid having every call go through * the security manager, only the call to get an instance is checked. Once an * implementation * has an instance, any of the methods can be invoked without security checks. * @version 2.1 * */ public class JDOImplHelper extends java.lang.Object { /** This synchronized HashMap contains a static mapping of * PersistenceCapable class to * metadata for the class used for constructing new instances. New entries * are added by the static method in each PersistenceCapable * class. Entries are never removed. */ private static Map registeredClasses = Collections.synchronizedMap(new HashMap ()); /** This Set contains all classes that have registered for setStateManager * permissions via authorizeStateManagerClass. */ private static Map authorizedStateManagerClasses = new WeakHashMap(); /** This list contains the registered listeners for * RegisterClassEvents. */ private static List listeners = new ArrayList(); /** The list of registered StateInterrogation instances */ private static List stateInterrogations = new ArrayList(); /** The singleton JDOImplHelper instance. */ private static JDOImplHelper jdoImplHelper = new JDOImplHelper(); /** The Internationalization message helper. */ private final static I18NHelper msg = I18NHelper.getInstance ("javax.jdo.Bundle"); //NOI18N /** The DateFormat pattern. */ private static String dateFormatPattern; /** The default DateFormat instance. */ private static DateFormat dateFormat; /** * The DocumentBuilderFactory used during jdoconfig.xml parsing. */ private static DocumentBuilderFactory documentBuilderFactory; /** * The ErrorHandler used during jdoconfig.xml parsing. */ private static ErrorHandler errorHandler; /** Register the default DateFormat instance. */ static { jdoImplHelper.registerDateFormat(getDateTimeInstance()); } /** Creates new JDOImplHelper */ private JDOImplHelper() { } /** Get an instance of JDOImplHelper. This method * checks that the caller is authorized for * JDOPermission("getMetadata"), and if not, throws * SecurityException. * @return an instance of JDOImplHelper. * @throws SecurityException if the caller is not authorized for * JDOPermission("getMetadata"). */ public static JDOImplHelper getInstance() throws SecurityException { SecurityManager sec = System.getSecurityManager(); if (sec != null) { // throws exception if caller is not authorized sec.checkPermission (JDOPermission.GET_METADATA); } return jdoImplHelper; } /** Get the field names for a PersistenceCapable class. The * order of fields is the natural ordering of the String class * (without considering localization). * @param pcClass the PersistenceCapable class. * @return the field names for the class. */ public String[] getFieldNames (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldNames(); } /** Get the field types for a PersistenceCapable class. The * order of fields is the same as for field names. * @param pcClass the PersistenceCapable class. * @return the field types for the class. */ public Class[] getFieldTypes (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldTypes(); } /** Get the field flags for a PersistenceCapable class. The * order of fields is the same as for field names. * @param pcClass the PersistenceCapable class. * @return the field types for the class. */ public byte[] getFieldFlags (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getFieldFlags(); } /** Get the persistence-capable superclass for a * PersistenceCapable class. * @param pcClass the PersistenceCapable class. * @return The PersistenceCapable superclass for this class, * or null if there isn't one. */ public Class getPersistenceCapableSuperclass (Class pcClass) { Meta meta = getMeta (pcClass); return meta.getPersistenceCapableSuperclass(); } /** Create a new instance of the class and assign its * jdoStateManager. The new instance has its * jdoFlags set to LOAD_REQUIRED. * @see PersistenceCapable#jdoNewInstance(StateManager sm) * @param pcClass the PersistenceCapable class. * @param sm the StateManager which will own the new instance. * @return the new instance, or null if the class is not * registered. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm); } /** Create a new instance of the class and assign its * jdoStateManager and key values from the ObjectId. If the * oid parameter is null, no key values are copied. * The new instance has its jdoFlags set to * LOAD_REQUIRED. * @see PersistenceCapable#jdoNewInstance(StateManager sm, Object oid) * @param pcClass the PersistenceCapable class. * @param sm the StateManager which will own the new instance. * @return the new instance, or null if the class is not * registered. * @param oid the ObjectId instance from which to copy key field values. */ public PersistenceCapable newInstance (Class pcClass, StateManager sm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewInstance(sm, oid); } /** Create a new instance of the ObjectId class of this * PersistenceCapable class. * It is intended only for application identity. This method should * not be called for classes that use single field identity; * newObjectIdInstance(Class, Object) should be used instead. * If the class has been * enhanced for datastore identity, or if the class is abstract, * null is returned. * @param pcClass the PersistenceCapable class. * @return the new ObjectId instance, or null if the class * is not registered. */ public Object newObjectIdInstance (Class pcClass) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance(); } /** Create a new instance of the class used by the parameter Class * for JDO identity, using the * key constructor of the object id class. It is intended for single * field identity. The identity * instance returned has no relationship with the values of the primary key * fields of the persistence-capable instance on which the method is called. * If the key is the wrong class for the object id class, null is returned. *

For classes that use single field identity, if the parameter is * of one of the following types, the behavior must be as specified: *

  • Number or Character: the * parameter must be the single field * type or the wrapper class of the primitive field type; the parameter * is passed to the single field identity constructor *
  • ObjectIdFieldSupplier: the field value * is fetched from the ObjectIdFieldSupplier and passed to the * single field identity constructor *
  • String: the String is passed to the * single field identity constructor *
* @return the new ObjectId instance, or null * if the class is not registered. * @param obj the Object form of the object id * @param pcClass the PersistenceCapable class. * @since 2.0 */ public Object newObjectIdInstance (Class pcClass, Object obj) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return (pcInstance == null)?null:pcInstance.jdoNewObjectIdInstance(obj); } /** Copy fields from an outside source to the key fields in the ObjectId. * This method is generated in the PersistenceCapable class to * generate a call to the field manager for each key field in the ObjectId. *

For example, an ObjectId class that has three key fields * (int id, String name, and * Float salary) would have the method generated: *

* void jdoCopyKeyFieldsToObjectId (Object oid, ObjectIdFieldSupplier fm) { *
oid.id = fm.fetchIntField (0); *
oid.name = fm.fetchStringField (1); *
oid.salary = fm.fetchObjectField (2); *
}
*

The implementation is responsible for implementing the * ObjectIdFieldSupplier to provide the values for the key * fields. * @param pcClass the PersistenceCapable Class. * @param oid the ObjectId target of the copy. * @param fm the field manager that supplies the field values. */ public void copyKeyFieldsToObjectId (Class pcClass, PersistenceCapable.ObjectIdFieldSupplier fm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); if (pcInstance == null) { throw new JDOFatalInternalException (msg.msg( "ERR_AbstractClassNoIdentity", pcClass.getName())); //NOI18N } pcInstance.jdoCopyKeyFieldsToObjectId(fm, oid); } /** Copy fields to an outside source from the key fields in the ObjectId. * This method is generated in the PersistenceCapable class to * generate a call to the field manager for each key field in the ObjectId. * For example, an ObjectId class that has three key fields * (int id, String name, and * Float salary) would have the method generated: *

void jdoCopyKeyFieldsFromObjectId *
(PersistenceCapable oid, ObjectIdFieldConsumer fm) { *
fm.storeIntField (0, oid.id); *
fm.storeStringField (1, oid.name); *
fm.storeObjectField (2, oid.salary); *
}
*

The implementation is responsible for implementing the * ObjectIdFieldConsumer to store the values for the key * fields. * @param pcClass the PersistenceCapable class * @param oid the ObjectId source of the copy. * @param fm the field manager that receives the field values. */ public void copyKeyFieldsFromObjectId (Class pcClass, PersistenceCapable.ObjectIdFieldConsumer fm, Object oid) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); if (pcInstance == null) { throw new JDOFatalInternalException (msg.msg( "ERR_AbstractClassNoIdentity", pcClass.getName())); //NOI18N } pcInstance.jdoCopyKeyFieldsFromObjectId(fm, oid); } /** Register metadata by class. The registration will be done in the * class named JDOImplHelper loaded by the same or an * ancestor class loader as the PersistenceCapable class * performing the registration. * * @param pcClass the PersistenceCapable class * used as the key for lookup. * @param fieldNames an array of String field names for * persistent and transactional fields * @param fieldTypes an array of Class field types * @param fieldFlags the Field Flags for persistent and transactional fields * @param pc an instance of the PersistenceCapable class * @param persistenceCapableSuperclass the most immediate superclass that is * PersistenceCapable */ public static void registerClass (Class pcClass, String[] fieldNames, Class[] fieldTypes, byte[] fieldFlags, Class persistenceCapableSuperclass, PersistenceCapable pc) { if (pcClass == null) throw new NullPointerException(msg.msg("ERR_NullClass")); //NOI18N Meta meta = new Meta (fieldNames, fieldTypes, fieldFlags, persistenceCapableSuperclass, pc); registeredClasses.put (pcClass, meta); // handle class registration listeners synchronized (listeners) { if (!listeners.isEmpty()) { RegisterClassEvent event = new RegisterClassEvent( jdoImplHelper, pcClass, fieldNames, fieldTypes, fieldFlags, persistenceCapableSuperclass); for (Iterator i = listeners.iterator(); i.hasNext();) { RegisterClassListener crl = (RegisterClassListener)i.next(); if (crl != null) { crl.registerClass(event); } } } } } /** * Unregister metadata by class loader. This method unregisters all * registered PersistenceCapable classes loaded by the * specified class loader. Any attempt to get metadata for unregistered * classes will result in a JDOFatalUserException. * @param cl the class loader. * @since 1.0.2 */ public void unregisterClasses (ClassLoader cl) { SecurityManager sec = System.getSecurityManager(); if (sec != null) { // throws exception if caller is not authorized sec.checkPermission (JDOPermission.MANAGE_METADATA); } synchronized(registeredClasses) { for (Iterator i = registeredClasses.keySet().iterator(); i.hasNext();) { Class pcClass = (Class)i.next(); // Note, the pc class was registered by calling the static // method JDOImplHelper.registerClass. This means the // JDOImplHelper class loader is the same as or an ancestor // of the class loader of the pc class. In this case method // getClassLoader does not perform a security check for // RuntimePermission("getClassLoader") and thus we do not // need a privileged block for the getClassLoader call. if ((pcClass != null) && (pcClass.getClassLoader() == cl)) { // unregister pc class, if its class loader is the // specified one. i.remove(); } } } } /** * Unregister metadata by class. This method unregisters the specified * class. Any further attempt to get metadata for the specified class will * result in a JDOFatalUserException. * @param pcClass the PersistenceCapable class to be * unregistered. * @since 1.0.2 */ public void unregisterClass (Class pcClass) { if (pcClass == null) throw new NullPointerException(msg.msg("ERR_NullClass")); //NOI18N SecurityManager sec = System.getSecurityManager(); if (sec != null) { // throws exception if caller is not authorized sec.checkPermission (JDOPermission.MANAGE_METADATA); } registeredClasses.remove(pcClass); } /** * Add the specified RegisterClassListener to the listener * list. * @param crl the listener to be added */ public void addRegisterClassListener (RegisterClassListener crl) { HashSet alreadyRegisteredClasses = null; synchronized (listeners) { listeners.add(crl); // Make a copy of the existing set of registered classes. // Between these two lines of code, any number of new class // registrations might occur, and will then all wait until this // synchronized block completes. Some of the class registrations // might be delivered twice to the newly registered listener. alreadyRegisteredClasses = new HashSet (registeredClasses.keySet()); } // new registrations will call the new listener while the following // occurs notify the new listener about already-registered classes for (Iterator it = alreadyRegisteredClasses.iterator(); it.hasNext();) { Class pcClass = (Class)it.next(); Meta meta = getMeta (pcClass); RegisterClassEvent event = new RegisterClassEvent( this, pcClass, meta.getFieldNames(), meta.getFieldTypes(), meta.getFieldFlags(), meta.getPersistenceCapableSuperclass()); crl.registerClass (event); } } /** * Remove the specified RegisterClassListener from the listener * list. * @param crl the listener to be removed */ public void removeRegisterClassListener (RegisterClassListener crl) { synchronized (listeners) { listeners.remove(crl); } } /** * Returns a collection of class objects of the registered * persistence-capable classes. * @return registered persistence-capable classes */ public Collection getRegisteredClasses() { return Collections.unmodifiableCollection(registeredClasses.keySet()); } /** Look up the metadata for a PersistenceCapable class. * @param pcClass the Class. * @return the Meta for the Class. */ private static Meta getMeta (Class pcClass) { Meta ret = (Meta) registeredClasses.get (pcClass); if (ret == null) { throw new JDOFatalUserException( msg.msg ("ERR_NoMetadata", pcClass.getName())); //NOI18N } return ret; } /** Register a class authorized to replaceStateManager. The caller of * this method must be authorized for JDOPermission("setStateManager"). * During replaceStateManager, a persistence-capable class will call * the corresponding checkAuthorizedStateManager and the class of the * instance of the parameter must have been registered. * @param smClass a Class that is authorized for * JDOPermission("setStateManager"). * @throws SecurityException if the caller is not authorized for * JDOPermission("setStateManager"). * @since 1.0.1 */ public static void registerAuthorizedStateManagerClass (Class smClass) throws SecurityException { if (smClass == null) throw new NullPointerException(msg.msg("ERR_NullClass")); //NOI18N SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(JDOPermission.SET_STATE_MANAGER); } synchronized (authorizedStateManagerClasses) { authorizedStateManagerClasses.put(smClass, null); } } /** Register classes authorized to replaceStateManager. The caller of * this method must be authorized for JDOPermission("setStateManager"). * During replaceStateManager, a persistence-capable class will call * the corresponding checkAuthorizedStateManager and the class of the * instance of the parameter must have been registered. * @param smClasses a Collection of Classes that are authorized for * JDOPermission("setStateManager"). * @throws SecurityException if the caller is not authorized for * JDOPermission("setStateManager"). * @since 1.0.1 */ public static void registerAuthorizedStateManagerClasses ( Collection smClasses) throws SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(JDOPermission.SET_STATE_MANAGER); synchronized (authorizedStateManagerClasses) { for (Iterator it = smClasses.iterator(); it.hasNext();) { Object smClass = it.next(); if (!(smClass instanceof Class)) { throw new ClassCastException( msg.msg("ERR_StateManagerClassCast", //NOI18N smClass.getClass().getName())); } registerAuthorizedStateManagerClass((Class)it.next()); } } } } /** * Register a DocumentBuilderFactory instance for use in parsing the * resource(s) META-INF/jdoconfig.xml. The default is governed by the * semantics of DocumentBuilderFactory.newInstance(). * * @param factory the DocumentBuilderFactory instance to use * @since 2.1 */ public synchronized void registerDocumentBuilderFactory( DocumentBuilderFactory factory) { documentBuilderFactory = factory; } /** * Return the registered instance of DocumentBuilderFactory. * @return the DocumentBuilderFactory if registered; null otherwise * @since 2.1 */ public static DocumentBuilderFactory getRegisteredDocumentBuilderFactory() { return documentBuilderFactory; } /** * Register an ErrorHandler instance for use in parsing the * resource(s) META-INF/jdoconfig.xml. The default is an ErrorHandler * that throws on error or fatalError and ignores warnings. * * @param handler the ErrorHandler instance to use * @since 2.1 */ public synchronized void registerErrorHandler(ErrorHandler handler) { errorHandler = handler; } /** * Return the registered instance of ErrorHandler. * @return the registered ErrorHandler if registered; null otherwise * @since 2.1 */ public static ErrorHandler getRegisteredErrorHandler() { return errorHandler; } /** Check that the parameter instance is of a class that is authorized for * JDOPermission("setStateManager"). This method is called by the * replaceStateManager method in persistence-capable classes. * A class that is passed as the parameter to replaceStateManager must be * authorized for JDOPermission("setStateManager"). To improve performance, * first the set of authorized classes is checked, and if not present, a * regular permission check is made. The regular permission check requires * that all callers on the stack, including the persistence-capable class * itself, must be authorized for JDOPermission("setStateManager"). * @param sm an instance of StateManager whose class is to be checked. * @since 1.0.1 */ public static void checkAuthorizedStateManager (StateManager sm) { checkAuthorizedStateManagerClass(sm.getClass()); } /** Check that the parameter instance is a class that is authorized for * JDOPermission("setStateManager"). This method is called by the * constructors of JDO Reference Implementation classes. * @param smClass a Class to be checked for JDOPermission("setStateManager") * @since 1.0.1 */ public static void checkAuthorizedStateManagerClass (Class smClass) { final SecurityManager scm = System.getSecurityManager(); if (scm == null) { // if no security manager, no checking. return; } synchronized(authorizedStateManagerClasses) { if (authorizedStateManagerClasses.containsKey(smClass)) { return; } } // if not already authorized, perform "long" security checking. scm.checkPermission(JDOPermission.SET_STATE_MANAGER); } /** * Construct an instance of a key class using a String as input. * This is a helper interface for use with ObjectIdentity. * Classes without a String constructor (such as those in java.lang * and java.util) will use this interface for constructing new instances. * The result might be a singleton or use some other strategy. */ public interface StringConstructor { /** * Construct an instance of the class for which this instance * is registered. * @param s the parameter for construction * @return the constructed object */ public Object construct(String s); } /** * Special StringConstructor instances for use with specific * classes that have no public String constructor. The Map is * keyed on class instance and the value is an instance of * StringConstructor. */ static Map stringConstructorMap = new HashMap(); /** * * Register special StringConstructor instances. These instances * are for constructing instances from String parameters where there * is no String constructor for them. * @param cls the class to register a StringConstructor for * @param sc the StringConstructor instance * @return the previous StringConstructor registered for this class */ public Object registerStringConstructor(Class cls, StringConstructor sc) { synchronized(stringConstructorMap) { return stringConstructorMap.put(cls, sc); } } /** Register the default special StringConstructor instances. */ static { if (isClassLoadable("java.util.Currency")) { jdoImplHelper.registerStringConstructor( Currency.class, new StringConstructor() { public Object construct(String s) { try { return Currency.getInstance(s); } catch (IllegalArgumentException ex) { throw new javax.jdo.JDOUserException(msg.msg( "EXC_CurrencyStringConstructorIllegalArgument", //NOI18N s), ex); } catch (Exception ex) { throw new JDOUserException(msg.msg( "EXC_CurrencyStringConstructorException"), //NOI18N ex); } } }); } jdoImplHelper.registerStringConstructor(Locale.class, new StringConstructor() { public Object construct(String s) { try { return getLocale(s); } catch (Exception ex) { throw new JDOUserException(msg.msg( "EXC_LocaleStringConstructorException"), ex); //NOI18N } } }); jdoImplHelper.registerStringConstructor(Date.class, new StringConstructor() { public synchronized Object construct(String s) { try { // first, try the String as a Long return new Date(Long.parseLong(s)); } catch (NumberFormatException ex) { // not a Long; try the formatted date ParsePosition pp = new ParsePosition(0); Date result = dateFormat.parse(s, pp); if (result == null) { throw new JDOUserException (msg.msg( "EXC_DateStringConstructor", new Object[] //NOI18N {s, new Integer(pp.getErrorIndex()), dateFormatPattern})); } return result; } } }); } /** * Parse the String to a Locale. * @param s the name of the Locale * @return the Locale corresponding to the name */ private static Locale getLocale(String s) { String lang = s; int firstUnderbar = s.indexOf('_'); if (firstUnderbar == -1) { // nothing but language return new Locale(lang); } lang = s.substring(0, firstUnderbar); String country; int secondUnderbar = s.indexOf('_', firstUnderbar + 1); if (secondUnderbar == -1) { // nothing but language, country country = s.substring(firstUnderbar + 1); return new Locale(lang, country); } country = s.substring(firstUnderbar + 1, secondUnderbar); String variant = s.substring(secondUnderbar + 1); return new Locale(lang, country, variant); } /** * Determine if a class is loadable in the current environment. * @param className the fully-qualified name of the class * @return true if the class can be loaded; false otherwise */ private static boolean isClassLoadable(String className) { try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { return false; } } /** * Construct an instance of the parameter class, using the keyString * as an argument to the constructor. If the class has a StringConstructor * instance registered, use it. If not, try to find a constructor for * the class with a single String argument. Otherwise, throw a * JDOUserException. * @param className the name of the class * @param keyString the String parameter for the constructor * @return the result of construction */ public static Object construct(String className, String keyString) { StringConstructor stringConstructor; try { Class keyClass = Class.forName(className); synchronized(stringConstructorMap) { stringConstructor = (StringConstructor) stringConstructorMap.get(keyClass); } if (stringConstructor != null) { return stringConstructor.construct(keyString); } else { Constructor keyConstructor = keyClass.getConstructor(new Class[]{String.class}); return keyConstructor.newInstance(new Object[]{keyString}); } } catch (JDOException ex) { throw ex; } catch (Exception ex) { /* ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException */ throw new JDOUserException( msg.msg("EXC_ObjectIdentityStringConstruction", //NOI18N new Object[] {ex.toString(), className, keyString}), ex); } } /** * Get the DateFormat instance for the default locale from the VM. * This requires the following privileges for JDOImplHelper in the * security permissions file: * permission java.util.PropertyPermission "user.country", "read"; * permission java.util.PropertyPermission "user.timezone", "read,write"; * permission java.util.PropertyPermission "java.home", "read"; * If these permissions are not present, or there is some other * problem getting the default date format, a simple formatter is returned. * @since 2.1 * @return the default date-time formatter */ static DateFormat getDateTimeInstance() { DateFormat result = null; try { result = (DateFormat) AccessController.doPrivileged ( new PrivilegedAction () { public Object run () { return DateFormat.getDateTimeInstance(); } } ); } catch (Exception ex) { result = DateFormat.getInstance(); } return result; } /** * Register a DateFormat instance for use with constructing Date * instances. The default is the default DateFormat instance. * If the new instance implements SimpleDateFormat, get its pattern * for error messages. * @since 2.0 * @param df the DateFormat instance to use */ public synchronized void registerDateFormat(DateFormat df) { dateFormat = df; if (df instanceof SimpleDateFormat) { dateFormatPattern = ((SimpleDateFormat)df).toPattern(); } else { dateFormatPattern = msg.msg("MSG_unknown"); //NOI18N } } /** This is a helper class to manage metadata per persistence-capable * class. The information is used at runtime to provide field names and * field types to the JDO Model. * * This is the value of the HashMap which * relates the PersistenceCapable Class * as a key to the metadata. */ static class Meta { /** Construct an instance of Meta. * @param fieldNames An array of String * @param fieldTypes An array of Class * @param fieldFlags an array of int * @param persistenceCapableSuperclass the most immediate * PersistenceCapable superclass * @param pc An instance of the PersistenceCapable class */ Meta (String[] fieldNames, Class[] fieldTypes, byte[] fieldFlags, Class persistenceCapableSuperclass, PersistenceCapable pc) { this.fieldNames = fieldNames; this.fieldTypes = fieldTypes; this.fieldFlags = fieldFlags; this.persistenceCapableSuperclass = persistenceCapableSuperclass; this.pc = pc; } /** This is an array of field names used * for the Model at runtime. The field * is passed by the static class initialization. */ String[] fieldNames; /** Get the field names from the metadata. * @return the array of field names. */ String[] getFieldNames() { return fieldNames; } /** This is an array of field types used * for the Model at runtime. The field * is passed by the static class initialization. */ Class[] fieldTypes; /** Get the field types from the metadata. * @return the array of field types. */ Class[] getFieldTypes() { return fieldTypes; } /** This is an array of field flags used * for the Model at runtime. The field * is passed by the static class initialization. */ byte[] fieldFlags; /** Get the field types from the metadata. * @return the array of field types. */ byte[] getFieldFlags() { return fieldFlags; } /** This is the Class instance of the * PersistenceCapable superclass. */ Class persistenceCapableSuperclass; /** Return the PersistenceCapable superclass. * @return the PersistenceCapable superclass */ Class getPersistenceCapableSuperclass() { return persistenceCapableSuperclass; } /** This is an instance of PersistenceCapable, * used at runtime to create new instances. */ PersistenceCapable pc; /** Get an instance of the PersistenceCapable class. * @return an instance of the PersistenceCapable Class. */ PersistenceCapable getPC() { return pc; } /** Return the string form of the metadata. * @return the string form */ public String toString() { return "Meta-" + pc.getClass().getName(); //NOI18N } } /** * Add a StateInterrogation to the list. Create a new list * in case there is an iterator open on the original list. * @param si the StateInterrogation to add */ public synchronized void addStateInterrogation(StateInterrogation si) { List newList = new ArrayList(stateInterrogations); newList.add(si); stateInterrogations = newList; } /** * Remove a StateInterrogation from the list. Create a new list * in case there is an iterator open on the original list. * @param si the StateInterrogation to remove */ public synchronized void removeStateInterrogation(StateInterrogation si) { List newList = new ArrayList(stateInterrogations); newList.remove(si); stateInterrogations = newList; } /** * Return an Iterator over all StateInterrogation instances. * Synchronize to avoid add/remove/iterate conflicts. * @return an Iterator over all StateInterrogation instances. */ private synchronized Iterator getStateInterrogationIterator() { return stateInterrogations.iterator(); } /** * Mark a non-binary-compatible instance dirty. Delegate to all * registered StateInterrogation instances until one of them * handles the call. * @param pc the instance to mark dirty * @param fieldName the field to mark dirty */ public void nonBinaryCompatibleMakeDirty(Object pc, String fieldName) { Iterator sit = getStateInterrogationIterator(); while (sit.hasNext()) { StateInterrogation si = (StateInterrogation)sit.next(); try { if (si.makeDirty(pc, fieldName)) return; } catch (Throwable t) { continue; // ignore exceptions from errant StateInterrogations } } } /** * Determine the state of a non-binary-compatible instance. * Delegate to all registered StateInterrogation instances until * one of them handles the call (returns a non-null Boolean * with the answer). * The caller provides the stateless "method object" that does * the actual call to the StateInterrogation instance. * @param pc the instance to be checked * @param sibr the method object that delegates to the * non-binary-compatible implementation * @return Boolean.TRUE if the instance satisfies the state interrogation; * Boolean.FALSE if the instance does not satisfy the interrogation; * or null if the implementation does not manage the class of the instance */ public boolean nonBinaryCompatibleIs(Object pc, StateInterrogationBooleanReturn sibr) { Iterator sit = getStateInterrogationIterator(); while (sit.hasNext()) { StateInterrogation si = (StateInterrogation)sit.next(); Boolean result; try { result = sibr.is(pc, si); } catch (Throwable t) { continue; // ignore exceptions from errant StateInterrogations } if (result != null) return result.booleanValue(); } return false; } /** * Return an object associated with a non-binary-compatible instance. * Delegate to all registered StateInterrogation instances until * one of them handles the call (returns a non-null answer). * The caller provides the stateless "method object" that does * the actual call to the StateInterrogation instance. * @param pc the instance whose associated object is needed * @param sibr the method object that delegates to the * non-binary-compatible implementation * @return the associated object or null if the implementation does not * manage the class of the instance */ public Object nonBinaryCompatibleGet(Object pc, StateInterrogationObjectReturn sibr) { Iterator sit = getStateInterrogationIterator(); while (sit.hasNext()) { StateInterrogation si = (StateInterrogation)sit.next(); Object result; try { result = sibr.get(pc, si); } catch (Throwable t) { continue; // ignore exceptions from errant StateInterrogations } if (result != null) return result; } return null; } /** This is an interface used to interrogate the state of an instance * that does not implement PersistenceCapable. It is used for the * methods that return a boolean value. */ public static interface StateInterrogationBooleanReturn { /** * Interrogate the state of the instance * @param pc the instance * @param si the method object * @return the state of the instance or null */ public Boolean is(Object pc, StateInterrogation si); } /** This is an interface used to interrogate the state of an instance * that does not implement PersistenceCapable. It is used for the * methods that return an Object value. */ public static interface StateInterrogationObjectReturn { /** * Return the associated instance. * @param pc the instance * @param si the method object * @return the associated object or null */ public Object get(Object pc, StateInterrogation si); } } jdo2-api-2.2/src/java/javax/jdo/spi/JDOPermission.java100644 0 0 12373 11073716464 17670 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.spi; /** * The JDOPermission class is for operations that are reserved for * JDO implementations and should not be called by other code. A * JDOPermission is a named permission and has no * actions. There are two names currently defined. Each named permission * has a corresponding public static final field which contains an instance * of the named permission. *

* The following table * provides a summary description of what each named permission allows, * and discusses the risks of granting code the permission. *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
setStateManagerThis allows setting the StateManager for an instance of * PersistenceCapable. The StateManager * has unlimited access to get and set persistent and transactional fields of * the PersistenceCapable instance.This is dangerous in that information (possibly confidential) * normally unavailable would be accessible to malicious code.
getMetadataThis allows getting metadata for any PersistenceCapable * class that has registered with JDOImplHelper.This is dangerous in that metadata information (possibly confidential) * normally unavailable would be accessible to malicious code.
manageMetadataThis allows managing metadata for any PersistenceCapable * class that has registered with JDOImplHelper.This is dangerous in that metadata information (possibly confidential) * normally unavailable would be manageable (modifiable) by malicious code. *
closePersistenceManagerFactoryThis allows closing a PersistenceManagerFactory, * thereby releasing resources.This is dangerous in that resources bound to the * PersistenceManagerFactory would be releaseable by * malicious code.
* * @see java.security.Permission * @see java.security.BasicPermission * @see javax.jdo.spi.JDOImplHelper * @see javax.jdo.spi.PersistenceCapable * @version 1.0.2 */ public final class JDOPermission extends java.security.BasicPermission { /** * Constructs a JDOPermission with the specified name. * * @param name the name of the JDOPermission */ public JDOPermission(String name) { super(name); } /** * Constructs a JDOPermission with the specified name and * actions. The actions should be null; they are ignored. * This constructor exists for use by the Policy object * to instantiate new Permission objects. * * @param name the name of the JDOPermission * @param actions should be null. */ public JDOPermission(String name, String actions) { super(name, actions); } /** An instance of JDOPermission to be used for * getMetadata permission checking. */ public final static JDOPermission GET_METADATA = new JDOPermission("getMetadata"); // NOI18N /** An instance of JDOPermission to be used for * manageMetadata permission checking. * @since 1.0.2 */ public final static JDOPermission MANAGE_METADATA = new JDOPermission("manageMetadata"); // NOI18N /** An instance of JDOPermission to be used for * setStateManager permission checking. */ public final static JDOPermission SET_STATE_MANAGER = new JDOPermission("setStateManager"); // NOI18N /** An instance of JDOPermission to be used for * closePersistenceManagerFactory permission checking. * @since 1.0.1 */ public final static JDOPermission CLOSE_PERSISTENCE_MANAGER_FACTORY = new JDOPermission("closePersistenceManagerFactory"); // NOI18N } jdo2-api-2.2/src/java/javax/jdo/spi/package.html100644 0 0 4442 11073716465 16600 0ustar 0 0 JDO Service Provider Interface package

This package contains the interfaces and classes used by JDO implementations.

JDO defines interfaces and classes to be used by application programmers when using classes whose instances are to be stored in persistent storage (persistence-capable classes), and specifies the contracts between suppliers of persistence-capable classes and the runtime environment (which is part of the JDO implementation).

The PersistenceCapable interface is implemented by all classes whose instances are to be made persistent. The implementation might be done by a combination of techniques, as determined by the JDO vendor:

  • Pre-processing .java files
  • Post-processing .class files
  • Generating .java or .class files directly from an abstraction
The StateManager interface is the implementation's contact point with the PersistenceCapable instances. It defines methods that are called by the PersistenceCapable instances to implement the required PersistenceCapable behavior for persistent and transactional instances.

The JDOPermission class is used to manage security controls on JDO implementations.

The RegisterClassEvent class and RegisterClassListener interface are used by JDO implementations that need access to metadata of PersistenceCapable classes.

The JDOImplHelper class contains helper methods for JDO implementations. jdo2-api-2.2/src/java/javax/jdo/spi/PersistenceCapable.java100644 0 0 65742 11073716465 20750 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.spi; import javax.jdo.PersistenceManager; /** * A class that can be managed by a binary-compatible JDO implementation * must implement this interface. * *

This interface defines methods that allow the implementation to manage * the instances. It also defines 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, object identity, and version if it has one. * *

In the Reference Implementation, the JDO Enhancer modifies the class * to implement PersistenceCapable prior to loading the class into the runtime * environment. The Reference Enhancer also adds code to implement the * methods defined by PersistenceCapable. * *

The extra methods in the PersistenceCapable interface might be generated * by pre-processing a .java file, or might be generated from a tool directly. * The exact technique for generating the extra methods is not specified by * JDO. * *

The PersistenceCapable interface is designed to avoid name conflicts * in the scope of user-defined classes. All of its declared method * names are prefixed with 'jdo'. * @version 2.0 */ public interface PersistenceCapable { /** If jdoFlags is set to READ_WRITE_OK, then the fields in the default fetch group * can be accessed for read or write without notifying the StateManager. */ static final byte READ_WRITE_OK = 0; /** If jdoFlags is set to LOAD_REQUIRED, then the fields in the default fetch group * cannot be accessed for read or write without notifying the StateManager. */ static final byte LOAD_REQUIRED = 1; /** If jdoFlags is set to READ_OK, then the fields in the default fetch group * can be accessed for read without notifying the StateManager. */ static final byte READ_OK = -1; /** If jdoFieldFlags for a field includes CHECK_READ, then * the field has been enhanced to call the jdoStateManager on read * if the jdoFlags setting is not READ_OK or READ_WRITE_OK. */ static final byte CHECK_READ = 1; /** If jdoFieldFlags for a field includes MEDIATE_READ, then * the field has been enhanced to always call the jdoStateManager * on all reads. */ static final byte MEDIATE_READ = 2; /** If jdoFieldFlags for a field includes CHECK_WRITE, * then the field has been enhanced to call the * jdoStateManager on write if the jdoFlags setting is not * READ_WRITE_OK;. */ static final byte CHECK_WRITE = 4; /** If jdoFieldFlags for a field includes MEDIATE_WRITE, then * the field has been enhanced to always call the jdoStateManager * on all writes. */ static final byte MEDIATE_WRITE = 8; /** If jdoFieldFlags for a field includes SERIALIZABLE, * then the field is not declared as TRANSIENT. */ static final byte SERIALIZABLE = 16; /** Return the associated PersistenceManager if there is one. * Transactional and persistent instances return the associated * PersistenceManager. * *

Transient non-transactional instances return null. *

This method always delegates to the StateManager if it is non-null. * @return the PersistenceManager associated with this instance. */ PersistenceManager jdoGetPersistenceManager(); /** This method sets the StateManager instance that manages the state * of this instance. This method is normally used by the StateManager * during the process of making an instance persistent, transient, * or transactional. * * The caller of this method must have JDOPermission for the instance, * if the instance is not already owned by a StateManager. * If the parameter is null, and the StateManager approves the change, * then the jdoFlags field will be reset to READ_WRITE_OK. * If the parameter is not null, and the security manager approves * the change, then the jdoFlags field will be reset to LOAD_REQUIRED. * @param sm The StateManager which will own this instance, or null * to reset the instance to transient state * @throws SecurityException if the caller does not have JDOPermission * @see JDOPermission */ void jdoReplaceStateManager(StateManager sm) throws SecurityException; /** The owning StateManager uses this method to ask the instance to * provide the value of the single field identified by fieldNumber. * @param fieldNumber the field whose value is to be provided by * a callback to the StateManager's * providedXXXField method */ void jdoProvideField(int fieldNumber); /** The owning StateManager uses this method to ask the instance to * provide the values of the multiple fields identified by fieldNumbers. * @param fieldNumbers the fields whose values are to be provided by * multiple callbacks to the StateManager's * providedXXXField method */ void jdoProvideFields(int[] fieldNumbers); /** The owning StateManager uses this method to ask the instance to * replace the value of the single field identified by number. * @param fieldNumber the field whose value is to be replaced by * a callback to the StateManager's * replacingXXXField method */ void jdoReplaceField(int fieldNumber); /** The owning StateManager uses this method to ask the instance to * replace the values of the multiple fields identified by number. * @param fieldNumbers the fields whose values are to be replaced by * multiple callbacks to the StateManager's * replacingXXXField method */ void jdoReplaceFields(int[] fieldNumbers); /** The owning StateManager uses this method to ask the instance to * replace the value of the flags by calling back the StateManager * replacingFlags method. */ void jdoReplaceFlags(); /** Copy field values from another instance of the same class * to this instance. *

This method will throw an exception if the other instance is * not managed by the same StateManager as this instance. * @param other the PC instance from which field values are to be copied * @param fieldNumbers the field numbers to be copied into this instance */ void jdoCopyFields(Object other, int[] fieldNumbers); /** Explicitly mark this instance and this 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. * *

The field name should be the fully qualified name, including package * name and class name of the class declaring the field. This allows * unambiguous identification of the field to be marked dirty. * If multiple classes declare the same field, and * if the package and class name are not provided by the parameter in * this API, then the field marked * dirty is the field declared by the most derived class. *

Transient instances ignore this method. *

* @param fieldName the name of the field to be marked dirty. */ void jdoMakeDirty(String fieldName); /** Return a copy of the JDO identity associated with this 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 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. *

If the JDO identity is being changed in the transaction, this method * returns the object id as of the beginning of the current transaction. * * @see PersistenceManager#getObjectId(Object pc) * @see PersistenceManager#getObjectById(Object oid, boolean validate) * @return a copy of the ObjectId of this instance as of the beginning of the transaction. */ Object jdoGetObjectId(); /** Return a copy of the JDO identity associated with this instance. * This method is the same as jdoGetObjectId if the identity of the * instance has not changed in the current transaction. *

If the JDO identity is being changed in the transaction, this method * returns the current object id as modified in the current transaction. * * @see #jdoGetObjectId() * @see PersistenceManager#getObjectId(Object pc) * @see PersistenceManager#getObjectById(Object oid, boolean validate) * @return a copy of the ObjectId of this instance as modified in the transaction. */ Object jdoGetTransactionalObjectId(); /** Return the version of this instance. * @return the version * @since 2.0 */ Object jdoGetVersion(); /** Tests whether this object is dirty. * * Instances that have been modified, deleted, or newly * made persistent in the current transaction return true. * *

Transient instances return false. *

* @see javax.jdo.JDOHelper#isDirty(Object pc) * @see javax.jdo.JDOHelper#makeDirty(Object pc, String fieldName) * @see #jdoMakeDirty(String fieldName) * @return true if this instance has been modified in the current transaction. */ boolean jdoIsDirty(); /** Tests whether this object is transactional. * * Instances whose state is associated with the current transaction * return true. * *

Transient instances return false. *

* @see javax.jdo.JDOHelper#isTransactional(Object pc) * @see PersistenceManager#makeTransactional(Object pc) * @return true if this instance is transactional. */ boolean jdoIsTransactional(); /** Tests whether this object is persistent. * Instances that represent persistent objects in the data store * return true. * @see javax.jdo.JDOHelper#isPersistent(Object pc) * @see PersistenceManager#makePersistent(Object pc) * @return true if this instance is persistent. */ boolean jdoIsPersistent(); /** Tests whether this object has been newly made persistent. * * Instances that have been made persistent in the current transaction * return true. * *

Transient instances return false. *

* @see javax.jdo.JDOHelper#isNew(Object pc) * @see PersistenceManager#makePersistent(Object pc) * @return true if this instance was made persistent * in the current transaction. */ boolean jdoIsNew(); /** Tests whether this object has been deleted. * * Instances that have been deleted in the current transaction return true. * *

Transient instances return false. *

* @see javax.jdo.JDOHelper#isDeleted(Object pc) * @see PersistenceManager#deletePersistent(Object pc) * @return true if this instance was deleted * in the current transaction. */ boolean jdoIsDeleted(); /** Tests whether this object has been detached. * * Instances that have been detached return true. * *

Transient instances return false. *

* @see javax.jdo.JDOHelper#isDetached(Object pc) * @return true if this instance is detached. * @since 2.0 */ boolean jdoIsDetached(); /** Return a new instance of this class, with the jdoStateManager set to the * parameter, and jdoFlags set to LOAD_REQUIRED. *

This method is used as a performance optimization as an alternative to * using reflection to construct a new instance. It is used by the * JDOImplHelper class method newInstance. * @return a new instance of this class. * @see JDOImplHelper#newInstance(Class pcClass, StateManager sm) * @param sm the StateManager that will own the new instance. */ PersistenceCapable jdoNewInstance(StateManager sm); /** Return a new instance of this class, with the jdoStateManager set to the * parameter, key fields initialized to the values in the oid, and jdoFlags * set to LOAD_REQUIRED. *

This method is used as a performance optimization as an alternative to * using reflection to construct a new instance of a class that uses * application identity. It is used by the * JDOImplHelper class method newInstance. * @return a new instance of this class. * @see JDOImplHelper#newInstance(Class pcClass, StateManager sm) * @param sm the StateManager that will own the new instance. * @param oid an instance of the object id class (application identity). */ PersistenceCapable jdoNewInstance(StateManager sm, Object oid); /** Create a new instance of the * ObjectId class for this PersistenceCapable class and initialize * the key fields from the instance on which this method is called. * This method creates a new instance of the class used for JDO identity. * It is intended only for application identity. If the class has been * enhanced for datastore identity, or if the class is abstract, * null is returned. *

For classes using single field identity, this method must be called * on an instance of a persistence-capable class with its primary key * field initialized (not null), or a * JDONullIdentityException is thrown. *

The instance returned is initialized with the value(s) of the * primary key field(s) of the instance on which the method is called. * @return the new instance created. */ Object jdoNewObjectIdInstance(); /** Create a new instance of the class used for JDO identity, using the * key constructor of the object id class. It is intended for single * field identity. The identity * instance returned has no relationship with the values of the primary key * fields of the persistence-capable instance on which the method is called. * If the key is the wrong class for the object id class, null is returned. *

For classes that use single field identity, if the parameter is * of one of the following types, the behavior must be as specified: *

  • Number or Character: the * parameter must be the single field * type or the wrapper class of the primitive field type; the parameter * is passed to the single field identity constructor *
  • ObjectIdFieldSupplier: the field value * is fetched from the ObjectIdFieldSupplier and passed to the * single field identity constructor *
  • String: the String is passed to the * single field identity constructor *
* @return the new instance created. * @param o the object identity constructor parameter * @since 2.0 */ Object jdoNewObjectIdInstance(Object o); /** Copy fields from this PersistenceCapable instance to the Object Id * instance. For classes using single field identity, this method always * throws JDOUserException. * @param oid the ObjectId target of the key fields */ void jdoCopyKeyFieldsToObjectId(Object oid); /** Copy fields from an outside source to the key fields in the ObjectId. * This method is generated in the PersistenceCapable * class to generate * a call to the field manager for each key field in the ObjectId. For * example, an ObjectId class that has three key fields (int id, * String name, and Float salary) would have the method generated: * *

void jdoCopyKeyFieldsToObjectId *

(ObjectIdFieldSupplier fm, Object objectId) { *

EmployeeKey oid = (EmployeeKey)objectId; *

oid.id = fm.fetchIntField (0); *

oid.name = fm.fetchStringField (1); *

oid.salary = fm.fetchObjectField (2); *

} * *

The implementation is responsible for implementing the * ObjectIdFieldSupplier to produce the values * for the key fields. *

For classes using single field identity, this method always * throws JDOUserException. * @param oid the ObjectId target of the copy. * @param fm the field supplier that supplies the field values. */ void jdoCopyKeyFieldsToObjectId(ObjectIdFieldSupplier fm, Object oid); /** Copy fields to an outside consumer from the key fields in the ObjectId. * This method is generated in the PersistenceCapable * class to generate * a call to the field manager for each key field in the ObjectId. For * example, an ObjectId class that has three key fields (int id, * String name, and Float salary) would have the method generated: * *

void copyKeyFieldsFromObjectId *

(ObjectIdFieldConsumer fm, Object objectId) { *

EmployeeKey oid = (EmployeeKey)objectId; *

fm.storeIntField (0, oid.id); *

fm.storeStringField (1, oid.name); *

fm.storeObjectField (2, oid.salary); *

} * *

The implementation is responsible for implementing the * ObjectIdFieldConsumer to store the values for the * key fields. * @param oid the ObjectId source of the copy. * @param fm the field manager that receives the field values. */ void jdoCopyKeyFieldsFromObjectId(ObjectIdFieldConsumer fm, Object oid); /** This interface is a convenience interface that allows an instance to * implement both ObjectIdFieldSupplier and * ObjectIdFieldConsumer. */ static interface ObjectIdFieldManager extends ObjectIdFieldConsumer, ObjectIdFieldSupplier {} /** This interface is used to provide fields to the Object id instance. It is used * by the method copyKeyFieldsToObjectId. When the method is called, the * generated code calls the instance of ObjectIdFieldManager for each field in * the object id. */ static interface ObjectIdFieldSupplier { /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ boolean fetchBooleanField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ char fetchCharField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ byte fetchByteField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ short fetchShortField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ int fetchIntField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ long fetchLongField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ float fetchFloatField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ double fetchDoubleField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ String fetchStringField(int fieldNumber); /** Fetch one field from the field manager. This field will be stored in the * proper field of the ObjectId. * @param fieldNumber the field number of the key field. * @return the value of the field to be stored into the ObjectId. */ Object fetchObjectField(int fieldNumber); } /** This interface is used to store fields from the Object id instance. It is used * by the method copyKeyFieldsFromObjectId. When the method is called, the * generated code calls the instance of ObjectIdFieldManager for each field in * the object id. */ static interface ObjectIdFieldConsumer { /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeBooleanField(int fieldNumber, boolean value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeCharField(int fieldNumber, char value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeByteField(int fieldNumber, byte value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeShortField(int fieldNumber, short value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeIntField(int fieldNumber, int value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeLongField(int fieldNumber, long value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeFloatField(int fieldNumber, float value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeDoubleField(int fieldNumber, double value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeStringField(int fieldNumber, String value); /** Store one field into the field manager. This field was retrieved from * the field of the ObjectId. * @param fieldNumber the field number of the key field. * @param value the value of the field from the ObjectId. */ void storeObjectField(int fieldNumber, Object value); } } jdo2-api-2.2/src/java/javax/jdo/spi/RegisterClassEvent.java100644 0 0 7513 11073716465 20740 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * RegisterClassEvent.java * */ package javax.jdo.spi; import java.util.EventObject; /** * A RegisterClassEvent event gets delivered whenever a persistence-capable * class registers itself with the JDOImplHelper. * * @version 1.0 */ public class RegisterClassEvent extends EventObject { /** The class object of the registered persistence-capable class */ protected Class pcClass; /** The names of managed fields of the persistence-capable class */ protected String[] fieldNames; /** The types of managed fields of the persistence-capable class */ protected Class[] fieldTypes; /** The flags of managed fields of the persistence-capable class */ protected byte[] fieldFlags; /** */ protected Class persistenceCapableSuperclass; /** * Constructs a new RegisterClassEvent. * @param helper the JDOImplHelper instance * @param registeredClass the persistence-capable class * @param fieldNames the names of the managed fields * @param fieldTypes the types of the managed fields * @param fieldFlags the flags of the managed fields * @param persistenceCapableSuperclass the persistence-capable superclass **/ public RegisterClassEvent(JDOImplHelper helper, Class registeredClass, String[] fieldNames, Class[] fieldTypes, byte[] fieldFlags, Class persistenceCapableSuperclass) { super(helper); this.pcClass = registeredClass; this.fieldNames = fieldNames; this.fieldTypes = fieldTypes; this.fieldFlags = fieldFlags; this.persistenceCapableSuperclass = persistenceCapableSuperclass; } /** * Returns the class object of the registered persistence-capable class. * @return the persistence-capable class. */ public Class getRegisteredClass() { return pcClass; } /** * Returns the names of the managed field of the persistence-capable class. * @return the names of the managed fields */ public String[] getFieldNames() { return fieldNames; } /** * Returns the types of the managed field of the persistence-capable class. * @return the types of the managed fields */ public Class[] getFieldTypes() { return fieldTypes; } /** * Returns the flags of the managed field of the persistence-capable class. * @return the flags of the managed fields */ public byte[] getFieldFlags() { return fieldFlags; } /** * Returns the class object of the persistence-capable superclass. * @return the persistence-capable superclass. */ public Class getPersistenceCapableSuperclass() { return persistenceCapableSuperclass; } } jdo2-api-2.2/src/java/javax/jdo/spi/RegisterClassListener.java100644 0 0 3105 11073716464 21434 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * RegisterClassListener.java * */ package javax.jdo.spi; import java.util.EventListener; /** * A "RegisterClassEvent" event gets fired whenever a persistence-capable class * is loaded and gets registered with the JDOImplHelper. You can register a * RegisterClassListener so as to be notified of any registration of a * persistence-capable class. * * @version 1.0 */ public interface RegisterClassListener extends EventListener { /** * This method gets called when a persistence-capable class is registered. * @param event a RegisterClassEvent instance describing the registered * class plus metadata. */ public void registerClass(RegisterClassEvent event); } jdo2-api-2.2/src/java/javax/jdo/spi/StateInterrogation.java100644 0 0 24340 11073716464 21025 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * StateInterrogation.java * */ package javax.jdo.spi; import javax.jdo.PersistenceManager; /** * This interface is implemented by a non-binary-compatible JDO implementation * to provide state interrogation for non-enhanced persistent classes. * *

A call to JDOHelper to get the status of an instance is handled * internally if the parameter instance implements PersistenceCapable. * For non-binary-compatible implementations, there is no requirement * that persistent instances implement PersistenceCapable. Therefore, * if the parameter does not implement PersistenceCapable, JDOHelper * delegates to all registered instances of StateInterrogation until * an instance can handle the request. *

For JDOHelper isXXX methods, which return boolean, the * corresponding method in StateInterrogation returns Boolean. If the * return value is null then the StateInterrogation does * not recognize the parameter as being handled by it. A non-null return * value indicates that the implementation has determined the answer. *

For JDOHelper getXXX methods, which return an Object, each * registered StateInterrogation is given the parameter until one of * them returns a non-null value, which is passed to the caller. *

For JDOHelper makeDirty, each * registered StateInterrogation is given the parameter until one of * them returns true, indicating that it has handled the call. * An instance that implements this interface must be registered with the * {@link JDOImplHelper}. * @version 2.0 * @since 2.0 */ public interface StateInterrogation { /** Tests whether the parameter instance is persistent. * * Instances that represent persistent objects in the data store * return Boolean.TRUE. * *

Instances known by the implementation to be non-persistent * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsPersistent() * @param pc the instance. * @return Boolean.TRUE if the parameter instance is persistent. */ Boolean isPersistent (Object pc); /** Tests whether the parameter instance is transactional. * * Instances whose state is associated with the current transaction * return Boolean.TRUE. * *

Instances known by the implementation to be non-transactional * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see PersistenceCapable#jdoIsTransactional() * @param pc the instance. * @return Boolean.TRUE if the parameter instance is transactional. */ Boolean isTransactional (Object pc); /** Tests whether the parameter instance is dirty. * * Instances that have been modified, deleted, newly * made persistent in the current transaction, * or modified while detached return Boolean.TRUE. * *

Instances known by the implementation to be non-dirty * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see StateManager#makeDirty(PersistenceCapable pc, String fieldName) * @see PersistenceCapable#jdoIsDirty() * @param pc the instance. * @return Boolean.TRUE if the parameter instance has been modified * in the current transaction, or while detached. */ Boolean isDirty (Object pc); /** Tests whether the parameter instance has been newly made persistent. * * Instances that have been made persistent in the current transaction * return Boolean.TRUE. * *

Instances known by the implementation to be non-new * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see PersistenceManager#makePersistent(Object pc) * @see PersistenceCapable#jdoIsNew() * @param pc the instance. * @return Boolean.TRUE if the parameter instance was made persistent * in the current transaction. */ Boolean isNew (Object pc); /** Tests whether the parameter instance has been deleted. * * Instances that have been deleted in the current transaction * return Boolean.TRUE. * *

Instances known by the implementation to be non-deleted * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see PersistenceManager#deletePersistent(Object pc) * @see PersistenceCapable#jdoIsDeleted() * @param pc the instance. * @return Boolean.TRUE if the parameter instance was deleted * in the current transaction. */ Boolean isDeleted (Object pc); /** Tests whether the parameter instance is detached. * * Instances that are detached return Boolean.TRUE. * *

Instances known by the implementation to be non-detached * return Boolean.FALSE. * *

Instances not recognized by the implementation return * null. * * @see PersistenceManager#detachCopy(Object pc) * @see PersistenceCapable#jdoIsDeleted() * @param pc the instance. * @return Boolean.TRUE if the parameter instance is detached. */ Boolean isDetached (Object pc); /** Return the associated PersistenceManager if there is one. * Transactional and persistent instances return the associated * PersistenceManager. * *

Transient non-transactional instances return null. *

Instances unknown by the implementation return null. * @see PersistenceCapable#jdoGetPersistenceManager() * @param pc the instance. * @return the PersistenceManager associated with the * parameter instance. */ PersistenceManager getPersistenceManager (Object 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. * *

Instances unknown by the implementation 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 instance. * @return a copy of the ObjectId of the parameter instance as of the * beginning of the transaction. */ Object getObjectId (Object pc); /** Return a copy of the JDO identity associated with the parameter * instance. * *

Instances unknown by the implementation return null. * @see PersistenceCapable#jdoGetTransactionalObjectId() * @see PersistenceManager#getObjectById(Object oid, boolean validate) * @param pc the instance. * @return a copy of the ObjectId of the parameter instance as modified * in this transaction. */ Object getTransactionalObjectId (Object pc); /** Return the version of the parameter instance. * *

Instances unknown by the implementation return null. * @see PersistenceCapable#jdoGetVersion() * @param pc the instance. * @return a copy of the ObjectId of the parameter instance as modified * in this transaction. */ Object getVersion (Object 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. * *

Instances unknown by the implementation are unaffected. * @see PersistenceCapable#jdoMakeDirty(String fieldName) * @param pc the instance. * @param fieldName the name of the field to be marked dirty. */ boolean makeDirty (Object pc, String fieldName); } jdo2-api-2.2/src/java/javax/jdo/spi/StateManager.java100644 0 0 55742 11073716464 17565 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package javax.jdo.spi; import javax.jdo.PersistenceManager; /** This interface is the point of contact between managed instances of * PersistenceCapable classes and the JDO implementation. It * contains the methods used by PersistenceCapable instances to * delegate behavior to the JDO implementation. *

Each managed PersistenceCapable instance contains a reference * to a StateManager. A StateManager might manage one * or multiple instances of PersistenceCapable instances, at the * choice of the implementation. * * @version 2.0 * */ public interface StateManager { /** The owning StateManager uses this method to supply the * value of the flags to the PersistenceCapable instance. * @param pc the calling PersistenceCapable instance * @return the value of jdoFlags to be stored in the * PersistenceCapable instance */ byte replacingFlags(PersistenceCapable pc); /** Replace the current value of jdoStateManager. *

* This method is called by the PersistenceCapable whenever * jdoReplaceStateManager is called and there is already * an owning StateManager. This is a security precaution * to ensure that the owning StateManager is the only * source of any change to its reference in the * PersistenceCapable. * @return the new value for the jdoStateManager * @param pc the calling PersistenceCapable instance * @param sm the proposed new value for the jdoStateManager */ StateManager replacingStateManager (PersistenceCapable pc, StateManager sm); /** Tests whether this object is dirty. * * Instances that have been modified, deleted, or newly * made persistent in the current transaction return true. * *

Transient nontransactional instances return false. *

* @see PersistenceCapable#jdoMakeDirty(String fieldName) * @param pc the calling PersistenceCapable instance * @return true if this instance has been modified in the * current transaction. */ boolean isDirty(PersistenceCapable pc); /** Tests whether this object is transactional. * * Instances that respect transaction boundaries return true. * These instances include transient instances made transactional as a * result of being the target of a makeTransactional method * call; newly made persistent or deleted persistent instances; persistent * instances read in data store transactions; and persistent instances * modified in optimistic transactions. * *

Transient nontransactional instances return false. *

* @param pc the calling PersistenceCapable instance * @return true if this instance is transactional. */ boolean isTransactional(PersistenceCapable pc); /** Tests whether this object is persistent. * * Instances whose state is stored in the data store return * true. * *

Transient instances return false. *

* @see PersistenceManager#makePersistent(Object pc) * @param pc the calling PersistenceCapable instance * @return true if this instance is persistent. */ boolean isPersistent(PersistenceCapable pc); /** Tests whether this object has been newly made persistent. * * Instances that have been made persistent in the current transaction * return true. * *

Transient instances return false. *

* @see PersistenceManager#makePersistent(Object pc) * @param pc the calling PersistenceCapable instance * @return true if this instance was made persistent * in the current transaction. */ boolean isNew(PersistenceCapable pc); /** Tests whether this object has been deleted. * * Instances that have been deleted in the current transaction return * true. * *

Transient instances return false. *

* @see PersistenceManager#deletePersistent(Object pc) * @param pc the calling PersistenceCapable instance * @return true if this instance was deleted * in the current transaction. */ boolean isDeleted(PersistenceCapable pc); /** Return the PersistenceManager that owns this instance. * @param pc the calling PersistenceCapable instance * @return the PersistenceManager that owns this instance */ PersistenceManager getPersistenceManager (PersistenceCapable pc); /** Mark the associated PersistenceCapable field dirty. *

The StateManager will make a copy of the field * so it can be restored if needed later, and then mark * the field as modified in the current transaction. * @param pc the calling PersistenceCapable instance * @param fieldName the name of the field */ void makeDirty (PersistenceCapable pc, String fieldName); /** Return the object representing the JDO identity * of the calling instance. If the JDO identity is being changed in * the current transaction, this method returns the identity as of * the beginning of the transaction. * @param pc the calling PersistenceCapable instance * @return the object representing the JDO identity of the calling instance */ Object getObjectId (PersistenceCapable pc); /** Return the object representing the JDO identity * of the calling instance. If the JDO identity is being changed in * the current transaction, this method returns the current identity as * changed in the transaction. * @param pc the calling PersistenceCapable instance * @return the object representing the JDO identity of the calling instance */ Object getTransactionalObjectId (PersistenceCapable pc); /** Return the object representing the version * of the calling instance. * @param pc the calling PersistenceCapable instance * @return the object representing the version of the calling instance * @since 2.0 */ Object getVersion (PersistenceCapable pc); /** Return true if the field is cached in the calling * instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return whether the field is cached in the calling instance */ boolean isLoaded (PersistenceCapable pc, int field); /** Guarantee that the serializable transactional and persistent fields * are loaded into the instance. This method is called by the generated * jdoPreSerialize method prior to serialization of the * instance. * @param pc the calling PersistenceCapable instance */ void preSerialize (PersistenceCapable pc); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ boolean getBooleanField ( PersistenceCapable pc, int field, boolean currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ char getCharField (PersistenceCapable pc, int field, char currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ byte getByteField (PersistenceCapable pc, int field, byte currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ short getShortField (PersistenceCapable pc, int field, short currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ int getIntField (PersistenceCapable pc, int field, int currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ long getLongField (PersistenceCapable pc, int field, long currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ float getFloatField (PersistenceCapable pc, int field, float currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ double getDoubleField (PersistenceCapable pc, int field, double currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ String getStringField (PersistenceCapable pc, int field, String currentValue); /** Return the value for the field. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @return the new value for the field */ Object getObjectField (PersistenceCapable pc, int field, Object currentValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setBooleanField (PersistenceCapable pc, int field, boolean currentValue, boolean newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setCharField (PersistenceCapable pc, int field, char currentValue, char newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setByteField (PersistenceCapable pc, int field, byte currentValue, byte newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setShortField (PersistenceCapable pc, int field, short currentValue, short newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setIntField (PersistenceCapable pc, int field, int currentValue, int newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setLongField (PersistenceCapable pc, int field, long currentValue, long newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setFloatField (PersistenceCapable pc, int field, float currentValue, float newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setDoubleField (PersistenceCapable pc, int field, double currentValue, double newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setStringField (PersistenceCapable pc, int field, String currentValue, String newValue); /** Mark the field as modified by the user. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field * @param newValue the proposed new value of the field */ void setObjectField (PersistenceCapable pc, int field, Object currentValue, Object newValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedBooleanField (PersistenceCapable pc, int field, boolean currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedCharField (PersistenceCapable pc, int field, char currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedByteField (PersistenceCapable pc, int field, byte currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedShortField (PersistenceCapable pc, int field, short currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedIntField (PersistenceCapable pc, int field, int currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedLongField (PersistenceCapable pc, int field, long currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedFloatField (PersistenceCapable pc, int field, float currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedDoubleField (PersistenceCapable pc, int field, double currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedStringField (PersistenceCapable pc, int field, String currentValue); /** The value of the field requested to be provided to the * StateManager. * @param pc the calling PersistenceCapable instance * @param field the field number * @param currentValue the current value of the field */ void providedObjectField (PersistenceCapable pc, int field, Object currentValue); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ boolean replacingBooleanField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ char replacingCharField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ byte replacingByteField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ short replacingShortField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ int replacingIntField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ long replacingLongField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ float replacingFloatField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ double replacingDoubleField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ String replacingStringField (PersistenceCapable pc, int field); /** The replacement value of the field in the calling instance. * @param pc the calling PersistenceCapable instance * @param field the field number * @return the new value for the field */ Object replacingObjectField (PersistenceCapable pc, int field); /** The replacement value of the detached state in the calling instance. * @param pc the calling Detachable instance * @param state the current value of the detached state * @return the replacement value for the detached state * @since 2.0 */ Object[] replacingDetachedState (Detachable pc, Object[] state); } jdo2-api-2.2/src/java/javax/jdo/Transaction.java100644 0 0 23342 11073716465 16674 0ustar 0 0 /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Transaction.java * */ package javax.jdo; import javax.transaction.Synchronization; /** The JDO Transaction interface provides for initiation and * completion of transactions under user control. * It is a sub-interface of the {@link PersistenceManager} * that deals with options and transaction demarcation. *

Transaction options include whether optimistic concurrency * control should be used for the current transaction, whether instances * may hold values in the cache outside transactions, and whether * values should be retained in the cache after transaction completion. These * options are valid for both managed and non-managed transactions. * *

Transaction initiation and completion methods have similar semantics to * javax.transaction.UserTransaction when used outside a managed * environment. When used in a managed environment, transaction initiation * and completion methods may only be used with bean-managed transaction * semantics. * @version 2.2 */ public interface Transaction { /** Begin a transaction. The type of transaction is determined by the * setting of the Optimistic flag. * @see #setOptimistic * @see #getOptimistic * @throws JDOUserException if transactions are managed by a container * in the managed environment, or if the transaction is already active. */ void begin(); /** Commit the current transaction. * @throws JDOUserException if transactions are managed by a container * in the managed environment, or if the transaction is not active. */ void commit(); /** Roll back the current transaction. * @throws JDOUserException if transactions are managed by a container * in the managed environment, or if the transaction is not active. */ void rollback(); /** Returns whether there is a transaction currently active. * @return true if the transaction is active. */ boolean isActive(); /** * Returns the rollback-only status of the transaction. When * begun, the rollback-only status is false. Either the * application or the JDO implementation may set this flag * using setRollbackOnly. * @return true if the transaction has been * marked for rollback. * @since 2.0 */ boolean getRollbackOnly(); /** * Sets the rollback-only status of the transaction to true. * After this flag is set to true, the transaction * can no longer be committed, and any attempt to commit the * transaction will throw JDOFatalDataStoreException. * @since 2.0 */ void setRollbackOnly(); /** If true, allow persistent instances to be read without * a transaction active. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param nontransactionalRead the value of the nontransactionalRead * property */ void setNontransactionalRead (boolean nontransactionalRead); /** If true, allows persistent instances to be read without * a transaction active. * @return the value of the nontransactionalRead property */ boolean getNontransactionalRead (); /** If true, allow persistent instances to be written without * a transaction active. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param nontransactionalWrite the value of the nontransactionalRead * property */ void setNontransactionalWrite (boolean nontransactionalWrite); /** If true, allows persistent instances to be written without * a transaction active. * @return the value of the nontransactionalWrite property */ boolean getNontransactionalWrite (); /** If true, at commit instances retain their values and the * instances transition to persistent-nontransactional. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param retainValues the value of the retainValues property */ void setRetainValues(boolean retainValues); /** If true, at commit time instances retain their field * values. * @return the value of the retainValues property */ boolean getRetainValues(); /** If true, at rollback, fields of newly persistent instances * are restored to * their values as of the beginning of the transaction, and the instances * revert to transient. Additionally, fields of modified * instances of primitive types and immutable reference types * are restored to their values as of the beginning of the * transaction. *

If false, at rollback, the values of fields of * newly persistent instances are unchanged and the instances revert to * transient. Additionally, dirty instances transition to hollow. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param restoreValues the value of the restoreValues property */ void setRestoreValues(boolean restoreValues); /** Return the current value of the restoreValues property. * @return the value of the restoreValues property */ boolean getRestoreValues(); /** Optimistic transactions do not hold data store locks until commit time. * If an implementation does not support this option, a * JDOUnsupportedOptionException is thrown. * @param optimistic the value of the Optimistic flag. */ void setOptimistic(boolean optimistic); /** Optimistic transactions do not hold data store locks until commit time. * @return the value of the Optimistic property. */ boolean getOptimistic(); /** Get the value for transaction isolation level for this transaction. * @return the transaction isolation level * @see #setIsolationLevel(String) * @since 2.2 */ String getIsolationLevel(); /** Set the value for transaction isolation level for this transaction. * Transaction isolation levels are defined in javax.jdo.Constants. * If the requested level is not available, but a higher level is * available, the higher level is silently used. * If the requested level is not available, and no higher level is * available, then JDOUnsupportedOptionException is thrown. * Five standard isolation levels are defined. Other isolation levels * might be supported by an implementation but are not standard. *

Standard values in order of low to high are: *

  • read-uncommitted *
  • read-committed *
  • repeatable-read *
  • snapshot *
  • serializable *
* @param level the transaction isolation level * @see #getIsolationLevel() * @see Constants#TX_READ_UNCOMMITTED * @see Constants#TX_READ_COMMITTED * @see Constants#TX_REPEATABLE_READ * @see Constants#TX_SNAPSHOT * @see Constants#TX_SERIALIZABLE * @since 2.2 */ void setIsolationLevel(String level); /** The user can specify a Synchronization instance to be * notified on transaction completions. The beforeCompletion * method is called prior to flushing instances to the data store. * *

The afterCompletion method is called after performing * state transitions of persistent and transactional instances, following * the data store commit or rollback operation. *

Only one Synchronization instance can be registered with * the Transaction. If the application requires more than one * instance to receive synchronization callbacks, then the single * application instance is responsible for managing them, and forwarding * callbacks to them. * @param sync the Synchronization instance to be notified; * null for none */ void setSynchronization(Synchronization sync); /** The user-specified Synchronization instance for this * Transaction instance. * @return the user-specified Synchronization instance. */ Synchronization getSynchronization(); /** The Transaction instance is always associated with exactly * one PersistenceManager. * * @return the PersistenceManager for this * Transaction instance */ PersistenceManager getPersistenceManager(); } jdo2-api-2.2/src/schema/javax/jdo/jdoconfig_2_1.dtd100644 0 0 5466 11073716465 17152 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoconfig_2_1.xsd100644 0 0 23443 11073716464 17207 0ustar 0 0 This is the XML Schema for the JDO configuration file. The root configuration element for JDO. Standard JDO PersistenceManagerFactory configuration properties. Vendor-specific properties are set using additional vendor-specific attributes and/or property elements. Vendor-specific properties. javax.jdo.listener.InstanceLifecycleListener instance configuration. There is one instance-lifecycle-listener element per listener instance. Only one instance of the listener class is supported in this configuration file. If multiple instances of the same listener class is required, then the API PersistenceManagerFactory.addInstanceLifecycleListener(...) must be used. If attribute "classes" is missing, all persistence-capable instances are observed, otherwise it is a comma- or whitespace-delimited list of persistence-capable classes whose instances' will be observed. These are attributes corresponding to the standard properties defined in JDO 2.1. Any other attributes present, if unrecognized by a JDO implementation, may be silently ignored. jdo2-api-2.2/src/schema/javax/jdo/jdoconfig_2_2.dtd100644 0 0 5637 11073716465 17153 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoconfig_2_2.xsd100644 0 0 20454 11073716464 17207 0ustar 0 0 This is the XML Schema for the JDO configuration file. The root configuration element for JDO. Standard JDO PersistenceManagerFactory configuration properties. Vendor-specific properties are set using additional vendor-specific attributes and/or property elements. Vendor-specific properties. javax.jdo.listener.InstanceLifecycleListener instance configuration. There is one instance-lifecycle-listener element per listener instance. Only one instance of the listener class is supported in this configuration file. If multiple instances of the same listener class is required, then the API PersistenceManagerFactory.addInstanceLifecycleListener(...) must be used. If attribute "classes" is missing, all persistence-capable instances are observed; otherwise it is a comma- or whitespace-delimited list of persistence-capable classes whose instances will be observed. These are attributes corresponding to the standard properties defined in JDO. Any other attributes present, if unrecognized by a JDO implementation, may be silently ignored. jdo2-api-2.2/src/schema/javax/jdo/jdoquery_2_0.dtd100644 0 0 3431 11073716465 17037 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoquery_2_0.xsd100644 0 0 12254 11073716464 17104 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoquery_2_1.xsd100644 0 0 11125 11073716464 17101 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoquery_2_2.dtd100644 0 0 3356 11073716464 17046 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdoquery_2_2.xsd100644 0 0 10741 11073716465 17106 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdo_2_0.dtd100644 0 0 26613 11073716465 16000 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdo_2_0.xsd100644 0 0 142557 11073716464 16050 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdo_2_1.xsd100644 0 0 145737 11073716464 16054 0ustar 0 0 Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - the choice of array, collection and map, - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - primary-key - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - discriminator Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of array, collection, and map - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - the choice of columns, fields and properties Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties jdo2-api-2.2/src/schema/javax/jdo/jdo_2_2.dtd100644 0 0 27111 11073716465 15774 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/jdo_2_2.xsd100644 0 0 146000 11073716464 16035 0ustar 0 0 Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - the choice of array, collection and map, - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - primary-key - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - discriminator Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of array, collection, and map - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - the choice of columns, fields and properties Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties jdo2-api-2.2/src/schema/javax/jdo/orm_2_0.dtd100644 0 0 20501 11073716464 16006 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/orm_2_0.xsd100644 0 0 104622 11073716465 16061 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/orm_2_1.xsd100644 0 0 107677 11073716465 16077 0ustar 0 0 Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - primary-key - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - discriminator Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - the choice of columns, fields and properties Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties jdo2-api-2.2/src/schema/javax/jdo/orm_2_2.dtd100644 0 0 20213 11073716465 16011 0ustar 0 0 jdo2-api-2.2/src/schema/javax/jdo/orm_2_2.xsd100644 0 0 106115 11073716465 16062 0ustar 0 0 Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - datastore-identity - primary-key - inheritance - version Please note, the following subelements must not occur more than once: - primary-key - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - discriminator Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - join - embedded - key - value - order - foreign-key - index - unique Please note, the following subelements must not occur more than once: - the choice of columns, fields and properties Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - embedded - foreign-key - index - unique Please note, the following subelements must not occur more than once: - index Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties Please note, the following subelements must not occur more than once: - the choice of columns, fields or properties LICENSE.txt100644 0 0 26450 11072775131 10063 0ustar 0 0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. NOTICE.txt100644 0 0 275 11072775131 7717 0ustar 0 0 Apache Java Data Objects (JDO) Copyright 2005-2006 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). project.properties100644 0 0 4611 11072775131 11777 0ustar 0 0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # maven.repo.remote=\ http://repo1.maven.org/maven,\ http://download.java.net/maven/1 # Current version number currentVersion = 2.2 # Make sure the compiled class still work with J2SE 1.3 maven.compile.source = 1.3 maven.compile.target = 1.3 # refer to LICENSE file in root directory maven.license.licenseFile = ${basedir}/../LICENSE.txt # checkstyle settings maven.checkstyle.properties = ${basedir}/../jdo_checks.xml maven.checkstyle.header.file = ${basedir}/../LICENSE.txt # changelog settings maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory # Set the javadoc title maven.javadoc.windowtitle = ${pom.name} ${pom.currentVersion} # project lists # please note, the project lists must not include blanks jdo11.projects=api11/project.xml,btree/project.xml,ri11/project.xml,tck11/project.xml jdo2.projects=api2/project.xml,api2-legacy/project.xml,util20/project.xml,model20/project.xml,enhancer20/project.xml,\ runtime20/project.xml,query20/project.xml,btree/project.xml,fostore20/project.xml,\ tck2/project.xml,tck2-legacy/project.xml tck2.projects=api2/project.xml,api2-legacy/project.xml,util20/project.xml,model20/project.xml,enhancer20/project.xml,tck2/project.xml,tck2-legacy/project.xml fostore20.projects=api2/project.xml,util20/project.xml,model20/project.xml,runtime20/project.xml,query20/project.xml,btree/project.xml,fostore20/project.xml,enhancer20/project.xml # release properties jdo.releases.dir = ${basedir.substring(0, basedir.lastIndexOf('jdo'))}jdo/releases jdo.releases.dist.dir = ${jdo.releases.dir}/${pom.currentVersion}/dist project.xml100644 0 0 12402 11072775131 10420 0ustar 0 0 3 Java Data Objects (JDO) Apache Software Foundation http://www.apache.org 2005 Java Data Objects (JDO) The Java Data Objects (JDO) API is a standard interface-based Java model abstraction of persistence, developed as Java Specification Requests (JSR 12 and 243) under the auspices of the Java Community Process. http://db.apache.org/jdo scm:svn:http://svn.apache.org/repos/asf/db/jdo/trunk scm:svn:https://svn.apache.org/repos/asf/db/jdo/trunk http://svn.apache.org/viewcvs.cgi/ help JDO User List jdo-user-subscribe@db.apache.org jdo-user-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-user/ JDO Developer List jdo-dev-subscribe@db.apache.org jdo-dev-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-dev/ JDO Commits List jdo-commits-subscribe@db.apache.org jdo-commits-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-commits/ Craig Russell clr Craig.Russell@Sun.COM -8 Sun Microsystems, Inc. Michael Bouschen mbo mbo.tech@spree.de Tech@Spree Engineering GmbH 1 Michael Watzek brazil mwa.tech@spree.de Tech@Spree Engineering GmbH 1 Michelle Caisse mcaisse Michelle.Caisse@Sun.COM Sun Microsystems, Inc. -8 Matthew Adams madams matthew.adams@xcalia.com -8 Xcalia Martin Zaun mzaun martin.zaun@Sun.COM -8 Sun Microsystems, Inc. Erik Bengtson ebengtson erik@jpox.org 1 JPOX Geir Magnusson, Jr. geirm geirm@apache.org -8 Apache.org Brian McCallister brianm brianm@apache.org -8 Apache.org Apache Java Data Objects (JDO) Copyright 2005-2006 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). project.properties100644 0 0 4611 11072775131 11777 0ustar 0 0 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # maven.repo.remote=\ http://repo1.maven.org/maven,\ http://download.java.net/maven/1 # Current version number currentVersion = 2.2 # Make sure the compiled class still work with J2SE 1.3 maven.compile.source = 1.3 maven.compile.target = 1.3 # refer to LICENSE file in root directory maven.license.licenseFile = ${basedir}/../LICENSE.txt # checkstyle settings maven.checkstyle.properties = ${basedir}/../jdo_checks.xml maven.checkstyle.header.file = ${basedir}/../LICENSE.txt # changelog settings maven.changelog.factory = org.apache.maven.svnlib.SvnChangeLogFactory # Set the javadoc title maven.javadoc.windowtitle = ${pom.name} ${pom.currentVersion} # project lists # please note, the project lists must not include blanks jdo11.projects=api11/project.xml,btree/project.xml,ri11/project.xml,tck11/project.xml jdo2.projects=api2/project.xml,api2-legacy/project.xml,util20/project.xml,model20/project.xml,enhancer20/project.xml,\ runtime20/project.xml,query20/project.xml,btree/project.xml,fostore20/project.xml,\ tck2/project.xml,tck2-legacy/project.xml tck2.projects=api2/project.xml,api2-legacy/project.xml,util20/project.xml,model20/project.xml,enhancer20/project.xml,tck2/project.xml,tck2-legacy/project.xml fostore20.projects=api2/project.xml,util20/project.xml,model20/project.xml,runtime20/project.xml,query20/project.xml,btree/project.xml,fostore20/project.xml,enhancer20/project.xml # release properties jdo.releases.dir = ${basedir.substring(0, basedir.lastIndexOf('jdo'))}jdo/releases jdo.releases.dist.dir = ${jdo.releases.dir}/${pom.currentVersion}/dist project.xml100644 0 0 12402 11072775131 10420 0ustar 0 0 3 Java Data Objects (JDO) Apache Software Foundation http://www.apache.org 2005 Java Data Objects (JDO) The Java Data Objects (JDO) API is a standard interface-based Java model abstraction of persistence, developed as Java Specification Requests (JSR 12 and 243) under the auspices of the Java Community Process. http://db.apache.org/jdo scm:svn:http://svn.apache.org/repos/asf/db/jdo/trunk scm:svn:https://svn.apache.org/repos/asf/db/jdo/trunk http://svn.apache.org/viewcvs.cgi/ help JDO User List jdo-user-subscribe@db.apache.org jdo-user-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-user/ JDO Developer List jdo-dev-subscribe@db.apache.org jdo-dev-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-dev/ JDO Commits List jdo-commits-subscribe@db.apache.org jdo-commits-unsubscribe@db.apache.org http://mail-archives.apache.org/mod_mbox/db-jdo-commits/ Craig Russell clr Craig.Russell@Sun.COM -8 Sun Microsystems, Inc. Michael Bouschen mbo mbo.tech@spree.de Tech@Spree Engineering GmbH 1 Michael Watzek brazil mwa.tech@spree.de Tech@Spree Engineering GmbH 1 Michelle Caisse mcaisse Michelle.Caisse@Sun.COM Sun Microsystems, Inc. -8 Matthew Adams madams matthew.adams@xcalia.com -8 Xcalia Martin Zaun mzaun martin.zaun@Sun.COM -8 Sun Microsystems, Inc. Erik Bengtson ebengtson erik@jpox.org 1 JPOX Geir Magnusson, Jr. geirm geirm@apache.org -8 Apache.org Brian McCallister brianm brianm@apache.org -8 Apache.org