co.cask.wrangler.api.Compiler Maven / Gradle / Ivy
/*
* Copyright © 2017 Cask Data, 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 co.cask.wrangler.api;
import co.cask.wrangler.api.annotations.PublicEvolving;
import org.apache.twill.filesystem.Location;
import java.nio.file.Path;
/**
* This Compiler
interface provides a way to implement your
* own version of compiler for directive or recipe.
*
* This interface contains methods that provides variants of the source
* from which the recipe are read. It support reading from string, HDFS location
* and Path
.
*
* Each of the methods would return CompileStatus
objects that
* contains the compiled directives in the form of Executor
or
* iterator of SyntaxError
in case of failure to compile.
*/
@PublicEvolving
public interface Compiler {
/**
* Compiles the recipe that is supplied in a String
format.
*
* @param recipe representing the String
form of recipe.
* @return CompileStatus
status of compilation.
*/
CompileStatus compile(String recipe) throws CompileException;
/**
* Compiles the recipe that is supplied in a Location
on HDFS.
*
* @param location Location to the recipe being compiled.
* @return CompileStatus
status of compilation.
*/
CompileStatus compile(Location location) throws CompileException;
/**
* Compiles the recipe that is supplied in a Path
on Filesystem.
*
* @param path Path
to the recipe being compiled.
* @return CompileStatus
status of compilation.
*/
CompileStatus compile(Path path) throws CompileException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy