manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1535794 - /manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
Date Fri, 25 Oct 2013 17:34:32 GMT
Author: kwright
Date: Fri Oct 25 17:34:31 2013
New Revision: 1535794

URL: http://svn.apache.org/r1535794
Log:
Make the import be backwards compatible

Modified:
    manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java

Modified: manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java?rev=1535794&r1=1535793&r2=1535794&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
(original)
+++ manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
Fri Oct 25 17:34:31 2013
@@ -243,6 +243,7 @@ public class AuthorityConnectionManager 
   public void importConfiguration(java.io.InputStream is)
     throws java.io.IOException, ManifoldCFException
   {
+    IAuthorityGroupManager authMgr = AuthorityGroupManagerFactory.make(threadContext);
     int version = ManifoldCF.readDword(is);
     if (version < 1 || version > 2)
       throw new java.io.IOException("Unknown authority configuration version: "+Integer.toString(version));
@@ -251,8 +252,10 @@ public class AuthorityConnectionManager 
     while (i < count)
     {
       IAuthorityConnection conn = create();
-      conn.setName(ManifoldCF.readString(is));
-      conn.setDescription(ManifoldCF.readString(is));
+      String name = ManifoldCF.readString(is);
+      String description = ManifoldCF.readString(is);
+      conn.setName(name);
+      conn.setDescription(description);
       conn.setClassName(ManifoldCF.readString(is));
       conn.getConfigParams().fromXML(ManifoldCF.readString(is));
       conn.setMaxConnections(ManifoldCF.readDword(is));
@@ -265,6 +268,21 @@ public class AuthorityConnectionManager 
           conn.setAuthGroup(ManifoldCF.readString(is));
         }
       }
+      // For importing older than MCF 1.5 import files...
+      if (conn.getAuthGroup() == null || conn.getAuthGroup().length() == 0)
+      {
+        // Create a matching auth group.
+        IAuthorityGroup grp = authMgr.load(name);
+        if (grp == null)
+        {
+          grp = authMgr.create();
+          grp.setName(name);
+          grp.setDescription(description);
+          authMgr.save(grp);
+        }
+        conn.setAuthGroup(name);
+      }
+      
       // Attempt to save this connection
       save(conn);
       i++;



Mime
View raw message