java.lang.Object
org.postgresql.pljava.internal.Session
All Implemented Interfaces:
Session

public class Session extends Object implements Session
An instance of this interface reflects the current session. The attribute store is deprecated. It had interesting transactional behavior until PL/Java 1.2.0, but since then it has behaved as any (non-null-allowing) Map. Anyone needing any sort of attribute store with transactional behavior will need to implement one and use a TransactionListener to keep it sync'd.
Author:
Thomas Hallgren
  • Method Details

    • provider

      public static Session provider()
    • frozenSystemProperties

      public Properties frozenSystemProperties()
      Specified by:
      frozenSystemProperties in interface Session
    • implServerCharset

      public static Charset implServerCharset()
      A static method (not part of the API-exposed Session interface) by which pljava implementation classes can get hold of the server charset without the indirection of getting a Session instance. If there turns out to be demand for client code to obtain it through the API, an interface method serverCharset can easily be added later.
      Returns:
      The Java Charset corresponding to the server's encoding, or null if no matching Java charset was found. That can happen if a corresponding Java charset really does exist but is not successfully found using the name reported by PostgreSQL. That can be worked around by giving the right name explicitly as the system property org.postgresql.server.encoding in pljava.vmoptions for the affected database (or cluster-wide, if the same encoding is used).
    • addTransactionListener

      public void addTransactionListener(TransactionListener listener)
      Adds the specified listener to the list of listeners that will receive transactional events.
      Specified by:
      addTransactionListener in interface Session
    • addSavepointListener

      public void addSavepointListener(SavepointListener listener)
      Adds the specified listener to the list of listeners that will receive savepoint events.
      Specified by:
      addSavepointListener in interface Session
    • getAttribute

      @Deprecated(since="1.5.3", forRemoval=true) public Object getAttribute(String attributeName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Session's attribute store once had a special, and possibly useful, transactional behavior, but since PL/Java 1.2.0 it has lacked that, and offers nothing you don't get with an ordinary Map (that forbids nulls). If some kind of store with transactional behavior is needed, it should be implemented in straight Java and kept in sync by using a TransactionListener.
      Get an attribute from the session's attribute store.
      Specified by:
      getAttribute in interface Session
    • getObjectPool

      public <T extends PooledObject> ObjectPool<T> getObjectPool(Class<T> cls)
      Specified by:
      getObjectPool in interface Session
    • getUserName

      public String getUserName()
      Specified by:
      getUserName in interface Session
    • getOuterUserName

      public String getOuterUserName()
      Specified by:
      getOuterUserName in interface Session
    • getSessionUserName

      @Deprecated(since="1.5.0", forRemoval=true) public String getSessionUserName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getSessionUserName in interface Session
    • removeAttribute

      @Deprecated(since="1.5.3", forRemoval=true) public void removeAttribute(String attributeName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Session's attribute store once had a special, and possibly useful, transactional behavior, but since PL/Java 1.2.0 it has lacked that, and offers nothing you don't get with an ordinary Map (that forbids nulls). If some kind of store with transactional behavior is needed, it should be implemented in straight Java and kept in sync by using a TransactionListener.
      Remove an attribute from the session's attribute store.
      Specified by:
      removeAttribute in interface Session
    • setAttribute

      @Deprecated(since="1.5.3", forRemoval=true) public void setAttribute(String attributeName, Object value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Session's attribute store once had a special, and possibly useful, transactional behavior, but since PL/Java 1.2.0 it has lacked that, and offers nothing you don't get with an ordinary Map (that forbids nulls). If some kind of store with transactional behavior is needed, it should be implemented in straight Java and kept in sync by using a TransactionListener.
      Set an attribute in the session's attribute store.
      Specified by:
      setAttribute in interface Session
    • removeTransactionListener

      public void removeTransactionListener(TransactionListener listener)
      Removes the specified listener from the list of listeners that will receive transactional events.
      Specified by:
      removeTransactionListener in interface Session
    • removeSavepointListener

      public void removeSavepointListener(SavepointListener listener)
      Removes the specified listener from the list of listeners that will receive savepoint events.
      Specified by:
      removeSavepointListener in interface Session
    • executeAsSessionUser

      @Deprecated(since="1.5.0", forRemoval=true) public void executeAsSessionUser(Connection conn, String statement) throws SQLException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      executeAsSessionUser in interface Session
      Throws:
      SQLException
    • executeAsOuterUser

      public void executeAsOuterUser(Connection conn, String statement) throws SQLException
      Specified by:
      executeAsOuterUser in interface Session
      Throws:
      SQLException
    • getOuterUserSchema

      public Lexicals.Identifier.Simple getOuterUserSchema() throws SQLException
      Return current_schema() as the outer user would see it. Currently used only in Commands.java. Not made visible API yet because there has to be a more general way to do this.
      Throws:
      SQLException