如何通过apache camel从google-drive下载文件,我得到AbstractApiComponent无法访问?

问题描述 投票:0回答:1

在这里,我试图从谷歌驱动器下载(复制)一个文件,但我收到的错误是我无法理解的。我不确定源路由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();
     }}

错误:

[错误]无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:项目上的编译(默认编译)Google-Drive:编译 失败:编译失败:/ 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无法转换为Component

我被困在这里我的代码出了什么问题?

java apache-camel maven-3 dsl
1个回答
0
投票

看起来你没有AbstractApiComponent这是GoogleDriveComponent的父类。现在org.apache.camel.util.component.AbstractApiComponent是骆驼核心的一部分,所以更好地了解你正在使用的Camel版本。

© www.soinside.com 2019 - 2024. All rights reserved.