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 "Michael Bouschen (JIRA)" <ji...@apache.org> on 2006/07/19 21:30:13 UTC

[jira] Created: (JDO-398) Add servlet Filter utility class managing a PersistenceManager per request

Add servlet Filter utility class managing a PersistenceManager per request
--------------------------------------------------------------------------

                 Key: JDO-398
                 URL: http://issues.apache.org/jira/browse/JDO-398
             Project: JDO
          Issue Type: Task
          Components: util20
    Affects Versions: JDO 2 final
            Reporter: Michael Bouschen
         Assigned To: Michael Bouschen
            Priority: Minor
             Fix For: JDO 2 maintenance release 1


I propose to add a new class JDOFilter implementing a servlet filter (interface javax.servlet.Filter) to a new package org.apache.jdo.util.web for web support utility classes. The filter init method creates a PMF instance. Method doFilter creates a PersistenceManager, stores it as a request attribute and then calls the filter chain. It closes the PersistenceManager after the chain returns. The PMF is closed in the filter method destroy.

-- 
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-398) Add servlet Filter utility class managing a PersistenceManager per request

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

The filter looks good. It is vaguely familiar. I recall seeing similar code in a JavaOne presentation a few years back. ;-)

If the init getPersistenceManagerFactory call fails, have you looked at how the error is reported? You have special code to log some configuration errors, but nothing explicit for the getPersistenceManagerFactory call, which in my experience is the most likely API to fail. It might be good to wrap the call with try/catch and log the exception at level SEVERE. If you've already tested that a failure in init does the appropriate logging, you can ignore this.

There are several >80 character lines.



> Add servlet Filter utility class managing a PersistenceManager per request
> --------------------------------------------------------------------------
>
>                 Key: JDO-398
>                 URL: http://issues.apache.org/jira/browse/JDO-398
>             Project: JDO
>          Issue Type: Task
>          Components: util20
>    Affects Versions: JDO 2 final
>            Reporter: Michael Bouschen
>         Assigned To: Michael Bouschen
>            Priority: Minor
>             Fix For: JDO 2 maintenance release 1
>
>         Attachments: JDO-398.patch
>
>
> I propose to add a new class JDOFilter implementing a servlet filter (interface javax.servlet.Filter) to a new package org.apache.jdo.util.web for web support utility classes. The filter init method creates a PMF instance. Method doFilter creates a PersistenceManager, stores it as a request attribute and then calls the filter chain. It closes the PersistenceManager after the chain returns. The PMF is closed in the filter method destroy.

-- 
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-398) Add servlet Filter utility class managing a PersistenceManager per request

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-398?page=all ]

Michael Bouschen resolved JDO-398.
----------------------------------

    Resolution: Fixed

Any failure in initialization of the PMF results in a ServletException or in a JDOException which is a RuntimeException. Both get logged by the web container, if logging is configured to print error logs. 

I updated the implementation and checked it in (see revision 424813).

> Add servlet Filter utility class managing a PersistenceManager per request
> --------------------------------------------------------------------------
>
>                 Key: JDO-398
>                 URL: http://issues.apache.org/jira/browse/JDO-398
>             Project: JDO
>          Issue Type: Task
>          Components: util20
>    Affects Versions: JDO 2 final
>            Reporter: Michael Bouschen
>         Assigned To: Michael Bouschen
>            Priority: Minor
>             Fix For: JDO 2 maintenance release 1
>
>         Attachments: JDO-398.patch
>
>
> I propose to add a new class JDOFilter implementing a servlet filter (interface javax.servlet.Filter) to a new package org.apache.jdo.util.web for web support utility classes. The filter init method creates a PMF instance. Method doFilter creates a PersistenceManager, stores it as a request attribute and then calls the filter chain. It closes the PersistenceManager after the chain returns. The PMF is closed in the filter method destroy.

-- 
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-398) Add servlet Filter utility class managing a PersistenceManager per request

Posted by "Michael Bouschen (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JDO-398?page=all ]

Michael Bouschen updated JDO-398:
---------------------------------

    Attachment: JDO-398.patch

Attached is a patch JDO-398.patch for review. It adds a new class JDOFilter to the util20 subproject. 

> Add servlet Filter utility class managing a PersistenceManager per request
> --------------------------------------------------------------------------
>
>                 Key: JDO-398
>                 URL: http://issues.apache.org/jira/browse/JDO-398
>             Project: JDO
>          Issue Type: Task
>          Components: util20
>    Affects Versions: JDO 2 final
>            Reporter: Michael Bouschen
>         Assigned To: Michael Bouschen
>            Priority: Minor
>             Fix For: JDO 2 maintenance release 1
>
>         Attachments: JDO-398.patch
>
>
> I propose to add a new class JDOFilter implementing a servlet filter (interface javax.servlet.Filter) to a new package org.apache.jdo.util.web for web support utility classes. The filter init method creates a PMF instance. Method doFilter creates a PersistenceManager, stores it as a request attribute and then calls the filter chain. It closes the PersistenceManager after the chain returns. The PMF is closed in the filter method destroy.

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