py4j
Class Gateway

java.lang.Object
  extended by py4j.Gateway

public class Gateway
extends Object

A Gateway is manages various states: entryPoint, references to objects returned to a Python program, etc.

This class is not intended to be directly accessed by users.

Author:
Barthelemy Dagenais

Constructor Summary
Gateway(Object entryPoint)
           
Gateway(Object entryPoint, boolean cleanUpConnection)
           
 
Method Summary
 ReturnObject attachObject(String objectId)
           
 void closeConnection()
           Called when a connection is closed.
 void deleteObject(String objectId)
           
protected  AtomicInteger getArgCounter()
           
protected  Map<String,Object> getBindings()
           
 Object getEntryPoint()
           
 py4j.reflection.LRUCache<String,py4j.model.Py4JMember> getHelpPages()
           
 List<String> getMethodNames(Object obj)
           
 String getMethodNamesAsString(Object obj)
           
protected  String getNextObjectId()
           
protected  AtomicInteger getObjCounter()
           
 Object getObject(String objectId)
           
protected  Object getObjectFromId(String targetObjectId)
           
 py4j.reflection.ReflectionEngine getReflectionEngine()
           
 ReturnObject getReturnObject(Object object)
           
 ReturnObject invoke(String fqn, List<Argument> args)
           
 ReturnObject invoke(String methodName, String targetObjectId, List<Argument> args)
           
protected  boolean isList(Object object)
           
protected  boolean isMap(Object object)
           
protected  boolean isPrimitiveObject(Object object)
           
 boolean isStarted()
           
protected  String putNewObject(Object object)
           
 void setStarted(boolean isStarted)
           
 void shutdown()
           
 void startup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gateway

public Gateway(Object entryPoint)

Gateway

public Gateway(Object entryPoint,
               boolean cleanUpConnection)
Method Detail

attachObject

public ReturnObject attachObject(String objectId)

closeConnection

public void closeConnection()

Called when a connection is closed. Access ThreadLocal data to perform cleanup if necessary.

Because there is one thread per connection, ThreadLocal data belong to a single connection.


deleteObject

public void deleteObject(String objectId)

getArgCounter

protected AtomicInteger getArgCounter()

getBindings

protected Map<String,Object> getBindings()

getEntryPoint

public Object getEntryPoint()

getHelpPages

public py4j.reflection.LRUCache<String,py4j.model.Py4JMember> getHelpPages()

getMethodNames

public List<String> getMethodNames(Object obj)

getMethodNamesAsString

public String getMethodNamesAsString(Object obj)

getNextObjectId

protected String getNextObjectId()

getObjCounter

protected AtomicInteger getObjCounter()

getObject

public Object getObject(String objectId)
Parameters:
objectId -
Returns:
The object associated with the id or null if the object id is unknown.

getObjectFromId

protected Object getObjectFromId(String targetObjectId)

getReflectionEngine

public py4j.reflection.ReflectionEngine getReflectionEngine()

getReturnObject

public ReturnObject getReturnObject(Object object)

invoke

public ReturnObject invoke(String fqn,
                           List<Argument> args)

invoke

public ReturnObject invoke(String methodName,
                           String targetObjectId,
                           List<Argument> args)

isList

protected boolean isList(Object object)

isMap

protected boolean isMap(Object object)

isPrimitiveObject

protected boolean isPrimitiveObject(Object object)

isStarted

public boolean isStarted()

putNewObject

protected String putNewObject(Object object)

setStarted

public void setStarted(boolean isStarted)

shutdown

public void shutdown()

startup

public void startup()