You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "Matthew T. Adams (JIRA)" <ji...@apache.org> on 2006/01/20 19:25:42 UTC

[jira] Created: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
----------------------------------------------------------------------------------------------------

         Key: JDO-282
         URL: http://issues.apache.org/jira/browse/JDO-282
     Project: JDO
        Type: Improvement
  Components: api20  
    Reporter: Matthew T. Adams
 Assigned to: Matthew T. Adams 


The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-282?page=comments#action_12363558 ] 

Craig Russell commented on JDO-282:
-----------------------------------

I'd prefer to avoid the isPreCallback argumment entirely. I think if we add a line to the specification that the target is only allowed on the postAttach and postDetach events, then the existence of the target tells you what you need to know. So the code doesn't need the argument, but can simply return either the source or target depending on whether target is null.

For example,

+    public Object getDetachedInstance() {
boolean isPreCallback = (target == null);
+        switch (getEventType()) {
+            case DETACH:
+                return isPreCallback
+                        ? null          // preDetach:  no detached instance yet
+                        : getSource();  // postDetach:  source is detached instance
+            case ATTACH:
+                return isPreCallback
+                        ? getSource()   // preAttach:  source is detached instance
+                        : target  // postAttach:  target is detached instance
+        }
+
+        // for all other events, there is no detached instance
+        return null;
+    }


> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]

Matthew T. Adams updated JDO-282:
---------------------------------

    Attachment: InstanceLifecycleEvent.patch

Here's the patch.  This was harder than I thought, which, IMHO, illustrates its value.  I created the patch relative to the directory trunk/api20.  I would also like to see this included in the upcoming 2.0-beta release if possible.

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


RE: [jira] Updated: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
Anyone care to comment so that I can commit the changes?

--matthew

>-----Original Message-----
>From: Matthew T. Adams (JIRA) [mailto:jira@apache.org] 
>Sent: Monday, January 23, 2006 10:58 AM
>To: jdo-dev@db.apache.org
>Subject: [jira] Updated: (JDO-282) Add convenience methods to 
>get persistent instance and detached instance from 
>InstanceLifecycleEvent
>
>
>     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]
>
>Matthew T. Adams updated JDO-282:
>---------------------------------
>
>    Attachment: InstanceLifecycleEvent.java.2.patch
>
>OK, attached is the refactored patch.  Please review and 
>comment.  I opted not to use the boolean at all, as 
>isPreCallback and other variants of the name either weren't 
>correct or just weren't descriptive enough.
>
>> Add convenience methods to get persistent instance and 
>detached instance from InstanceLifecycleEvent
>> 
>---------------------------------------------------------------
>-------------------------------------
>>
>>          Key: JDO-282
>>          URL: http://issues.apache.org/jira/browse/JDO-282
>>      Project: JDO
>>         Type: Improvement
>>   Components: api20
>>     Reporter: Matthew T. Adams
>>     Assignee: Matthew T. Adams
>>  Attachments: InstanceLifecycleEvent.java.2.patch, 
>InstanceLifecycleEvent.patch
>>
>> The source and target object differ as to whether they are 
>the persistent or detached instance in class 
>InstanceLifecycleEvent depending upon whether the event object 
>is given in the preDetach, postDetach, preAttach, or 
>postAttach callbacks.  I propose adding two convenience 
>methods that makes it obvious from the API which object the 
>user is getting.
>
>-- 
>This message is automatically generated by JIRA.
>-
>If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
>-
>For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>
>



[jira] Updated: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]

Matthew T. Adams updated JDO-282:
---------------------------------

    Attachment: InstanceLifecycleEvent.java.2.patch

OK, attached is the refactored patch.  Please review and comment.  I opted not to use the boolean at all, as isPreCallback and other variants of the name either weren't correct or just weren't descriptive enough.

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]
     
Matthew T. Adams reopened JDO-282:
----------------------------------


The JDO 2.0 specification needs to be updated to reflect the addition of the methods getPersistentInstance and getDetachedInstance to the class InstanceLifecycleEvent.

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]
     
Matthew T. Adams resolved JDO-282:
----------------------------------

    Resolution: Fixed

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]

Matthew T. Adams reassigned JDO-282:
------------------------------------

    Assign To: Craig Russell  (was: Matthew T. Adams)

Assigning this to Craig, as he is responsible for updating the spec.

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Craig Russell
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


RE: [jira] Commented: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams" <ma...@xcalia.com>.
Can someone please review this patch so that we can see about its inclusion
in the 2.0-beta branch as well?

Thanks,
Matthew

>-----Original Message-----
>From: Matthew T. Adams (JIRA) [mailto:jira@apache.org] 
>Sent: Friday, January 20, 2006 11:56 AM
>To: jdo-dev@db.apache.org
>Subject: [jira] Commented: (JDO-282) Add convenience methods 
>to get persistent instance and detached instance from 
>InstanceLifecycleEvent
>
>
>    [ 
>http://issues.apache.org/jira/browse/JDO-282?page=comments#acti
>on_12363452 ] 
>
>Matthew T. Adams commented on JDO-282:
>--------------------------------------
>
>In case anyone were wondering, the reason for the "boolean 
>isPreCallback" argument on the getPersistentInstance and 
>getDetachedInstance is that the event enums do not indicate 
>whether the event is a preDetach/preAttach or 
>postDetach/postAttach.  The event enums for everything are 
>only CREATE, LOAD, STORE, etc. instead of POST_CREATE, 
>POST_LOAD, PRE_STORE, etc.
>
>* Should the enums be refactored to include PRE & POST prefixes, or
>* should we add a boolean field to the object indicating 
>whether it's a pre- or post-event object, or
>* just do nothing and preserve the boolean isPreCallback 
>arguments on the convenience methods?
>
>
>> Add convenience methods to get persistent instance and 
>detached instance from InstanceLifecycleEvent
>> 
>---------------------------------------------------------------
>-------------------------------------
>>
>>          Key: JDO-282
>>          URL: http://issues.apache.org/jira/browse/JDO-282
>>      Project: JDO
>>         Type: Improvement
>>   Components: api20
>>     Reporter: Matthew T. Adams
>>     Assignee: Matthew T. Adams
>>  Attachments: InstanceLifecycleEvent.patch
>>
>> The source and target object differ as to whether they are 
>the persistent or detached instance in class 
>InstanceLifecycleEvent depending upon whether the event object 
>is given in the preDetach, postDetach, preAttach, or 
>postAttach callbacks.  I propose adding two convenience 
>methods that makes it obvious from the API which object the 
>user is getting.
>
>-- 
>This message is automatically generated by JIRA.
>-
>If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
>-
>For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>
>



[jira] Commented: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Matthew T. Adams (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-282?page=comments#action_12363452 ] 

Matthew T. Adams commented on JDO-282:
--------------------------------------

In case anyone were wondering, the reason for the "boolean isPreCallback" argument on the getPersistentInstance and getDetachedInstance is that the event enums do not indicate whether the event is a preDetach/preAttach or postDetach/postAttach.  The event enums for everything are only CREATE, LOAD, STORE, etc. instead of POST_CREATE, POST_LOAD, PRE_STORE, etc.

* Should the enums be refactored to include PRE & POST prefixes, or
* should we add a boolean field to the object indicating whether it's a pre- or post-event object, or
* just do nothing and preserve the boolean isPreCallback arguments on the convenience methods?


> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-282?page=all ]
     
Craig Russell resolved JDO-282:
-------------------------------

    Fix Version: JDO 2 rc1
     Resolution: Fixed

The change was committed to the repository and will be released with the Release Candidate 1. The specification has been updated.

> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Craig Russell
>      Fix For: JDO 2 rc1
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JDO-282) Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent

Posted by "Craig Russell (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JDO-282?page=comments#action_12363868 ] 

Craig Russell commented on JDO-282:
-----------------------------------

Looks good to go.



> Add convenience methods to get persistent instance and detached instance from InstanceLifecycleEvent
> ----------------------------------------------------------------------------------------------------
>
>          Key: JDO-282
>          URL: http://issues.apache.org/jira/browse/JDO-282
>      Project: JDO
>         Type: Improvement
>   Components: api20
>     Reporter: Matthew T. Adams
>     Assignee: Matthew T. Adams
>  Attachments: InstanceLifecycleEvent.java.2.patch, InstanceLifecycleEvent.patch
>
> The source and target object differ as to whether they are the persistent or detached instance in class InstanceLifecycleEvent depending upon whether the event object is given in the preDetach, postDetach, preAttach, or postAttach callbacks.  I propose adding two convenience methods that makes it obvious from the API which object the user is getting.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira