|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.networkupstools.jnut.Scanner
public class Scanner
jNut scanner. Wrap calls to nut-scanner in java. Just, instantiate it, set options and nut-scanner path, then scan.
Scanner scanner = new Scanner(); scanner.setExecName("/usr/local/ups/bin/nut-scanner"); scanner.setExecPath("/usr/local/ups/bin"); scanner.setParam(Scanner.OPTION_MASK_CIDR, "192.168.1.1/24"); Scanner.DiscoveredDevice[] devs = scanner.scan();
Nested Class Summary | |
---|---|
static class |
Scanner.DiscoveredDevice
Result of a scan. |
Field Summary | |
---|---|
static java.lang.String |
OPTION_END_IP
|
static java.lang.String |
OPTION_MASK_CIDR
|
static java.lang.String |
OPTION_NUT_UPSD_PORT
|
static java.lang.String |
OPTION_SCANNER_EXEC
|
static java.lang.String |
OPTION_SCANNER_PATH
|
static java.lang.String |
OPTION_SNMPv1_COMMUNITY
|
static java.lang.String |
OPTION_SNMPv3_AUTHENTICATION_PASSWORD
|
static java.lang.String |
OPTION_SNMPv3_AUTHENTICATION_PROTOCOL
|
static java.lang.String |
OPTION_SNMPv3_PRIVACY_PASSWORD
|
static java.lang.String |
OPTION_SNMPv3_PRIVACY_PROTOCOL
|
static java.lang.String |
OPTION_SNMPv3_SECURITY_LEVEL
|
static java.lang.String |
OPTION_SNMPv3_SECURITY_NAME
|
static java.lang.String |
OPTION_START_IP
|
static java.lang.String |
OPTION_TIMEOUT
|
static int |
SCAN_AVAHI
|
static int |
SCAN_COMPLETE
|
static int |
SCAN_IPMI
|
static int |
SCAN_OLDNUT
|
static int |
SCAN_SNMP
|
static int |
SCAN_USB
|
static int |
SCAN_XML
|
Constructor Summary | |
---|---|
Scanner()
Default constructor (scan for all device types). |
|
Scanner(int scanType)
Constructor with device types. |
|
Scanner(int scanType,
java.util.Map config)
Constructor with device types and scan parameters. |
Method Summary | |
---|---|
java.util.Map |
getConfig()
Retrieve scanner extra parameters like snmp community name or passwords. |
java.lang.String |
getExecName()
Retrieve nut-scanner executable name (with location if any). |
java.lang.String |
getExecPath()
Retrieve nut-scanner executable path. |
java.lang.String |
getParam(java.lang.String name)
Retrieve a scanner extra parameter. |
int |
getScanType()
Retrieve the scan type. |
boolean |
hasParam(java.lang.String name)
Test if a scanner has an extra parameter. |
void |
removeParam(java.lang.String name)
Remove a scanner extra parameter. |
Scanner.DiscoveredDevice[] |
scan()
Execute the scan. |
void |
setConfig(java.util.Map config)
Set the scanner extra parameters. |
void |
setExecName(java.lang.String value)
Set nut-scanner executable name (with location if any). |
void |
setExecPath(java.lang.String value)
Set nut-scanner executable path. |
void |
setParam(java.lang.String name,
java.lang.String value)
Set a scanner extra parameter. |
void |
setScanType(int scanType)
Set the scan type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SCAN_USB
public static final int SCAN_SNMP
public static final int SCAN_XML
public static final int SCAN_OLDNUT
public static final int SCAN_AVAHI
public static final int SCAN_IPMI
public static final int SCAN_COMPLETE
public static final java.lang.String OPTION_SCANNER_EXEC
public static final java.lang.String OPTION_SCANNER_PATH
public static final java.lang.String OPTION_TIMEOUT
public static final java.lang.String OPTION_START_IP
public static final java.lang.String OPTION_END_IP
public static final java.lang.String OPTION_MASK_CIDR
public static final java.lang.String OPTION_SNMPv1_COMMUNITY
public static final java.lang.String OPTION_SNMPv3_SECURITY_LEVEL
public static final java.lang.String OPTION_SNMPv3_SECURITY_NAME
public static final java.lang.String OPTION_SNMPv3_AUTHENTICATION_PROTOCOL
public static final java.lang.String OPTION_SNMPv3_AUTHENTICATION_PASSWORD
public static final java.lang.String OPTION_SNMPv3_PRIVACY_PROTOCOL
public static final java.lang.String OPTION_SNMPv3_PRIVACY_PASSWORD
public static final java.lang.String OPTION_NUT_UPSD_PORT
Constructor Detail |
---|
public Scanner()
public Scanner(int scanType)
scanType
- Type of scan, union of SCAN_* flags.public Scanner(int scanType, java.util.Map config)
scanType
- Type of scan, union of SCAN_* flags.config
- Map of extra parameters, names are OPTION_*.Method Detail |
---|
public java.lang.String getExecName()
public void setExecName(java.lang.String value)
value
- nut-scanner executable namepublic java.lang.String getExecPath()
public void setExecPath(java.lang.String value)
value
- nut-scanner executable pathpublic java.util.Map getConfig()
public void setConfig(java.util.Map config)
map
- Map of parameters.public void setParam(java.lang.String name, java.lang.String value)
name
- Name of the parameter.value
- Value of the parameter.public void removeParam(java.lang.String name)
name
- Name of the parameter to remove.public java.lang.String getParam(java.lang.String name)
name
- Name of the parameter.
public boolean hasParam(java.lang.String name)
name
- Name of the parameter.
public int getScanType()
public void setScanType(int scanType)
scanType
- Union of SCAN_* flags.public Scanner.DiscoveredDevice[] scan() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |