manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1470550 [2/2] - in /manifoldcf/branches/CONNECTORS-676: ./ connectors/dropbox/ connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/ dist-license/ framework/core/src/main/java/org/apache/manifoldcf/co...
Date Mon, 22 Apr 2013 14:41:36 GMT
Modified: manifoldcf/branches/CONNECTORS-676/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-676/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxSession.java?rev=1470550&r1=1470549&r2=1470550&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-676/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxSession.java
(original)
+++ manifoldcf/branches/CONNECTORS-676/connectors/dropbox/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/dropbox/DropboxSession.java
Mon Apr 22 14:41:36 2013
@@ -50,65 +50,63 @@ import org.json.simple.parser.ParseExcep
  */
 public class DropboxSession {
 
-    private DropboxAPI<?> client;
-    private String cursor = null;
-    
-
-    DropboxSession(Map<String, String> parameters) {
-        AppKeyPair appKeyPair = new AppKeyPair(parameters.get(DropboxConfig.APP_KEY_PARAM),
parameters.get(DropboxConfig.APP_SECRET_PARAM));
-        WebAuthSession session = new WebAuthSession(appKeyPair, WebAuthSession.AccessType.DROPBOX);
-        AccessTokenPair ac = new AccessTokenPair(parameters.get(DropboxConfig.KEY_PARAM),
parameters.get(DropboxConfig.SECRET_PARAM));
-        session.setAccessTokenPair(ac);
-        client = new DropboxAPI<WebAuthSession>(session);
+  private DropboxAPI<?> client;
+  private String cursor = null;
+  
+
+  public DropboxSession(Map<String, String> parameters) {
+    AppKeyPair appKeyPair = new AppKeyPair(parameters.get(DropboxConfig.APP_KEY_PARAM), parameters.get(DropboxConfig.APP_SECRET_PARAM));
+    WebAuthSession session = new WebAuthSession(appKeyPair, WebAuthSession.AccessType.DROPBOX);
+    AccessTokenPair ac = new AccessTokenPair(parameters.get(DropboxConfig.KEY_PARAM), parameters.get(DropboxConfig.SECRET_PARAM));
+    session.setAccessTokenPair(ac);
+    client = new DropboxAPI<WebAuthSession>(session);
+  }
+
+  public Map<String, String> getRepositoryInfo() throws DropboxException {
+    Map<String, String> info = new HashMap<String, String>();
+
+    info.put("Country", client.accountInfo().country);
+    info.put("Display Name", client.accountInfo().displayName);
+    info.put("Referral Link", client.accountInfo().referralLink);
+    info.put("Quota", String.valueOf(client.accountInfo().quota));
+    info.put("Quota Normal", String.valueOf(client.accountInfo().quotaNormal));
+    info.put("Quota Shared", String.valueOf(client.accountInfo().quotaShared));
+    info.put("Uid", String.valueOf(client.accountInfo().uid));
+    return info;
+  }
+
+  public HashSet<String> getSeeds() throws DropboxException {
+    HashSet<String> ids = new HashSet<String>();
+    Boolean changed = false;
+    while (true) {
+      // Get /delta results from Dropbox
+      DropboxAPI.DeltaPage<DropboxAPI.Entry> page = client.delta(cursor);
+
+      if (page.reset) {
+        changed = true;
+      }
+      // Apply the entries one by one.
+      for (DeltaEntry<DropboxAPI.Entry> e : page.entries) {
+        ids.add(e.lcPath);
+        changed = true;
+      }
+      cursor = page.cursor;
+      if (!page.hasMore) {
+        break;
+      }
     }
+    return ids;
+  }
 
-    public Map<String, String> getRepositoryInfo() throws DropboxException {
-        Map<String, String> info = new HashMap<String, String>();
-
-        info.put("Country", client.accountInfo().country);
-        info.put("Display Name", client.accountInfo().displayName);
-        info.put("Referral Link", client.accountInfo().referralLink);
-        info.put("Quota", String.valueOf(client.accountInfo().quota));
-        info.put("Quota Normal", String.valueOf(client.accountInfo().quotaNormal));
-        info.put("Quota Shared", String.valueOf(client.accountInfo().quotaShared));
-        info.put("Uid", String.valueOf(client.accountInfo().uid));
-        return info;
-    }
-
-    HashSet<String> getSeeds() throws DropboxException {
-        HashSet<String> ids = new HashSet<String>();
-        Boolean changed = false;
-        while (true) {
-            // Get /delta results from Dropbox
-            DropboxAPI.DeltaPage<DropboxAPI.Entry> page = client.delta(cursor);
-
-            if (page.reset) {
-                changed = true;
-            }
-            // Apply the entries one by one.
-            for (DeltaEntry<DropboxAPI.Entry> e : page.entries) {
-                ids.add(e.lcPath);
-                changed = true;
-            }
-            cursor = page.cursor;
-            if (!page.hasMore) {
-                break;
-            }
-        }
-        return ids;
-    }
-
-    public DropboxAPI.Entry getObject(String id) throws DropboxException {
-        DropboxAPI.Entry entry = null;
-        try {
-            entry = client.metadata(id, 25000, null, true, null);
-        } catch (DropboxException e) {
-            System.out.println("Something went wrong: " + e);
-        }
-        return entry;
-    }
-
-    public DropboxInputStream getDropboxInputStream(String id) throws DropboxException {
-        return client.getFileStream(id, null);
-    }
+  public DropboxAPI.Entry getObject(String id) throws DropboxException {
+    return client.metadata(id, 25000, null, true, null);
+  }
+
+  public DropboxInputStream getDropboxInputStream(String id) throws DropboxException {
+    return client.getFileStream(id, null);
+  }
+  
+  public void close() {
+    // MHL
+  }
 }

Modified: manifoldcf/branches/CONNECTORS-676/dist-license/LICENSE.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-676/dist-license/LICENSE.txt?rev=1470550&r1=1470549&r2=1470550&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-676/dist-license/LICENSE.txt (original)
+++ manifoldcf/branches/CONNECTORS-676/dist-license/LICENSE.txt Mon Apr 22 14:41:36 2013
@@ -293,6 +293,12 @@ License: Common Development and Distribu
 This product includes a jstl-impl-1.2.jar.
 License: Common Development and Distribution License (CDDL) v1.0 (https://glassfish.dev.java.net/public/CDDLv1.0.html)
 
+This product includes a dropbox-client-1.5.3.jar.
+License: MIT license (???).
+
+This product includes a json-simple-1.1.jar.
+License: Apache 2 (http://www.apache.org/licenses/LICENSE-2.0.txt)
+
 This product may include pdf files that embed IPA-licensed fonts.
 License: IPA Font License Agreement v1.0 (http://ossipedia.ipa.go.jp/ipafont/index.html#LicenseEng)
 

Modified: manifoldcf/branches/CONNECTORS-676/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-676/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java?rev=1470550&r1=1470549&r2=1470550&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-676/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java
(original)
+++ manifoldcf/branches/CONNECTORS-676/framework/core/src/main/java/org/apache/manifoldcf/core/common/XThreadInputStream.java
Mon Apr 22 14:41:36 2013
@@ -232,7 +232,7 @@ public class XThreadInputStream extends 
   public void close()
     throws IOException
   {
-    // MHL
+    // Do nothing; stream close is handled by the caller on the stuffer side
   }
 
 }



Mime
View raw message