continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r442155 - in /maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi: ./ src/main/java/org/apache/maven/continuum/security/acegi/acl/ src/main/resources/META-INF/plexus/ src/main/resources/org/apache/maven/cont...
Date Mon, 11 Sep 2006 10:02:58 GMT
Author: carlos
Date: Mon Sep 11 03:02:58 2006
New Revision: 442155

URL: http://svn.apache.org/viewvc?view=rev&rev=442155
Log:
Move AclInitializer to maven user

Removed:
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/org/apache/maven/continuum/security/acegi/acl/
Modified:
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml?view=diff&rev=442155&r1=442154&r2=442155
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/pom.xml
Mon Sep 11 03:02:58 2006
@@ -43,11 +43,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.mojo</groupId>
-      <artifactId>sql-maven-plugin</artifactId>
-      <version>1.0-beta-2-SNAPSHOT</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.derby</groupId>
       <artifactId>derby</artifactId>
       <version>10.1.2.1</version>

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java?view=diff&rev=442155&r1=442154&r2=442155
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
Mon Sep 11 03:02:58 2006
@@ -16,144 +16,29 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.acegisecurity.acl.basic.AclObjectIdentity;
 import org.acegisecurity.acl.basic.NamedEntityObjectIdentity;
 import org.acegisecurity.acl.basic.SimpleAclEntry;
-import org.acegisecurity.acl.basic.jdbc.JdbcExtendedDaoImpl;
 import org.apache.maven.continuum.model.project.ProjectGroup;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.codehaus.mojo.sql.SqlExecMojo;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-import org.codehaus.plexus.util.IOUtil;
 
 /**
- * Initialize the ACL system with some default values.
+ * Initialize the ACL system with a parent ACL for all {@link ProjectGroup}s.
  * 
  * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
  * @version $Id$
  */
 public class AclInitializer
-    extends AbstractLogEnabled
-    implements Initializable
+    extends org.apache.maven.user.acegi.acl.AclInitializer
 {
-    public static final String ROLE = AclInitializer.class.getName();
-
-    public static final AclObjectIdentity PARENT_PROJECT_GROUP_ACL_ID =
-        new NamedEntityObjectIdentity( ProjectGroup.class.getName(), "0" );
-
-    private JdbcExtendedDaoImpl dao;
-
-    private SqlExecMojo sqlMojo;
-
-    private String sqlClasspathResource;
-
-    public void setDao( JdbcExtendedDaoImpl dao )
-    {
-        this.dao = dao;
-    }
-
-    public JdbcExtendedDaoImpl getDao()
-    {
-        return dao;
-    }
-
-    public void setSqlMojo( SqlExecMojo sqlMojo )
-    {
-        this.sqlMojo = sqlMojo;
-    }
-
-    public SqlExecMojo getSqlMojo()
-    {
-        return sqlMojo;
-    }
+    public static final int PARENT_PROJECT_GROUP_ACL_ID = 0;
 
-    public void setSqlClasspathResource( String sqlClasspathResource )
+    protected void insertDefaultData()
     {
-        this.sqlClasspathResource = sqlClasspathResource;
-    }
-
-    /**
-     * Classpath resource that contains the SQL to be executed.
-     * 
-     * @return classpath path
-     */
-    public String getSqlClasspathResource()
-    {
-        return sqlClasspathResource;
-    }
-
-    public void initialize()
-        throws InitializationException
-    {
-
-        InputStream is = null;
-        String sql = null;
-        try
-        {
-            is = this.getClass().getClassLoader().getResourceAsStream( getSqlClasspathResource()
);
-            if ( is == null )
-            {
-                throw new InitializationException( getSqlClasspathResource() + " does not
exist in the classpath" );
-            }
-            sql = IOUtil.toString( is );
-        }
-        catch ( IOException e )
-        {
-            throw new InitializationException( "Unable to read sql file from classpath: "
+ getSqlClasspathResource(),
-                                               e );
-        }
-        finally
-        {
-            if ( is != null )
-            {
-                try
-                {
-                    is.close();
-                }
-                catch ( IOException e )
-                {
-                    // nothing to do here
-                }
-            }
-        }
-
-        getSqlMojo().addText( sql );
-
-        if ( getSqlMojo().getPassword() == null )
-        {
-            getSqlMojo().setPassword( "" );
-        }
-
-        try
-        {
-            getSqlMojo().execute();
-        }
-        catch ( MojoExecutionException e )
-        {
-            throw new InitializationException( e.getMessage(), e );
-        }
-
-        /* execute Spring initialization callback */
-        getDao().afterPropertiesSet();
-
-        /* poor check to see if this is the first time initializing the database */
-        if ( getSqlMojo().getSuccessfulStatements() >= 2 )
-        {
-            /* tables were created, insert default values */
-            getLogger().info( "Initializing ACL database" );
-
-            /* admin can do anything with project number 1 */
-            SimpleAclEntry aclEntry = new SimpleAclEntry();
-            aclEntry.setAclObjectIdentity( PARENT_PROJECT_GROUP_ACL_ID );
-            aclEntry.setRecipient( "ROLE_admin" );
-            aclEntry.addPermission( SimpleAclEntry.ADMINISTRATION );
-            getDao().create( aclEntry );
-        }
-
+        /* admin can do anything with project number 1 */
+        SimpleAclEntry aclEntry = new SimpleAclEntry();
+        aclEntry.setAclObjectIdentity( new NamedEntityObjectIdentity( ProjectGroup.class.getName(),
Integer
+            .toString( PARENT_PROJECT_GROUP_ACL_ID ) ) );
+        aclEntry.setRecipient( "ROLE_admin" );
+        aclEntry.addPermission( SimpleAclEntry.ADMINISTRATION );
+        getDao().create( aclEntry );
     }
 }

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=442155&r1=442154&r2=442155
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/resources/META-INF/plexus/components.xml
Mon Sep 11 03:02:58 2006
@@ -30,7 +30,7 @@
     </component>
 
     <component>
-      <role>org.apache.maven.continuum.security.acegi.acl.AclInitializer</role>
+      <role>org.apache.maven.user.acegi.acl.AclInitializer</role>
       <implementation>org.apache.maven.continuum.security.acegi.acl.AclInitializer</implementation>
       <requirements>
         <requirement>
@@ -43,7 +43,7 @@
         </requirement>
       </requirements>
       <configuration>
-        <sqlClasspathResource>org/apache/maven/continuum/security/acegi/acl/acegi-acl-derby.sql</sqlClasspathResource>
+        <sqlClasspathResource>org/apache/maven/user/acegi/acl/acegi-acl-derby.sql</sqlClasspathResource>
       </configuration>
     </component>
 

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml?view=diff&rev=442155&r1=442154&r2=442155
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/test/resources/org/apache/maven/continuum/security/acegi/acl/AclInitializerPlexusTest.xml
Mon Sep 11 03:02:58 2006
@@ -3,7 +3,7 @@
   <components>
 
     <component>
-      <role>org.apache.maven.continuum.security.acegi.acl.AclInitializer</role>
+      <role>org.apache.maven.user.acegi.acl.AclInitializer</role>
       <implementation>org.apache.maven.continuum.security.acegi.acl.AclInitializer</implementation>
       <requirements>
         <requirement>
@@ -16,7 +16,7 @@
         </requirement>
       </requirements>
       <configuration>
-        <sqlClasspathResource>org/apache/maven/continuum/security/acegi/acl/acegi-acl-derby.sql</sqlClasspathResource>
+        <sqlClasspathResource>org/apache/maven/user/acegi/acl/acegi-acl-derby.sql</sqlClasspathResource>
       </configuration>
     </component>
 



Mime
View raw message