You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2013/06/26 16:32:11 UTC
svn commit: r1496946 - in
/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf:
authorities/ crawler/system/
Author: kwright
Date: Wed Jun 26 14:32:10 2013
New Revision: 1496946
URL: http://svn.apache.org/r1496946
Log:
Add support for registering mapping connectors
Added:
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java (with props)
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java (with props)
Modified:
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java
manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,45 @@
+/* $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;
+
+import org.apache.manifoldcf.authorities.interfaces.MappingConnectorManagerFactory;
+import org.apache.manifoldcf.authorities.interfaces.IMappingConnectorManager;
+import org.apache.manifoldcf.authorities.system.ManifoldCF;
+import org.apache.manifoldcf.core.InitializationCommand;
+import org.apache.manifoldcf.core.interfaces.IThreadContext;
+import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
+import org.apache.manifoldcf.core.interfaces.ThreadContextFactory;
+
+/**
+ * @author Jettro Coenradie
+ */
+public abstract class BaseMappersInitializationCommand implements InitializationCommand
+{
+ public void execute() throws ManifoldCFException
+ {
+ ManifoldCF.initializeEnvironment();
+ IThreadContext tc = ThreadContextFactory.make();
+ IMappingConnectorManager mgr = MappingConnectorManagerFactory.make(tc);
+
+ doExecute(mgr);
+ }
+
+ protected abstract void doExecute(IMappingConnectorManager mgr) throws ManifoldCFException;
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/BaseMappersInitializationCommand.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java?rev=1496946&r1=1496945&r2=1496946&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineAuthorityConnection.java Wed Jun 26 14:32:10 2013
@@ -28,66 +28,64 @@ import java.util.*;
*/
public class DefineAuthorityConnection
{
- public static final String _rcsid = "@(#)$Id: DefineAuthorityConnection.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: DefineAuthorityConnection.java 988245 2010-08-23 18:39:35Z kwright $";
- private DefineAuthorityConnection()
- {
- }
-
-
- public static void main(String[] args)
- {
- if (args.length < 4)
- {
- System.err.println("Usage: DefineAuthorityConnection <connection_name> <description> <connector_class> <pool_max> <param1>=<value1> ...");
- System.exit(1);
- }
-
- String connectionName = args[0];
- String description = args[1];
- String connectorClass = args[2];
- String poolMax = args[3];
-
-
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
- IAuthorityConnection conn = mgr.create();
- conn.setName(connectionName);
- conn.setDescription(description);
- conn.setClassName(connectorClass);
- conn.setMaxConnections(new Integer(poolMax).intValue());
- ConfigParams x = conn.getConfigParams();
- int i = 4;
- while (i < args.length)
- {
- String arg = args[i++];
- // Parse
- int pos = arg.indexOf("=");
- if (pos == -1)
- throw new ManifoldCFException("Argument missing =");
- String name = arg.substring(0,pos);
- String value = arg.substring(pos+1);
- if (name.endsWith("assword"))
- x.setObfuscatedParameter(name,value);
- else
- x.setParameter(name,value);
- }
-
- // Now, save
- mgr.save(conn);
-
- }
- catch (Exception e)
- {
- e.printStackTrace(System.err);
- System.exit(2);
- }
- }
+ private DefineAuthorityConnection()
+ {
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length < 4)
+ {
+ System.err.println("Usage: DefineAuthorityConnection <connection_name> <description> <connector_class> <pool_max> <param1>=<value1> ...");
+ System.exit(1);
+ }
+
+ String connectionName = args[0];
+ String description = args[1];
+ String connectorClass = args[2];
+ String poolMax = args[3];
+
+
+ try
+ {
+ ManifoldCF.initializeEnvironment();
+ IThreadContext tc = ThreadContextFactory.make();
+ IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
+ IAuthorityConnection conn = mgr.create();
+ conn.setName(connectionName);
+ conn.setDescription(description);
+ conn.setClassName(connectorClass);
+ conn.setMaxConnections(new Integer(poolMax).intValue());
+ ConfigParams x = conn.getConfigParams();
+ int i = 4;
+ while (i < args.length)
+ {
+ String arg = args[i++];
+ // Parse
+ int pos = arg.indexOf("=");
+ if (pos == -1)
+ throw new ManifoldCFException("Argument missing =");
+ String name = arg.substring(0,pos);
+ String value = arg.substring(pos+1);
+ if (name.endsWith("assword"))
+ x.setObfuscatedParameter(name,value);
+ else
+ x.setParameter(name,value);
+ }
+
+ // Now, save
+ mgr.save(conn);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.exit(2);
+ }
+ }
-
-
}
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,91 @@
+/* $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;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+import java.util.*;
+
+/** This class is used during testing.
+*/
+public class DefineMappingConnection
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ private DefineMappingConnection()
+ {
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length < 4)
+ {
+ System.err.println("Usage: DefineMappingConnection <connection_name> <description> <connector_class> <pool_max> <param1>=<value1> ...");
+ System.exit(1);
+ }
+
+ String connectionName = args[0];
+ String description = args[1];
+ String connectorClass = args[2];
+ String poolMax = args[3];
+
+
+ try
+ {
+ ManifoldCF.initializeEnvironment();
+ IThreadContext tc = ThreadContextFactory.make();
+ IMappingConnectionManager mgr = MappingConnectionManagerFactory.make(tc);
+ IMappingConnection conn = mgr.create();
+ conn.setName(connectionName);
+ conn.setDescription(description);
+ conn.setClassName(connectorClass);
+ conn.setMaxConnections(new Integer(poolMax).intValue());
+ ConfigParams x = conn.getConfigParams();
+ int i = 4;
+ while (i < args.length)
+ {
+ String arg = args[i++];
+ // Parse
+ int pos = arg.indexOf("=");
+ if (pos == -1)
+ throw new ManifoldCFException("Argument missing =");
+ String name = arg.substring(0,pos);
+ String value = arg.substring(pos+1);
+ if (name.endsWith("assword"))
+ x.setObfuscatedParameter(name,value);
+ else
+ x.setParameter(name,value);
+ }
+
+ // Now, save
+ mgr.save(conn);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.exit(2);
+ }
+ }
+
+
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DefineMappingConnection.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java?rev=1496946&r1=1496945&r2=1496946&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java (original)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteAuthorityConnection.java Wed Jun 26 14:32:10 2013
@@ -28,38 +28,38 @@ import java.util.*;
*/
public class DeleteAuthorityConnection
{
- public static final String _rcsid = "@(#)$Id: DeleteAuthorityConnection.java 988245 2010-08-23 18:39:35Z kwright $";
+ public static final String _rcsid = "@(#)$Id: DeleteAuthorityConnection.java 988245 2010-08-23 18:39:35Z kwright $";
- private DeleteAuthorityConnection()
- {
- }
-
-
- public static void main(String[] args)
- {
- if (args.length != 1)
- {
- System.err.println("Usage: DeleteAuthorityConnection <connection_name>");
- System.exit(1);
- }
-
- String connectionName = args[0];
- try
- {
- ManifoldCF.initializeEnvironment();
- IThreadContext tc = ThreadContextFactory.make();
- IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
- mgr.delete(connectionName);
-
- }
- catch (Exception e)
- {
- e.printStackTrace(System.err);
- System.exit(2);
- }
- }
+ private DeleteAuthorityConnection()
+ {
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length != 1)
+ {
+ System.err.println("Usage: DeleteAuthorityConnection <connection_name>");
+ System.exit(1);
+ }
+
+ String connectionName = args[0];
+ try
+ {
+ ManifoldCF.initializeEnvironment();
+ IThreadContext tc = ThreadContextFactory.make();
+ IAuthorityConnectionManager mgr = AuthorityConnectionManagerFactory.make(tc);
+ mgr.delete(connectionName);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.exit(2);
+ }
+ }
-
+
}
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,62 @@
+/* $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;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+import java.util.*;
+
+/** This class is used during testing.
+*/
+public class DeleteMappingConnection
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ private DeleteMappingConnection()
+ {
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length != 1)
+ {
+ System.err.println("Usage: DeleteMappingConnection <connection_name>");
+ System.exit(1);
+ }
+
+ String connectionName = args[0];
+ try
+ {
+ ManifoldCF.initializeEnvironment();
+ IThreadContext tc = ThreadContextFactory.make();
+ IMappingConnectionManager mgr = MappingConnectionManagerFactory.make(tc);
+ mgr.delete(connectionName);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.err);
+ System.exit(2);
+ }
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/DeleteMappingConnection.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,67 @@
+/* $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;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+
+public class RegisterMapper extends BaseMappersInitializationCommand
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ private final String className;
+ private final String description;
+
+ public RegisterMapper(String className, String description)
+ {
+ this.className = className;
+ this.description = description;
+ }
+
+ protected void doExecute(IMappingConnectorManager mgr) throws ManifoldCFException
+ {
+ mgr.registerConnector(description,className);
+ Logging.root.info("Successfully registered connector '"+className+"'");
+ }
+
+ public static void main(String[] args)
+ {
+ if (args.length != 2)
+ {
+ System.err.println("Usage: RegisterMapper <classname> <description>");
+ System.exit(1);
+ }
+
+ String className = args[0];
+ String description = args[1];
+
+ try
+ {
+ RegisterMapper registerMapper = new RegisterMapper(className,description);
+ registerMapper.execute();
+ System.err.println("Successfully registered connector '"+className+"'");
+ }
+ catch (ManifoldCFException e)
+ {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/RegisterMapper.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,77 @@
+/* $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;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+
+public class SynchronizeMappers extends BaseMappersInitializationCommand
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ public SynchronizeMappers()
+ {
+ }
+
+
+ protected void doExecute(IMappingConnectorManager mgr) throws ManifoldCFException
+ {
+ IResultSet classNames = mgr.getConnectors();
+ int i = 0;
+ while (i < classNames.getRowCount())
+ {
+ IResultRow row = classNames.getRow(i++);
+ String classname = (String)row.getValue("classname");
+ try
+ {
+ MappingConnectorFactory.getConnectorNoCheck(classname);
+ }
+ catch (ManifoldCFException e)
+ {
+ mgr.removeConnector(classname);
+ }
+ }
+ Logging.root.info("Successfully synchronized all mappers");
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length > 0)
+ {
+ System.err.println("Usage: SynchronizeMappers");
+ System.exit(1);
+ }
+
+
+ try
+ {
+ SynchronizeMappers synchronizeMappers = new SynchronizeMappers();
+ synchronizeMappers.execute();
+ System.err.println("Successfully synchronized all mappers");
+ }
+ catch (ManifoldCFException e)
+ {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/SynchronizeMappers.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,68 @@
+/* $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;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+
+public class UnRegisterAllMappers extends BaseMappersInitializationCommand
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ private UnRegisterAllMappers()
+ {
+ }
+
+ protected void doExecute(IMappingConnectorManager mgr) throws ManifoldCFException
+ {
+ IResultSet classNames = mgr.getConnectors();
+ int i = 0;
+ while (i < classNames.getRowCount())
+ {
+ IResultRow row = classNames.getRow(i++);
+ mgr.unregisterConnector((String)row.getValue("classname"));
+ }
+ Logging.root.info("Successfully unregistered all connectors");
+ }
+
+
+ public static void main(String[] args)
+ {
+ if (args.length > 0)
+ {
+ System.err.println("Usage: UnRegisterAllMappers");
+ System.exit(1);
+ }
+
+
+ try
+ {
+ UnRegisterAllMappers unRegisterAllMappers = new UnRegisterAllMappers();
+ unRegisterAllMappers.execute();
+ System.err.println("Successfully unregistered all connectors");
+ }
+ catch (ManifoldCFException e)
+ {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterAllMappers.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java?rev=1496946&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java (added)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java Wed Jun 26 14:32:10 2013
@@ -0,0 +1,65 @@
+/* $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;
+
+import java.io.*;
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.authorities.interfaces.*;
+import org.apache.manifoldcf.authorities.system.*;
+
+public class UnRegisterMapper extends BaseMappersInitializationCommand
+{
+ public static final String _rcsid = "@(#)$Id$";
+
+ private final String className;
+
+ public UnRegisterMapper(String className)
+ {
+ this.className = className;
+ }
+
+ protected void doExecute(IMappingConnectorManager mgr) throws ManifoldCFException
+ {
+ mgr.unregisterConnector(className);
+ Logging.root.info("Successfully unregistered connector '"+className+"'");
+ }
+
+ public static void main(String[] args)
+ {
+ if (args.length != 1)
+ {
+ System.err.println("Usage: UnRegisterMapper <classname>");
+ System.exit(1);
+ }
+
+ String className = args[0];
+
+ try
+ {
+ UnRegisterMapper unRegisterMapper = new UnRegisterMapper(className);
+ unRegisterMapper.execute();
+ System.err.println("Successfully unregistered connector '"+className+"'");
+ }
+ catch (ManifoldCFException e)
+ {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/UnRegisterMapper.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java?rev=1496946&r1=1496945&r2=1496946&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java (original)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java Wed Jun 26 14:32:10 2013
@@ -235,6 +235,7 @@ public class ManifoldCF extends org.apac
// Connectors configuration file
protected static final String NODE_OUTPUTCONNECTOR = "outputconnector";
+ protected static final String NODE_MAPPINGCONNECTOR = "mappingconnector";
protected static final String NODE_AUTHORITYCONNECTOR = "authorityconnector";
protected static final String NODE_REPOSITORYCONNECTOR = "repositoryconnector";
protected static final String ATTRIBUTE_NAME = "name";
@@ -248,6 +249,7 @@ public class ManifoldCF extends org.apac
// Create a map of class name and description, so we can compare what we can find
// against what we want.
Map<String,String> desiredOutputConnectors = new HashMap<String,String>();
+ Map<String,String> desiredMappingConnectors = new HashMap<String,String>();
Map<String,String> desiredAuthorityConnectors = new HashMap<String,String>();
Map<String,String> desiredRepositoryConnectors = new HashMap<String,String>();
@@ -262,6 +264,12 @@ public class ManifoldCF extends org.apac
String className = cn.getAttributeValue(ATTRIBUTE_CLASS);
desiredOutputConnectors.put(className,name);
}
+ else if (cn.getType().equals(NODE_MAPPINGCONNECTOR))
+ {
+ String name = cn.getAttributeValue(ATTRIBUTE_NAME);
+ String className = cn.getAttributeValue(ATTRIBUTE_CLASS);
+ desiredMappingConnectors.put(className,name);
+ }
else if (cn.getType().equals(NODE_AUTHORITYCONNECTOR))
{
String name = cn.getAttributeValue(ATTRIBUTE_NAME);
@@ -325,7 +333,25 @@ public class ManifoldCF extends org.apac
}
System.err.println("Successfully unregistered all output connectors");
}
-
+
+ // Mapping connectors...
+ {
+ IMappingConnectorManager mgr = MappingConnectorManagerFactory.make(tc);
+ IResultSet classNames = mgr.getConnectors();
+ int i = 0;
+ while (i < classNames.getRowCount())
+ {
+ IResultRow row = classNames.getRow(i++);
+ String className = (String)row.getValue("classname");
+ String description = (String)row.getValue("description");
+ if (desiredMappingConnectors.get(className) == null || !desiredMappingConnectors.get(className).equals(description))
+ {
+ mgr.unregisterConnector(className);
+ }
+ }
+ System.err.println("Successfully unregistered all mapping connectors");
+ }
+
// Authority connectors...
{
IAuthorityConnectorManager mgr = AuthorityConnectorManagerFactory.make(tc);
@@ -450,6 +476,14 @@ public class ManifoldCF extends org.apac
mgr.registerConnector(name,className);
System.err.println("Successfully registered authority connector '"+className+"'");
}
+ else if (cn.getType().equals(NODE_MAPPINGCONNECTOR))
+ {
+ String name = cn.getAttributeValue(ATTRIBUTE_NAME);
+ String className = cn.getAttributeValue(ATTRIBUTE_CLASS);
+ IMappingConnectorManager mgr = MappingConnectorManagerFactory.make(tc);
+ mgr.registerConnector(name,className);
+ System.err.println("Successfully registered mapping connector '"+className+"'");
+ }
else if (cn.getType().equals(NODE_REPOSITORYCONNECTOR))
{
String name = cn.getAttributeValue(ATTRIBUTE_NAME);
@@ -1073,6 +1107,7 @@ public class ManifoldCF extends org.apac
// Also create the following managers, which will handle the actual details of writing configuration data
IOutputConnectionManager outputManager = OutputConnectionManagerFactory.make(threadContext);
IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(threadContext);
+ IMappingConnectionManager mappingManager = MappingConnectionManagerFactory.make(threadContext);
IAuthorityConnectionManager authManager = AuthorityConnectionManagerFactory.make(threadContext);
IJobManager jobManager = JobManagerFactory.make(threadContext);
@@ -1134,6 +1169,11 @@ public class ManifoldCF extends org.apac
outputManager.exportConfiguration(zos);
zos.closeEntry();
+ java.util.zip.ZipEntry mappingEntry = new java.util.zip.ZipEntry("mappings");
+ zos.putNextEntry(mappingEntry);
+ mappingManager.exportConfiguration(zos);
+ zos.closeEntry();
+
java.util.zip.ZipEntry authEntry = new java.util.zip.ZipEntry("authorities");
zos.putNextEntry(authEntry);
authManager.exportConfiguration(zos);
@@ -1201,6 +1241,7 @@ public class ManifoldCF extends org.apac
// Also create the following managers, which will handle the actual details of reading configuration data
IOutputConnectionManager outputManager = OutputConnectionManagerFactory.make(threadContext);
IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(threadContext);
+ IMappingConnectionManager mappingManager = MappingConnectionManagerFactory.make(threadContext);
IAuthorityConnectionManager authManager = AuthorityConnectionManagerFactory.make(threadContext);
IJobManager jobManager = JobManagerFactory.make(threadContext);
@@ -1256,6 +1297,8 @@ public class ManifoldCF extends org.apac
String name = z.getName();
if (name.equals("outputs"))
outputManager.importConfiguration(zis);
+ else if (name.equals("mappings"))
+ mappingManager.importConfiguration(zis);
else if (name.equals("authorities"))
authManager.importConfiguration(zis);
else if (name.equals("connections"))