public class ListenerInterface extends java.lang.Object implements ImmutableListenerInterface, IXMLEncodable
Modifier and Type | Class and Description |
---|---|
static interface |
ListenerInterface.IListenerInterfaceGetter |
Modifier and Type | Field and Description |
---|---|
private boolean |
m_bHidden |
private boolean |
m_bUseInterface
This describes, whether we can reach this interface or not.
|
private boolean |
m_bVirtual |
private long |
m_endOfBlocking |
private int |
m_iInetPort
This is the representation of the port of the ListenerInterface.
|
private int |
m_iProtocolType
This describes the protocol type.
|
private java.lang.String |
m_strHostname
This is the host of this interface (hostname or IP).
|
static int |
PORT_MAX_VALUE |
static int |
PORT_MIN_VALUE |
static java.lang.String |
XML_ATTR_HIDDEN |
static java.lang.String |
XML_ATTR_VIRTUAL |
static java.lang.String |
XML_ELEM_FILE |
static java.lang.String |
XML_ELEM_HOST |
static java.lang.String |
XML_ELEM_PORT |
static java.lang.String |
XML_ELEMENT_CONTAINER_NAME |
static java.lang.String |
XML_ELEMENT_NAME |
PROTOCOL_STR_TYPE_HTTP, PROTOCOL_STR_TYPE_HTTPS, PROTOCOL_STR_TYPE_RAW_TCP, PROTOCOL_STR_TYPE_RAW_UDP, PROTOCOL_STR_TYPE_RAW_UNIX, PROTOCOL_STR_TYPE_SOCKS, PROTOCOL_STR_TYPE_UNKNOWN, PROTOCOL_TYPE_FTP, PROTOCOL_TYPE_HTTP, PROTOCOL_TYPE_HTTPS, PROTOCOL_TYPE_RAW_TCP, PROTOCOL_TYPE_RAW_UDP, PROTOCOL_TYPE_RAW_UNIX, PROTOCOL_TYPE_SOCKS, PROTOCOL_TYPE_UNKNOWN
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Constructor and Description |
---|
ListenerInterface(org.w3c.dom.Element listenerInterfaceNode)
Creates a new ListenerInterface from XML description (ListenerInterface node).
|
ListenerInterface(java.lang.String a_strValue)
Creates a new ListenerInterface from a String which is of the form
hostname:port.
|
ListenerInterface(java.lang.String a_hostname,
int a_port)
Creates a new ListenerInterface from a hostname / IP address and a port.
|
ListenerInterface(java.lang.String a_hostname,
int a_port,
int a_protocol)
Creates a new ListenerInterface from a hostname / IP address, a port and a protocol
information.
|
Modifier and Type | Method and Description |
---|---|
void |
blockInterface(long a_blockingTime)
Blocks this interface for a specified time.
|
static void |
blockInterfacesFromDatabase(ListenerInterface.IListenerInterfaceGetter a_listenerInterfaceGetter) |
private boolean |
equals(ListenerInterface a_listenerInterface)
Tests if two ListenerInterface instances are equal.
|
boolean |
equals(java.lang.Object a_listenerInterface) |
long |
getBlockingTimeRemaining() |
java.lang.String |
getHost()
Get the host (hostname or IP) of this interface as a String.
|
java.lang.String |
getId() |
int |
getPort()
Get the port of this interface.
|
int |
getProtocol()
Gets the protocol of this ListenerInterface.
|
java.lang.String |
getProtocolAsString()
Gets the protocol of this ListenerInterface as String.
|
int |
hashCode() |
static boolean |
isBlockingRecommended(java.lang.Throwable a_e) |
boolean |
isHidden() |
boolean |
isValid()
Get the validity of this interface.
|
static boolean |
isValidHostname(java.lang.String a_hostname)
Returns if the given host name is valid.
|
static boolean |
isValidIP(java.lang.String a_ipAddress)
Returns if the given IP address is valid.
|
static boolean |
isValidPort(int a_port)
Returns if the given port is valid.
|
static boolean |
isValidProtocol(int a_protocol)
Returns if the given protocol is valid web protocol and can be recognized by
recognizeProtocol().
|
static boolean |
isValidProtocol(java.lang.String a_protocol)
Returns if the given protocol is valid web protocol and can be recognized by
recognizeProtocol().
|
boolean |
isVirtual() |
static ListenerInterface |
parseHostnamePort(java.lang.String a_hostNamePort) |
static ListenerInterface |
parseHostnamePort(java.lang.String a_hostNamePort,
int a_protocol) |
protected static int |
recognizeProtocol(int a_protocol)
Transforms a given protocol number into a valid protocol if recognized.
|
protected static int |
recognizeProtocol(java.lang.String a_protocol)
Transforms a given protocol string into a valid protocol if recognized.
|
void |
setHostname(java.lang.String a_strHostname)
Sets the host name.
|
void |
setPort(int a_port)
Sets the port number.
|
void |
setProtocol(int a_protocol)
Sets the protocol.
|
void |
setProtocol(java.lang.String a_protocol)
Sets the protocol.
|
void |
setUseInterface(boolean a_bUseInterface)
Sets if this interface is used or not.
|
java.lang.String |
toString() |
java.util.Vector |
toVector()
Creates a Vector of listeners with only the current listener.
|
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Creates an XML node without signature for this ListenerInterface..
|
protected org.w3c.dom.Element |
toXmlElementInternal(org.w3c.dom.Document doc,
java.lang.String a_strXmlElementName)
Creates an XML node without signature for this ListenerInterface.
|
static void |
unblockInterfacesFromDatabase(java.lang.Class a_classIListenerInterfaceGetter) |
public static final int PORT_MIN_VALUE
public static final int PORT_MAX_VALUE
public static final java.lang.String XML_ELEMENT_NAME
public static final java.lang.String XML_ELEMENT_CONTAINER_NAME
public static final java.lang.String XML_ATTR_HIDDEN
public static final java.lang.String XML_ATTR_VIRTUAL
public static final java.lang.String XML_ELEM_HOST
public static final java.lang.String XML_ELEM_PORT
public static final java.lang.String XML_ELEM_FILE
private long m_endOfBlocking
private java.lang.String m_strHostname
private int m_iInetPort
private int m_iProtocolType
private boolean m_bUseInterface
private boolean m_bVirtual
private boolean m_bHidden
public ListenerInterface(org.w3c.dom.Element listenerInterfaceNode) throws XMLParseException
listenerInterfaceNode
- The ListenerInterface node from an XML document.XMLParseException
- if an error in the xml structure occurspublic ListenerInterface(java.lang.String a_hostname, int a_port) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface (1 <= port <= 65535).java.lang.IllegalArgumentException
- if an illegal host name or port was givenpublic ListenerInterface(java.lang.String a_strValue) throws java.lang.IllegalArgumentException
a_strValue
- The string containing hostname and port.java.lang.IllegalArgumentException
- if an illegal host name or port was givenpublic ListenerInterface(java.lang.String a_hostname, int a_port, int a_protocol) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface (1 <= port <= 65535).a_protocol
- The protocol information. Invalid protocols are replaced by http.java.lang.IllegalArgumentException
- if an illegal host name, port or protocol was givenpublic static boolean isValidPort(int a_port)
a_port
- a port numberpublic static boolean isValidProtocol(java.lang.String a_protocol)
a_protocol
- a web protocolrecognizeProtocol(String)
public static boolean isValidProtocol(int a_protocol)
a_protocol
- a web protocolrecognizeProtocol(String)
public static boolean isValidHostname(java.lang.String a_hostname)
a_hostname
- a host namepublic static boolean isValidIP(java.lang.String a_ipAddress)
a_ipAddress
- an IP addresspublic int getProtocol()
getProtocol
in interface ImmutableListenerInterface
public java.lang.String getProtocolAsString()
public java.lang.String getHost()
getHost
in interface ImmutableListenerInterface
public int getPort()
getPort
in interface ImmutableListenerInterface
public java.lang.String getId()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object a_listenerInterface)
equals
in class java.lang.Object
private boolean equals(ListenerInterface a_listenerInterface)
a_listenerInterface
- a ListenerInterfacepublic org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
a_doc
- The XML document, which is the environment for the created XML node.public void setUseInterface(boolean a_bUseInterface)
a_bUseInterface
- true if this interface is used; false otherwisepublic static boolean isBlockingRecommended(java.lang.Throwable a_e)
public long getBlockingTimeRemaining()
public void blockInterface(long a_blockingTime)
a_blockingTime
- longpublic boolean isValid()
isValid
in interface ImmutableListenerInterface
public boolean isVirtual()
public boolean isHidden()
protected static int recognizeProtocol(java.lang.String a_protocol)
a_protocol
- a protocol stringprotected static int recognizeProtocol(int a_protocol)
a_protocol
- a protocol numberpublic void setProtocol(java.lang.String a_protocol)
a_protocol
- a protocolpublic void setProtocol(int a_protocol)
a_protocol
- a protocolpublic void setPort(int a_port)
a_port
- a port numberpublic void setHostname(java.lang.String a_strHostname)
a_strHostname
- a host name
TODO This method seems to be buggy!public java.util.Vector toVector()
protected org.w3c.dom.Element toXmlElementInternal(org.w3c.dom.Document doc, java.lang.String a_strXmlElementName)
doc
- The XML document, which is the environment for the created XML node.a_strXmlElementName
- the name of the xml element to createpublic java.lang.String toString()
toString
in class java.lang.Object
public static void unblockInterfacesFromDatabase(java.lang.Class a_classIListenerInterfaceGetter)
public static void blockInterfacesFromDatabase(ListenerInterface.IListenerInterfaceGetter a_listenerInterfaceGetter)
public static ListenerInterface parseHostnamePort(java.lang.String a_hostNamePort) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException
java.lang.IllegalArgumentException
java.lang.NumberFormatException
public static ListenerInterface parseHostnamePort(java.lang.String a_hostNamePort, int a_protocol) throws java.lang.IllegalArgumentException, java.lang.NumberFormatException
java.lang.IllegalArgumentException
java.lang.NumberFormatException
Copyright © 2023. All rights reserved.