camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject git commit: move drive scopes to configuration
Date Tue, 09 Sep 2014 19:01:11 GMT
Repository: camel
Updated Branches:
  refs/heads/master 92c8ee51e -> 734afce69


move drive scopes to configuration


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/734afce6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/734afce6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/734afce6

Branch: refs/heads/master
Commit: 734afce69cc1877f7aba7d112b0d0305060fcbba
Parents: 92c8ee5
Author: Jonathan Anstey <janstey@gmail.com>
Authored: Tue Sep 9 16:30:59 2014 -0230
Committer: Jonathan Anstey <janstey@gmail.com>
Committed: Tue Sep 9 16:30:59 2014 -0230

----------------------------------------------------------------------
 .../google/drive/GoogleDriveComponent.java       | 18 ++----------------
 .../google/drive/GoogleDriveConfiguration.java   | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/734afce6/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
index 816058f..d4918f5 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveComponent.java
@@ -16,11 +16,7 @@
  */
 package org.apache.camel.component.google.drive;
 
-import java.util.Arrays;
-import java.util.List;
-
 import com.google.api.services.drive.Drive;
-import com.google.api.services.drive.DriveScopes;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
@@ -34,11 +30,9 @@ import org.apache.camel.util.component.AbstractApiComponent;
  */
 @UriEndpoint(scheme = "google-drive", consumerClass = GoogleDriveConsumer.class, consumerPrefix
= "consumer")
 public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiName, GoogleDriveConfiguration,
GoogleDriveApiCollection> {
-    private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE,
DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
-                                                                     DriveScopes.DRIVE);

+
     private Drive client;
     private GoogleDriveClientFactory clientFactory;
-    private List<String> scopes = DEFAULT_SCOPES;
     
     public GoogleDriveComponent() {
         super(GoogleDriveEndpoint.class, GoogleDriveApiName.class, GoogleDriveApiCollection.getCollection());
@@ -55,7 +49,7 @@ public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiNam
 
     public Drive getClient() {
         if (client == null) {
-            client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(),
scopes, 
+            client = getClientFactory().makeClient(configuration.getClientId(), configuration.getClientSecret(),
configuration.getScopes(), 
                 configuration.getApplicationName(), configuration.getRefreshToken(), configuration.getAccessToken());
         }
         return client;
@@ -77,12 +71,4 @@ public class GoogleDriveComponent extends AbstractApiComponent<GoogleDriveApiNam
                                       GoogleDriveConfiguration endpointConfiguration) {
         return new GoogleDriveEndpoint(uri, this, apiName, methodName, endpointConfiguration);
     }
-
-    private List<String> getScopes() {
-        return scopes;
-    }
-
-    private void setScopes(List<String> scopes) {
-        this.scopes = scopes;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/734afce6/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
index 2f8b19c..dcc8205 100644
--- a/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
+++ b/components/camel-google-drive/src/main/java/org/apache/camel/component/google/drive/GoogleDriveConfiguration.java
@@ -16,6 +16,11 @@
  */
 package org.apache.camel.component.google.drive;
 
+import java.util.Arrays;
+import java.util.List;
+
+import com.google.api.services.drive.DriveScopes;
+
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
 
@@ -24,7 +29,12 @@ import org.apache.camel.spi.UriParams;
  */
 @UriParams
 public class GoogleDriveConfiguration {
-
+    private static final List<String> DEFAULT_SCOPES = Arrays.asList(DriveScopes.DRIVE_FILE,
DriveScopes.DRIVE_APPS_READONLY, DriveScopes.DRIVE_METADATA_READONLY,
+            DriveScopes.DRIVE); 
+    
+    @UriParam
+    private List<String> scopes = DEFAULT_SCOPES;
+    
     @UriParam
     private String clientId;
 
@@ -79,5 +89,12 @@ public class GoogleDriveConfiguration {
     public void setApplicationName(String applicationName) {
         this.applicationName = applicationName;
     }
+    
+    public List<String> getScopes() {
+        return scopes;
+    }
 
+    public void setScopes(List<String> scopes) {
+        this.scopes = scopes;
+    }
 }


Mime
View raw message