manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1536941 - in /manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf: authorities/authgroups/ authorities/authority/ authorities/interfaces/ authorities/system/ crawler/repository/ crawler/system/
Date Wed, 30 Oct 2013 00:16:30 GMT
Author: kwright
Date: Wed Oct 30 00:16:30 2013
New Revision: 1536941

URL: http://svn.apache.org/r1536941
Log:
Fixed the upgrade from 1.4 to 1.5.

Modified:
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/AuthorityGroupManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/AuthorityGroupManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/AuthorityGroupManager.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/AuthorityGroupManager.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/AuthorityGroupManager.java
Wed Oct 30 00:16:30 2013
@@ -396,6 +396,15 @@ public class AuthorityGroupManager exten
     return nameField;
   }
 
+  /** Get the authority connection description column.
+  *@return the description column.
+  */
+  @Override
+  public String getGroupDescriptionColumn()
+  {
+    return descriptionField;
+  }
+
   // Caching strategy: Individual connection descriptions are cached, and there is a global
cache key for the list of
   // repository connections.
 

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
Wed Oct 30 00:16:30 2013
@@ -140,15 +140,17 @@ public class AuthorityConnectionManager 
               IResultRow row = set.getRow(i);
               String authName = (String)row.getValue(nameField);
               String authDescription = (String)row.getValue(descriptionField);
-              IAuthorityGroup gp = authMgr.load(authName);
-              if (gp == null)
+              ArrayList list = new ArrayList();
+              list.add(authName);
+              IResultSet set2 = dbInterface.performQuery("SELECT 'x' FROM "+authMgr.getTableName()+"
WHERE "+authMgr.getGroupNameColumn()+"=?",list,null,null);
+              if (set2.getRowCount() == 0)
               {
                 // Create an authority group with this name
-                gp = authMgr.create();
-                gp.setName(authName);
+                Map<String,Object> groupMap = new HashMap<String,Object>();
+                groupMap.put(authMgr.getGroupNameColumn(),authName);
                 if (authDescription != null)
-                  gp.setDescription(authDescription);
-                authMgr.save(gp);
+                  groupMap.put(authMgr.getGroupDescriptionColumn(),authDescription);
+                dbInterface.performInsert(authMgr.getTableName(),groupMap,null);
               }
               Map<String,String> map = new HashMap<String,String>();
               map.put(groupNameField,authName);
@@ -162,12 +164,13 @@ public class AuthorityConnectionManager 
               authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
             performAlter(null,modifyMap,null,null);
           }
-          finally
+          catch (ManifoldCFException e)
           {
             // Upgrade failed; back out our changes
             List<String> deleteList = new ArrayList<String>();
             deleteList.add(groupNameField);
             performAlter(null,null,deleteList,null);
+            throw e;
           }
         }
       }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
Wed Oct 30 00:16:30 2013
@@ -97,4 +97,9 @@ public interface IAuthorityGroupManager
   */
   public String getGroupNameColumn();
 
+  /** Get the authority connection description column.
+  *@return the description column.
+  */
+  public String getGroupDescriptionColumn();
+
 }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
Wed Oct 30 00:16:30 2013
@@ -91,11 +91,6 @@ public class ManifoldCF extends org.apac
   public static void installSystemTables(IThreadContext threadcontext)
     throws ManifoldCFException
   {
-    IDBInterface mainDatabase = DBInterfaceFactory.make(threadcontext,
-      ManifoldCF.getMasterDatabaseName(),
-      ManifoldCF.getMasterDatabaseUsername(),
-      ManifoldCF.getMasterDatabasePassword());
-
     IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadcontext);
     IAuthorityGroupManager groupMgr = AuthorityGroupManagerFactory.make(threadcontext);
     IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext);
@@ -103,31 +98,12 @@ public class ManifoldCF extends org.apac
     IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext);
     IMappingConnectionManager mappingConnectionMgr = MappingConnectionManagerFactory.make(threadcontext);
 
-    mainDatabase.beginTransaction();
-    try
-    {
-      domainMgr.install();
-      connMgr.install();
-      mappingConnectorMgr.install();
-      groupMgr.install();
-      authConnMgr.install();
-      mappingConnectionMgr.install();
-    }
-    catch (ManifoldCFException e)
-    {
-      mainDatabase.signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      mainDatabase.signalRollback();
-      throw e;
-    }
-    finally
-    {
-      mainDatabase.endTransaction();
-    }
-
+    domainMgr.install();
+    connMgr.install();
+    mappingConnectorMgr.install();
+    groupMgr.install();
+    authConnMgr.install();
+    mappingConnectionMgr.install();
   }
 
   /** Uninstall all the authority manager system tables.
@@ -136,13 +112,6 @@ public class ManifoldCF extends org.apac
   public static void deinstallSystemTables(IThreadContext threadcontext)
     throws ManifoldCFException
   {
-    IDBInterface mainDatabase = DBInterfaceFactory.make(threadcontext,
-      ManifoldCF.getMasterDatabaseName(),
-      ManifoldCF.getMasterDatabaseUsername(),
-      ManifoldCF.getMasterDatabasePassword());
-
-    ManifoldCFException se = null;
-
     IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadcontext);
     IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext);
     IAuthorityGroupManager groupMgr = AuthorityGroupManagerFactory.make(threadcontext);
@@ -150,33 +119,12 @@ public class ManifoldCF extends org.apac
     IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext);
     IMappingConnectionManager mappingConnectionMgr = MappingConnectionManagerFactory.make(threadcontext);
 
-    mainDatabase.beginTransaction();
-    try
-    {
-      mappingConnectionMgr.deinstall();
-      authConnMgr.deinstall();
-      groupMgr.deinstall();
-      mappingConnectorMgr.deinstall();
-      connMgr.deinstall();
-      domainMgr.deinstall();
-    }
-    catch (ManifoldCFException e)
-    {
-      mainDatabase.signalRollback();
-      throw e;
-    }
-    catch (Error e)
-    {
-      mainDatabase.signalRollback();
-      throw e;
-    }
-    finally
-    {
-      mainDatabase.endTransaction();
-    }
-    if (se != null)
-      throw se;
-
+    mappingConnectionMgr.deinstall();
+    authConnMgr.deinstall();
+    groupMgr.deinstall();
+    mappingConnectorMgr.deinstall();
+    connMgr.deinstall();
+    domainMgr.deinstall();
   }
 
   /** Start the authority system.

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
Wed Oct 30 00:16:30 2013
@@ -140,13 +140,15 @@ public class RepositoryConnectionManager
             String authName = (String)row.getValue(authorityNameField);
             if (authName != null && authName.length() > 0)
             {
-              IAuthorityGroup gp = authMgr.load(authName);
-              if (gp == null)
+              ArrayList list = new ArrayList();
+              list.add(authName);
+              IResultSet set2 = dbInterface.performQuery("SELECT 'x' FROM "+authMgr.getTableName()+"
WHERE "+authMgr.getGroupNameColumn()+"=?",list,null,null);
+              if (set2.getRowCount() == 0)
               {
                 // Create an authority group with this name
-                gp = authMgr.create();
-                gp.setName(authName);
-                authMgr.save(gp);
+                Map<String,Object> groupMap = new HashMap<String,Object>();
+                groupMap.put(authMgr.getGroupNameColumn(),authName);
+                dbInterface.performInsert(authMgr.getTableName(),groupMap,null);
               }
               Map<String,String> map = new HashMap<String,String>();
               map.put(groupNameField,authName);

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1536941&r1=1536940&r2=1536941&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
(original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Wed Oct 30 00:16:30 2013
@@ -576,8 +576,6 @@ public class ManifoldCF extends org.apac
   public static void deinstallSystemTables(IThreadContext threadcontext)
     throws ManifoldCFException
   {
-    ManifoldCFException se = null;
-
     IConnectorManager repConnMgr = ConnectorManagerFactory.make(threadcontext);
     IRepositoryConnectionManager repCon = RepositoryConnectionManagerFactory.make(threadcontext);
     IJobManager jobManager = JobManagerFactory.make(threadcontext);
@@ -585,8 +583,6 @@ public class ManifoldCF extends org.apac
     repCon.deinstall();
     repConnMgr.deinstall();
     org.apache.manifoldcf.authorities.system.ManifoldCF.deinstallSystemTables(threadcontext);
-    if (se != null)
-      throw se;
   }
 
 



Mime
View raw message