Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 Cloudera Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kitesdk.maven.plugins;
 
 import java.io.File;
 import java.net.URI;
 import java.net.URL;
 import java.util.List;
 
 abstract class AbstractDatasetMojo extends AbstractHadoopMojo {

  
A Kite dataset URI.
 
   @Parameter(property = "kite.uri")
   protected String uri;

  
The root directory of the dataset repository. Optional if using HCatalog for metadata storage.
 
   @Parameter(property = "kite.rootDirectory")
   protected String rootDirectory;

  
If true, store dataset metadata in HCatalog, otherwise store it on the filesystem.
 
   @Parameter(property = "kite.hcatalog")
   protected boolean hcatalog = true;

  
The URI specifying the dataset repository, e.g. repo:hdfs://host:8020/data. Optional, but if specified then kite.rootDirectory and kite.hcatalog are ignored.
 
   @Parameter(property = "kite.repositoryUri")
   protected String repositoryUri;

  
Hadoop configuration properties.
 
   @Parameter(property = "kite.hadoopConfiguration")
 
 
 
   private Configuration getConf() {
     Configuration conf = new Configuration(false);
     for (String key : .stringPropertyNames()) {
       String value = .getProperty(key);
       conf.set(keyvalue);
     }
     return conf;
   }
 
     DatasetRepository repo;
     if ( != null) {
       return DatasetRepositories.repositoryFor();
     }
     if (! &&  == null) {
       throw new IllegalArgumentException("Root directory must be specified if not " +
           "using HCatalog.");
    }
    if ( != null) {
      try {
        URI uri = new URI();
        if () {
          .rootDirectory(uri);
        } else {
          .rootDirectory(uri);
        }
      } catch (URISyntaxException e) {
        throw new IllegalArgumentException(e);
      }
    }
    if () {
      repo = .configuration(getConf()).build();
    } else {
      repo = .configuration(getConf()).build();
    }
    return repo;
  }
  void configureSchema(DatasetDescriptor.Builder descriptorBuilderString
      avroSchemaFileString avroSchemaReflectClassthrows MojoExecutionException {
    if (avroSchemaFile != null) {
      File avroSchema = new File(avroSchemaFile);
      try {
        if (avroSchema.exists()) {
          descriptorBuilder.schema(avroSchema);
        } else {
          descriptorBuilder.schema(Resources.getResource(avroSchemaFile).openStream());
        }
      } catch (IOException e) {
        throw new MojoExecutionException("Problem while reading file " + avroSchemaFilee);
      }
    } else if (avroSchemaReflectClass != null) {
      try {
        List<URLclasspath = new ArrayList<URL>();
        for (Object element : .getCompileClasspathElements()) {
          String path = (Stringelement;
          classpath.add(new File(path).toURI().toURL());
        }
        ClassLoader parentClassLoader = getClass().getClassLoader(); // use Maven's classloader, not the system one
        ClassLoader classLoader = new URLClassLoader(
            classpath.toArray(new URL[classpath.size()]), parentClassLoader);
        descriptorBuilder.schema(Class.forName(avroSchemaReflectClasstrueclassLoader));
      } catch (ClassNotFoundException e) {
        throw new MojoExecutionException("Problem finding class " +
            avroSchemaReflectClasse);
      } catch (MalformedURLException e) {
        throw new MojoExecutionException("Problem finding class " +
            avroSchemaReflectClasse);
      } catch (DependencyResolutionRequiredException e) {
        throw new MojoExecutionException("Problem finding class " +
            avroSchemaReflectClasse);
      }
    }
  }
New to GrepCode? Check out our FAQ X