Search in sources :

Example 41 with ZeppelinApi

use of org.apache.zeppelin.annotation.ZeppelinApi in project zeppelin by apache.

the class ZeppelinContext method remove.

/**
   * Remove object from resourcePool
   * @param name
   */
@ZeppelinApi
public void remove(String name) {
    ResourcePool resourcePool = interpreterContext.getResourcePool();
    resourcePool.remove(name);
}
Also used : ResourcePool(org.apache.zeppelin.resource.ResourcePool) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 42 with ZeppelinApi

use of org.apache.zeppelin.annotation.ZeppelinApi in project zeppelin by apache.

the class ZeppelinContext method put.

/**
   * Add object into resource pool
   * @param name
   * @param value
   */
@ZeppelinApi
public void put(String name, Object value) {
    ResourcePool resourcePool = interpreterContext.getResourcePool();
    resourcePool.put(name, value);
}
Also used : ResourcePool(org.apache.zeppelin.resource.ResourcePool) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 43 with ZeppelinApi

use of org.apache.zeppelin.annotation.ZeppelinApi in project zeppelin by apache.

the class ZeppelinContext method get.

/**
   * Get object from resource pool
   * Search local process first and then the other processes
   * @param name
   * @return null if resource not found
   */
@ZeppelinApi
public Object get(String name) {
    ResourcePool resourcePool = interpreterContext.getResourcePool();
    Resource resource = resourcePool.get(name);
    if (resource != null) {
        return resource.get();
    } else {
        return null;
    }
}
Also used : Resource(org.apache.zeppelin.resource.Resource) ResourcePool(org.apache.zeppelin.resource.ResourcePool) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 44 with ZeppelinApi

use of org.apache.zeppelin.annotation.ZeppelinApi in project zeppelin by apache.

the class Interpreter method getProperty.

@ZeppelinApi
public Properties getProperty() {
    Properties p = new Properties();
    p.putAll(property);
    RegisteredInterpreter registeredInterpreter = Interpreter.findRegisteredInterpreterByClassName(getClassName());
    if (null != registeredInterpreter) {
        Map<String, InterpreterProperty> defaultProperties = registeredInterpreter.getProperties();
        for (String k : defaultProperties.keySet()) {
            if (!p.containsKey(k)) {
                String value = defaultProperties.get(k).getValue();
                if (value != null) {
                    p.put(k, defaultProperties.get(k).getValue());
                }
            }
        }
    }
    return p;
}
Also used : Properties(java.util.Properties) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Example 45 with ZeppelinApi

use of org.apache.zeppelin.annotation.ZeppelinApi in project zeppelin by apache.

the class ZeppelinContext method getInterpreterContextRunner.

/**
   * get Zeppelin Paragraph Runner from zeppelin server
   * @param noteId
   * @param paragraphId
   */
@ZeppelinApi
public List<InterpreterContextRunner> getInterpreterContextRunner(String noteId, String paragraphId, InterpreterContext interpreterContext) {
    List<InterpreterContextRunner> runners = new LinkedList<>();
    RemoteWorksController remoteWorksController = interpreterContext.getRemoteWorksController();
    if (remoteWorksController != null) {
        runners = remoteWorksController.getRemoteContextRunner(noteId, paragraphId);
    }
    return runners;
}
Also used : InterpreterContextRunner(org.apache.zeppelin.interpreter.InterpreterContextRunner) RemoteWorksController(org.apache.zeppelin.interpreter.RemoteWorksController) LinkedList(java.util.LinkedList) ZeppelinApi(org.apache.zeppelin.annotation.ZeppelinApi)

Aggregations

ZeppelinApi (org.apache.zeppelin.annotation.ZeppelinApi)45 Path (javax.ws.rs.Path)35 Note (org.apache.zeppelin.notebook.Note)22 AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)16 JsonResponse (org.apache.zeppelin.server.JsonResponse)15 GET (javax.ws.rs.GET)13 POST (javax.ws.rs.POST)13 Paragraph (org.apache.zeppelin.notebook.Paragraph)11 DELETE (javax.ws.rs.DELETE)6 PUT (javax.ws.rs.PUT)6 InterpreterException (org.apache.zeppelin.interpreter.InterpreterException)5 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 ResourcePool (org.apache.zeppelin.resource.ResourcePool)4 Map (java.util.Map)3 ZeppelinConfiguration (org.apache.zeppelin.conf.ZeppelinConfiguration)3 InterpreterSetting (org.apache.zeppelin.interpreter.InterpreterSetting)3 Properties (java.util.Properties)2 Subject (org.apache.shiro.subject.Subject)2 NotebookRepoWithSettings (org.apache.zeppelin.notebook.repo.NotebookRepoWithSettings)2