com.pixelmed.network
Class ProbeCapability

java.lang.Object
  extended by com.pixelmed.network.ProbeCapability
All Implemented Interfaces:
Runnable

public class ProbeCapability
extends Object
implements 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
protected  class ProbeCapability.AETGenerator
           
protected  class ProbeCapability.StringPermutationGenerator
           
 
Field Summary
protected static char[] upperCase
           
protected static char[] upperCaseNumericUnderscore
           
 
Constructor Summary
ProbeCapability(String hostname, int port, String calledAETitle, String callingAETitle, int debugLevel)
          Establish an association to the specified AE and using the specified port, and probe its capabilities.
ProbeCapability(String hostname, String callingAETitle, int debugLevel)
          Establish an association to the specified host, find a suitable port and AE Title, and probe its capabilities.
ProbeCapability(String hostname, String calledAETitle, String callingAETitle, int debugLevel)
          Establish an association to the specified AE, find a suitable port, and probe its capabilities.
 
Method Summary
static boolean canConnectToPort(String hostAddress, int port)
          Can a connection to the specified address and port be established?
static boolean canConnectToPort(String hostAddress, int port, int timeout)
          Can a connection to the specified address and port be established?
static String describeIPAddress(InetAddress address)
           
 String getCalledAETitle()
          Get the Called AET.
 String getHostname()
          Get the hostname or IP address.
 int getPort()
          Get the port.
 PresentationAddress getPresentationAddress()
          Get the Presentation Address.
 String getQueryModel()
          Get the supported query model.
 List getSupportedQuerySOPClasses()
          Get the supported Query SOP Classes.
 List getSupportedRetrieveWithGetSOPClasses()
          Get the supported Retrieve with Get SOP Classes.
 List getSupportedRetrieveWithMoveSOPClasses()
          Get the supported Retrieve with Move SOP Classes.
 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(String[] arg)
          For testing, establish an association to the specified AE, find a suitable port if necessary, and probe its capabilities.
static void probeRangeAllHostsOnLocalSubnet(String callingAETitle)
           
static List probeSupportedSOPClasses(String[] arrayOfSOPClasses, String hostname, int port, String calledAETitle, 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.
 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(String hostname,
                       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(String hostname,
                       String calledAETitle,
                       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(String hostname,
                       int port,
                       String calledAETitle,
                       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 String getCalledAETitle()

Get the Called AET.

Returns:
the Called AET

getPresentationAddress

public PresentationAddress getPresentationAddress()

Get the Presentation Address.

Returns:
the Presentation Address

getHostname

public 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 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 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 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 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 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 List probeSupportedSOPClasses(String[] arrayOfSOPClasses,
                                            String hostname,
                                            int port,
                                            String calledAETitle,
                                            String callingAETitle,
                                            int debugLevel)
                                     throws DicomNetworkException,
                                            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
IOException

run

public void run()

Actually do the work to probe for the requested information.

Specified by:
run in interface Runnable

runUntilDone

public void runUntilDone()
                  throws InterruptedException

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

Throws:
InterruptedException

toString

public String toString()

Return a String representing this object's value.

Overrides:
toString in class Object
Returns:
a string representation of the value of this object

canConnectToPort

public static boolean canConnectToPort(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(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(String callingAETitle)

describeIPAddress

public static String describeIPAddress(InetAddress address)

main

public static void main(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