如何使用apache camel + java DSL复制文件frome google驱动器?

时间:2017-09-20 09:12:40

标签: java apache-camel dsl

每个人我都是apache camel的新手,我想在我的本地系统中复制Gdrive的文件。如果有人告诉我,那对我来说会很棒。

我做了:

1.Maven Dependencies

    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>2.13.0</version> 


        <groupId>org.apache.camel</groupId>
        <artifactId>camel-google-drive</artifactId>
        <version>2.14-SNAPSHOT</version>

我需要添加什么依赖?

2.对于Main class / RouteBuilder类,我需要导入哪些包。 (这段代码来自@Tolik Thanks4This。)

public class FileCopyGDrive
  {
 public static void main(String[] args ) throws Exception 
   {       
 CamelContext context = new DefaultCamelContext();  

 GoogleDriveConfiguration configuration = new GoogleDriveConfiguration();
    configuration.setApplicationName("CopyFile");
    configuration.setClientId("..");
    configuration.setClientSecret("..");
    configuration.setScopes(scopes);
    configuration.setAccessToken("..");
    configuration.setRefreshToken("..");

    GoogleDriveComponent googleDriveComponent = new GoogleDriveComponent();
    googleDriveComponent.setConfiguration(configuration);
    context.addComponent("google-drive", googleDriveComponent);

    context.addRoutes(  
         new RouteBuilder()  
         {  
            @Override  
            public void configure() throws Exception  
            {  
                from("google-drive://drive-files/copy?   ").to("file:/home/rajat/Desktop/folder");   
            }  
         });  
      context.start();  
      Thread.sleep(10000);  
      context.stop();  
     }}
  }

请伙计们帮帮我。

0 个答案:

没有答案