Package com.impossibl.postgres.system
Class BasicContext
- java.lang.Object
-
- com.impossibl.postgres.system.AbstractContext
-
- com.impossibl.postgres.system.BasicContext
-
- All Implemented Interfaces:
Configuration,Context
- Direct Known Subclasses:
PGDirectConnection
public class BasicContext extends AbstractContext
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.charset.Charsetcharsetprotected Registryregistryprotected ServerConnectionserverConnectionprotected Settingssettingsprotected java.util.Map<java.lang.String,java.lang.Class<?>>typeMap
-
Constructor Summary
Constructors Constructor Description BasicContext(java.net.SocketAddress address, Settings settings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconnectionClosed()Called whenserverConnectionwas closed externally (i.e.protected voidconnectionNotificationReceived(int processId, java.lang.String channelName, java.lang.String payload)Called whenserverConnectionreceived an asynchronous notificationio.netty.buffer.ByteBufAllocatorgetAllocator()java.nio.charset.CharsetgetCharset()java.text.DecimalFormatgetCurrencyFormatter()java.util.Map<java.lang.String,java.lang.Class<?>>getCustomTypeMap()DateTimeFormatgetDateFormat()java.text.DecimalFormatgetDecimalFormatter()java.text.NumberFormatgetIntegerFormatter()ServerConnection.KeyDatagetKeyData()RegistrygetRegistry()RequestExecutorgetRequestExecutor()ServerInfogetServerInfo()<T> TgetSetting(Setting<T> setting)DateTimeFormatgetTimeFormat()DateTimeFormatgetTimestampFormat()java.util.TimeZonegetTimeZone()java.time.ZoneIdgetTimeZoneId()protected voidinit(SharedRegistry.Factory sharedRegistryFactory)booleanisUtilQueryPrepared(java.lang.String name)voidprepareUtilQuery(java.lang.String name, java.lang.String sql, java.lang.String... parameterTypeNames)voidquery(java.lang.String queryTxt, long timeout)protected ResultBatchqueryBatch(java.lang.String queryTxt, long timeout)Queries for a single (the first) result batch.protected ResultBatchqueryBatchPrepared(java.lang.String queryTxt, FieldFormatRef[] paramFormats, io.netty.buffer.ByteBuf[] paramBuffers, long timeout)Queries a single result batch (the first) via a parameterized query.ResultBatchqueryBatchPrepared(java.lang.String queryTxt, java.lang.Object[] paramValues, long timeout)Queries a single result batch (the first) via a parameterized query.protected java.lang.StringqueryString(java.lang.String queryTxt, long timeout)protected io.netty.channel.ChannelFutureshutdown()Contextunwrap()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.impossibl.postgres.system.Configuration
getSetting
-
-
-
-
Field Detail
-
registry
protected Registry registry
-
typeMap
protected java.util.Map<java.lang.String,java.lang.Class<?>> typeMap
-
charset
protected java.nio.charset.Charset charset
-
settings
protected Settings settings
-
serverConnection
protected ServerConnection serverConnection
-
-
Constructor Detail
-
BasicContext
public BasicContext(java.net.SocketAddress address, Settings settings) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
shutdown
protected io.netty.channel.ChannelFuture shutdown()
-
connectionClosed
protected void connectionClosed()
Called whenserverConnectionwas closed externally (i.e. without callingshutdown()
-
connectionNotificationReceived
protected void connectionNotificationReceived(int processId, java.lang.String channelName, java.lang.String payload)Called whenserverConnectionreceived an asynchronous notification
-
getAllocator
public io.netty.buffer.ByteBufAllocator getAllocator()
-
getRegistry
public Registry getRegistry()
-
getRequestExecutor
public RequestExecutor getRequestExecutor()
-
getSetting
public <T> T getSetting(Setting<T> setting)
- Specified by:
getSettingin interfaceConfiguration- Overrides:
getSettingin classAbstractContext
-
getCustomTypeMap
public java.util.Map<java.lang.String,java.lang.Class<?>> getCustomTypeMap()
-
getCharset
public java.nio.charset.Charset getCharset()
-
getTimeZone
public java.util.TimeZone getTimeZone()
-
getTimeZoneId
public java.time.ZoneId getTimeZoneId()
-
getServerInfo
public ServerInfo getServerInfo()
-
getKeyData
public ServerConnection.KeyData getKeyData()
-
getDateFormat
public DateTimeFormat getDateFormat()
-
getTimeFormat
public DateTimeFormat getTimeFormat()
-
getTimestampFormat
public DateTimeFormat getTimestampFormat()
-
getIntegerFormatter
public java.text.NumberFormat getIntegerFormatter()
-
getDecimalFormatter
public java.text.DecimalFormat getDecimalFormatter()
-
getCurrencyFormatter
public java.text.DecimalFormat getCurrencyFormatter()
-
init
protected void init(SharedRegistry.Factory sharedRegistryFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
isUtilQueryPrepared
public boolean isUtilQueryPrepared(java.lang.String name)
-
prepareUtilQuery
public void prepareUtilQuery(java.lang.String name, java.lang.String sql, java.lang.String... parameterTypeNames) throws java.io.IOException- Throws:
java.io.IOException
-
query
public void query(java.lang.String queryTxt, long timeout) throws java.io.IOException- Throws:
java.io.IOException
-
queryString
protected java.lang.String queryString(java.lang.String queryTxt, long timeout) throws java.io.IOException- Throws:
java.io.IOException
-
queryBatch
protected ResultBatch queryBatch(java.lang.String queryTxt, long timeout) throws java.io.IOException
Queries for a single (the first) result batch. The batch must be released.- Throws:
java.io.IOException
-
queryBatchPrepared
public ResultBatch queryBatchPrepared(java.lang.String queryTxt, java.lang.Object[] paramValues, long timeout) throws java.io.IOException
Queries a single result batch (the first) via a parameterized query. The batch must be released.- Throws:
java.io.IOException
-
queryBatchPrepared
protected ResultBatch queryBatchPrepared(java.lang.String queryTxt, FieldFormatRef[] paramFormats, io.netty.buffer.ByteBuf[] paramBuffers, long timeout) throws java.io.IOException
Queries a single result batch (the first) via a parameterized query. The batch must be released.- Throws:
java.io.IOException
-
unwrap
public Context unwrap()
-
-