manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1552525 - /manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
Date Fri, 20 Dec 2013 08:15:29 GMT
Author: kwright
Date: Fri Dec 20 08:15:29 2013
New Revision: 1552525

URL: http://svn.apache.org/r1552525
Log:
Add a method which can list folders.

Modified:
    manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java

Modified: manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java?rev=1552525&r1=1552524&r2=1552525&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-553/connectors/email/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/email/EmailConnector.java
Fri Dec 20 08:15:29 2013
@@ -1044,4 +1044,30 @@ public class EmailConnector extends org.
   }
 
   ///////////////////////////////////////End of specification UI///////////////////////////////////////////////
+  
+  // Get a sorted list of folder names
+  protected String[] getFolderNames()
+    throws ManifoldCFException, ServiceInterruption
+  {
+    getSession();
+    List<String> folderList = new ArrayList<String>();
+    try
+    {
+      Folder[] folders = store.getDefaultFolder().list("*");
+      for (Folder folder : folders)
+      {
+        if ((folder.getType() & Folder.HOLDS_MESSAGES) != 0)
+          folderList.add(folder.getFullName());
+      }
+    }
+    catch (MessagingException e)
+    {
+      Logging.connectors.error("Email: Can't get folder list: "+e.getMessage(),e);
+      throw new ManifoldCFException("Can't get folder list: "+e.getMessage(),e);
+    }
+    String[] rval = folderList.toArray(new String[0]);
+    java.util.Arrays.sort(rval);
+    return rval;
+  }
+
 }
\ No newline at end of file



Mime
View raw message