You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by oz...@apache.org on 2004/10/13 23:54:18 UTC

cvs commit: jakarta-slide/proposals/wck/src/org/apache/slide/simple/store WebdavStoreAdapter.java

ozeigermann    2004/10/13 14:54:18

  Modified:    proposals/wck/src/org/apache/slide/simple/authentication
                        JAASLoginModule.java
               proposals/wck/src/org/apache/slide/simple/store
                        WebdavStoreAdapter.java
  Log:
  Removed thread local shortcut for session as it seemed to be
  much more of a threat of correctness than actually useful
  
  Revision  Changes    Path
  1.2       +3 -11     jakarta-slide/proposals/wck/src/org/apache/slide/simple/authentication/JAASLoginModule.java
  
  Index: JAASLoginModule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/authentication/JAASLoginModule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JAASLoginModule.java	12 Oct 2004 20:19:03 -0000	1.1
  +++ JAASLoginModule.java	13 Oct 2004 21:54:18 -0000	1.2
  @@ -68,8 +68,6 @@
   
       protected static final String DEFAULT_MANAGER = "org.apache.slide.simple.reference.FakeSessionManager";
   
  -    protected static ThreadLocal connection = new ThreadLocal();
  -
       protected static Object STATIC_LOCK = new Object();
   
       protected static String factoryClassName;
  @@ -82,10 +80,6 @@
           return (factoryClassName != null);
       }
   
  -    public static Object getActiveConnection() {
  -        return connection.get();
  -    }
  -
       public static Object getConnectionForUser(Principal principal) throws Exception {
           Object conn = null;
           if (factory != null) {
  @@ -100,7 +94,6 @@
           if (factory != null && connection != null) {
               factory.closeAuthenticationSession(connection);
           }
  -        JAASLoginModule.connection.set(null);
       }
   
       public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
  @@ -163,7 +156,6 @@
                   if (conn == null) {
                       throw new LoginException("Could not authenticate");
                   }
  -                connection.set(conn);
               } catch (Exception e) {
                   throw new LoginException("Could not create session: " + e.getMessage());
               }
  
  
  
  1.3       +11 -29    jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreAdapter.java
  
  Index: WebdavStoreAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/wck/src/org/apache/slide/simple/store/WebdavStoreAdapter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebdavStoreAdapter.java	13 Oct 2004 20:36:14 -0000	1.2
  +++ WebdavStoreAdapter.java	13 Oct 2004 21:54:18 -0000	1.3
  @@ -406,10 +406,7 @@
           }
   
           protected void closeConnection() {
  -            // XXX we must not eliminate the connection when this is a temporary
  -            // transaction
  -            // as more requests are to come
  -            if (connection != null && xid != null && JAASLoginModule.isInitialized())
  +            if (connection != null)
                   try {
                       JAASLoginModule.closeConnection(connection);
                   } catch (Exception e) {
  @@ -418,27 +415,12 @@
           }
   
           protected void openConnection() {
  -            if (JAASLoginModule.isInitialized()) {
  -                connection = JAASLoginModule.getActiveConnection();
  -                // XXX now something bad may happen to us and our login module
  -                // has not been
  -                // called as the principal already was authenticated. In this
  -                // case there is
  -                // no special connection we would have to reuse and we simply
  -                // get one from the pool
  -                // using the principal. This time the name is enough as we know
  -                // it has
  -                // authenticated itself correctly. If there is no principal, we
  -                // really
  -                // have no chance to get a connection. This should only be the
  -                // case in the initialization phase.
  -                if (connection == null && principal != null) {
  -                    try {
  -                        connection = JAASLoginModule.getConnectionForUser(principal);
  -                    } catch (Exception e) {
  -                        getLogger().log("Could not get connection for user " + principal.getName(), e, LOG_CHANNEL,
  -                                Logger.WARNING);
  -                    }
  +            if (JAASLoginModule.isInitialized() && connection == null && principal != null) {
  +                try {
  +                    connection = JAASLoginModule.getConnectionForUser(principal);
  +                } catch (Exception e) {
  +                    getLogger().log("Could not get connection for user " + principal.getName(), e, LOG_CHANNEL,
  +                            Logger.WARNING);
                   }
               } else {
                   connection = null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org