]> source.dussan.org Git - archiva.git/commitdiff
package move to o.a.a.r
authorOlivier Lamy <olamy@apache.org>
Sat, 7 Apr 2012 15:13:38 +0000 (15:13 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 7 Apr 2012 15:13:38 +0000 (15:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1310785 13f79535-47bb-0310-9956-ffa450edef68

redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/org/codehaus/plexus/redback/struts2/action/admin/AssignmentsActionTest.xml
redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/org/codehaus/plexus/redback/struts2/action/admin/UserEditActionTest.xml
redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/spring-context.xml
redback-rbac/redback-authorization-rbac/src/test/resources/spring-context.xml
redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java [new file with mode: 0644]
redback-users/redback-users-providers/redback-users-cached/src/main/java/org/codehaus/plexus/redback/users/cached/CachedUserManager.java [deleted file]
redback-users/redback-users-providers/redback-users-cached/src/test/java/org/codehaus/plexus/redback/users/cached/CachedUserManagerTest.java
redback-users/redback-users-providers/redback-users-cached/src/test/resources/spring-context.xml

index 8355d7178d182e41154c2d18a9282617b2a1ad59..79fb9a89d473657084fdd7290bd26c079065faa1 100644 (file)
@@ -71,7 +71,7 @@
     <component>
       <role>org.apache.archiva.redback.users.UserManager</role>
       <role-hint>cached</role-hint>
-      <implementation>org.codehaus.plexus.redback.users.cached.CachedUserManager</implementation>
+      <implementation>org.apache.archiva.redback.users.cached.CachedUserManager</implementation>
       <description>CachedUserManager</description>
       <requirements>
         <requirement>
index 8355d7178d182e41154c2d18a9282617b2a1ad59..79fb9a89d473657084fdd7290bd26c079065faa1 100644 (file)
@@ -71,7 +71,7 @@
     <component>
       <role>org.apache.archiva.redback.users.UserManager</role>
       <role-hint>cached</role-hint>
-      <implementation>org.codehaus.plexus.redback.users.cached.CachedUserManager</implementation>
+      <implementation>org.apache.archiva.redback.users.cached.CachedUserManager</implementation>
       <description>CachedUserManager</description>
       <requirements>
         <requirement>
index a5eb68e1086fee66ea8930be061668316e33c8a5..ab958004c114c47f2e55c10292860a301c3c4e20 100755 (executable)
@@ -92,7 +92,7 @@
       </requirements>
     </component>
   -->
-  <bean name="userManager#cached" class="org.codehaus.plexus.redback.users.cached.CachedUserManager">
+  <bean name="userManager#cached" class="org.apache.archiva.redback.users.cached.CachedUserManager">
     <property name="userImpl" ref="userManager#memory"/>
   </bean>
 
     <component>
       <role>org.apache.archiva.redback.users.UserManager</role>
       <role-hint>cached</role-hint>
-      <implementation>org.codehaus.plexus.redback.users.cached.CachedUserManager</implementation>
+      <implementation>org.apache.archiva.redback.users.cached.CachedUserManager</implementation>
       <description>CachedUserManager</description>
       <requirements>
         <requirement>
index ce88667c0264ec16aeff12ffe3fdfcef499e76bf..9aacd8ad334aa22537c3c3ad0ef5059c360f50bf 100644 (file)
@@ -27,7 +27,7 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
-  <bean name="userManager#cached" class="org.codehaus.plexus.redback.users.cached.CachedUserManager">
+  <bean name="userManager#cached" class="org.apache.archiva.redback.users.cached.CachedUserManager">
     <property name="userImpl" ref="userManager#memory"/>
     <property name="usersCache" ref="cache#users"/>
   </bean>
diff --git a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/apache/archiva/redback/users/cached/CachedUserManager.java
new file mode 100644 (file)
index 0000000..822f76c
--- /dev/null
@@ -0,0 +1,321 @@
+package org.apache.archiva.redback.users.cached;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManagerListener;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.users.UserQuery;
+import org.codehaus.plexus.cache.Cache;
+import org.apache.archiva.redback.users.UserManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.List;
+
+/**
+ * CachedUserManager
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "userManager#cached" )
+public class CachedUserManager
+    implements UserManager, UserManagerListener
+{
+
+    private Logger log = LoggerFactory.getLogger( getClass() );
+
+    @Inject
+    @Named( value = "userManager#jdo" )
+    private UserManager userImpl;
+
+    @Inject
+    @Named( value = "cache#users" )
+    private Cache usersCache;
+
+    public boolean isReadOnly()
+    {
+        return userImpl.isReadOnly();
+    }
+
+    public User createGuestUser()
+    {
+        return userImpl.createGuestUser();
+    }
+
+    public User addUser( User user )
+    {
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+        return this.userImpl.addUser( user );
+    }
+
+    public void addUserManagerListener( UserManagerListener listener )
+    {
+        this.userImpl.addUserManagerListener( listener );
+    }
+
+    public void addUserUnchecked( User user )
+    {
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+        this.userImpl.addUserUnchecked( user );
+    }
+
+    public User createUser( String username, String fullName, String emailAddress )
+    {
+        usersCache.remove( username );
+        return this.userImpl.createUser( username, fullName, emailAddress );
+    }
+
+    public void deleteUser( Object principal )
+        throws UserNotFoundException
+    {
+        usersCache.remove( principal );
+        this.userImpl.deleteUser( principal );
+    }
+
+    public void deleteUser( String username )
+        throws UserNotFoundException
+    {
+        usersCache.remove( username );
+        this.userImpl.deleteUser( username );
+    }
+
+    public void eraseDatabase()
+    {
+        try
+        {
+            this.userImpl.eraseDatabase();
+        }
+        finally
+        {
+            usersCache.clear();
+        }
+    }
+
+    public User findUser( String username )
+        throws UserNotFoundException
+    {
+        if ( GUEST_USERNAME.equals( username ) )
+        {
+            return getGuestUser();
+        }
+
+        Object el = usersCache.get( username );
+        if ( el != null )
+        {
+            return (User) el;
+        }
+        else
+        {
+            User user = this.userImpl.findUser( username );
+            usersCache.put( username, user );
+            return user;
+        }
+    }
+
+    public User getGuestUser()
+        throws UserNotFoundException
+    {
+        Object el = usersCache.get( GUEST_USERNAME );
+        if ( el != null )
+        {
+            return (User) el;
+        }
+        else
+        {
+            User user = this.userImpl.getGuestUser();
+            usersCache.put( GUEST_USERNAME, user );
+            return user;
+        }
+    }
+
+    public User findUser( Object principal )
+        throws UserNotFoundException
+    {
+        Object el = usersCache.get( principal );
+        if ( el != null )
+        {
+            return (User) el;
+        }
+        else
+        {
+            User user = this.userImpl.findUser( principal );
+            usersCache.put( principal, user );
+            return user;
+        }
+    }
+
+    public UserQuery createUserQuery()
+    {
+        return userImpl.createUserQuery();
+    }
+
+
+    public List<User> findUsersByQuery( UserQuery query )
+    {
+        log.debug( "NOT CACHED - .findUsersByQuery(UserQuery)" );
+        return this.userImpl.findUsersByQuery( query );
+    }
+
+    public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
+    {
+        log.debug( "NOT CACHED - .findUsersByEmailKey(String, boolean)" );
+        return this.userImpl.findUsersByEmailKey( emailKey, orderAscending );
+    }
+
+    public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
+    {
+        log.debug( "NOT CACHED - .findUsersByFullNameKey(String, boolean)" );
+        return this.userImpl.findUsersByFullNameKey( fullNameKey, orderAscending );
+    }
+
+    public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
+    {
+        log.debug( "NOT CACHED - .findUsersByUsernameKey(String, boolean)" );
+        return this.userImpl.findUsersByUsernameKey( usernameKey, orderAscending );
+    }
+
+    public String getId()
+    {
+        return "Cached User Manager [" + this.userImpl.getId() + "]";
+    }
+
+    public List<User> getUsers()
+    {
+        log.debug( "NOT CACHED - .getUsers()" );
+        return this.userImpl.getUsers();
+    }
+
+    public List<User> getUsers( boolean orderAscending )
+    {
+        log.debug( "NOT CACHED - .getUsers(boolean)" );
+        return this.userImpl.getUsers( orderAscending );
+    }
+
+    public void removeUserManagerListener( UserManagerListener listener )
+    {
+        this.userImpl.removeUserManagerListener( listener );
+    }
+
+    public User updateUser( User user )
+        throws UserNotFoundException
+    {
+        return updateUser( user, false );
+    }
+
+    public User updateUser( User user, boolean passwordChangeRequired )
+        throws UserNotFoundException
+    {
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+        return this.userImpl.updateUser( user, passwordChangeRequired );
+    }
+
+    public boolean userExists( Object principal )
+    {
+        if ( usersCache.hasKey( principal ) )
+        {
+            return true;
+        }
+
+        return this.userImpl.userExists( principal );
+    }
+
+    public void userManagerInit( boolean freshDatabase )
+    {
+        if ( userImpl instanceof UserManager )
+        {
+            ( (UserManagerListener) this.userImpl ).userManagerInit( freshDatabase );
+        }
+
+        usersCache.clear();
+    }
+
+    public void userManagerUserAdded( User user )
+    {
+        if ( userImpl instanceof UserManager )
+        {
+            ( (UserManagerListener) this.userImpl ).userManagerUserAdded( user );
+        }
+
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+    }
+
+    public void userManagerUserRemoved( User user )
+    {
+        if ( userImpl instanceof UserManager )
+        {
+            ( (UserManagerListener) this.userImpl ).userManagerUserRemoved( user );
+        }
+
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+    }
+
+    public void userManagerUserUpdated( User user )
+    {
+        if ( userImpl instanceof UserManager )
+        {
+            ( (UserManagerListener) this.userImpl ).userManagerUserUpdated( user );
+        }
+
+        if ( user != null )
+        {
+            usersCache.remove( user.getPrincipal() );
+        }
+    }
+
+    public UserManager getUserImpl()
+    {
+        return userImpl;
+    }
+
+    public void setUserImpl( UserManager userImpl )
+    {
+        this.userImpl = userImpl;
+    }
+
+    public Cache getUsersCache()
+    {
+        return usersCache;
+    }
+
+    public void setUsersCache( Cache usersCache )
+    {
+        this.usersCache = usersCache;
+    }
+}
diff --git a/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/codehaus/plexus/redback/users/cached/CachedUserManager.java b/redback-users/redback-users-providers/redback-users-cached/src/main/java/org/codehaus/plexus/redback/users/cached/CachedUserManager.java
deleted file mode 100644 (file)
index 31775a0..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-package org.codehaus.plexus.redback.users.cached;
-
-/*
- * 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.
- */
-
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManagerListener;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.users.UserQuery;
-import org.codehaus.plexus.cache.Cache;
-import org.apache.archiva.redback.users.UserManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.List;
-
-/**
- * CachedUserManager
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "userManager#cached" )
-public class CachedUserManager
-    implements UserManager, UserManagerListener
-{
-
-    private Logger log = LoggerFactory.getLogger( getClass() );
-
-    @Inject
-    @Named( value = "userManager#jdo" )
-    private UserManager userImpl;
-
-    @Inject
-    @Named( value = "cache#users" )
-    private Cache usersCache;
-
-    public boolean isReadOnly()
-    {
-        return userImpl.isReadOnly();
-    }
-
-    public User createGuestUser()
-    {
-        return userImpl.createGuestUser();
-    }
-
-    public User addUser( User user )
-    {
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-        return this.userImpl.addUser( user );
-    }
-
-    public void addUserManagerListener( UserManagerListener listener )
-    {
-        this.userImpl.addUserManagerListener( listener );
-    }
-
-    public void addUserUnchecked( User user )
-    {
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-        this.userImpl.addUserUnchecked( user );
-    }
-
-    public User createUser( String username, String fullName, String emailAddress )
-    {
-        usersCache.remove( username );
-        return this.userImpl.createUser( username, fullName, emailAddress );
-    }
-
-    public void deleteUser( Object principal )
-        throws UserNotFoundException
-    {
-        usersCache.remove( principal );
-        this.userImpl.deleteUser( principal );
-    }
-
-    public void deleteUser( String username )
-        throws UserNotFoundException
-    {
-        usersCache.remove( username );
-        this.userImpl.deleteUser( username );
-    }
-
-    public void eraseDatabase()
-    {
-        try
-        {
-            this.userImpl.eraseDatabase();
-        }
-        finally
-        {
-            usersCache.clear();
-        }
-    }
-
-    public User findUser( String username )
-        throws UserNotFoundException
-    {
-        if ( GUEST_USERNAME.equals( username ) )
-        {
-            return getGuestUser();
-        }
-
-        Object el = usersCache.get( username );
-        if ( el != null )
-        {
-            return (User) el;
-        }
-        else
-        {
-            User user = this.userImpl.findUser( username );
-            usersCache.put( username, user );
-            return user;
-        }
-    }
-
-    public User getGuestUser()
-        throws UserNotFoundException
-    {
-        Object el = usersCache.get( GUEST_USERNAME );
-        if ( el != null )
-        {
-            return (User) el;
-        }
-        else
-        {
-            User user = this.userImpl.getGuestUser();
-            usersCache.put( GUEST_USERNAME, user );
-            return user;
-        }
-    }
-
-    public User findUser( Object principal )
-        throws UserNotFoundException
-    {
-        Object el = usersCache.get( principal );
-        if ( el != null )
-        {
-            return (User) el;
-        }
-        else
-        {
-            User user = this.userImpl.findUser( principal );
-            usersCache.put( principal, user );
-            return user;
-        }
-    }
-
-    public UserQuery createUserQuery()
-    {
-        return userImpl.createUserQuery();
-    }
-
-
-    public List<User> findUsersByQuery( UserQuery query )
-    {
-        log.debug( "NOT CACHED - .findUsersByQuery(UserQuery)" );
-        return this.userImpl.findUsersByQuery( query );
-    }
-
-    public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
-    {
-        log.debug( "NOT CACHED - .findUsersByEmailKey(String, boolean)" );
-        return this.userImpl.findUsersByEmailKey( emailKey, orderAscending );
-    }
-
-    public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
-    {
-        log.debug( "NOT CACHED - .findUsersByFullNameKey(String, boolean)" );
-        return this.userImpl.findUsersByFullNameKey( fullNameKey, orderAscending );
-    }
-
-    public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
-    {
-        log.debug( "NOT CACHED - .findUsersByUsernameKey(String, boolean)" );
-        return this.userImpl.findUsersByUsernameKey( usernameKey, orderAscending );
-    }
-
-    public String getId()
-    {
-        return "Cached User Manager [" + this.userImpl.getId() + "]";
-    }
-
-    public List<User> getUsers()
-    {
-        log.debug( "NOT CACHED - .getUsers()" );
-        return this.userImpl.getUsers();
-    }
-
-    public List<User> getUsers( boolean orderAscending )
-    {
-        log.debug( "NOT CACHED - .getUsers(boolean)" );
-        return this.userImpl.getUsers( orderAscending );
-    }
-
-    public void removeUserManagerListener( UserManagerListener listener )
-    {
-        this.userImpl.removeUserManagerListener( listener );
-    }
-
-    public User updateUser( User user )
-        throws UserNotFoundException
-    {
-        return updateUser( user, false );
-    }
-
-    public User updateUser( User user, boolean passwordChangeRequired )
-        throws UserNotFoundException
-    {
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-        return this.userImpl.updateUser( user, passwordChangeRequired );
-    }
-
-    public boolean userExists( Object principal )
-    {
-        if ( usersCache.hasKey( principal ) )
-        {
-            return true;
-        }
-
-        return this.userImpl.userExists( principal );
-    }
-
-    public void userManagerInit( boolean freshDatabase )
-    {
-        if ( userImpl instanceof UserManager )
-        {
-            ( (UserManagerListener) this.userImpl ).userManagerInit( freshDatabase );
-        }
-
-        usersCache.clear();
-    }
-
-    public void userManagerUserAdded( User user )
-    {
-        if ( userImpl instanceof UserManager )
-        {
-            ( (UserManagerListener) this.userImpl ).userManagerUserAdded( user );
-        }
-
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-    }
-
-    public void userManagerUserRemoved( User user )
-    {
-        if ( userImpl instanceof UserManager )
-        {
-            ( (UserManagerListener) this.userImpl ).userManagerUserRemoved( user );
-        }
-
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-    }
-
-    public void userManagerUserUpdated( User user )
-    {
-        if ( userImpl instanceof UserManager )
-        {
-            ( (UserManagerListener) this.userImpl ).userManagerUserUpdated( user );
-        }
-
-        if ( user != null )
-        {
-            usersCache.remove( user.getPrincipal() );
-        }
-    }
-
-    public UserManager getUserImpl()
-    {
-        return userImpl;
-    }
-
-    public void setUserImpl( UserManager userImpl )
-    {
-        this.userImpl = userImpl;
-    }
-
-    public Cache getUsersCache()
-    {
-        return usersCache;
-    }
-
-    public void setUsersCache( Cache usersCache )
-    {
-        this.usersCache = usersCache;
-    }
-}
index 73775079bebe31648dc748fe7062109628633dca..b936e12febf2ac65e570ad349ff1d760eace7405 100644 (file)
@@ -22,6 +22,7 @@ package org.codehaus.plexus.redback.users.cached;
 import net.sf.ehcache.CacheManager;
 
 import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.users.cached.CachedUserManager;
 import org.codehaus.plexus.redback.users.provider.test.AbstractUserManagerTestCase;
 import org.junit.After;
 import org.junit.AfterClass;
index 1168e2c5633dadc50c5077327873afe0811d260a..47aeee0e36711a5cab00068903f5319dc6512696 100644 (file)
@@ -27,7 +27,7 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd"
        default-lazy-init="true">
 
-  <bean name="userManager#cached" class="org.codehaus.plexus.redback.users.cached.CachedUserManager">
+  <bean name="userManager#cached" class="org.apache.archiva.redback.users.cached.CachedUserManager">
     <property name="userImpl" ref="userManager#memory"/>
     <property name="usersCache" ref="cache#users"/>
   </bean>