Remove unused methods and add deprecated message for dep interpreter

This commit is contained in:
Mina Lee 2016-01-19 21:27:39 -08:00
parent 2cd715c487
commit 37005c5a80
2 changed files with 9 additions and 121 deletions

View file

@ -74,127 +74,6 @@ public class ZeppelinContext extends HashMap<String, Object> {
public HiveContext hiveContext;
private GUI gui;
/**
* Load dependency for interpreter and runtime (driver).
* And distribute them to spark cluster (sc.add())
*
* @param artifact "group:artifact:version" or file path like "/somepath/your.jar"
* @return
* @throws Exception
*/
public Iterable<String> load(String artifact) throws Exception {
return collectionAsScalaIterable(dep.load(artifact, true));
}
/**
* Load dependency and it's transitive dependencies for interpreter and runtime (driver).
* And distribute them to spark cluster (sc.add())
*
* @param artifact "groupId:artifactId:version" or file path like "/somepath/your.jar"
* @param excludes exclusion list of transitive dependency. list of "groupId:artifactId" string.
* @return
* @throws Exception
*/
public Iterable<String> load(String artifact, scala.collection.Iterable<String> excludes)
throws Exception {
return collectionAsScalaIterable(
dep.load(artifact,
asJavaCollection(excludes),
true));
}
/**
* Load dependency and it's transitive dependencies for interpreter and runtime (driver).
* And distribute them to spark cluster (sc.add())
*
* @param artifact "groupId:artifactId:version" or file path like "/somepath/your.jar"
* @param excludes exclusion list of transitive dependency. list of "groupId:artifactId" string.
* @return
* @throws Exception
*/
public Iterable<String> load(String artifact, Collection<String> excludes) throws Exception {
return collectionAsScalaIterable(dep.load(artifact, excludes, true));
}
/**
* Load dependency for interpreter and runtime, and then add to sparkContext.
* But not adding them to spark cluster
*
* @param artifact "groupId:artifactId:version" or file path like "/somepath/your.jar"
* @return
* @throws Exception
*/
public Iterable<String> loadLocal(String artifact) throws Exception {
return collectionAsScalaIterable(dep.load(artifact, false));
}
/**
* Load dependency and it's transitive dependencies and then add to sparkContext.
* But not adding them to spark cluster
*
* @param artifact "groupId:artifactId:version" or file path like "/somepath/your.jar"
* @param excludes exclusion list of transitive dependency. list of "groupId:artifactId" string.
* @return
* @throws Exception
*/
public Iterable<String> loadLocal(String artifact,
scala.collection.Iterable<String> excludes) throws Exception {
return collectionAsScalaIterable(dep.load(artifact,
asJavaCollection(excludes), false));
}
/**
* Load dependency and it's transitive dependencies and then add to sparkContext.
* But not adding them to spark cluster
*
* @param artifact "groupId:artifactId:version" or file path like "/somepath/your.jar"
* @param excludes exclusion list of transitive dependency. list of "groupId:artifactId" string.
* @return
* @throws Exception
*/
public Iterable<String> loadLocal(String artifact, Collection<String> excludes)
throws Exception {
return collectionAsScalaIterable(dep.load(artifact, excludes, false));
}
/**
* Add maven repository
*
* @param id id of repository ex) oss, local, snapshot
* @param url url of repository. supported protocol : file, http, https
*/
public void addRepo(String id, String url) {
addRepo(id, url, false);
}
/**
* Add maven repository
*
* @param id id of repository
* @param url url of repository. supported protocol : file, http, https
* @param snapshot true if it is snapshot repository
*/
public void addRepo(String id, String url, boolean snapshot) {
dep.addRepo(id, url, snapshot);
}
/**
* Remove maven repository by id
* @param id id of repository
*/
public void removeRepo(String id){
dep.delRepo(id);
}
/**
* Load dependency only interpreter.
*
* @param name
* @return
*/
public Object input(String name) {
return input(name, "");
}

View file

@ -42,10 +42,13 @@ import org.sonatype.aether.util.artifact.JavaScopes;
import org.sonatype.aether.util.filter.DependencyFilterUtils;
import org.sonatype.aether.util.filter.PatternExclusionsDependencyFilter;
import scala.Console;
/**
*
*/
@Deprecated
public class SparkDependencyContext {
List<Dependency> dependencies = new LinkedList<Dependency>();
List<Repository> repositories = new LinkedList<Repository>();
@ -64,6 +67,8 @@ public class SparkDependencyContext {
}
public Dependency load(String lib) {
Console.println("DepInterpreter(%dep) deprecated. "
+ "Load dependency through GUI interpreter menu instead.");
Dependency dep = new Dependency(lib);
if (dependencies.contains(dep)) {
@ -74,12 +79,16 @@ public class SparkDependencyContext {
}
public Repository addRepo(String name) {
Console.println("DepInterpreter(%dep) deprecated. "
+ "Add repository through GUI interpreter menu instead.");
Repository rep = new Repository(name);
repositories.add(rep);
return rep;
}
public void reset() {
Console.println("DepInterpreter(%dep) deprecated. "
+ "Remove dependencies and repositories through GUI interpreter menu instead.");
dependencies = new LinkedList<Dependency>();
repositories = new LinkedList<Repository>();