continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r546944 - in /maven/continuum/trunk/continuum-data-management: data-management-api/src/main/java/org/apache/maven/continuum/management/ data-management-cli/src/main/java/org/apache/maven/continuum/management/ data-management-jdo/src/main/ja...
Date Wed, 13 Jun 2007 16:08:52 GMT
Author: brett
Date: Wed Jun 13 09:08:51 2007
New Revision: 546944

URL: http://svn.apache.org/viewvc?view=rev&rev=546944
Log:
must init jdo factory first

Added:
    maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseFactoryConfigurator.java
  (with props)
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DefaultDatabaseFactoryConfigurator.java
  (with props)
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/DefaultDatabaseFactoryConfigurator.java
  (with props)
Removed:
    maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/AbstractDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/AbstractDataManagementTool.java
Modified:
    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-cli/src/main/java/org/apache/maven/continuum/management/DataManagementCli.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-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java
    maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java

Modified: maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java?view=diff&rev=546944&r1=546943&r2=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
(original)
+++ maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DataManagementTool.java
Wed Jun 13 09:08:51 2007
@@ -27,8 +27,6 @@
  */
 public interface DataManagementTool
 {
-    void configure( DatabaseParams params );
-
     /**
      * Backup the database.
      *

Added: maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseFactoryConfigurator.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseFactoryConfigurator.java?view=auto&rev=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseFactoryConfigurator.java
(added)
+++ maven/continuum/trunk/continuum-data-management/data-management-api/src/main/java/org/apache/maven/continuum/management/DatabaseFactoryConfigurator.java
Wed Jun 13 09:08:51 2007
@@ -0,0 +1,25 @@
+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.
+ */
+
+public interface DatabaseFactoryConfigurator
+{
+    void configure( DatabaseParams params );
+}

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

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=546944&r1=546943&r2=546944
==============================================================================
--- 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 09:08:51 2007
@@ -126,20 +126,20 @@
         {
             LOGGER.info( "Processing Continuum database..." );
             processDatabase( databaseType, databaseFormat, mode, command.buildsJdbcUrl, command.directory,
-                             databaseFormat.getContinuumToolRoleHint(), "data-management-jdo"
);
+                             databaseFormat.getContinuumToolRoleHint(), "data-management-jdo",
"continuum" );
         }
 
         if ( command.usersJdbcUrl != null )
         {
             LOGGER.info( "Processing Redback database..." );
             processDatabase( databaseType, databaseFormat, mode, command.usersJdbcUrl, command.directory,
-                             databaseFormat.getRedbackToolRoleHint(), "data-management-redback-jdo"
);
+                             databaseFormat.getRedbackToolRoleHint(), "data-management-redback-jdo",
"redback" );
         }
     }
 
     private static void processDatabase( SupportedDatabase databaseType, DatabaseFormat databaseFormat,
                                          OperationMode mode, String jdbcUrl, File directory,
String toolRoleHint,
-                                         String managementArtifactId )
+                                         String managementArtifactId, String configRoleHint
)
         throws PlexusContainerException, ComponentLookupException, ArtifactNotFoundException,
         ArtifactResolutionException, IOException
     {
@@ -206,9 +206,12 @@
 
         ClassRealm oldRealm = container.setLookupRealm( realm );
 
+        DatabaseFactoryConfigurator configurator = (DatabaseFactoryConfigurator) container.lookup(
+            DatabaseFactoryConfigurator.class.getName(), configRoleHint, realm );
+        configurator.configure( params );
+
         DataManagementTool manager =
             (DataManagementTool) container.lookup( DataManagementTool.class.getName(), toolRoleHint,
realm );
-        manager.configure( params );
 
         if ( mode == OperationMode.EXPORT )
         {

Added: maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DefaultDatabaseFactoryConfigurator.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DefaultDatabaseFactoryConfigurator.java?view=auto&rev=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DefaultDatabaseFactoryConfigurator.java
(added)
+++ maven/continuum/trunk/continuum-data-management/data-management-jdo/src/main/java/org/apache/maven/continuum/management/DefaultDatabaseFactoryConfigurator.java
Wed Jun 13 09:08:51 2007
@@ -0,0 +1,53 @@
+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.Iterator;
+import java.util.Properties;
+
+/**
+ * @plexus.component role="org.apache.maven.continuum.management.DatabaseFactoryConfigurator"
role-hint="continuum"
+ */
+public class DefaultDatabaseFactoryConfigurator
+    implements DatabaseFactoryConfigurator
+{
+    /**
+     * @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/DefaultDatabaseFactoryConfigurator.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=546944&r1=546943&r2=546944
==============================================================================
--- 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 09:08:51 2007
@@ -30,7 +30,7 @@
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.store.ContinuumStore;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.codehaus.plexus.jdo.ConfigurableJdoFactory;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.PlexusJdoUtils;
 import org.codehaus.plexus.util.IOUtil;
 
@@ -59,12 +59,19 @@
  * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="continuum-jdo"
  */
 public class JdoDataManagementTool
-    extends AbstractDataManagementTool
+    implements DataManagementTool
 {
     /**
      * @plexus.requirement role-hint="jdo"
      */
     private ContinuumStore store;
+
+    protected static final String BUILDS_XML = "builds.xml";
+
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.jdo.JdoFactory" role-hint="continuum"
+     */
+    protected DefaultConfigurableJdoFactory factory;
 
     public void backupDatabase( File backupDirectory )
         throws IOException

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=546944&r1=546943&r2=546944
==============================================================================
--- 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 09:08:51 2007
@@ -38,7 +38,7 @@
 import org.apache.maven.continuum.model.scm.v1_0_9.TestResult;
 import org.apache.maven.continuum.model.system.v1_0_9.SystemConfiguration;
 import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.codehaus.plexus.jdo.ConfigurableJdoFactory;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
 import org.codehaus.plexus.jdo.PlexusJdoUtils;
 import org.codehaus.plexus.util.IOUtil;
 
@@ -70,8 +70,15 @@
  * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-continuum-jdo"
  */
 public class LegacyJdoDataManagementTool
-    extends 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 backupDatabase( File backupDirectory )
         throws IOException
     {

Added: maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/DefaultDatabaseFactoryConfigurator.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/DefaultDatabaseFactoryConfigurator.java?view=auto&rev=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/DefaultDatabaseFactoryConfigurator.java
(added)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/DefaultDatabaseFactoryConfigurator.java
Wed Jun 13 09:08:51 2007
@@ -0,0 +1,55 @@
+package org.apache.maven.continuum.management.redback;
+
+import org.apache.maven.continuum.management.DatabaseFactoryConfigurator;
+import org.apache.maven.continuum.management.DatabaseParams;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+/*
+ * 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.
+ */
+
+/**
+ * @plexus.component role="org.apache.maven.continuum.management.DatabaseFactoryConfigurator"
role-hint="redback"
+ */
+public class DefaultDatabaseFactoryConfigurator
+    implements DatabaseFactoryConfigurator
+{
+    /**
+     * @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/DefaultDatabaseFactoryConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 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=diff&rev=546944&r1=546943&r2=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java
(original)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/JdoDataManagementTool.java
Wed Jun 13 09:08:51 2007
@@ -19,11 +19,12 @@
  * under the License.
  */
 
+import org.apache.maven.continuum.management.DataManagementException;
+import org.apache.maven.continuum.management.DataManagementTool;
 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;
@@ -35,7 +36,7 @@
  * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="redback-jdo"
  */
 public class JdoDataManagementTool
-    extends AbstractDataManagementTool
+    implements DataManagementTool
 {
     /**
      * @plexus.requirement role-hint="jdo"

Modified: 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=diff&rev=546944&r1=546943&r2=546944
==============================================================================
--- maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java
(original)
+++ maven/continuum/trunk/continuum-data-management/data-management-redback-jdo/src/main/java/org/apache/maven/continuum/management/redback/LegacyJdoDataManagementTool.java
Wed Jun 13 09:08:51 2007
@@ -20,6 +20,7 @@
  */
 
 import org.apache.maven.continuum.management.DataManagementException;
+import org.apache.maven.continuum.management.DataManagementTool;
 import org.codehaus.plexus.jdo.JdoFactory;
 import org.codehaus.plexus.jdo.PlexusJdoUtils;
 import org.codehaus.plexus.jdo.PlexusStoreException;
@@ -68,7 +69,7 @@
  * @plexus.component role="org.apache.maven.continuum.management.DataManagementTool" role-hint="legacy-redback-jdo"
  */
 public class LegacyJdoDataManagementTool
-    extends AbstractDataManagementTool
+    implements DataManagementTool
 {
     private static final String USERS_XML_NAME = "users.xml";
 
@@ -238,7 +239,8 @@
                 else if ( objectExists( permission ) )
                 {
                     permission = (JdoPermission) PlexusJdoUtils.getObjectById( getPersistenceManager(),
-                                                                            JdoPermission.class,
permission.getName() );
+                                                                               JdoPermission.class,
+                                                                               permission.getName()
);
                     permissionMap.put( permission.getName(), permission );
                 }
                 else
@@ -251,13 +253,15 @@
                     else if ( objectExists( operation ) )
                     {
                         operation = (JdoOperation) PlexusJdoUtils.getObjectById( getPersistenceManager(),
-                                                                              JdoOperation.class,
operation.getName() );
+                                                                                 JdoOperation.class,
+                                                                                 operation.getName()
);
                         operations.put( operation.getName(), operation );
                     }
                     else
                     {
                         RBACObjectAssertions.assertValid( operation );
-                        operation = (JdoOperation) PlexusJdoUtils.saveObject( getPersistenceManager(),
operation, null );
+                        operation =
+                            (JdoOperation) PlexusJdoUtils.saveObject( getPersistenceManager(),
operation, null );
                         operations.put( operation.getName(), operation );
                     }
                     permission.setOperation( operation );
@@ -269,8 +273,9 @@
                     }
                     else if ( objectExists( resource ) )
                     {
-                        resource = (JdoResource) PlexusJdoUtils.getObjectById( getPersistenceManager(),
JdoResource.class,
-                                                                            resource.getIdentifier()
);
+                        resource = (JdoResource) PlexusJdoUtils.getObjectById( getPersistenceManager(),
+                                                                               JdoResource.class,
+                                                                               resource.getIdentifier()
);
                         resources.put( resource.getIdentifier(), resource );
                     }
                     else



Mime
View raw message