com.pixelmed.network

## Class ProbeCapability

- java.lang.Object
- - com.pixelmed.network.ProbeCapability

All Implemented Interfaces:
  java.lang.Runnable

    public class ProbeCapability
    extends java.lang.Object
    implements java.lang.Runnable

This class provides utilities to probe the capabilities of potential DICOM Application Entities, used for example to maintain a cache of potential C-MOVE targets.

The constructors perform the probe and may be used to determine the capabilities of an AE listening on a specified port, or to probe for plausible ports.

The Verification SOP Class must be supported by the AE being tested for it to be detected.

The supported SOP Classes are tested by proposing associations with the default transfer syntax.

The main method may be useful in its own right as a command line utility.

### Nested Class Summary

Nested Classes
`protected class` `ProbeCapability.AETGenerator`
`protected class` `ProbeCapability.StringPermutationGenerator`

### Field Summary

Fields
`protected static char[]` `upperCase`
`protected static char[]` `upperCaseNumericUnderscore`

### Constructor Summary

Constructors
Constructor and Description
`ProbeCapability(java.lang.String hostname, int port, java.lang.String calledAETitle, java.lang.String callingAETitle, int debugLevel)` Establish an association to the specified AE and using the specified port, and probe its capabilities.
`ProbeCapability(java.lang.String hostname, java.lang.String callingAETitle, int debugLevel)` Establish an association to the specified host, find a suitable port and AE Title, and probe its capabilities.
`ProbeCapability(java.lang.String hostname, java.lang.String calledAETitle, java.lang.String callingAETitle, int debugLevel)` Establish an association to the specified AE, find a suitable port, and probe its capabilities.

### Method Summary

Methods
`static boolean` `canConnectToPort(java.lang.String hostAddress, int port)` Can a connection to the specified address and port be established?
`static boolean` `canConnectToPort(java.lang.String hostAddress, int port, int timeout)` Can a connection to the specified address and port be established?
`static java.lang.String` `describeIPAddress(java.net.InetAddress address)`
`java.lang.String` `getCalledAETitle()` Get the Called AET.
`java.lang.String` `getHostname()` Get the hostname or IP address.
`int` `getPort()` Get the port.
`PresentationAddress` `getPresentationAddress()` Get the Presentation Address.
`java.lang.String` `getQueryModel()` Get the supported query model.
`java.util.List` `getSupportedQuerySOPClasses()` Get the supported Query SOP Classes.
`java.util.List` `getSupportedRetrieveWithGetSOPClasses()` Get the supported Retrieve with Get SOP Classes.
`java.util.List` `getSupportedRetrieveWithMoveSOPClasses()` Get the supported Retrieve with Move SOP Classes.
`java.util.List` `getSupportedStorageSOPClasses()` Get the supported Storage SOP Classes.
`boolean` `isDone()` Has thread finished probing ?
`boolean` `isQuerySupported()` Are any Query SOP Classes supported ?
`boolean` `isRetrieveWithGetSupported()` Are any Retrieve with Get SOP Classes supported ?
`boolean` `isRetrieveWithMoveSupported()` Are any Retrieve with Move SOP Classes supported ?
`boolean` `isStorageSupported()` Are any Storage SOP Classes supported ?
`static void` `main(java.lang.String[] arg)` For testing, establish an association to the specified AE, find a suitable port if necessary, and probe its capabilities.
`static void` `probeRangeAllHostsOnLocalSubnet(java.lang.String callingAETitle)`
`static java.util.List` `probeSupportedSOPClasses(java.lang.String[] arrayOfSOPClasses, java.lang.String hostname, int port, java.lang.String calledAETitle, java.lang.String callingAETitle, int debugLevel)` Establish an association to the specified AE, and probe its capabilities with respect to those SOP Classes supported.
`void` `run()` Actually do the work to probe for the requested information.
`void` `runUntilDone()` Actually do the work to probe for the requested information, and do not come back until done.
`java.lang.String` `toString()` Return a String representing this object's value.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### upperCase

    protected static final char[] upperCase

#### upperCaseNumericUnderscore

    protected static final char[] upperCaseNumericUnderscore

### Constructor Detail

#### ProbeCapability

    public ProbeCapability(java.lang.String hostname,
                   java.lang.String callingAETitle,
                   int debugLevel)
                    throws DicomNetworkException

Establish an association to the specified host, find a suitable port and AE Title, and probe its capabilities.

The parameters are established but the work is deferred until run() is called.

Parameters:
  `hostname` - their hostname or IP address
  `callingAETitle` - our AE Title
  `debugLevel` - zero for no debugging messages, higher values more verbose messages
Throws:
  `DicomNetworkException`

#### ProbeCapability

    public ProbeCapability(java.lang.String hostname,
                   java.lang.String calledAETitle,
                   java.lang.String callingAETitle,
                   int debugLevel)
                    throws DicomNetworkException

Establish an association to the specified AE, find a suitable port, and probe its capabilities.

The parameters are established but the work is deferred until run() is called.

Parameters:
  `hostname` - their hostname or IP address
  `calledAETitle` - their AE Title
  `callingAETitle` - our AE Title
  `debugLevel` - zero for no debugging messages, higher values more verbose messages
Throws:
  `DicomNetworkException`

#### ProbeCapability

    public ProbeCapability(java.lang.String hostname,
                   int port,
                   java.lang.String calledAETitle,
                   java.lang.String callingAETitle,
                   int debugLevel)

Establish an association to the specified AE and using the specified port, and probe its capabilities.

The parameters are established but the work is deferred until run() is called.

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port
  `calledAETitle` - their AE Title
  `callingAETitle` - our AE Title
  `debugLevel` - zero for no debugging messages, higher values more verbose messages

### Method Detail

#### getCalledAETitle

    public java.lang.String getCalledAETitle()

Get the Called AET.

Returns:
  the Called AET

#### getPresentationAddress

    public PresentationAddress getPresentationAddress()

Get the Presentation Address.

Returns:
  the Presentation Address

#### getHostname

    public java.lang.String getHostname()

Get the hostname or IP address.

Returns:
  the hostname or IP address

#### getPort

    public int getPort()

Get the port.

Returns:
  the port

#### getSupportedStorageSOPClasses

    public java.util.List getSupportedStorageSOPClasses()

Get the supported Storage SOP Classes.

Returns:
  a list of the supported Storage SOP Class UID strings

#### isStorageSupported

    public boolean isStorageSupported()

Are any Storage SOP Classes supported ?

Returns:
  true if any Storage SOP Classes are supported

#### getSupportedQuerySOPClasses

    public java.util.List getSupportedQuerySOPClasses()

Get the supported Query SOP Classes.

Returns:
  a list of the supported Query SOP Class UID strings

#### isQuerySupported

    public boolean isQuerySupported()

Are any Query SOP Classes supported ?

Returns:
  true if any Query SOP Classes are supported

#### getSupportedRetrieveWithMoveSOPClasses

    public java.util.List getSupportedRetrieveWithMoveSOPClasses()

Get the supported Retrieve with Move SOP Classes.

Returns:
  a list of the supported Retrieve with Move SOP Class UID strings

#### isRetrieveWithMoveSupported

    public boolean isRetrieveWithMoveSupported()

Are any Retrieve with Move SOP Classes supported ?

Returns:
  true if any Retrieve with Move SOP Classes are supported

#### getSupportedRetrieveWithGetSOPClasses

    public java.util.List getSupportedRetrieveWithGetSOPClasses()

Get the supported Retrieve with Get SOP Classes.

Returns:
  a list of the supported Retrieve with Get SOP Class UID strings

#### isRetrieveWithGetSupported

    public boolean isRetrieveWithGetSupported()

Are any Retrieve with Get SOP Classes supported ?

Returns:
  true if any Retrieve with Get SOP Classes are supported

#### getQueryModel

    public java.lang.String getQueryModel()

Get the supported query model.

Note that only a single model is returned, even if more than one is supported; in the later case, study root is preferred over patient root over patient/study only.

Further, the query model of the query (find) is returned, in preference to checking the model of the retrieve (move or get), which is only done of no find SOP classes are supported.

Returns:
  the (preferred) query model supported; one of `NetworkApplicationProperties.StudyRootQueryModel` or `NetworkApplicationProperties.PatientRootQueryModel` or `NetworkApplicationProperties.PatientStudyOnlyQueryModel`.

#### isDone

    public boolean isDone()

Has thread finished probing ?

Returns:
  true if probe has finished

#### probeSupportedSOPClasses

    public static java.util.List probeSupportedSOPClasses(java.lang.String[] arrayOfSOPClasses,
                                          java.lang.String hostname,
                                          int port,
                                          java.lang.String calledAETitle,
                                          java.lang.String callingAETitle,
                                          int debugLevel)
                                                   throws DicomNetworkException,
                                                          java.io.IOException

Establish an association to the specified AE, and probe its capabilities with respect to those SOP Classes supported.

Parameters:
  `arrayOfSOPClasses` - the SOP Classes to test for
  `hostname` - their hostname or IP address
  `port` - their port
  `calledAETitle` - their AE Title
  `callingAETitle` - our AE Title
  `debugLevel` - zero for no debugging messages, higher values more verbose messages
Returns:
  a list of Strings each being a SOP Class that is supported, or an empty list
Throws:
  `DicomNetworkException`
  `java.io.IOException`

#### run

    public void run()

Actually do the work to probe for the requested information.

Specified by:
  `run` in interface `java.lang.Runnable`

#### runUntilDone

    public void runUntilDone()
                      throws java.lang.InterruptedException

Actually do the work to probe for the requested information, and do not come back until done.

Throws:
  `java.lang.InterruptedException`

#### toString

    public java.lang.String toString()

Return a String representing this object's value.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  a string representation of the value of this object

#### canConnectToPort

    public static boolean canConnectToPort(java.lang.String hostAddress,
                           int port)

Can a connection to the specified address and port be established?

Will block until connected or an error occurs.

Parameters:
  `hostAddress` -
  `port` -
Returns:
  true if can connect

#### canConnectToPort

    public static boolean canConnectToPort(java.lang.String hostAddress,
                           int port,
                           int timeout)

Can a connection to the specified address and port be established?

Parameters:
  `hostAddress` -
  `port` -
  `timeout` - in milliseconds, or zero for no timeout (will block until connected or an error occurs)
Returns:
  true if can connect within specified timeout period

#### probeRangeAllHostsOnLocalSubnet

    public static void probeRangeAllHostsOnLocalSubnet(java.lang.String callingAETitle)

#### describeIPAddress

    public static java.lang.String describeIPAddress(java.net.InetAddress address)

#### main

    public static void main(java.lang.String[] arg)

For testing, establish an association to the specified AE, find a suitable port if necessary, and probe its capabilities.

Parameters:
  `arg` - array of three, four or five values - their hostname, optionally their port, optionally their AE Title, our AE Title, and the debug level