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

时间:2017-09-25 13:25:14

标签: java apache-camel maven-3 dsl

我尝试从google-drive下载(复制)文件 但我得到的错误是我无法理解的。 我不确定源路由的正确陈述 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]        无法执行目标org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile   项目Google-Drive上的(默认编译):编译
       失败:编译失败:/ home / rajat / workspace / Google-Drive / src / main / java / com / pkgName / gdrive   /Google_Drive/GdriveCopyFile.java:[32,16]错误:无法访问   AbstractApiComponent类文件   org.apache.camel.util.component.AbstractApiComponent没有   找到/家庭/拉雅/工作区/谷歌驱动器/ src目录/主/ JAVA / COM / PKGNAME / GDrive的/ Google_Drive / GdriveCopyFile.java:[33,42]   错误:不兼容的类型:GoogleDriveComponent不能   转换为组件

我在这里遇到了我的代码有什么问题?

1 个答案:

答案 0 :(得分:0)

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