繁体   English   中英

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

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

在这里,我正在尝试从Google驱动器下载(复制)文件,但出现错误,这是我目前无法理解的。 我不确定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();
     }}

错误:

[错误]无法在项目Google驱动器上执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile(默认编译)
故障:编译故障:/ 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无法转换为组件

我被困在这里,我的代码有什么问题?

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

暂无
暂无

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

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