Author: kwright
Date: Thu Oct 24 08:55:49 2013
New Revision: 1535317

URL: http://svn.apache.org/r1535317
Log:
Add auth group factory, instantiation, initialization, and import/export.

Added:
    
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
   (with props)
Modified:
    
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
    
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java

Added: 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java?rev=1535317&view=auto
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
 (added)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
 Thu Oct 24 08:55:49 2013
@@ -0,0 +1,57 @@
+/* $Id$ */
+
+/**
+* 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.
+*/
+package org.apache.manifoldcf.authorities.interfaces;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import java.util.*;
+import org.apache.manifoldcf.authorities.system.ManifoldCF;
+
+/** This is the factory class for authority group manager objects.
+*/
+public class AuthorityGroupManagerFactory
+{
+  // name to use in thread context pool of objects
+  private final static String objectName = "_AuthGroupMgr_";
+
+  private AuthorityGroupManagerFactory()
+  {
+  }
+
+  /** Make an authority connection manager handle.
+  *@param tc is the thread context.
+  *@return the handle.
+  */
+  public static IAuthorityGroupManager make(IThreadContext tc)
+    throws ManifoldCFException
+  {
+    Object o = tc.get(objectName);
+    if (o == null || !(o instanceof IAuthorityGroupManager))
+    {
+      IDBInterface database = DBInterfaceFactory.make(tc,
+        ManifoldCF.getMasterDatabaseName(),
+        ManifoldCF.getMasterDatabaseUsername(),
+        ManifoldCF.getMasterDatabasePassword());
+
+      o = new 
org.apache.manifoldcf.authorities.authgroups.AuthorityGroupManager(tc,database);
+      tc.save(objectName,o);
+    }
+    return (IAuthorityGroupManager)o;
+  }
+
+}

Propchange: 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java?rev=1535317&r1=1535316&r2=1535317&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
 Thu Oct 24 08:55:49 2013
@@ -96,6 +96,7 @@ public class ManifoldCF extends org.apac
       ManifoldCF.getMasterDatabaseUsername(),
       ManifoldCF.getMasterDatabasePassword());
 
+    IAuthorityGroupManager groupMgr = 
AuthorityGroupManagerFactory.make(threadcontext);
     IAuthorityConnectorManager connMgr = 
AuthorityConnectorManagerFactory.make(threadcontext);
     IAuthorityConnectionManager authConnMgr = 
AuthorityConnectionManagerFactory.make(threadcontext);
     IMappingConnectorManager mappingConnectorMgr = 
MappingConnectorManagerFactory.make(threadcontext);
@@ -105,6 +106,7 @@ public class ManifoldCF extends org.apac
     try
     {
       connMgr.install();
+      groupMgr.install();
       authConnMgr.install();
       mappingConnectorMgr.install();
       mappingConnectionMgr.install();
@@ -140,6 +142,7 @@ public class ManifoldCF extends org.apac
     ManifoldCFException se = null;
 
     IAuthorityConnectorManager connMgr = 
AuthorityConnectorManagerFactory.make(threadcontext);
+    IAuthorityGroupManager groupMgr = 
AuthorityGroupManagerFactory.make(threadcontext);
     IAuthorityConnectionManager authConnMgr = 
AuthorityConnectionManagerFactory.make(threadcontext);
     IMappingConnectorManager mappingConnectorMgr = 
MappingConnectorManagerFactory.make(threadcontext);
     IMappingConnectionManager mappingConnectionMgr = 
MappingConnectionManagerFactory.make(threadcontext);
@@ -150,6 +153,7 @@ public class ManifoldCF extends org.apac
       mappingConnectionMgr.deinstall();
       mappingConnectorMgr.deinstall();
       authConnMgr.deinstall();
+      groupMgr.deinstall();
       connMgr.deinstall();
     }
     catch (ManifoldCFException e)

Modified: 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1535317&r1=1535316&r2=1535317&view=diff
==============================================================================
--- 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
 (original)
+++ 
manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
 Thu Oct 24 08:55:49 2013
@@ -1084,6 +1084,7 @@ public class ManifoldCF extends org.apac
       ManifoldCF.getMasterDatabasePassword());
     // Also create the following managers, which will handle the actual 
details of writing configuration data
     IOutputConnectionManager outputManager = 
OutputConnectionManagerFactory.make(threadContext);
+    IAuthorityGroupManager groupManager = 
AuthorityGroupManagerFactory.make(threadContext);
     IRepositoryConnectionManager connManager = 
RepositoryConnectionManagerFactory.make(threadContext);
     IMappingConnectionManager mappingManager = 
MappingConnectionManagerFactory.make(threadContext);
     IAuthorityConnectionManager authManager = 
AuthorityConnectionManagerFactory.make(threadContext);
@@ -1147,6 +1148,11 @@ public class ManifoldCF extends org.apac
             outputManager.exportConfiguration(zos);
             zos.closeEntry();
 
+            java.util.zip.ZipEntry groupEntry = new 
java.util.zip.ZipEntry("groups");
+            zos.putNextEntry(groupEntry);
+            groupManager.exportConfiguration(zos);
+            zos.closeEntry();
+
             java.util.zip.ZipEntry mappingEntry = new 
java.util.zip.ZipEntry("mappings");
             zos.putNextEntry(mappingEntry);
             mappingManager.exportConfiguration(zos);
@@ -1218,6 +1224,7 @@ public class ManifoldCF extends org.apac
       ManifoldCF.getMasterDatabasePassword());
     // Also create the following managers, which will handle the actual 
details of reading configuration data
     IOutputConnectionManager outputManager = 
OutputConnectionManagerFactory.make(threadContext);
+    IAuthorityGroupManager groupManager = 
AuthorityGroupManagerFactory.make(threadContext);
     IRepositoryConnectionManager connManager = 
RepositoryConnectionManagerFactory.make(threadContext);
     IMappingConnectionManager mappingManager = 
MappingConnectionManagerFactory.make(threadContext);
     IAuthorityConnectionManager authManager = 
AuthorityConnectionManagerFactory.make(threadContext);
@@ -1275,6 +1282,8 @@ public class ManifoldCF extends org.apac
               String name = z.getName();
               if (name.equals("outputs"))
                 outputManager.importConfiguration(zis);
+              else if (name.equals("groups"))
+                groupManager.importConfiguration(zis);
               else if (name.equals("mappings"))
                 mappingManager.importConfiguration(zis);
               else if (name.equals("authorities"))


Reply via email to