openlsd.database.data
Class LSDDbIpPort

java.lang.Object
  extended by openlsd.database.data.LSDDbIpPort

public class LSDDbIpPort
extends java.lang.Object

Class for IpPort manipulation

Author:
Frederic Bregier LGPL

Field Summary
static java.lang.String allfields
          DB field for all fields in select command.
 boolean ccompression
          Is this service compressed from client part
 java.lang.String context
          The associated context
static int fadmin
          Type of client to use
static java.lang.String[] fields
          DB field names
static int fprotected
          Type of client to use
 int function
          The associated function
static int fuser
          Type of client to use
static int fusercomp
          Type of client to use
 long id
          Internal Id
 java.lang.String ip
          The IP address (or hostname in DNS)
 java.lang.String name
          The associated name
 java.lang.String password
          Associated password if any
 int port
          The associated port
 long rankGlobal
          Associated Global Rank (Multiple Legacies support)
static int rcontext
          DB field rank
static int rfunction
          DB field rank
static int rid
          DB field rank
static int rip
          DB field rank
static int rname
          DB field rank
static int rport
          DB field rank
 boolean scompression
          Is this service compressed from server part
static java.lang.String table
          information for DB manipulation: Table name
 
Constructor Summary
LSDDbIpPort()
          Create an empty IpPort
LSDDbIpPort(long id, java.lang.String ip, int port, int function, java.lang.String name, java.lang.String context)
          Create an IpPort from args
 
Method Summary
static boolean del(LSDDbAdmin admin, long idip)
          Del the IpPort object from the DB
protected static long findFirstIndex(LSDDbAdmin admin)
          Find first available IpPort id for this object.
 boolean get(LSDDbAdmin admin, long idip)
          Get the IpPort object from the DB
 boolean get(LSDDbAdmin admin, java.lang.String ip, int port, int function)
          Get the IpPort object from the DB
 boolean get(java.sql.ResultSet resultSet)
          Get Values from ResultSet
static java.util.ArrayList<LSDDbIpPort> getIpPort(LSDDbAdmin admin, int function)
          Get all IpPort for the given function for any Legacy
static java.util.ArrayList<LSDDbIpPort> getIpPort(LSDDbAdmin admin, int function, long legacy)
          Get all IpPort for the given function for the given Legacy
static java.util.ArrayList<LSDDbIpPort> newIpPort(LSDDbAdmin admin, java.util.ArrayList<LSDDbIpPort> listIpPort, java.lang.String IP, int Port, int function, java.lang.String name, java.lang.String context)
          Create a new IpPort from args and add it to the list.
 boolean set(LSDDbAdmin admin)
          Update (id >= 0) or Insert (Id < 0) data into DB from object
static java.lang.String setContextLSD(boolean servercomp, boolean clientcomp, java.lang.String password, long rank)
          Initialized a Context String from args for LSD Server
 java.lang.String toString()
          Object to String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public long id
Internal Id


ip

public java.lang.String ip
The IP address (or hostname in DNS)


port

public int port
The associated port


function

public int function
The associated function


name

public java.lang.String name
The associated name


context

public java.lang.String context
The associated context


scompression

public boolean scompression
Is this service compressed from server part


ccompression

public boolean ccompression
Is this service compressed from client part


password

public java.lang.String password
Associated password if any


rankGlobal

public long rankGlobal
Associated Global Rank (Multiple Legacies support)


table

public static final java.lang.String table
information for DB manipulation: Table name

See Also:
Constant Field Values

fields

public static final java.lang.String[] fields
DB field names


rid

public static final int rid
DB field rank

See Also:
Constant Field Values

rip

public static final int rip
DB field rank

See Also:
Constant Field Values

rport

public static final int rport
DB field rank

See Also:
Constant Field Values

rfunction

public static final int rfunction
DB field rank

See Also:
Constant Field Values

rname

public static final int rname
DB field rank

See Also:
Constant Field Values

rcontext

public static final int rcontext
DB field rank

See Also:
Constant Field Values

allfields

public static final java.lang.String allfields
DB field for all fields in select command.


fadmin

public static final int fadmin
Type of client to use

See Also:
Constant Field Values

fuser

public static final int fuser
Type of client to use

See Also:
Constant Field Values

fusercomp

public static final int fusercomp
Type of client to use

See Also:
Constant Field Values

fprotected

public static final int fprotected
Type of client to use

See Also:
Constant Field Values
Constructor Detail

LSDDbIpPort

public LSDDbIpPort()
Create an empty IpPort


LSDDbIpPort

public LSDDbIpPort(long id,
                   java.lang.String ip,
                   int port,
                   int function,
                   java.lang.String name,
                   java.lang.String context)
Create an IpPort from args

Parameters:
id -
ip -
port -
function -
name -
context -
Method Detail

setContextLSD

public static java.lang.String setContextLSD(boolean servercomp,
                                             boolean clientcomp,
                                             java.lang.String password,
                                             long rank)
Initialized a Context String from args for LSD Server

Parameters:
servercomp -
clientcomp -
password -
rank -
Returns:
the new context string

get

public boolean get(java.sql.ResultSet resultSet)
Get Values from ResultSet

Parameters:
resultSet -
Returns:
True if OK, else False

get

public boolean get(LSDDbAdmin admin,
                   long idip)
Get the IpPort object from the DB

Parameters:
admin -
idip -
Returns:
True if OK, else False

get

public boolean get(LSDDbAdmin admin,
                   java.lang.String ip,
                   int port,
                   int function)
Get the IpPort object from the DB

Parameters:
admin -
ip -
port -
function -
Returns:
True if OK, else False

set

public boolean set(LSDDbAdmin admin)
Update (id >= 0) or Insert (Id < 0) data into DB from object

Parameters:
admin -
Returns:
True if OK, else False

del

public static boolean del(LSDDbAdmin admin,
                          long idip)
Del the IpPort object from the DB

Parameters:
admin -
idip -
Returns:
True if OK, else False

newIpPort

public static java.util.ArrayList<LSDDbIpPort> newIpPort(LSDDbAdmin admin,
                                                         java.util.ArrayList<LSDDbIpPort> listIpPort,
                                                         java.lang.String IP,
                                                         int Port,
                                                         int function,
                                                         java.lang.String name,
                                                         java.lang.String context)
Create a new IpPort from args and add it to the list. If the list is null, it is created. The "id" is set from the one pick up from the database.

Parameters:
admin -
listIpPort -
IP -
Port -
function -
name -
context -
Returns:
the list with the new IpPort added or if an error occurs, no insertion is made to the list (if the list was not created, null is returned).

getIpPort

public static java.util.ArrayList<LSDDbIpPort> getIpPort(LSDDbAdmin admin,
                                                         int function,
                                                         long legacy)
Get all IpPort for the given function for the given Legacy

Parameters:
admin -
function -
legacy -
Returns:
ArrayList of IpPort

getIpPort

public static java.util.ArrayList<LSDDbIpPort> getIpPort(LSDDbAdmin admin,
                                                         int function)
Get all IpPort for the given function for any Legacy

Parameters:
admin -
function -
Returns:
ArrayList of IpPort

findFirstIndex

protected static long findFirstIndex(LSDDbAdmin admin)
Find first available IpPort id for this object. No update are made into the DB.

Parameters:
admin -
Returns:
The new index if found or LSDConstant.invalide_idx if not found.

toString

public java.lang.String toString()
Object to String

Overrides:
toString in class java.lang.Object
Returns:
the string that displays this object
See Also:
Object.toString()