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=1498128&r1=1498127&r2=1498128&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 Sun Jun 30 14:15:49 2013 @@ -31,15 +31,21 @@ public class ManifoldCF extends org.apac // Threads protected static IdleCleanupThread idleCleanupThread = null; protected static AuthCheckThread[] authCheckThreads = null; + protected static MappingThread[] mappingThreads = null; // Number of auth check threads protected static int numAuthCheckThreads = 0; - + // Number of mapping threads + protected static int numMappingThreads = 0; + protected static final String authCheckThreadCountProperty = "org.apache.manifoldcf.authorityservice.threads"; + protected static final String mappingThreadCountProperty = "org.apache.manifoldcf.authorityservice.mappingthreads"; // Request queue - protected static RequestQueue requestQueue = null; - + protected static RequestQueue<AuthRequest> requestQueue = null; + // Mapping request queue + protected static RequestQueue<MappingRequest> mappingRequestQueue = null; + /** Initialize environment. */ public static void initializeEnvironment() @@ -92,12 +98,16 @@ public class ManifoldCF extends org.apac IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext); IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(threadcontext); + IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext); + IMappingConnectionManager mappingConnectionMgr = MappingConnectionManagerFactory.make(threadcontext); mainDatabase.beginTransaction(); try { connMgr.install(); authConnMgr.install(); + mappingConnectorMgr.install(); + mappingConnectionMgr.install(); } catch (ManifoldCFException e) { @@ -131,10 +141,14 @@ public class ManifoldCF extends org.apac IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext); IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(threadcontext); + IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext); + IMappingConnectionManager mappingConnectionMgr = MappingConnectionManagerFactory.make(threadcontext); mainDatabase.beginTransaction(); try { + mappingConnectionMgr.deinstall(); + mappingConnectorMgr.deinstall(); authConnMgr.deinstall(); connMgr.deinstall(); } @@ -170,20 +184,34 @@ public class ManifoldCF extends org.apac if (numAuthCheckThreads < 1 || numAuthCheckThreads > 100) throw new ManifoldCFException("Illegal value for the number of auth check threads"); + String maxMappingThreads = getProperty(mappingThreadCountProperty); + if (maxMappingThreads == null) + maxMappingThreads = "10"; + numMappingThreads = new Integer(maxMappingThreads).intValue(); + if (numMappingThreads < 1 || numMappingThreads > 100) + throw new ManifoldCFException("Illegal value for the number of mapping threads"); + // Start up threads idleCleanupThread = new IdleCleanupThread(); idleCleanupThread.start(); - requestQueue = new RequestQueue(); + requestQueue = new RequestQueue<AuthRequest>(); + mappingRequestQueue = new RequestQueue<MappingRequest>(); authCheckThreads = new AuthCheckThread[numAuthCheckThreads]; - int i = 0; - while (i < numAuthCheckThreads) + for (int i = 0; i < numAuthCheckThreads; i++) { authCheckThreads[i] = new AuthCheckThread(Integer.toString(i),requestQueue); authCheckThreads[i].start(); - i++; } + + mappingThreads = new MappingThread[numMappingThreads]; + for (int i = 0; i < numMappingThreads; i++) + { + mappingThreads[i] = new MappingThread(Integer.toString(i),mappingRequestQueue); + mappingThreads[i].start(); + } + } /** Shut down the authority system. @@ -192,7 +220,7 @@ public class ManifoldCF extends org.apac throws ManifoldCFException { - while (idleCleanupThread != null || authCheckThreads != null) + while (idleCleanupThread != null || authCheckThreads != null || mappingThreads != null) { if (idleCleanupThread != null) { @@ -200,15 +228,23 @@ public class ManifoldCF extends org.apac } if (authCheckThreads != null) { - int i = 0; - while (i < authCheckThreads.length) + for (int i = 0; i < authCheckThreads.length; i++) { - Thread authCheckThread = authCheckThreads[i++]; + Thread authCheckThread = authCheckThreads[i]; if (authCheckThread != null) authCheckThread.interrupt(); } } - + if (mappingThreads != null) + { + for (int i = 0; i < mappingThreads.length; i++) + { + Thread mappingThread = mappingThreads[i]; + if (mappingThread != null) + mappingThread.interrupt(); + } + } + if (idleCleanupThread != null) { if (!idleCleanupThread.isAlive()) @@ -216,9 +252,8 @@ public class ManifoldCF extends org.apac } if (authCheckThreads != null) { - int i = 0; boolean isAlive = false; - while (i < authCheckThreads.length) + for (int i = 0; i < authCheckThreads.length; i++) { Thread authCheckThread = authCheckThreads[i]; if (authCheckThread != null) @@ -234,6 +269,25 @@ public class ManifoldCF extends org.apac authCheckThreads = null; } + if (mappingThreads != null) + { + boolean isAlive = false; + for (int i = 0; i < mappingThreads.length; i++) + { + Thread mappingThread = mappingThreads[i]; + if (mappingThread != null) + { + if (!mappingThread.isAlive()) + mappingThreads[i] = null; + else + isAlive = true; + } + i++; + } + if (!isAlive) + mappingThreads = null; + } + try { ManifoldCF.sleep(1000); @@ -247,13 +301,22 @@ public class ManifoldCF extends org.apac AuthorityConnectorFactory.closeAllConnectors(threadContext); numAuthCheckThreads = 0; requestQueue = null; + MappingConnectorFactory.closeAllConnectors(threadContext); + numMappingThreads = 0; + mappingRequestQueue = null; } /** Get the current request queue */ - public static RequestQueue getRequestQueue() + public static RequestQueue<AuthRequest> getRequestQueue() { return requestQueue; } + /** Get the current mapping request queue */ + public static RequestQueue<MappingRequest> getMappingRequestQueue() + { + return mappingRequestQueue; + } + }
Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/RequestQueue.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/RequestQueue.java?rev=1498128&r1=1498127&r2=1498128&view=diff ============================================================================== --- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/RequestQueue.java (original) +++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/RequestQueue.java Sun Jun 30 14:15:49 2013 @@ -28,12 +28,12 @@ import java.util.*; * (b) the "reader" threads block if queue is empty. * The objects being queued are all AuthRequest objects. */ -public class RequestQueue +public class RequestQueue<T> { public static final String _rcsid = "@(#)$Id: RequestQueue.java 988245 2010-08-23 18:39:35Z kwright $"; // Since the queue has a maximum size, an ArrayList is a fine way to keep it - protected ArrayList queue = new ArrayList(); + protected List<T> queue = new ArrayList<T>(); /** Constructor. */ @@ -44,7 +44,7 @@ public class RequestQueue /** Add a request to the queue. *@param dd is the request. */ - public void addRequest(AuthRequest dd) + public void addRequest(T dd) { synchronized (queue) { @@ -57,7 +57,7 @@ public class RequestQueue * nothing there. *@return the request to be processed. */ - public AuthRequest getRequest() + public T getRequest() throws InterruptedException { synchronized (queue) @@ -66,7 +66,7 @@ public class RequestQueue while (queue.size() == 0) queue.wait(); - return (AuthRequest)queue.remove(queue.size()-1); + return queue.remove(queue.size()-1); } } 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=1498128&r1=1498127&r2=1498128&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 Sun Jun 30 14:15:49 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")) @@ -1645,9 +1688,11 @@ public class ManifoldCF extends org.apac protected static final String API_REPOSITORYCONNECTORNODE = "repositoryconnector"; protected static final String API_OUTPUTCONNECTORNODE = "outputconnector"; protected static final String API_AUTHORITYCONNECTORNODE = "authorityconnector"; + protected static final String API_MAPPINGCONNECTORNODE = "mappingconnector"; protected static final String API_REPOSITORYCONNECTIONNODE = "repositoryconnection"; protected static final String API_OUTPUTCONNECTIONNODE = "outputconnection"; protected static final String API_AUTHORITYCONNECTIONNODE = "authorityconnection"; + protected static final String API_MAPPINGCONNECTIONNODE = "mappingconnection"; protected static final String API_CHECKRESULTNODE = "check_result"; protected static final String API_JOBIDNODE = "job_id"; protected static final String API_CONNECTIONNAMENODE = "connection_name"; @@ -1830,6 +1875,47 @@ public class ManifoldCF extends org.apac } return READRESULT_FOUND; } + + /** Read a mapping connection status */ + protected static int apiReadMappingConnectionStatus(IThreadContext tc, Configuration output, String connectionName) + throws ManifoldCFException + { + try + { + IMappingConnectionManager connectionManager = MappingConnectionManagerFactory.make(tc); + IMappingConnection connection = connectionManager.load(connectionName); + if (connection == null) + { + createErrorNode(output,"Connection '"+connectionName+"' does not exist"); + return READRESULT_NOTFOUND; + } + + String results; + // Grab a connection handle, and call the test method + IMappingConnector connector = MappingConnectorFactory.grab(tc,connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections()); + try + { + results = connector.check(); + } + catch (ManifoldCFException e) + { + results = e.getMessage(); + } + finally + { + MappingConnectorFactory.release(connector); + } + + ConfigurationNode response = new ConfigurationNode(API_CHECKRESULTNODE); + response.setValue(results); + output.addChild(output.getChildCount(),response); + } + catch (ManifoldCFException e) + { + createErrorNode(output,e); + } + return READRESULT_FOUND; + } /** Read a repository connection status */ protected static int apiReadRepositoryConnectionStatus(IThreadContext tc, Configuration output, String connectionName) @@ -2077,6 +2163,29 @@ public class ManifoldCF extends org.apac return READRESULT_FOUND; } + /** Get mapping connections */ + protected static int apiReadMappingConnections(IThreadContext tc, Configuration output) + throws ManifoldCFException + { + try + { + IMappingConnectionManager connManager = MappingConnectionManagerFactory.make(tc); + IMappingConnection[] connections = connManager.getAllConnections(); + int i = 0; + while (i < connections.length) + { + ConfigurationNode connectionNode = new ConfigurationNode(API_MAPPINGCONNECTIONNODE); + formatMappingConnection(connectionNode,connections[i++]); + output.addChild(output.getChildCount(),connectionNode); + } + } + catch (ManifoldCFException e) + { + createErrorNode(output,e); + } + return READRESULT_FOUND; + } + /** Read authority connection */ protected static int apiReadAuthorityConnection(IThreadContext tc, Configuration output, String connectionName) throws ManifoldCFException @@ -2105,6 +2214,34 @@ public class ManifoldCF extends org.apac return READRESULT_FOUND; } + /** Read mapping connection */ + protected static int apiReadMappingConnection(IThreadContext tc, Configuration output, String connectionName) + throws ManifoldCFException + { + try + { + IMappingConnectionManager connectionManager = MappingConnectionManagerFactory.make(tc); + IMappingConnection connection = connectionManager.load(connectionName); + if (connection != null) + { + // Fill the return object with job information + ConfigurationNode connectionNode = new ConfigurationNode(API_MAPPINGCONNECTIONNODE); + formatMappingConnection(connectionNode,connection); + output.addChild(output.getChildCount(),connectionNode); + } + else + { + createErrorNode(output,"Mapping connection '"+connectionName+"' does not exist."); + return READRESULT_NOTFOUND; + } + } + catch (ManifoldCFException e) + { + createErrorNode(output,e); + } + return READRESULT_FOUND; + } + /** Get repository connections */ protected static int apiReadRepositoryConnections(IThreadContext tc, Configuration output) throws ManifoldCFException @@ -2230,6 +2367,43 @@ public class ManifoldCF extends org.apac return READRESULT_FOUND; } + /** List mapping connectors */ + protected static int apiReadMappingConnectors(IThreadContext tc, Configuration output) + throws ManifoldCFException + { + // List registered authority connectors + try + { + IMappingConnectorManager manager = MappingConnectorManagerFactory.make(tc); + IResultSet resultSet = manager.getConnectors(); + int j = 0; + while (j < resultSet.getRowCount()) + { + IResultRow row = resultSet.getRow(j++); + ConfigurationNode child = new ConfigurationNode(API_MAPPINGCONNECTORNODE); + String description = (String)row.getValue("description"); + String className = (String)row.getValue("classname"); + ConfigurationNode node; + if (description != null) + { + node = new ConfigurationNode(CONNECTORNODE_DESCRIPTION); + node.setValue(description); + child.addChild(child.getChildCount(),node); + } + node = new ConfigurationNode(CONNECTORNODE_CLASSNAME); + node.setValue(className); + child.addChild(child.getChildCount(),node); + + output.addChild(output.getChildCount(),child); + } + } + catch (ManifoldCFException e) + { + createErrorNode(output,e); + } + return READRESULT_FOUND; + } + /** List repository connectors */ protected static int apiReadRepositoryConnectors(IThreadContext tc, Configuration output) throws ManifoldCFException @@ -2940,6 +3114,10 @@ public class ManifoldCF extends org.apac { return apiReadOutputConnectionStatus(tc,output,connectionName); } + else if (connectionType.equals("mappingconnections")) + { + return apiReadMappingConnectionStatus(tc,output,connectionName); + } else if (connectionType.equals("authorityconnections")) { return apiReadAuthorityConnectionStatus(tc,output,connectionName); @@ -3012,6 +3190,15 @@ public class ManifoldCF extends org.apac String connectionName = decodeAPIPathElement(path.substring("outputconnections/".length())); return apiReadOutputConnection(tc,output,connectionName); } + else if (path.equals("mappingconnections")) + { + return apiReadMappingConnections(tc,output); + } + else if (path.startsWith("mappingconnections/")) + { + String connectionName = decodeAPIPathElement(path.substring("mappingconnections/".length())); + return apiReadMappingConnection(tc,output,connectionName); + } else if (path.equals("authorityconnections")) { return apiReadAuthorityConnections(tc,output); @@ -3034,6 +3221,10 @@ public class ManifoldCF extends org.apac { return apiReadOutputConnectors(tc,output); } + else if (path.equals("mappingconnectors")) + { + return apiReadMappingConnectors(tc,output); + } else if (path.equals("authorityconnectors")) { return apiReadAuthorityConnectors(tc,output); @@ -3317,6 +3508,41 @@ public class ManifoldCF extends org.apac return WRITERESULT_FOUND; } + /** Write mapping connection. + */ + protected static int apiWriteMappingConnection(IThreadContext tc, Configuration output, Configuration input, String connectionName) + throws ManifoldCFException + { + ConfigurationNode connectionNode = findConfigurationNode(input,API_MAPPINGCONNECTIONNODE); + if (connectionNode == null) + throw new ManifoldCFException("Input argument must have '"+API_MAPPINGCONNECTIONNODE+"' field"); + + // Turn the configuration node into an OutputConnection + org.apache.manifoldcf.authorities.mapping.MappingConnection mappingConnection = new org.apache.manifoldcf.authorities.mapping.MappingConnection(); + processMappingConnection(mappingConnection,connectionNode); + + if (mappingConnection.getName() == null) + mappingConnection.setName(connectionName); + else + { + if (!mappingConnection.getName().equals(connectionName)) + throw new ManifoldCFException("Connection name in path and in object must agree"); + } + + try + { + // Save the connection. + IMappingConnectionManager connectionManager = MappingConnectionManagerFactory.make(tc); + if (connectionManager.save(mappingConnection)) + return WRITERESULT_CREATED; + } + catch (ManifoldCFException e) + { + createErrorNode(output,e); + } + return WRITERESULT_FOUND; + } + /** Write repository connection. */ protected static int apiWriteRepositoryConnection(IThreadContext tc, Configuration output, Configuration input, String connectionName) @@ -3424,6 +3650,11 @@ public class ManifoldCF extends org.apac String connectionName = decodeAPIPathElement(path.substring("outputconnections/".length())); return apiWriteOutputConnection(tc,output,input,connectionName); } + else if (path.startsWith("mappingconnections/")) + { + String connectionName = decodeAPIPathElement(path.substring("mappingconnections/".length())); + return apiWriteMappingConnection(tc,output,input,connectionName); + } else if (path.startsWith("authorityconnections/")) { String connectionName = decodeAPIPathElement(path.substring("authorityconnections/".length())); @@ -4247,6 +4478,7 @@ public class ManifoldCF extends org.apac protected static final String CONNECTIONNODE_CLASSNAME = "class_name"; protected static final String CONNECTIONNODE_MAXCONNECTIONS = "max_connections"; protected static final String CONNECTIONNODE_DESCRIPTION = "description"; + protected static final String CONNECTIONNODE_PREREQUISITE = "prerequisite"; protected static final String CONNECTIONNODE_CONFIGURATION = "configuration"; protected static final String CONNECTIONNODE_ACLAUTHORITY = "acl_authority"; protected static final String CONNECTIONNODE_THROTTLE = "throttle"; @@ -4410,6 +4642,12 @@ public class ManifoldCF extends org.apac throw new ManifoldCFException("Error parsing max connections: "+e.getMessage(),e); } } + else if (childType.equals(CONNECTIONNODE_PREREQUISITE)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection prerequisite node requires a value"); + connection.setPrerequisiteMapping(child.getValue()); + } else if (childType.equals(CONNECTIONNODE_DESCRIPTION)) { if (child.getValue() == null) @@ -4435,7 +4673,8 @@ public class ManifoldCF extends org.apac throw new ManifoldCFException("Missing connection field: '"+CONNECTIONNODE_CLASSNAME+"'"); } - + + /** Format an authority connection. */ protected static void formatAuthorityConnection(ConfigurationNode connectionNode, IAuthorityConnection connection) @@ -4459,6 +4698,138 @@ public class ManifoldCF extends org.apac child.setValue(Integer.toString(connection.getMaxConnections())); connectionNode.addChild(connectionNode.getChildCount(),child); + if (connection.getPrerequisiteMapping() != null) + { + child = new ConfigurationNode(CONNECTIONNODE_PREREQUISITE); + child.setValue(connection.getPrerequisiteMapping()); + connectionNode.addChild(connectionNode.getChildCount(),child); + } + + if (connection.getDescription() != null) + { + child = new ConfigurationNode(CONNECTIONNODE_DESCRIPTION); + child.setValue(connection.getDescription()); + connectionNode.addChild(connectionNode.getChildCount(),child); + } + + ConfigParams cp = connection.getConfigParams(); + child = new ConfigurationNode(CONNECTIONNODE_CONFIGURATION); + j = 0; + while (j < cp.getChildCount()) + { + ConfigurationNode cn = cp.findChild(j++); + child.addChild(child.getChildCount(),cn); + } + connectionNode.addChild(connectionNode.getChildCount(),child); + + } + + // Mapping connection API methods + + /** Convert input hierarchy into an MappingConnection object. + */ + protected static void processMappingConnection(org.apache.manifoldcf.authorities.mapping.MappingConnection connection, ConfigurationNode connectionNode) + throws ManifoldCFException + { + // Walk through the node's children + int i = 0; + while (i < connectionNode.getChildCount()) + { + ConfigurationNode child = connectionNode.findChild(i++); + String childType = child.getType(); + if (childType.equals(CONNECTIONNODE_ISNEW)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection isnew node requires a value"); + connection.setIsNew(child.getValue().equals("true")); + } + else if (childType.equals(CONNECTIONNODE_NAME)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection name node requires a value"); + connection.setName(child.getValue()); + } + else if (childType.equals(CONNECTIONNODE_CLASSNAME)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection classname node requires a value"); + connection.setClassName(child.getValue()); + } + else if (childType.equals(CONNECTIONNODE_MAXCONNECTIONS)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection maxconnections node requires a value"); + try + { + connection.setMaxConnections(Integer.parseInt(child.getValue())); + } + catch (NumberFormatException e) + { + throw new ManifoldCFException("Error parsing max connections: "+e.getMessage(),e); + } + } + else if (childType.equals(CONNECTIONNODE_PREREQUISITE)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection prerequisite node requires a value"); + connection.setPrerequisiteMapping(child.getValue()); + } + else if (childType.equals(CONNECTIONNODE_DESCRIPTION)) + { + if (child.getValue() == null) + throw new ManifoldCFException("Connection description node requires a value"); + connection.setDescription(child.getValue()); + } + else if (childType.equals(CONNECTIONNODE_CONFIGURATION)) + { + // Get the connection's configuration, clear out the children, and copy new ones from the child. + ConfigParams cp = connection.getConfigParams(); + cp.clearChildren(); + int j = 0; + while (j < child.getChildCount()) + { + ConfigurationNode cn = child.findChild(j++); + cp.addChild(cp.getChildCount(),new ConfigNode(cn)); + } + } + else + throw new ManifoldCFException("Unrecognized mapping connection field: '"+childType+"'"); + } + if (connection.getClassName() == null) + throw new ManifoldCFException("Missing connection field: '"+CONNECTIONNODE_CLASSNAME+"'"); + + } + + /** Format a mapping connection. + */ + protected static void formatMappingConnection(ConfigurationNode connectionNode, IMappingConnection connection) + { + ConfigurationNode child; + int j; + + child = new ConfigurationNode(CONNECTIONNODE_ISNEW); + child.setValue(connection.getIsNew()?"true":"false"); + connectionNode.addChild(connectionNode.getChildCount(),child); + + child = new ConfigurationNode(CONNECTIONNODE_NAME); + child.setValue(connection.getName()); + connectionNode.addChild(connectionNode.getChildCount(),child); + + child = new ConfigurationNode(CONNECTIONNODE_CLASSNAME); + child.setValue(connection.getClassName()); + connectionNode.addChild(connectionNode.getChildCount(),child); + + child = new ConfigurationNode(CONNECTIONNODE_MAXCONNECTIONS); + child.setValue(Integer.toString(connection.getMaxConnections())); + connectionNode.addChild(connectionNode.getChildCount(),child); + + if (connection.getPrerequisiteMapping() != null) + { + child = new ConfigurationNode(CONNECTIONNODE_PREREQUISITE); + child.setValue(connection.getPrerequisiteMapping()); + connectionNode.addChild(connectionNode.getChildCount(),child); + } + if (connection.getDescription() != null) { child = new ConfigurationNode(CONNECTIONNODE_DESCRIPTION); Modified: manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties?rev=1498128&r1=1498127&r2=1498128&view=diff ============================================================================== --- manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties (original) +++ manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties Sun Jun 30 14:15:49 2013 @@ -19,12 +19,9 @@ editoutput.Throttling=Throttling editconnection.Name=Name editconnection.Type=Type editconnection.Throttling=Throttling -editconnection.Addthrottle +editconnection.Addthrottle=Add throttle editjob.Name=Name editjob.Connection=Connection -editauthority.Name=Name -editauthority.Type=Type -editauthority.Throttling=Throttling viewconnection.NoneGlobalAuthority=None (global authority) @@ -41,6 +38,8 @@ banner.DocumentIngestion=Document Ingest navigation.Outputs=Outputs navigation.ListOutputConnections=List Output Connections +navigation.UserMappings=User Mappings +navigation.ListUserMappings=List User Mapping Connections navigation.Authorities=Authorities navigation.ListAuthorityConnections=List Authority Connections navigation.Repositories=Repositories @@ -59,11 +58,10 @@ navigation.ResultHistogram=Result Histog navigation.Miscellaneous=Miscellaneous navigation.Locale=en_US navigation.Help=Help - navigation.Listoutputconnections=List output connections navigation.Listrepositoryconnections=List repository connections +navigation.Listusermappings=List user mapping connections navigation.Listauthorities=List authorities -navigation.Listrepositorconnections=List repository connections navigation.Listjobs=List jobs navigation.Managejobs=Manage jobs navigation.Documentstatus=Document status @@ -85,6 +83,7 @@ listoutputs.Edit=Edit listoutputs.Delete=Delete listoutputs.DeleteOutputConnection=Delete output connection listoutputs.AddAnOutputConnection=Add an output connection +listoutputs.uninstalled=(uninstalled) editoutput.ApacheManifoldCFEditOutputConnection=Apache ManifoldCF: Edit Output Connection editoutput.EditAnOutputConnection=Edit an Output Connection @@ -131,6 +130,7 @@ viewoutput.Threwexception=Threw exceptio listauthorities.ApacheManifoldCFListAuthorities=Apache ManifoldCF: List Authorities listauthorities.ListOfAuthorityConnections=List of Authority Connections +listauthorities.DeleteAuthority=Delete authority listauthorities.Name=Name listauthorities.Description=Description listauthorities.AuthorityType=Authority Type @@ -140,6 +140,21 @@ listauthorities.AddNewConnection=Add a n listauthorities.View=View listauthorities.Edit=Edit listauthorities.Delete=Delete +listauthorities.uninstalled=(uninstalled) + +listmappers.ApacheManifoldCFListMappers=Apache ManifoldCF: List User Mappers +listmappers.ListOfMappingConnections=List of User Mapping Connections +listmappers.DeleteMapper=Delete user mapper +listmappers.Name=Name +listmappers.Description=Description +listmappers.MapperType=Mapping Type +listmappers.Max=Max +listmappers.AddaNewConnection=Add a new connection +listmappers.AddNewConnection=Add a new connection +listmappers.View=View +listmappers.Edit=Edit +listmappers.Delete=Delete +listmappers.uninstalled=(uninstalled) editauthority.ApacheManifoldCFEditAuthority=Apache ManifoldCF: Edit Authority editauthority.EditAnAuthority=Edit an Authority @@ -158,9 +173,42 @@ editauthority.EditAuthority=Edit authori editauthority.TheMaximumNumberOfConnectionsMustBeAValidInteger=The maximum number of connections must be a valid integer editauthority.ConnectionMustHaveAName=Connection must have a name editauthority.NoAuthorityConnectorsRegistered=No authority connectors registered - editauthority.UNREGISTERED=UNREGISTERED editauthority.tab=tab +editauthority.Name=Name +editauthority.Type=Type +editauthority.Throttling=Throttling +editauthority.EditAuthorityConnection=Edit Authority Connection +editauthority.Prerequisites=Prerequisites +editauthority.PrerequisiteUserMappingColon=Prerequisite user mapping: +editauthority.NoPrerequisites=(No Prerequisites) + +editmapper.ApacheManifoldCFEditMapping=Apache ManifoldCF: Edit Mapping +editmapper.EditAMapping=Edit A Mapping +editmapper.NameColon=Name: +editmapper.DescriptionColon=Description: +editmapper.ConnectionTypeColon=Connection type: +editmapper.Continue=Continue +editmapper.ContinueToNextPage=Continue to next page +editmapper.MaxConnections=Max connections +editmapper.PerJVMColon=(per JVM): +editmapper.Cancel=Cancel +editmapper.CancelMappingEditing=Cancel mapping editing +editmapper.Save=Save +editmapper.SaveThisMappingConnection=Save this mapping connection +editmapper.editmapper=Edit mapper +editmapper.TheMaximumNumberOfConnectionsMustBeAValidInteger=The maximum number of connections must be a valid integer +editmapper.ConnectionMustHaveAName=Connection must have a name +editmapper.NoMappingConnectorsRegistered=No mapping connectors registered +editmapper.UNREGISTERED=UNREGISTERED +editmapper.tab=tab +editmapper.Name=Name +editmapper.Type=Type +editmapper.Throttling=Throttling +editmapper.EditMappingConnection=Edit Mapping Connection +editmapper.Prerequisites=Prerequisites +editmapper.PrerequisiteUserMappingColon=Prerequisite user mapping: +editmapper.NoPrerequisites=(No Prerequisites) listconnections.ApacheManifoldCFListConnections=Apache ManifoldCF: List Connections listconnections.ListOfRepositoryConnections=List of Repository Connections @@ -175,6 +223,7 @@ listconnections.Edit=Edit listconnections.Delete=Delete listconnections.DeleteConnection=Delete connection listconnections.AddAConnection=Add a connection +listconnections.uninstalled=(uninstalled) editconnection.ApacheManifoldCFEditConnection=Apache ManifoldCF: Edit Connection editconnection.EditAConnection=Edit a Connection @@ -771,3 +820,25 @@ viewauthority.Connectorisnotinstalled=Co viewauthority.uninstalled=(uninstalled) viewauthority.Threwexception=Threw exception: viewauthority.qmark=? +viewauthority.PrerequisiteUserMappingColon=Prerequisite user mapping: +viewauthority.NoPrerequisites=No prerequisites + +viewmapper.ApacheManifoldCFViewMappingConnectionStatus=Apache ManifoldCF: View Mapping Connection Status +viewmapper.DeleteConnection=Delete connection +viewmapper.ViewMappingConnectionStatus=View Mapping Connection Status +viewmapper.uninstalled=(uninstalled) +viewmapper.Connectorisnotinstalled=Connector is not installed. +viewmapper.Threwexception=Threw exception: +viewmapper.NameColon=Name: +viewmapper.DescriptionColon=Description: +viewmapper.MapperTypeColon=Mapping type: +viewmapper.MaxConnectionsColon=Max connections: +viewmapper.ConnectionStatusColon=Connection status: +viewmapper.Refresh=Refresh +viewmapper.Edit=Edit +viewmapper.EditThisMappingConnection=Edit this mapping connection +viewmapper.Delete=Delete +viewmapper.DeleteThisMappingConnection=Delete this mapping connection +viewmapper.qmark=? +viewmapper.PrerequisiteUserMappingColon=Prerequisite user mapping: +viewmapper.NoPrerequisites=No prerequisites Modified: manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties?rev=1498128&r1=1498127&r2=1498128&view=diff ============================================================================== --- manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties (original) +++ manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties Sun Jun 30 14:15:49 2013 @@ -19,12 +19,9 @@ editoutput.Throttling=ã¹ãã editconnection.Name=åå editconnection.Type=ã¿ã¤ã editconnection.Throttling=ã¹ããããªã³ã° -editconnection.Addthrottle +editconnection.Addthrottle=Add throttle editjob.Name=åå editjob.Connection=ã³ãã¯ã·ã§ã³ -editauthority.Name=åå -editauthority.Type=ã¿ã¤ã -editauthority.Throttling=ã¹ããããªã³ã° viewconnection.NoneGlobalAuthority=ãªãï¼globalAuthorityï¼ @@ -41,6 +38,8 @@ banner.DocumentIngestion=ã³ã³ã� navigation.Outputs=åºå navigation.ListOutputConnections=åºåã³ãã¯ã·ã§ã³ä¸è¦§ +navigation.UserMappings=User Mappings +navigation.ListUserMappings=List User Mapping Connections navigation.Authorities=権é navigation.ListAuthorityConnections=権éã³ãã¯ã·ã§ã³ä¸è¦§ navigation.Repositories=ãªãã¸ã㪠@@ -59,11 +58,10 @@ navigation.ResultHistogram=çµæ� navigation.Miscellaneous=ãã®ä» navigation.Locale=ja_JP navigation.Help=ãã«ã - navigation.Listrepositoryconnections=List repository connections navigation.Listoutputconnections=List output connections +navigation.Listusermappings=List user mapping connections navigation.Listauthorities=List authorities -navigation.Listrepositorconnections=List repository connections navigation.Listjobs=List jobs navigation.Managejobs=Manage jobs navigation.Documentstatus=Document status @@ -85,6 +83,7 @@ listoutputs.Edit=ç·¨é listoutputs.Delete=åé¤ listoutputs.DeleteOutputConnection=åºåã³ãã¯ã·ã§ã³ãåé¤ listoutputs.AddAnOutputConnection=åºåã³ãã¯ã·ã§ã³ã追å +listoutputs.uninstalled=(uninstalled) editoutput.ApacheManifoldCFEditOutputConnection=Apache ManifoldCFï¼åºåã³ãã¯ã·ã§ã³ã®ç·¨é editoutput.EditAnOutputConnection=åºåã³ãã¯ã·ã§ã³ã®ç·¨é @@ -131,6 +130,7 @@ viewoutput.Threwexception=Threw exceptio listauthorities.ApacheManifoldCFListAuthorities=Apache ManifoldCFï¼æ¨©éä¸è¦§ listauthorities.ListOfAuthorityConnections=権éã³ãã¯ã·ã§ã³ä¸è¦§ +listauthorities.DeleteAuthority=Delete authority listauthorities.Name=åå listauthorities.Description=説æ listauthorities.AuthorityType=権éã¿ã¤ã @@ -140,6 +140,21 @@ listauthorities.AddNewConnection=æ°� listauthorities.View=表示 listauthorities.Edit=ç·¨é listauthorities.Delete=åé¤ +listauthorities.uninstalled=(uninstalled) + +listmappers.ApacheManifoldCFListMappers=Apache ManifoldCF: List User Mappers +listmappers.ListOfMappingConnections=List of User Mapping Connections +listmappers.DeleteMapper=Delete user mapper +listmappers.Name=åå +listmappers.Description=説æ +listmappers.MapperType=Mapping Type +listmappers.Max=æå¤§å¤ +listmappers.AddaNewConnection=æ°ããã³ãã¯ã·ã§ã³ã追å +listmappers.AddNewConnection=æ°ããã³ãã¯ã·ã§ã³ã追å +listmappers.View=表示 +listmappers.Edit=ç·¨é +listmappers.Delete=åé¤ +listmappers.uninstalled=(uninstalled) editauthority.ApacheManifoldCFEditAuthority=Apache ManifoldCFï¼æ¨©éã®ç·¨é editauthority.EditAnAuthority=権éãç·¨é @@ -158,9 +173,42 @@ editauthority.EditAuthority=権é editauthority.TheMaximumNumberOfConnectionsMustBeAValidInteger=æå¤§ã³ãã¯ã·ã§ã³æ°ã«ã¯æ´æ°ãå ¥åãã¦ãã ãã editauthority.ConnectionMustHaveAName=ã³ãã¯ã·ã§ã³åãå ¥åãã¦ãã ãã editauthority.NoAuthorityConnectorsRegistered=権éã³ãã¯ã·ã§ã³ãããã¾ãã - editauthority.UNREGISTERED=UNREGISTERED editauthority.tab=tab +editauthority.Name=åå +editauthority.Type=ã¿ã¤ã +editauthority.Throttling=ã¹ããããªã³ã° +editauthority.EditAuthorityConnection=Edit Authority Connection +editauthority.Prerequisites=Prerequisites +editauthority.PrerequisiteUserMappingColon=Prerequisite user mapping: +editauthority.NoPrerequisites=(No Prerequisites) + +editmapper.ApacheManifoldCFEditMapping=Apache ManifoldCF: Edit Mapping +editmapper.EditAMapping=Edit A Mapping +editmapper.NameColon=Name: +editmapper.DescriptionColon=Description: +editmapper.ConnectionTypeColon=Connection type: +editmapper.Continue=Continue +editmapper.ContinueToNextPage=Continue to next page +editmapper.MaxConnections=Max connections +editmapper.PerJVMColon=(per JVM): +editmapper.Cancel=Cancel +editmapper.CancelMappingEditing=Cancel mapping editing +editmapper.Save=Save +editmapper.SaveThisMappingConnection=Save this mapping connection +editmapper.editmapper=Edit mapping +editmapper.TheMaximumNumberOfConnectionsMustBeAValidInteger=The maximum number of connections must be a valid integer +editmapper.ConnectionMustHaveAName=Connection must have a name +editmapper.NoMappingConnectorsRegistered=No mapping connectors registered +editmapper.UNREGISTERED=UNREGISTERED +editmapper.tab=tab +editmapper.Name=Name +editmapper.Type=Type +editmapper.Throttling=Throttling +editmapper.EditMappingConnection=Edit Mapping Connection +editmapper.Prerequisites=Prerequisites +editmapper.PrerequisiteUserMappingColon=Prerequisite user mapping: +editmapper.NoPrerequisites=(No Prerequisites) listconnections.ApacheManifoldCFListConnections=Apache ManifoldCFï¼ã³ãã¯ã·ã§ã³ä¸è¦§ listconnections.ListOfRepositoryConnections=ãªãã¸ããªã³ãã¯ã·ã§ã³ä¸è¦§ @@ -175,6 +223,7 @@ listconnections.Edit=ç·¨é listconnections.Delete=åé¤ listconnections.DeleteConnection=ã³ãã¯ã·ã§ã³ãåé¤ï¼ listconnections.AddAConnection=ã³ãã¯ã·ã§ã³ã追å +listconnections.uninstalled=(uninstalled) editconnection.ApacheManifoldCFEditConnection=Apache ManifoldCFï¼ã³ãã¯ã·ã§ã³ãç·¨é editconnection.EditAConnection=ã³ãã¯ã·ã§ã³ãç·¨é @@ -772,3 +821,25 @@ viewauthority.Connectorisnotinstalled=Co viewauthority.uninstalled=(uninstalled) viewauthority.Threwexception=Threw exception: viewauthority.qmark=? +viewauthority.PrerequisiteUserMappingColon=Prerequisite user mapping: +viewauthority.NoPrerequisites=No prerequisites + +viewmapper.ApacheManifoldCFViewMappingConnectionStatus=Apache ManifoldCF: View Mapping Connection Status +viewmapper.DeleteConnection=Delete connection +viewmapper.ViewMappingConnectionStatus=View Mapping Connection Status +viewmapper.uninstalled=(uninstalled) +viewmapper.Connectorisnotinstalled=Connector is not installed. +viewmapper.Threwexception=Threw exception: +viewmapper.NameColon=ååï¼ +viewmapper.DescriptionColon=説æï¼ +viewmapper.MapperTypeColon=Mapping type: +viewmapper.MaxConnectionsColon=æå¤§ã³ãã¯ã·ã§ã³ï¼ +viewmapper.ConnectionStatusColon=ã³ãã¯ã·ã§ã³ç¶æ ï¼ +viewmapper.Refresh=æ´æ° +viewmapper.Edit=ç·¨é +viewmapper.EditThisMappingConnection=Edit this mapping connection +viewmapper.Delete=åé¤ +viewmapper.DeleteThisMappingConnection=Delete this mapping connection +viewmapper.qmark=? +viewmapper.PrerequisiteUserMappingColon=Prerequisite user mapping: +viewmapper.NoPrerequisites=No prerequisites
