public class DbHostAuth extends AbstractDbDataDao<Host>
Modifier and Type | Class and Description |
---|---|
static class |
DbHostAuth.Columns |
AbstractDbData.UpdatedInfo
Modifier and Type | Field and Description |
---|---|
static int[] |
dbTypes |
static String |
DEFAULT_CLIENT_ADDRESS |
static DbHostAuth.Columns[] |
indexes |
protected static String |
selectAllFields |
static String |
table |
JSON_MODEL, pojo, SHOULD_NOT_BE_CALLED
allFields, dbSession, isSaved, otherFields, primaryKey
Constructor and Description |
---|
DbHostAuth(com.fasterxml.jackson.databind.node.ObjectNode source) |
DbHostAuth(String hostid) |
DbHostAuth(String hostid,
String address,
int port,
boolean isSSL,
byte[] hostkey,
boolean adminrole,
boolean isClient) |
Modifier and Type | Method and Description |
---|---|
void |
changeUpdatedInfo(AbstractDbData.UpdatedInfo info)
Change UpdatedInfo status
|
protected void |
checkValues() |
static DbHostAuth[] |
deleteAll()
Delete all entries (used when purge and reload)
|
String |
getAddress() |
static DbHostAuth[] |
getAllHosts()
Get All DbHostAuth from database or from internal hashMap in case of no
database support
|
protected AbstractDAO<Host> |
getDao(boolean isCacheable) |
static DbPreparedStatement |
getFilterPrepareStament(DbSession session,
String host,
String addr) |
static DbPreparedStatement |
getFilterPrepareStament(DbSession session,
String host,
String addr,
boolean ssl,
boolean active) |
static DbHostAuth |
getFromStatement(DbPreparedStatement preparedStatement)
For instance from Commander when getting updated information
|
String |
getHostid() |
byte[] |
getHostkey() |
static String |
getJson(DbPreparedStatement preparedStatement,
int limit)
Write selected DbHostAuth to a Json String
|
String |
getJsonAsString() |
int |
getPort() |
protected String |
getPrimaryField() |
protected String |
getPrimaryKey() |
SocketAddress |
getSocketAddress() |
protected String |
getTable() |
static DbHostAuth[] |
getUpdatedPreparedStatement() |
static boolean |
hasProxifiedHosts() |
protected void |
initObject()
To setup primaryKey, otherFields, allFields.
|
boolean |
isActive() |
boolean |
isAdminrole() |
boolean |
isClient()
Test if the address is 0.0.0.0 for a client or isClient
|
boolean |
isKeyValid(byte[] newkey)
Is the given key a valid one
|
boolean |
isNoAddress()
True if the address is a client address (0.0.0.0) or if the port is < 0
|
boolean |
isProxified() |
boolean |
isSsl() |
void |
setActive(boolean isActive) |
void |
setFromJson(com.fasterxml.jackson.databind.node.ObjectNode node,
boolean ignorePrimaryKey)
Set the values from the Json node to the current object (no database
access)
|
protected void |
setFromJson(String field,
com.fasterxml.jackson.databind.JsonNode value) |
void |
setProxified(boolean isProxified) |
String |
toSpecializedHtml(R66Session session,
String body,
boolean crypted) |
String |
toString() |
asJson, delete, exist, getInsertAllValues, getJson, getSelectAllFields, getUpdateAllFields, getValues, getWherePrimaryKey, insert, select, setFromArray, setPrimaryKey, setToArray, toJson, update, validateLength, validateLength
getAllFields, getTrueValue, setTrueValue, setValues
public static final String DEFAULT_CLIENT_ADDRESS
public static final int[] dbTypes
public static final String table
protected static final String selectAllFields
public static final DbHostAuth.Columns[] indexes
public DbHostAuth(String hostid, String address, int port, boolean isSSL, byte[] hostkey, boolean adminrole, boolean isClient) throws WaarpDatabaseSqlException
hostid
- address
- port
- isSSL
- hostkey
- adminrole
- isClient
- WaarpDatabaseSqlException
public DbHostAuth(com.fasterxml.jackson.databind.node.ObjectNode source) throws WaarpDatabaseSqlException
WaarpDatabaseSqlException
public DbHostAuth(String hostid) throws WaarpDatabaseException
hostid
- WaarpDatabaseException
protected final void initObject()
AbstractDbData
initObject
in class AbstractDbDataDao<Host>
protected final String getTable()
getTable
in class AbstractDbDataDao<Host>
protected final AbstractDAO<Host> getDao(boolean isCacheable) throws DAOConnectionException
getDao
in class AbstractDbDataDao<Host>
DAOConnectionException
protected final String getPrimaryKey()
getPrimaryKey
in class AbstractDbDataDao<Host>
protected final String getPrimaryField()
getPrimaryField
in class AbstractDbDataDao<Host>
protected final void checkValues() throws WaarpDatabaseSqlException
checkValues
in class AbstractDbDataDao<Host>
WaarpDatabaseSqlException
public final void setFromJson(com.fasterxml.jackson.databind.node.ObjectNode node, boolean ignorePrimaryKey) throws WaarpDatabaseSqlException
AbstractDbDataDao
setFromJson
in class AbstractDbDataDao<Host>
ignorePrimaryKey
- True will ignore primaryKey from JsonWaarpDatabaseSqlException
protected final void setFromJson(String field, com.fasterxml.jackson.databind.JsonNode value)
setFromJson
in class AbstractDbDataDao<Host>
public static DbHostAuth[] deleteAll() throws WaarpDatabaseException
WaarpDatabaseException
public static DbHostAuth[] getAllHosts() throws WaarpDatabaseNoConnectionException
WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
public static DbHostAuth getFromStatement(DbPreparedStatement preparedStatement) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
preparedStatement
- WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
public static DbHostAuth[] getUpdatedPreparedStatement() throws WaarpDatabaseNoConnectionException
public static DbPreparedStatement getFilterPrepareStament(DbSession session, String host, String addr, boolean ssl, boolean active) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
session
- host
- addr
- ssl
- active
- WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
public static DbPreparedStatement getFilterPrepareStament(DbSession session, String host, String addr) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
session
- host
- addr
- WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
public final void changeUpdatedInfo(AbstractDbData.UpdatedInfo info)
AbstractDbDataDao
changeUpdatedInfo
in class AbstractDbDataDao<Host>
public final boolean isActive()
public final void setActive(boolean isActive)
isActive
- the isActive to setpublic final boolean isProxified()
public final void setProxified(boolean isProxified)
isProxified
- the isProxified to setpublic final boolean isKeyValid(byte[] newkey)
newkey
- public final byte[] getHostkey()
public final boolean isAdminrole()
public final boolean isClient()
public final boolean isNoAddress()
public final SocketAddress getSocketAddress() throws IllegalArgumentException
IllegalArgumentException
- when the address is for a Client
and
therefore cannot be checkedpublic final boolean isSsl()
public final String getHostid()
public final String getAddress()
public final int getPort()
public static String getJson(DbPreparedStatement preparedStatement, int limit) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException
preparedStatement
- WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
public final String getJsonAsString()
public final String toSpecializedHtml(R66Session session, String body, boolean crypted)
session
- body
- crypted
- True if the Key is kept crypted, False it will be
in
clear formpublic static boolean hasProxifiedHosts()
Copyright © 2009–2022 Waarp. All rights reserved.