continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r546923 [1/2] - in /maven/continuum/trunk/continuum-data-management: ./ data-management-api/src/main/java/org/apache/maven/continuum/management/ data-management-cli/ data-management-cli/src/main/java/org/apache/maven/continuum/management/ d...
Date Wed, 13 Jun 2007 15:30:17 GMT
Author: brett
Date: Wed Jun 13 08:30:15 2007
New Revision: 546923

URL: http://svn.apache.org/viewvc?view=rev&rev=546923
Log:
add redback support (RBAC database backup is not yet working)

Added:
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java   (with props)
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/
      - copied from r546586, maven/continuum/trunk/continuum-data-management/data-management-jdo/
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/pom.xml
      - copied, changed from r546588, maven/continuum/trunk/continuum-data-management/data-management-jdo/pom.xml
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java   (with props)
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java   (with props)
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java   (with props)
    maven/continuum/trunk/continuum-data-management/redback-legacy/
      - copied from r546586, maven/continuum/trunk/continuum-data-management/continuum-legacy/
    maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/keys-jdo.mdo
    maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/rbac-jdo.mdo
    maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/users-jdo.mdo
Removed:
    maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseManager.java
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/JdoDatabaseManager.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/test/
    maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/continuum.xml
Modified:
    maven/continuum/trunk/continuum-data-management/data-management-cli/pom.xml
    maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
    maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/jpox/store/OID.java
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java
    maven/continuum/trunk/continuum-data-management/pom.xml
    maven/continuum/trunk/continuum-data-management/redback-legacy/pom.xml

Modified: maven/continuum/trunk/continuum-data-management/data-management-cli/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-cli/pom.xml?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-cli/pom.xml (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-cli/pom.xml Wed Jun 13 08:30:15 2007
@@ -46,6 +46,13 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>data-management-redback-jdo</artifactId>
+      <version>1.1-SNAPSHOT</version>
+      <!-- Ensures correct build order -->
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>com.google.code.cli-parser</groupId>
       <artifactId>cli</artifactId>
       <version>7</version>

Modified: maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.java Wed Jun 13 08:30:15 2007
@@ -39,10 +39,12 @@
 import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
 import org.codehaus.plexus.DefaultPlexusContainer;
 import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusContainerException;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -57,6 +59,8 @@
  */
 public class DataManagementCli
 {
+    private static final Logger LOGGER = Logger.getLogger( DataManagementCli.class );
+
     public static void main( String[] args )
         throws Exception
     {
@@ -95,22 +99,59 @@
             return;
         }
 
+        if ( command.buildsJdbcUrl == null && command.usersJdbcUrl == null )
+        {
+            System.err.println( "You must specify one of -buildsJdbcUrl and -usersJdbcUrl" );
+            return;
+        }
+
+        if ( command.usersJdbcUrl != null && databaseFormat == DatabaseFormat.CONTINUUM_103 )
+        {
+            System.err.println( "The -usersJdbcUrl option can not be used with Continuum 1.0.3 databases" );
+            return;
+        }
+
+        BasicConfigurator.configure();
         if ( command.debug )
         {
-            BasicConfigurator.configure();
             Logger.getRootLogger().setLevel( Level.DEBUG );
             Logger.getLogger( "JPOX" ).setLevel( Level.DEBUG );
         }
+        else
+        {
+            Logger.getRootLogger().setLevel( Level.INFO );
+        }
 
+        if ( command.buildsJdbcUrl != null )
+        {
+            LOGGER.info( "Processing Continuum database..." );
+            processDatabase( databaseType, databaseFormat, mode, command.buildsJdbcUrl, command.directory,
+                             databaseFormat.getContinuumToolRoleHint(), "data-management-jdo" );
+        }
+
+        if ( command.usersJdbcUrl != null )
+        {
+            LOGGER.info( "Processing Redback database..." );
+            processDatabase( databaseType, databaseFormat, mode, command.usersJdbcUrl, command.directory,
+                             databaseFormat.getRedbackToolRoleHint(), "data-management-redback-jdo" );
+        }
+    }
+
+    private static void processDatabase( SupportedDatabase databaseType, DatabaseFormat databaseFormat,
+                                         OperationMode mode, String jdbcUrl, File directory, String toolRoleHint,
+                                         String managementArtifactId )
+        throws PlexusContainerException, ComponentLookupException, ArtifactNotFoundException,
+        ArtifactResolutionException, IOException
+    {
         DatabaseParams params = new DatabaseParams( databaseType.defaultParams );
-        params.setUrl( command.jdbcUrl );
+        params.setUrl( jdbcUrl );
 
         DefaultPlexusContainer container = new DefaultPlexusContainer();
         List<Artifact> artifacts = new ArrayList<Artifact>();
         artifacts.addAll(
             downloadArtifact( container, params.getGroupId(), params.getArtifactId(), params.getVersion() ) );
         artifacts.addAll(
-            downloadArtifact( container, "org.apache.maven.continuum", "data-management-jdo", "1.1-SNAPSHOT" ) );
+            downloadArtifact( container, "org.apache.maven.continuum", managementArtifactId, "1.1-SNAPSHOT" ) );
         artifacts.addAll( downloadArtifact( container, "jpox", "jpox", databaseFormat.getJpoxVersion() ) );
 
         List<File> jars = new ArrayList<File>();
@@ -127,7 +168,8 @@
                 String id = urlEF.substring( urlEF.lastIndexOf( '/', idEndIdx - 1 ) + 1, idEndIdx );
                 // continuum-legacy included because the IDE doesn't do the proper assembly of enhanced classes and JDO metadata
                 if ( !"data-management-api".equals( id ) && !"data-management-cli".equals( id ) &&
-                    !"continuum-legacy".equals( id ) && !"continuum-model".equals( id ) )
+                    !"continuum-legacy".equals( id ) && !"continuum-model".equals( id ) &&
+                    !"redback-legacy".equals( id ) )
                 {
                     exclusions.add( "org.apache.maven.continuum:" + id );
                     jars.add( new File( url.getPath() ) );
@@ -164,20 +206,18 @@
 
         ClassRealm oldRealm = container.setLookupRealm( realm );
 
-        DatabaseManager manager = (DatabaseManager) container.lookup( DatabaseManager.class.getName(), "jdo", realm );
+        DataManagementTool manager =
+            (DataManagementTool) container.lookup( DataManagementTool.class.getName(), toolRoleHint, realm );
         manager.configure( params );
 
-        DataManagementTool tool =
-            (DataManagementTool) container.lookup( DataManagementTool.ROLE, databaseFormat.getToolRoleHint(), realm );
-
         if ( mode == OperationMode.EXPORT )
         {
-            tool.backupBuildDatabase( command.directory );
+            manager.backupDatabase( directory );
         }
         else if ( mode == OperationMode.IMPORT )
         {
-            tool.eraseBuildDatabase();
-            tool.restoreBuildDatabase( command.directory );
+            manager.eraseDatabase();
+            manager.restoreDatabase( directory );
         }
 
         container.setLookupRealm( oldRealm );
@@ -215,8 +255,6 @@
         exclusions.add( "stax:stax-api" );
         exclusions.add( "log4j:log4j" );
 
-        Collection<File> jars = new ArrayList<File>();
-
         ArtifactFilter filter = new ExcludesArtifactFilter( exclusions );
 
         ArtifactMetadataSource source =
@@ -230,10 +268,15 @@
 
     private static class Commands
     {
-        @Argument(required = true,
-                  description = "The JDBC URL for the database that contains the data to convert, or to import the data into",
-                  value = "jdbcUrl")
-        private String jdbcUrl;
+        @Argument(
+            description = "The JDBC URL for the Continuum database that contains the data to convert, or to import the data into",
+            value = "buildsJdbcUrl")
+        private String buildsJdbcUrl;
+
+        @Argument(
+            description = "The JDBC URL for the Redback database that contains the data to convert, or to import the data into",
+            value = "usersJdbcUrl")
+        private String usersJdbcUrl;
 
         // TODO: ability to use the enum directly would be nice
         @Argument(
@@ -271,8 +314,6 @@
             value = "debug")
         private boolean debug;
     }
-
-    // TODO: add user database formats
 
     private enum OperationMode
     {

Modified: maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-cli/src/main/java/org/apache/maven/continuum/management/DatabaseFormat.java Wed Jun 13 08:30:15 2007
@@ -29,7 +29,7 @@
      *
      * @todo this hasn't been completed/tested - the model needs to be annotated with 1.0.3 metadata and converters written.
      */
-    CONTINUUM_103( "1.1.1", "legacy-jdo" )
+    CONTINUUM_103( "1.1.1", "legacy-continuum-jdo" )
         {
             public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
             {
@@ -38,9 +38,9 @@
         },
 
     /**
-     * Continuum pre-alpha build database.
+     * Continuum pre-alpha build database. Plexus Security 1.0-alpha-5.
      */
-    CONTINUUM_109( "1.1.1", "legacy-jdo" )
+    CONTINUUM_109( "1.1.1", "legacy-continuum-jdo", "legacy-redback-jdo" )
         {
             public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
             {
@@ -51,7 +51,7 @@
     /**
      * Continuum 1.1+ build database.
      */
-    CONTINUUM_11( "1.1.6", "jdo" )
+    CONTINUUM_11( "1.1.6", "continuum-jdo", "redback-jdo" )
         {
             public boolean isConvertibleFrom( DatabaseFormat sourceFormat )
             {
@@ -59,15 +59,28 @@
             }
         };
 
-    private String jpoxVersion;
+    private final String jpoxVersion;
 
-    private String toolRoleHint;
+    private final String continuumToolRoleHint;
 
-    DatabaseFormat( String jpoxVersion, String toolRoleHint )
+    private final String redbackToolRoleHint;
+
+    DatabaseFormat( String jpoxVersion, String continuumToolRoleHint )
     {
         this.jpoxVersion = jpoxVersion;
 
-        this.toolRoleHint = toolRoleHint;
+        this.continuumToolRoleHint = continuumToolRoleHint;
+
+        this.redbackToolRoleHint = null;
+    }
+
+    DatabaseFormat( String jpoxVersion, String continuumToolRoleHint, String redbackToolRoleHint )
+    {
+        this.jpoxVersion = jpoxVersion;
+
+        this.continuumToolRoleHint = continuumToolRoleHint;
+
+        this.redbackToolRoleHint = redbackToolRoleHint;
     }
 
     /**
@@ -83,8 +96,13 @@
         return jpoxVersion;
     }
 
-    public String getToolRoleHint()
+    public String getContinuumToolRoleHint()
+    {
+        return continuumToolRoleHint;
+    }
+
+    public String getRedbackToolRoleHint()
     {
-        return toolRoleHint;
+        return redbackToolRoleHint;
     }
 }

Added: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java (added)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -0,0 +1,52 @@
+package org.apache.maven.continuum.management;
+
+/*
+ * 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.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+
+import java.util.Properties;
+import java.util.Iterator;
+
+public abstract class AbstractDataManagementTool
+    implements DataManagementTool
+{
+    protected static final String BUILDS_XML = "builds.xml";
+
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
+     */
+    protected DefaultConfigurableJdoFactory factory;
+
+    public void configure( DatabaseParams params )
+    {
+        // Must occur before store is looked up
+        factory.setDriverName( params.getDriverClass() );
+        factory.setUserName( params.getUsername() );
+        factory.setPassword( params.getPassword() );
+        factory.setUrl( params.getUrl() );
+
+        Properties properties = params.getProperties();
+        for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+        {
+            String key = (String) i.next();
+            factory.setProperty( key, properties.getProperty( key ) );
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/JdoDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -56,22 +56,17 @@
 /**
  * JDO implementation the database management tool API.
  *
- * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="jdo"
+ * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="continuum-jdo"
  */
 public class JdoDataManagementTool
-    implements DataManagementTool
+    extends AbstractDataManagementTool
 {
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private ContinuumStore store;
 
-    /**
-     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
-     */
-    private ConfigurableJdoFactory factory;
-
-    public void backupBuildDatabase( File backupDirectory )
+    public void backupDatabase( File backupDirectory )
         throws IOException
     {
         ContinuumDatabase database = new ContinuumDatabase();
@@ -113,12 +108,12 @@
         }
     }
 
-    public void eraseBuildDatabase()
+    public void eraseDatabase()
     {
         store.eraseDatabase();
     }
 
-    public void restoreBuildDatabase( File backupDirectory )
+    public void restoreDatabase( File backupDirectory )
         throws IOException
     {
         ContinuumStaxReader reader = new ContinuumStaxReader();

Modified: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/LegacyJdoDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -67,17 +67,12 @@
 /**
  * JDO implementation the database management tool API.
  *
- * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-jdo"
+ * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-continuum-jdo"
  */
 public class LegacyJdoDataManagementTool
-    implements DataManagementTool
+    extends AbstractDataManagementTool
 {
-    /**
-     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
-     */
-    private ConfigurableJdoFactory factory;
-
-    public void backupBuildDatabase( File backupDirectory )
+    public void backupDatabase( File backupDirectory )
         throws IOException
     {
         PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );
@@ -156,7 +151,7 @@
     }
 
     @SuppressWarnings({"OverlyCoupledMethod"})
-    public void eraseBuildDatabase()
+    public void eraseDatabase()
     {
         PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdo109" );
         PersistenceManager persistenceManager = getPersistenceManager( pmf );
@@ -187,7 +182,7 @@
         return pm;
     }
 
-    public void restoreBuildDatabase( File backupDirectory )
+    public void restoreDatabase( File backupDirectory )
         throws IOException
     {
         ContinuumStaxReader reader = new ContinuumStaxReader();

Modified: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/jpox/store/OID.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/jpox/store/OID.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/jpox/store/OID.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/jpox/store/OID.java Wed Jun 13 08:30:15 2007
@@ -1,28 +1,23 @@
-/**********************************************************************
- Copyright (c) 2002 Kelly Grizzle (TJDO) and others. All rights reserved.
- Licensed 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.
-
-
- Contributors:
- 2003 Erik Bengtson - Refactored OID
- 2003 Andy Jefferson - fixed OID(String)
- 2003 Andy Jefferson - coding standards
- 2004 Andy Jefferson - fixes to allow full use of long or String OIDs
- 2005 Erik Bengtson - removed oidType
- 2007 Brett Porter - changed hashcode algorithm to avoid collisions (see CORE-3297)
- ...
- **********************************************************************/
 package org.jpox.store;
+
+/*
+ * 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.jpox.ClassNameConstants;
 import org.jpox.util.Localiser;

Modified: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/test/java/org/apache/maven/continuum/management/DataManagementToolTest.java Wed Jun 13 08:30:15 2007
@@ -43,12 +43,14 @@
 
     private File targetDirectory;
 
+    private static final String BUILDS_XML = "builds.xml";
+
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        dataManagementTool = (DataManagementTool) lookup( DataManagementTool.ROLE, "jdo" );
+        dataManagementTool = (DataManagementTool) lookup( DataManagementTool.class.getName(), "continuum-jdo" );
 
         targetDirectory = createBackupDirectory();
     }
@@ -77,9 +79,9 @@
         // test sanity check
         assertBuildDatabase();
 
-        dataManagementTool.backupBuildDatabase( targetDirectory );
+        dataManagementTool.backupDatabase( targetDirectory );
 
-        File backupFile = new File( targetDirectory, DataManagementTool.BUILDS_XML );
+        File backupFile = new File( targetDirectory, BUILDS_XML );
 
         assertTrue( "Check database exists", backupFile.exists() );
 
@@ -96,7 +98,7 @@
     {
         createBuildDatabase();
 
-        dataManagementTool.eraseBuildDatabase();
+        dataManagementTool.eraseDatabase();
 
         assertEmpty();
     }
@@ -108,17 +110,17 @@
 
         assertEmpty();
 
-        File backupFile = new File( targetDirectory, DataManagementTool.BUILDS_XML );
+        File backupFile = new File( targetDirectory, BUILDS_XML );
 
         IOUtil.copy( getClass().getResourceAsStream( "/expected.xml" ), new FileWriter( backupFile ) );
 
-        dataManagementTool.restoreBuildDatabase( targetDirectory );
+        dataManagementTool.restoreDatabase( targetDirectory );
 
         // TODO: why is this wrong?
         assertBuildDatabase();
 
         // Test that it worked. Relies on BackupBuilds having worked
-        dataManagementTool.backupBuildDatabase( targetDirectory );
+        dataManagementTool.backupDatabase( targetDirectory );
 
         StringWriter sw = new StringWriter();
 

Copied: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/pom.xml (from r546588, maven/continuum/trunk/continuum-data-management/data-management-jdo/pom.xml)
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/pom.xml?view=diff&rev=546923&p1=maven/continuum/trunk/continuum-data-management/data-management-jdo/pom.xml&r1=546588&p2=maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/pom.xml&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/pom.xml (original)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/pom.xml Wed Jun 13 08:30:15 2007
@@ -26,7 +26,7 @@
     <version>1.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>data-management-jdo</artifactId>
+  <artifactId>data-management-redback-jdo</artifactId>
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.continuum</groupId>
@@ -40,52 +40,30 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.continuum</groupId>
-      <artifactId>continuum-legacy</artifactId>
+      <artifactId>redback-legacy</artifactId>
       <version>1.1-SNAPSHOT</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.continuum</groupId>
-      <artifactId>continuum-model</artifactId>
+      <groupId>org.codehaus.plexus.redback</groupId>
+      <artifactId>redback-data-management</artifactId>
+      <version>1.0-alpha-1</version>
     </dependency>
+<!--
     <dependency>
-      <groupId>org.apache.maven.continuum</groupId>
-      <artifactId>continuum-api</artifactId>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-authorization-rbac-store-jdo</artifactId>
+      <version>1.0-alpha-5</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.continuum</groupId>
-      <artifactId>continuum-store</artifactId>
-      <scope>runtime</scope>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-keys-jdo</artifactId>
+      <version>1.0-alpha-5</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.continuum</groupId>
-      <artifactId>continuum-store</artifactId>
-      <classifier>tests</classifier>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>jpox</groupId>
-      <artifactId>jpox</artifactId>
-      <version>1.1.6</version>
-      <!-- Temporary while we have the OID patch in there
-            <scope>test</scope>
-      -->
-    </dependency>
-    <dependency>
-      <groupId>hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>stax</groupId>
-      <artifactId>stax</artifactId>
-      <version>1.1.1-dev</version>
-      <scope>test</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>xmlbeans</groupId>
-          <artifactId>xmlbeans-jsr173-api</artifactId>
-        </exclusion>
-      </exclusions>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-user-management-provider-jdo</artifactId>
+      <version>1.0-alpha-5</version>
     </dependency>
+-->
   </dependencies>
 </project>

Added: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java (added)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -0,0 +1,52 @@
+package org.apache.maven.continuum.management.redback;
+
+/*
+ * 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.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+import org.apache.maven.continuum.management.DataManagementTool;
+import org.apache.maven.continuum.management.DatabaseParams;
+
+import java.util.Properties;
+import java.util.Iterator;
+
+public abstract class AbstractDataManagementTool
+    implements DataManagementTool
+{
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="users"
+     */
+    protected DefaultConfigurableJdoFactory factory;
+
+    public void configure( DatabaseParams params )
+    {
+        // Must occur before store is looked up
+        factory.setDriverName( params.getDriverClass() );
+        factory.setUserName( params.getUsername() );
+        factory.setPassword( params.getPassword() );
+        factory.setUrl( params.getUrl() );
+
+        Properties properties = params.getProperties();
+        for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+        {
+            String key = (String) i.next();
+            factory.setProperty( key, properties.getProperty( key ) );
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java (added)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -0,0 +1,104 @@
+package org.apache.maven.continuum.management.redback;
+
+/*
+ * 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.codehaus.plexus.redback.keys.KeyManager;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.RbacManagerException;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.apache.maven.continuum.management.DataManagementException;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * JDO implementation the database management tool API.
+ *
+ * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="redback-jdo"
+ */
+public class JdoDataManagementTool
+    extends AbstractDataManagementTool
+{
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private org.codehaus.plexus.redback.management.DataManagementTool toolDelegate;
+
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private RBACManager rbacManager;
+
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private UserManager userManager;
+
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private KeyManager keyManager;
+
+    public void backupDatabase( File backupDirectory )
+        throws IOException
+    {
+        try
+        {
+            toolDelegate.backupKeyDatabase( keyManager, backupDirectory );
+            toolDelegate.backupRBACDatabase( rbacManager, backupDirectory );
+            toolDelegate.backupUserDatabase( userManager, backupDirectory );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new DataManagementException( e );
+        }
+    }
+
+    public void eraseDatabase()
+    {
+        toolDelegate.eraseKeysDatabase( keyManager );
+        toolDelegate.eraseRBACDatabase( rbacManager );
+        toolDelegate.eraseUsersDatabase( userManager );
+    }
+
+    public void restoreDatabase( File backupDirectory )
+        throws IOException
+    {
+        try
+        {
+            toolDelegate.restoreKeysDatabase( keyManager, backupDirectory );
+            toolDelegate.restoreRBACDatabase( rbacManager, backupDirectory );
+            toolDelegate.restoreUsersDatabase( userManager, backupDirectory );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new DataManagementException( e );
+        }
+    }
+}

Propchange: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java (added)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java Wed Jun 13 08:30:15 2007
@@ -0,0 +1,397 @@
+package org.apache.maven.continuum.management.redback;
+
+/*
+ * 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.maven.continuum.management.DataManagementException;
+import org.codehaus.plexus.jdo.JdoFactory;
+import org.codehaus.plexus.jdo.PlexusJdoUtils;
+import org.codehaus.plexus.jdo.PlexusStoreException;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.JdoOperation;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.JdoPermission;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.JdoResource;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.JdoRole;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.JdoUserAssignment;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.RbacDatabase;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.RbacJdoModelModelloMetadata;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.io.stax.RbacJdoModelStaxReader;
+import org.codehaus.plexus.security.authorization.rbac.jdo.v0_9_0.io.stax.RbacJdoModelStaxWriter;
+import org.codehaus.plexus.security.keys.jdo.v0_9_0.AuthenticationKeyDatabase;
+import org.codehaus.plexus.security.keys.jdo.v0_9_0.JdoAuthenticationKey;
+import org.codehaus.plexus.security.keys.jdo.v0_9_0.PlexusSecurityKeyManagementJdoModelloMetadata;
+import org.codehaus.plexus.security.keys.jdo.v0_9_0.io.stax.PlexusSecurityKeyManagementJdoStaxReader;
+import org.codehaus.plexus.security.keys.jdo.v0_9_0.io.stax.PlexusSecurityKeyManagementJdoStaxWriter;
+import org.codehaus.plexus.security.rbac.RBACObjectAssertions;
+import org.codehaus.plexus.security.rbac.RbacManagerException;
+import org.codehaus.plexus.security.user.Messages;
+import org.codehaus.plexus.security.user.UserManagerException;
+import org.codehaus.plexus.security.user.jdo.v0_9_0.JdoUser;
+import org.codehaus.plexus.security.user.jdo.v0_9_0.UserDatabase;
+import org.codehaus.plexus.security.user.jdo.v0_9_0.UserManagementModelloMetadata;
+import org.codehaus.plexus.security.user.jdo.v0_9_0.io.stax.UserManagementStaxReader;
+import org.codehaus.plexus.security.user.jdo.v0_9_0.io.stax.UserManagementStaxWriter;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.xml.stream.XMLStreamException;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JDO implementation the database management tool API.
+ *
+ * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-redback-jdo"
+ */
+public class LegacyJdoDataManagementTool
+    extends AbstractDataManagementTool
+{
+    private static final String USERS_XML_NAME = "users.xml";
+
+    private static final String KEYS_XML_NAME = "keys.xml";
+
+    private static final String RBAC_XML_NAME = "rbac.xml";
+
+    /**
+     * @plexus.requirement role-hint="users"
+     */
+    private JdoFactory jdoFactory;
+
+    public void backupDatabase( File backupDirectory )
+        throws IOException
+    {
+        try
+        {
+            backupKeyDatabase( backupDirectory );
+            backupRBACDatabase( backupDirectory );
+            backupUserDatabase( backupDirectory );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new DataManagementException( e );
+        }
+    }
+
+    public void restoreDatabase( File backupDirectory )
+        throws IOException, DataManagementException
+    {
+        try
+        {
+            restoreKeysDatabase( backupDirectory );
+            restoreRBACDatabase( backupDirectory );
+            restoreUsersDatabase( backupDirectory );
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new DataManagementException( e );
+        }
+        catch ( PlexusStoreException e )
+        {
+            throw new DataManagementException( e );
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new DataManagementException( e );
+        }
+    }
+
+    public void eraseDatabase()
+    {
+        eraseKeysDatabase();
+        eraseRBACDatabase();
+        eraseUsersDatabase();
+    }
+
+    public void backupRBACDatabase( File backupDirectory )
+        throws RbacManagerException, IOException, XMLStreamException
+    {
+        RbacDatabase database = new RbacDatabase();
+        database.setRoles( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoRole.class ) );
+        database.setUserAssignments(
+            PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoUserAssignment.class ) );
+        database.setPermissions( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoPermission.class ) );
+        database.setOperations( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoOperation.class ) );
+        database.setResources( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoResource.class ) );
+
+        RbacJdoModelStaxWriter writer = new RbacJdoModelStaxWriter();
+        FileWriter fileWriter = new FileWriter( new File( backupDirectory, RBAC_XML_NAME ) );
+        try
+        {
+            writer.write( fileWriter, database );
+        }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
+    }
+
+    public void backupUserDatabase( File backupDirectory )
+        throws IOException, XMLStreamException
+    {
+        UserDatabase database = new UserDatabase();
+        database.setUsers( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoUser.class ) );
+
+        UserManagementStaxWriter writer = new UserManagementStaxWriter();
+        FileWriter fileWriter = new FileWriter( new File( backupDirectory, USERS_XML_NAME ) );
+        try
+        {
+            writer.write( fileWriter, database );
+        }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
+    }
+
+    public void backupKeyDatabase( File backupDirectory )
+        throws IOException, XMLStreamException
+    {
+        AuthenticationKeyDatabase database = new AuthenticationKeyDatabase();
+        List keys = PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoAuthenticationKey.class );
+
+        database.setKeys( keys );
+
+        PlexusSecurityKeyManagementJdoStaxWriter writer = new PlexusSecurityKeyManagementJdoStaxWriter();
+        FileWriter fileWriter = new FileWriter( new File( backupDirectory, KEYS_XML_NAME ) );
+        try
+        {
+            writer.write( fileWriter, database );
+        }
+        finally
+        {
+            IOUtil.close( fileWriter );
+        }
+    }
+
+    private PersistenceManager getPersistenceManager()
+    {
+        PersistenceManager pm = jdoFactory.getPersistenceManagerFactory().getPersistenceManager();
+
+        pm.getFetchPlan().setMaxFetchDepth( 5 );
+
+        return pm;
+    }
+
+    public void restoreRBACDatabase( File backupDirectory )
+        throws IOException, XMLStreamException, RbacManagerException, PlexusStoreException
+    {
+        RbacJdoModelStaxReader reader = new RbacJdoModelStaxReader();
+
+        FileReader fileReader = new FileReader( new File( backupDirectory, RBAC_XML_NAME ) );
+
+        RbacDatabase database;
+        try
+        {
+            database = reader.read( fileReader );
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+
+        Map<String, JdoPermission> permissionMap = new HashMap<String, JdoPermission>();
+        Map<String, JdoResource> resources = new HashMap<String, JdoResource>();
+        Map<String, JdoOperation> operations = new HashMap<String, JdoOperation>();
+        for ( Iterator i = database.getRoles().iterator(); i.hasNext(); )
+        {
+            JdoRole role = (JdoRole) i.next();
+
+            // TODO: this could be generally useful and put into saveRole itself as long as the performance penalty isn't too harsh.
+            //   Currently it always saves everything where it could pull pack the existing permissions, etc if they exist
+            List<JdoPermission> permissions = new ArrayList<JdoPermission>();
+            for ( Iterator j = role.getPermissions().iterator(); j.hasNext(); )
+            {
+                JdoPermission permission = (JdoPermission) j.next();
+
+                if ( permissionMap.containsKey( permission.getName() ) )
+                {
+                    permission = permissionMap.get( permission.getName() );
+                }
+                else if ( objectExists( permission ) )
+                {
+                    permission = (JdoPermission) PlexusJdoUtils.getObjectById( getPersistenceManager(),
+                                                                            JdoPermission.class, permission.getName() );
+                    permissionMap.put( permission.getName(), permission );
+                }
+                else
+                {
+                    JdoOperation operation = (JdoOperation) permission.getOperation();
+                    if ( operations.containsKey( operation.getName() ) )
+                    {
+                        operation = operations.get( operation.getName() );
+                    }
+                    else if ( objectExists( operation ) )
+                    {
+                        operation = (JdoOperation) PlexusJdoUtils.getObjectById( getPersistenceManager(),
+                                                                              JdoOperation.class, operation.getName() );
+                        operations.put( operation.getName(), operation );
+                    }
+                    else
+                    {
+                        RBACObjectAssertions.assertValid( operation );
+                        operation = (JdoOperation) PlexusJdoUtils.saveObject( getPersistenceManager(), operation, null );
+                        operations.put( operation.getName(), operation );
+                    }
+                    permission.setOperation( operation );
+
+                    JdoResource resource = (JdoResource) permission.getResource();
+                    if ( resources.containsKey( resource.getIdentifier() ) )
+                    {
+                        resource = resources.get( resource.getIdentifier() );
+                    }
+                    else if ( objectExists( resource ) )
+                    {
+                        resource = (JdoResource) PlexusJdoUtils.getObjectById( getPersistenceManager(), JdoResource.class,
+                                                                            resource.getIdentifier() );
+                        resources.put( resource.getIdentifier(), resource );
+                    }
+                    else
+                    {
+                        RBACObjectAssertions.assertValid( resource );
+                        resource = (JdoResource) PlexusJdoUtils.saveObject( getPersistenceManager(), resource, null );
+                        resources.put( resource.getIdentifier(), resource );
+                    }
+                    permission.setResource( resource );
+
+                    RBACObjectAssertions.assertValid( permission );
+                    permission = (JdoPermission) PlexusJdoUtils.saveObject( getPersistenceManager(), permission, null );
+                    permissionMap.put( permission.getName(), permission );
+                }
+                permissions.add( permission );
+            }
+            role.setPermissions( permissions );
+
+            RBACObjectAssertions.assertValid( role );
+
+            PlexusJdoUtils.saveObject( getPersistenceManager(), role, new String[]{null} );
+        }
+
+        for ( Iterator i = database.getUserAssignments().iterator(); i.hasNext(); )
+        {
+            JdoUserAssignment userAssignment = (JdoUserAssignment) i.next();
+
+            RBACObjectAssertions.assertValid( "Save User Assignment", userAssignment );
+
+            PlexusJdoUtils.saveObject( getPersistenceManager(), userAssignment, new String[]{null} );
+        }
+    }
+
+    private boolean objectExists( Object object )
+    {
+        return JDOHelper.getObjectId( object ) != null;
+    }
+
+    public void restoreUsersDatabase( File backupDirectory )
+        throws IOException, XMLStreamException
+    {
+        UserManagementStaxReader reader = new UserManagementStaxReader();
+
+        FileReader fileReader = new FileReader( new File( backupDirectory, USERS_XML_NAME ) );
+
+        UserDatabase database;
+        try
+        {
+            database = reader.read( fileReader );
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+
+        for ( Iterator i = database.getUsers().iterator(); i.hasNext(); )
+        {
+            JdoUser user = (JdoUser) i.next();
+
+            if ( !( user instanceof JdoUser ) )
+            {
+                throw new UserManagerException( "Unable to Add User. User object " + user.getClass().getName() +
+                    " is not an instance of " + JdoUser.class.getName() );
+            }
+
+            if ( StringUtils.isEmpty( user.getUsername() ) )
+            {
+                throw new IllegalStateException(
+                    Messages.getString( "user.manager.cannot.add.user.without.username" ) ); //$NON-NLS-1$
+            }
+
+            PlexusJdoUtils.addObject( getPersistenceManager(), user );
+
+        }
+    }
+
+    public void restoreKeysDatabase( File backupDirectory )
+        throws IOException, XMLStreamException
+    {
+        PlexusSecurityKeyManagementJdoStaxReader reader = new PlexusSecurityKeyManagementJdoStaxReader();
+
+        FileReader fileReader = new FileReader( new File( backupDirectory, KEYS_XML_NAME ) );
+
+        AuthenticationKeyDatabase database;
+        try
+        {
+            database = reader.read( fileReader );
+        }
+        finally
+        {
+            IOUtil.close( fileReader );
+        }
+
+        for ( Iterator i = database.getKeys().iterator(); i.hasNext(); )
+        {
+            JdoAuthenticationKey key = (JdoAuthenticationKey) i.next();
+
+            PlexusJdoUtils.addObject( getPersistenceManager(), key );
+        }
+    }
+
+    public void eraseRBACDatabase()
+    {
+        // Must delete in order so that FK constraints don't get violated
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoRole.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoPermission.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoOperation.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoResource.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoUserAssignment.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), RbacJdoModelModelloMetadata.class );
+    }
+
+    public void eraseUsersDatabase()
+    {
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoUser.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), UserManagementModelloMetadata.class );
+    }
+
+    public void eraseKeysDatabase()
+    {
+        PlexusJdoUtils.removeAll( getPersistenceManager(), JdoAuthenticationKey.class );
+        PlexusJdoUtils.removeAll( getPersistenceManager(), PlexusSecurityKeyManagementJdoModelloMetadata.class );
+    }
+}

Propchange: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/trunk/continuum-data-management/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/pom.xml?view=diff&rev=546923&r1=546922&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/pom.xml (original)
+++ maven/continuum/trunk/continuum-data-management/pom.xml Wed Jun 13 08:30:15 2007
@@ -18,6 +18,7 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
@@ -36,6 +37,9 @@
     <module>data-management-api</module>
     <module>continuum-legacy</module>
     <module>data-management-jdo</module>
+    <!-- TODO: move to redback data management -->
+    <module>redback-legacy</module>
+    <module>data-management-redback-jdo</module>
   </modules>
   <build>
     <plugins>

Modified: maven/continuum/trunk/continuum-data-management/redback-legacy/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/redback-legacy/pom.xml?view=diff&rev=546923&r1=546586&r2=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/redback-legacy/pom.xml (original)
+++ maven/continuum/trunk/continuum-data-management/redback-legacy/pom.xml Wed Jun 13 08:30:15 2007
@@ -25,8 +25,8 @@
     <version>1.1-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>continuum-legacy</artifactId>
-  <name>Continuum Legacy Model</name>
+  <artifactId>redback-legacy</artifactId>
+  <name>Redback Legacy Model</name>
   <build>
     <plugins>
       <plugin>
@@ -34,51 +34,121 @@
         <artifactId>modello-maven-plugin</artifactId>
         <executions>
           <execution>
-            <id>modello-continuum-metadata</id>
+            <id>modello-rbac</id>
             <goals>
               <goal>jpox-metadata-class</goal>
               <goal>java</goal>
               <goal>stax-reader</goal>
               <goal>stax-writer</goal>
             </goals>
+            <configuration>
+              <model>src/main/mdo/rbac-jdo.mdo</model>
+            </configuration>
           </execution>
           <execution>
-            <id>jpox-jdo-mapping</id>
+            <id>jpox-jdo-mapping-rbac</id>
             <goals>
               <goal>jpox-jdo-mapping</goal>
             </goals>
             <configuration>
-              <outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
+              <model>src/main/mdo/rbac-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/authorization/rbac/jdo
+              </outputDirectory>
             </configuration>
           </execution>
           <execution>
-            <id>jpox-jdo-mapping-replication</id>
+            <id>jpox-jdo-mapping-rbac-replication</id>
             <goals>
               <goal>jpox-jdo-mapping</goal>
             </goals>
             <configuration>
-              <outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
+              <model>src/main/mdo/rbac-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/authorization/rbac/jdo
+              </outputDirectory>
               <replicationParameters>true</replicationParameters>
             </configuration>
           </execution>
-        </executions>
-        <configuration>
-          <version>1.0.9</version>
-          <packageWithVersion>true</packageWithVersion>
-          <model>src/main/mdo/continuum.xml</model>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>jpox-maven-plugin</artifactId>
-        <version>1.1.6</version>
-        <executions>
           <execution>
+            <id>modello-keys</id>
             <goals>
-              <goal>enhance</goal>
+              <goal>jpox-metadata-class</goal>
+              <goal>java</goal>
+              <goal>stax-reader</goal>
+              <goal>stax-writer</goal>
+            </goals>
+            <configuration>
+              <model>src/main/mdo/keys-jdo.mdo</model>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jpox-jdo-mapping-keys</id>
+            <goals>
+              <goal>jpox-jdo-mapping</goal>
+            </goals>
+            <configuration>
+              <model>src/main/mdo/keys-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/keys/jdo
+              </outputDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jpox-jdo-mapping-keys-replication</id>
+            <goals>
+              <goal>jpox-jdo-mapping</goal>
+            </goals>
+            <configuration>
+              <model>src/main/mdo/keys-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/keys/jdo
+              </outputDirectory>
+              <replicationParameters>true</replicationParameters>
+            </configuration>
+          </execution>
+          <execution>
+            <id>modello-users</id>
+            <goals>
+              <goal>jpox-metadata-class</goal>
+              <goal>java</goal>
+              <goal>stax-reader</goal>
+              <goal>stax-writer</goal>
             </goals>
+            <configuration>
+              <model>src/main/mdo/users-jdo.mdo</model>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jpox-jdo-mapping-users</id>
+            <goals>
+              <goal>jpox-jdo-mapping</goal>
+            </goals>
+            <configuration>
+              <model>src/main/mdo/users-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/user/jdo
+              </outputDirectory>
+            </configuration>
+          </execution>
+          <execution>
+            <id>jpox-jdo-mapping-users-replication</id>
+            <goals>
+              <goal>jpox-jdo-mapping</goal>
+            </goals>
+            <configuration>
+              <model>src/main/mdo/users-jdo.mdo</model>
+              <outputDirectory>
+                ${basedir}/target/classes/org/codehaus/plexus/security/user/jdo
+              </outputDirectory>
+              <replicationParameters>true</replicationParameters>
+            </configuration>
           </execution>
         </executions>
+        <configuration>
+          <version>0.9.0</version>
+          <packageWithVersion>true</packageWithVersion>
+        </configuration>
       </plugin>
       <plugin>
         <artifactId>maven-antrun-plugin</artifactId>
@@ -90,8 +160,14 @@
               <tasks>
                 <!-- Workaround for MODELLO-89 -->
                 <replace
-                    file="target/generated-sources/modello/org/apache/maven/continuum/model/project/v1_0_9/ContinuumModelloMetadata.java"
-                    token="project;" value="project.v1_0_9;"/>
+                    file="target/generated-sources/modello/org/codehaus/plexus/security/keys/jdo/v0_9_0/PlexusSecurityKeyManagementJdoModelloMetadata.java"
+                    token="jdo;" value="jdo.v0_9_0;"/>
+                <replace
+                    file="target/generated-sources/modello/org/codehaus/plexus/security/authorization/rbac/jdo/v0_9_0/RbacJdoModelModelloMetadata.java"
+                    token="jdo;" value="jdo.v0_9_0;"/>
+                <replace
+                    file="target/generated-sources/modello/org/codehaus/plexus/security/user/jdo/v0_9_0/UserManagementModelloMetadata.java"
+                    token="jdo;" value="jdo.v0_9_0;"/>
               </tasks>
             </configuration>
             <goals>
@@ -104,18 +180,21 @@
             <configuration>
               <tasks>
                 <!-- Workaround for MODELLO-91 -->
-                <replace dir="target/classes/META-INF" token='name="notifiertype"' value='name="type"'/>
-                <replace dir="target/classes/META-INF" token='name="resultstate"' value='name="state"'/>
-                <replace dir="target/classes/META-INF" token='name="resulttrigger"' value='name="trigger"'/>
-                <replace dir="target/classes/META-INF" token='name="projectstate"' value='name="state"'/>
-                <replace dir="target/classes/META-INF" token='name="changecomment"' value='name="comment"'/>
-                <replace dir="target/classes/META-INF" token='name="changedate"' value='name="date"'/>
-                <replace dir="target/classes/META-INF" token='name="scheduledelay"' value='name="delay"'/>
-                <move file="target/classes/META-INF/package.jdorepl"
-                      tofile="target/classes/META-INF/package.jdorepl109"/>
-                <move file="target/classes/META-INF/package.jdo" tofile="target/classes/META-INF/package.jdo109"/>
-                <delete file="target/classes/package.jdo" />
-                <delete file="target/classes/package.jdorepl" />
+                <replace dir="target/classes/org/codehaus/plexus/security/user/jdo" token='name="USER_PASSWORD"'
+                         value='name="PASSWORD"'/>
+                <replace dir="target/classes/org/codehaus/plexus/security/authorization/rbac/jdo"
+                         token='name="RBAC_OPERATION"'
+                         value='name="OPERATION"'/>
+                <replace dir="target/classes/org/codehaus/plexus/security/authorization/rbac/jdo"
+                         token='name="RBAC_RESOURCE"'
+                         value='name="RESOURCE"'/>
+                <!-- TODO!
+                                <move file="target/classes/META-INF/package.jdorepl"
+                                      tofile="target/classes/META-INF/package.jdorepl109"/>
+                                <move file="target/classes/META-INF/package.jdo" tofile="target/classes/META-INF/package.jdo109"/>
+                                <delete file="target/classes/package.jdo" />
+                                <delete file="target/classes/package.jdorepl" />
+                -->
               </tasks>
             </configuration>
             <goals>
@@ -124,6 +203,18 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jpox-maven-plugin</artifactId>
+        <version>1.1.6</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>enhance</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
@@ -142,6 +233,21 @@
       <groupId>stax</groupId>
       <artifactId>stax-api</artifactId>
       <version>1.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-keys-api</artifactId>
+      <version>1.0-alpha-5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-authorization-rbac-model</artifactId>
+      <version>1.0-alpha-5</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-user-management-api</artifactId>
+      <version>1.0-alpha-5</version>
     </dependency>
   </dependencies>
 </project>

Added: maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/keys-jdo.mdo
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/keys-jdo.mdo?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/keys-jdo.mdo (added)
+++ maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/keys-jdo.mdo Wed Jun 13 08:30:15 2007
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+
+<model>
+  <id>plexus-security-keys-jdo</id>
+  <name>PlexusSecurityKeyManagementJdo</name>
+  <version>0.9.0</version>
+  <description>Plexus Security :: Key Management JDO Store.</description>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.codehaus.plexus.security.keys.jdo</value>
+    </default>
+  </defaults>
+
+  <classes>
+    <class stash.storable="false" rootElement="true">
+      <name>AuthenticationKeyDatabase</name>
+      <version>0.9.0</version>
+      <fields>
+        <field jpox.column="AUTH_KEYS">
+          <name>keys</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoAuthenticationKey</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+    <class stash.storable="true" jpox.use-identifiers-as-primary-key="false">
+      <name>JdoAuthenticationKey</name>
+      <version>0.9.0</version>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.keys.AuthenticationKey</interface>
+      </interfaces>
+      <description>
+        @plexus.component role="org.codehaus.plexus.security.keys.AuthenticationKey"
+        role-hint="jdo"
+      </description>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="AUTHKEY">
+          <name>key</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>forPrincipal</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>purpose</name>
+          <version>0.9.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>dateCreated</name>
+          <version>0.9.0</version>
+          <type>Date</type>
+        </field>
+        <field>
+          <name>dateExpires</name>
+          <version>0.9.0</version>
+          <type>Date</type>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>

Added: maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/rbac-jdo.mdo
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/rbac-jdo.mdo?view=auto&rev=546923
==============================================================================
--- maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/rbac-jdo.mdo (added)
+++ maven/continuum/trunk/continuum-data-management/redback-legacy/src/main/mdo/rbac-jdo.mdo Wed Jun 13 08:30:15 2007
@@ -0,0 +1,337 @@
+<?xml version="1.0"?>
+<!--
+  ~ 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.
+  -->
+
+<model jpox.table-prefix="SECURITY_">
+  <!-- TODO: there is no reason this model is JDO specific. Shouldn't it be the basis for the various providers? It would dramatically reduce the code in -memory, for example -->
+  <id>rbac-jdo</id>
+  <name>RbacJdoModel</name>
+  <version>0.9.0</version>
+  <defaults>
+    <default>
+      <key>package</key>
+      <value>org.codehaus.plexus.security.authorization.rbac.jdo</value>
+    </default>
+  </defaults>
+  <classes>
+    <class rootElement="true"
+           jpox.stashable="false">
+      <name>RbacDatabase</name>
+      <version>0.9.0</version>
+      <fields>
+        <field jpox.column="RBAC_ROLES">
+          <name>roles</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoRole</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>permissions</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoPermission</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>operations</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoOperation</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>resources</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoResource</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>userAssignments</name>
+          <version>0.9.0</version>
+          <association>
+            <type>JdoUserAssignment</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+
+    <class jpox.stashable="true" 
+           jpox.table="ROLES"
+           jpox.not-persisted-fields="modelEncoding">
+      <name>JdoRole</name>
+      <version>0.9.0</version>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.rbac.Role</interface>
+      </interfaces>
+      <superClass>org.codehaus.plexus.security.rbac.AbstractRole</superClass>
+      <fields>
+        <field jpox.primary-key="true" jpox.value-strategy="off">
+          <name>name</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>description</name>
+          <version>0.9.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>assignable</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this role is available to be assigned to a user
+          </description>
+        </field>
+        <field>
+          <name>permanent</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this object is permanent.
+          </description>
+        </field>
+        <field jpox.persistence-modifier="persistent" 
+               jpox.fetch-groups="role-child-detail"
+               jpox.join-table="ROLE_CHILDROLE_MAP">
+          <name>childRoleNames</name>
+          <version>0.9.0</version>
+          <association stash.part="true" 
+                       jpox.join="true"
+                       java.init="field" 
+                       jpox.dependent="false"
+                       java.generate-break="false" 
+                       java.generate-create="false"
+                       zjava.use-interface="org.codehaus.plexus.security.rbac.Role">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+          <description>
+            roles that will inherit the permissions of this role
+          </description>
+        </field>
+        <field jpox.fetch-groups="role-child-detail"
+               jpox.join-table="ROLE_PERMISSION_MAP">
+          <name>permissions</name>
+          <version>0.9.0</version>
+          <association stash.part="true"
+                       xml.reference="true"
+                       jpox.join="true"
+                       jpox.dependent="false"
+                       java.init="field"
+                       java.generate-break="false"
+                       java.generate-create="false"
+                       java.use-interface="org.codehaus.plexus.security.rbac.Permission">
+            <type>JdoPermission</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+
+    <class jpox.stashable="true" 
+           jpox.table="PERMISSIONS"
+           jpox.not-persisted-fields="modelEncoding">
+      <name>JdoPermission</name>
+      <version>0.9.0</version>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.rbac.Permission</interface>
+      </interfaces>
+      <fields>
+        <field jpox.primary-key="true" jpox.value-strategy="off">
+          <name>name</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>description</name>
+          <version>0.9.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>permanent</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this object is permanent.
+          </description>
+        </field>
+        <field jpox.indexed="true" jpox.column="RBAC_OPERATION">
+          <name>operation</name>
+          <version>0.9.0</version>
+          <association stash.part="true" 
+                       xml.reference="true"
+                       java.use-interface="org.codehaus.plexus.security.rbac.Operation"
+                       jpox.dependent="false">
+            <type>JdoOperation</type>
+            <multiplicity>1</multiplicity>
+          </association>
+        </field>
+        <field jpox.indexed="true" jpox.column="RBAC_RESOURCE">
+          <name>resource</name>
+          <version>0.9.0</version>
+          <association stash.part="true" 
+                       xml.reference="true"
+                       java.use-interface="org.codehaus.plexus.security.rbac.Resource"
+                       jpox.dependent="false">
+            <type>JdoResource</type>
+            <multiplicity>1</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+
+    <class jpox.stashable="true" 
+           jpox.table="OPERATIONS"
+           jpox.not-persisted-fields="modelEncoding">
+      <name>JdoOperation</name>
+      <version>0.9.0</version>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.rbac.Operation</interface>
+      </interfaces>
+      <fields>
+        <field jpox.primary-key="true" jpox.value-strategy="off">
+          <name>name</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>description</name>
+          <version>0.9.0</version>
+          <type>String</type>
+        </field>
+        <field>
+          <name>permanent</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this object is permanent.
+          </description>
+        </field>
+        <field>
+          <name>resourceRequired</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if the resource is required for authorization to be granted
+          </description>
+        </field>
+      </fields>
+    </class>
+
+    <class jpox.stashable="true" 
+           jpox.table="RESOURCES"
+           jpox.not-persisted-fields="modelEncoding">
+      <name>JdoResource</name>
+      <version>0.9.0</version>
+      <description>
+        In RBAC terms, this is the entity which an operation is associated with that which permissions are based on.
+      </description>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.rbac.Resource</interface>
+      </interfaces>
+      <fields>
+        <field jpox.primary-key="true" jpox.value-strategy="off">
+          <name>identifier</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <description>
+            The string identifier for a resource.
+          </description>
+          <identifier>true</identifier>
+        </field>
+        <field>
+          <name>pattern</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if the identifer is a pattern that is to be evaluated, for example x.* could match x.a or x.b and x.**
+            could match x.foo
+          </description>
+        </field>
+        <field>
+          <name>permanent</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this object is permanent.
+          </description>
+        </field>
+      </fields>
+    </class>
+
+    <class jpox.stashable="true" 
+           jpox.table="USER_ASSIGNMENTS"
+           jpox.not-persisted-fields="modelEncoding">
+      <name>JdoUserAssignment</name>
+      <description>binding of a principal to a role</description>
+      <version>0.9.0</version>
+      <interfaces>
+        <interface>org.codehaus.plexus.security.rbac.UserAssignment</interface>
+      </interfaces>
+      <superClass>org.codehaus.plexus.security.rbac.AbstractUserAssignment</superClass>
+      <fields>
+        <field jpox.primary-key="true" jpox.value-strategy="off">
+          <name>principal</name>
+          <version>0.9.0</version>
+          <type>String</type>
+          <identifier>true</identifier>
+        </field>
+        <field jpox.column="LAST_UPDATED">
+          <name>timestamp</name>
+          <version>0.9.0</version>
+          <type>Date</type>
+        </field>
+        <field>
+          <name>permanent</name>
+          <version>0.9.0</version>
+          <type>boolean</type>
+          <description>
+            true if this object is permanent.
+          </description>
+        </field>
+        <field java.adder="false"
+               jpox.persistence-modifier="persistent" 
+               jpox.indexed="false"
+               jpox.join-table="USERASSIGNMENT_ROLENAMES">
+          <name>roleNames</name>
+          <version>0.9.0</version>
+          <association stash.part="true" 
+                       jpox.join="true"
+                       java.init="field"
+                       java.generate-break="false"
+                       java.generate-create="false">
+            <type>String</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+      </fields>
+    </class>
+  </classes>
+</model>



Mime
View raw message