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 |
protected static String |
insertAllValues |
static int |
NBPRKEY |
protected static String |
selectAllFields |
static String |
table |
protected static String |
updateAllFields |
JSON_MODEL, pojo
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
|
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() |
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
get, getAllFields, getTrueValue, getValue, setTrueValue, setValue, setValues
public static final String DEFAULT_CLIENT_ADDRESS
public static final int[] dbTypes
public static final String table
public static final int NBPRKEY
protected static final String selectAllFields
protected static final String updateAllFields
protected static final String insertAllValues
public DbHostAuth(String hostid, String address, int port, boolean isSSL, byte[] hostkey, boolean adminrole, boolean isClient)
hostid
- address
- port
- isSSL
- hostkey
- adminrole
- isClient
- public DbHostAuth(com.fasterxml.jackson.databind.node.ObjectNode source) throws WaarpDatabaseSqlException
WaarpDatabaseSqlException
public DbHostAuth(String hostid) throws WaarpDatabaseException
hostid
- WaarpDatabaseException
protected void initObject()
AbstractDbData
initObject
in class AbstractDbDataDao<Host>
protected String getTable()
getTable
in class AbstractDbDataDao<Host>
protected AbstractDAO<Host> getDao() throws DAOConnectionException
getDao
in class AbstractDbDataDao<Host>
DAOConnectionException
protected String getPrimaryKey()
getPrimaryKey
in class AbstractDbDataDao<Host>
protected String getPrimaryField()
getPrimaryField
in class AbstractDbDataDao<Host>
public 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
public static DbHostAuth[] deleteAll() throws WaarpDatabaseException
WaarpDatabaseException
protected void setFromJson(String field, com.fasterxml.jackson.databind.JsonNode value)
setFromJson
in class AbstractDbDataDao<Host>
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 void changeUpdatedInfo(AbstractDbData.UpdatedInfo info)
AbstractDbDataDao
changeUpdatedInfo
in class AbstractDbDataDao<Host>
public boolean isActive()
public void setActive(boolean isActive)
isActive
- the isActive to setpublic boolean isProxified()
public void setProxified(boolean isProxified)
isProxified
- the isProxified to setpublic boolean isKeyValid(byte[] newkey)
newkey
- public byte[] getHostkey()
public boolean isAdminrole()
public boolean isClient()
public boolean isNoAddress()
public SocketAddress getSocketAddress() throws IllegalArgumentException
IllegalArgumentException
- when the address is for a Client
and
therefore cannot be checkedpublic boolean isSsl()
public String getHostid()
public String getAddress()
public int getPort()
public static String getJson(DbPreparedStatement preparedStatement, int limit) throws WaarpDatabaseNoConnectionException, WaarpDatabaseSqlException, OpenR66ProtocolBusinessException
preparedStatement
- WaarpDatabaseNoConnectionException
WaarpDatabaseSqlException
OpenR66ProtocolBusinessException
public String getJsonAsString()
public 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–2020 Waarp. All rights reserved.