Search in sources :

Example 16 with ResourceSet

use of org.apache.zeppelin.resource.ResourceSet in project SSM by Intel-bigdata.

the class ApplicationLoader method findRequiredResourceSet.

static ResourceSet findRequiredResourceSet(String[][] requiredResources, String noteId, String paragraphId, ResourceSet resources) {
    ResourceSet args = new ResourceSet();
    if (requiredResources == null || requiredResources.length == 0) {
        return args;
    }
    resources = resources.filterByNoteId(noteId).filterByParagraphId(paragraphId);
    for (String[] requires : requiredResources) {
        args.clear();
        for (String require : requires) {
            boolean found = false;
            for (Resource r : resources) {
                if (require.startsWith(":") && r.getClassName().equals(require.substring(1))) {
                    found = true;
                } else if (r.getResourceId().getName().equals(require)) {
                    found = true;
                }
                if (found) {
                    args.add(r);
                    break;
                }
            }
            if (found == false) {
                break;
            }
        }
        if (args.size() == requires.length) {
            return args;
        }
    }
    return null;
}
Also used : Resource(org.apache.zeppelin.resource.Resource) ResourceSet(org.apache.zeppelin.resource.ResourceSet)

Aggregations

ResourceSet (org.apache.zeppelin.resource.ResourceSet)16 LinkedList (java.util.LinkedList)7 Resource (org.apache.zeppelin.resource.Resource)6 Gson (com.google.gson.Gson)5 List (java.util.List)5 ResourcePool (org.apache.zeppelin.resource.ResourcePool)5 TException (org.apache.thrift.TException)4 Client (org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client)4 TypeToken (com.google.gson.reflect.TypeToken)3 IOException (java.io.IOException)3 URLClassLoader (java.net.URLClassLoader)3 Map (java.util.Map)3 AngularObjectRegistry (org.apache.zeppelin.display.AngularObjectRegistry)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 AngularObject (org.apache.zeppelin.display.AngularObject)2 InterpreterContextRunner (org.apache.zeppelin.interpreter.InterpreterContextRunner)2 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)2 RemoteZeppelinServerResource (org.apache.zeppelin.interpreter.RemoteZeppelinServerResource)2 RemoteInterpreterEvent (org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEvent)2 RemoteInterpreterEventType (org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType)2