Search in sources :

Example 6 with Resource

use of org.apache.zeppelin.resource.Resource in project zeppelin by apache.

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)

Example 7 with Resource

use of org.apache.zeppelin.resource.Resource in project zeppelin by apache.

the class TableDataProxy method rows.

@Override
public Iterator<Row> rows() {
    String resourceName = resource.getResourceId().getName() + ".rows";
    Resource rows = resource.invokeMethod("rows", null, null, resourceName);
    ProxyRowIterator it = new ProxyRowIterator(rows);
    return it;
}
Also used : Resource(org.apache.zeppelin.resource.Resource)

Aggregations

Resource (org.apache.zeppelin.resource.Resource)7 ResourcePool (org.apache.zeppelin.resource.ResourcePool)4 Gson (com.google.gson.Gson)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 TException (org.apache.thrift.TException)2 ZeppelinApi (org.apache.zeppelin.annotation.ZeppelinApi)2 RemoteZeppelinServerResource (org.apache.zeppelin.interpreter.RemoteZeppelinServerResource)2 Client (org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService.Client)2 ByteBuffer (java.nio.ByteBuffer)1 LinkedList (java.util.LinkedList)1 AngularObject (org.apache.zeppelin.display.AngularObject)1 InterpreterGroup (org.apache.zeppelin.interpreter.InterpreterGroup)1 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)1 ResourceId (org.apache.zeppelin.resource.ResourceId)1 ResourceSet (org.apache.zeppelin.resource.ResourceSet)1