简体   繁体   English

如何通过apache骆驼从Google驱动器下载文件,我无法访问AbstractApiComponent?

[英]How to download file from google-drive by apache camel, I am getting AbstractApiComponent cannot access?

Here I'm trying to download(copy) a file from google-drive but I'm getting error which is I cannot understand yet. 在这里,我正在尝试从Google驱动器下载(复制)文件,但出现错误,这是我目前无法理解的。 I'm not sure about the correct statement for source-route from().to(localDrive) . 我不确定source-route from().to(localDrive)的正确声明。

    public class GdriveCopyFile {
    public static void main(String ar[])throws Exception{

    ArrayList<String> scope = new ArrayList<String>();
    scope.add("https://www.googleapis.com/auth/drive.file");

    CamelContext context=new DefaultCamelContext();
    GoogleDriveConfiguration configuration=new GoogleDriveConfiguration();

    configuration.setApplicationName("GdriveCopyFile");
    configuration.setClientId("..");
    configuration.setClientSecret("..");
    configuration.setScopes(scope);

    configuration.setAccessToken("..);
    configuration.setRefreshToken("..");

      GoogleDriveComponent gDriveCompo=new GoogleDriveComponent();
      gDriveCompo.setConfiguration(configuration);      //32
      context.addComponent("google-drive", gDriveCompo); //33

      context.addRoutes(new RouteBuilder(){
      @Override
      public void configure()throws Exception{

      from("google-drive://drive-files/copy?..").to("file:..");

     }
         });
    context.start();
    Thread.sleep(10000);
    context.stop();
     }}

error: 错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project Google-Drive: Compilation [错误]无法在项目Google驱动器上执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile(默认编译)
failure: Compilation failure: /home/rajat/workspace/Google-Drive/src/main/java/com/pkgName/gdrive /Google_Drive/GdriveCopyFile.java:[32,16] error: cannot access AbstractApiComponent class file for org.apache.camel.util.component.AbstractApiComponent not found/home/rajat/workspace/Google-Drive/src/main/java/com/pkgName/gdrive/Google_Drive/GdriveCopyFile.java:[33,42] error: incompatible types: GoogleDriveComponent cannot be converted to Component 故障:编译故障:/ home / rajat / workspace / Google-Drive / src / main / java / com / pkgName / gdrive /Google_Drive/GdriveCopyFile.java:[32,16]错误:无法访问org.apache的AbstractApiComponent类文件找不到.camel.util.component.AbstractApiComponent / home / rajat / workspace / Google-Drive / src / main / java / com / pkgName / gdrive / Google_Drive / GdriveCopyFile.java:[33,42]错误:类型不兼容:GoogleDriveComponent无法转换为组件

And I'm stuck in here what is wrong with my code? 我被困在这里,我的代码有什么问题?

Looks like you do not have AbstractApiComponent which is parent class for GoogleDriveComponent . 看起来您没有AbstractApiComponent ,它是GoogleDriveComponent父类。 Now org.apache.camel.util.component.AbstractApiComponent is part of camel core so better look at what version of Camel you're using. 现在org.apache.camel.util.component.AbstractApiComponent是骆驼核心的一部分,因此可以更好地了解您使用的Camel版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM