db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r557821 - in /db/jdo/trunk/api2: src/java/javax/jdo/annotations/ test/java/javax/jdo/annotations/
Date Fri, 20 Jul 2007 00:12:14 GMT
Author: clr
Date: Thu Jul 19 17:12:10 2007
New Revision: 557821

URL: http://svn.apache.org/viewvc?view=rev&rev=557821
Log:
JDO-403 Added Embedded mappings for Element, Key, and Value
Added embeddedKey, embeddedValue, and embeddedElement to match xml embedded-xxx
Added properties to Unique and Index
Added Indexes as synonym for Indices

Added:
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java   (with props)
    db/jdo/trunk/api2/test/java/javax/jdo/annotations/
    db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java   (with props)
    db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java   (with props)
    db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java   (with props)
    db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java   (with props)
Modified:
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Element.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Field.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/ForeignKey.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Index.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Key.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Property.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Unique.java
    db/jdo/trunk/api2/src/java/javax/jdo/annotations/Value.java

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Element.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Element.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Element.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Element.java Thu Jul 19 17:12:10 2007
@@ -56,10 +56,10 @@
     String serialized() default "";
 
     /**
-     * Whether the element is to be stored embedded (into a join table).
-     * @return whether the element is to be stored embedded (into a join table)
+     * The embedded mapping for the element.
+     * @return the embedded mapping for the element
      */
-    String embedded() default "";
+    Embedded[] embedded() default {};
 
     /**
      * Whether the element is dependent on the owner, and will be deleted 

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Field.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Field.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Field.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Field.java Thu Jul 19 17:12:10 2007
@@ -57,6 +57,21 @@
      */
     String embedded() default "";
 
+    /** Whether the elements of this field are embedded. 
+     * @return whether the elements of this field are embedded
+     */
+    String embeddedElement() default "";
+
+    /** Whether the keys of this field are embedded. 
+     * @return whether the keys of this field are embedded
+     */
+    String embeddedKey() default "";
+
+    /** Whether the values of this field are embedded. 
+     * @return whether the values of this field are embedded
+     */
+    String embeddedValue() default "";
+
     /** Whether this field is serialised into a single column. 
      * @return whether this field is serialized into a single column
      */

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/ForeignKey.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/ForeignKey.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/ForeignKey.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/ForeignKey.java Thu Jul 19 17:12:10 2007
@@ -69,6 +69,11 @@
      */
     String[] fields() default {};
 
+    /** Property names that compose this foreign key.
+     * @return the property names that compose this foreign key
+     */
+    String[] properties() default {};
+
     /** Columns that comprise this foreign key.
      * @return the columns that comprise this foreign key
      */

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Index.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Index.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Index.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Index.java Thu Jul 19 17:12:10 2007
@@ -43,13 +43,20 @@
      */
     String table() default "";
 
-    /** Whether this index is unique 
+    /** Whether this index is unique
+     * @return whether this index is unique
      */
     String unique() default "";
 
-    /** Field names that comprise this index. 
+    /** Field names that compose this index.
+     * @return field names that compose this index
      */
     String[] fields() default {};
+
+    /** Property names that compose this index.
+     * @return property names that compose this index
+     */
+    String[] properties() default {};
 
     /** Columns that comprise this index. 
      */

Added: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java?view=auto&rev=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java (added)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java Thu Jul 19 17:12:10 2007
@@ -0,0 +1,39 @@
+/*
+ * 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 Indexes
+{
+    /**
+     * The indexes
+     * @return The indexes
+     */
+    Index[] value();
+}
\ No newline at end of file

Propchange: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Indexes.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Key.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Key.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Key.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Key.java Thu Jul 19 17:12:10 2007
@@ -56,11 +56,10 @@
     String serialized() default "";
 
     /**
-     * Whether the key is to be stored embedded (into one or several columns 
-     * of a join table).
-     * @return whether the key is to be stored embedded (into a join table)
+     * The embedded mapping for the key.
+     * @return the embedded mapping for the key
      */
-    String embedded() default "";
+    Embedded[] embedded() default {};
 
     /**
      * Whether the key is dependent on the owner (and will be deleted 

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Property.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Property.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Property.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Property.java Thu Jul 19 17:12:10 2007
@@ -57,7 +57,22 @@
      */
     String embedded() default "";
 
-    /** Whether this property is serialised into a single column. 
+    /** Whether the elements of this field are embedded. 
+     * @return whether the elements of this field are embedded
+     */
+    String embeddedElement() default "";
+
+    /** Whether the keys of this field are embedded. 
+     * @return whether the keys of this field are embedded
+     */
+    String embeddedKey() default "";
+
+    /** Whether the values of this field are embedded. 
+     * @return whether the values of this field are embedded
+     */
+    String embeddedValue() default "";
+
+    /** Whether this property is serialized into a single column. 
      * @return whether this property is serialized into a single column
      */
     String serialized() default "";

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Unique.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Unique.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Unique.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Unique.java Thu Jul 19 17:12:10 2007
@@ -54,6 +54,11 @@
      */
     String[] fields() default {};
 
+    /** Property names that compose this unique constraint.
+     * @return the property names that compose this unique constraint
+     */
+    String[] properties() default {};
+
     /** Columns that comprise this unique constraint.
      * @return columns that comprise this unique constraint
      */

Modified: db/jdo/trunk/api2/src/java/javax/jdo/annotations/Value.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/annotations/Value.java?view=diff&rev=557821&r1=557820&r2=557821
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/annotations/Value.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/annotations/Value.java Thu Jul 19 17:12:10 2007
@@ -55,11 +55,10 @@
     String serialized() default "";
 
     /**
-     * Whether the value is to be stored embedded (into one or several columns 
-     * of a join table).
-     * @return Whether the value is to be stored embedded (into a join table)
+     * The embedded mapping for the value.
+     * @return the embedded mapping for the value
      */
-    String embedded() default "";
+    Embedded[] embedded() default {};
 
     /**
      * Whether the value is dependent on the owner (and will be deleted 

Added: db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java?view=auto&rev=557821
==============================================================================
--- db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java (added)
+++ db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java Thu Jul 19 17:12:10 2007
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/*
+ * Line.java
+ *
+ * Created on July 18, 2007, 9:41 AM
+ *
+ */
+public class Line {
+    
+    /** Creates a new instance of Line */
+    public Line() {
+    }
+
+    Point point1;
+    Point point2;
+}

Propchange: db/jdo/trunk/api2/test/java/javax/jdo/annotations/Line.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java?view=auto&rev=557821
==============================================================================
--- db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java (added)
+++ db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java Thu Jul 19 17:12:10 2007
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+/*
+ * Point.java
+ *
+ * Created on July 18, 2007, 9:41 AM
+ *
+ */
+public class Point {
+    
+    /** Creates a new instance of Point */
+    public Point() {
+    }
+
+    int x;
+    Integer y;
+}

Propchange: db/jdo/trunk/api2/test/java/javax/jdo/annotations/Point.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java?view=auto&rev=557821
==============================================================================
--- db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java (added)
+++ db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java Thu Jul 19 17:12:10
2007
@@ -0,0 +1,60 @@
+/*
+ * 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.util.Map;
+
+/*
+ * TestEmbeddedMap.java
+ *
+ * Created on July 18, 2007, 10:16 AM
+ *
+ */
+public abstract class TestEmbeddedMap {
+    
+    /** Creates a new instance of TestEmbeddedMap */
+    public TestEmbeddedMap() {
+    }
+
+    @Field(table="INTEGER_LINES", embeddedKey="true", embeddedValue="true")
+    @Join(column="OWNER_FK")
+    @Key(column="INTEGER")
+    @Value(
+        embedded=@Embedded(
+            fields={
+                @Field(name="point1.x", column="POINT1_X"),
+                @Field(name="point1.y", column="POINT2_Y"),
+                @Field(name="point2.x", column="POINT2_X"),
+                @Field(name="point2.y", column="POINT2_Y")
+    }))
+    Map<Integer, Line> integerLines;
+
+    @Property(table="INTEGER_LINES", embeddedKey="true", embeddedValue="true")
+    @Join(column="OWNER_FK")
+    @Key(column="INTEGER")
+    @Value(
+        embedded=@Embedded(
+            properties={
+                @Property(name="point1.x", column="POINT1_X"),
+                @Property(name="point1.y", column="POINT2_Y"),
+                @Property(name="point2.x", column="POINT2_X"),
+                @Property(name="point2.y", column="POINT2_Y")
+    }))
+    abstract Map<Integer, Line> getIntegerLines();
+
+}

Propchange: db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedMap.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java?view=auto&rev=557821
==============================================================================
--- db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java (added)
+++ db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java Thu Jul 19 17:12:10
2007
@@ -0,0 +1,61 @@
+/*
+ * 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.util.Set;
+
+/*
+ * TestEmbeddedSet.java
+ *
+ * Created on July 18, 2007, 9:40 AM
+ *
+ */
+@PersistenceCapable
+public abstract class TestEmbeddedSet {
+    
+    /** Creates a new instance of TestEmbeddedSet */
+
+    public TestEmbeddedSet() {
+    }
+
+    @Field (table="LINES", embeddedElement="true")
+    @Join(column="OWNER_FK")
+    @Element (
+        embedded=@Embedded(
+            fields={
+                @Field(name="point1.x", column="POINT1_X"),
+                @Field(name="point1.y", column="POINT2_Y"),
+                @Field(name="point2.x", column="POINT2_X"),
+                @Field(name="point2.y", column="POINT2_Y")
+            }))
+    Set<Line> lines;
+
+    @Property (embeddedElement="true")
+    @Join(column="OWNER_FK")
+    @Element (
+        embedded=@Embedded(
+            properties={
+                @Property(name="point1.x", column="POINT1_X"),
+                @Property(name="point1.y", column="POINT2_Y"),
+                @Property(name="point2.x", column="POINT2_X"),
+                @Property(name="point2.y", column="POINT2_Y")
+            }))
+    abstract Set<Line> getLines();
+
+    
+}

Propchange: db/jdo/trunk/api2/test/java/javax/jdo/annotations/TestEmbeddedSet.java
------------------------------------------------------------------------------
    svn:eol-style = LF



Mime
View raw message