org.eclipse.ohf.ihe.atna.agent
Class AtnaAgent

java.lang.Object
  extended by org.eclipse.ohf.ihe.atna.agent.AtnaAgent
All Implemented Interfaces:
AtnaAgentService

public class AtnaAgent
extends java.lang.Object
implements AtnaAgentService

AtnaAgent is the primary class for ATNA Transport and ATNA Audit. The class and its underlying classes are intended to be thread safe, and support the concept of InheritableThreadLocal behaviour. Which means it is possible to have distinct AtnaAgent configuration and behaviour per thread if needed. This behaviour is controlled via the ConfigurableInheritableThreadLocal.enableThreading(boolean) method.
Use AtnaAgentFactory to get a reference to an instance.
For example on use of Audit look at getAudit() javadoc

TLS

TLS Communication requires configuration of PKI Keystore and Truststores. This is done by creating SecurityDomain objects and adding them to the ConfigurationManager. The communication classes used by AtnaAgent will retrieve the security domain objects needed from the ConfigurationManager. Examples of use:
Step 1. If TLS is to be used, populate the ConfigurationManager with SecurityDomain objects: Properties prop = new Properties(); prop.setProperty("javax.net.ssl.keyStore",System.getProperty("javax.net.ssl.keyStore","c:/mykeys.jks")); prop.setProperty("javax.net.ssl.keyStorePassword",System.getProperty("javax.net.ssl.keyStorePassword","mypassword")); prop.setProperty("javax.net.ssl.trustStore",System.getProperty("javax.net.ssl.trustStore","c:/mytrust.jks")); prop.setProperty("javax.net.ssl.trustStorePassword",System.getProperty("javax.net.ssl.trustStorePassword","mytrustpwd")); ConfigurationManager.registerDefaultSecurityDomain(new SecurityDomain("mydomain",prop)); Step 2. Create the atna agent AtnaAgent agent = new AtnaAgentFactory.getAtnaAgent() Step 3. reguest a socket with TLS to a uri Socket s = agent.getSocket(uri, true);

Author:
Timothy Jeffcoat
, Glenn Deen glenn@almaden.ibm.com

Constructor Summary
AtnaAgent()
          Deprecated. Use AtnaAgentFactory to obtain an AtnaAgent instance.
 
Method Summary
 AuditMessage eventPending(java.lang.String eventType)
          Given "query", "import" , or "export" returns a AuditMessage.
 void eventTriggered(AuditMessage msg)
          Sends the AuditMessage to the host server
static java.lang.String exampleMessage()
          BSD example audit message From /syslog/gov/nist/registry/syslog/bsd/BSDClient.java http://iheos.cvs.sourceforge.net/iheos/syslog/gov/nist/registry/syslog/bsd/BSDClient.java?view=markup
 AuditService getAudit()
          To use this do something like :

AtnaAgent agent = new AtnaAgent();
AuditMessage auditMessage = agent.getAudit().eventPending("query");
auditMessage.setEventOutcomeIndicator(eventOutcomeIndicator)
auditMessage.setUserIDActiveParticipantConsumer(userIDActiveParticipantConsumer)
auditMessage.setUserIDActiveParticipantRegistry(userIDActiveParticipantRegistry)
auditMessage.setAuditSourceId(auditSourceId)
auditMessage.setParticipantObjectId(participantObjectId)
auditMessage.setParticipantObjectQuery(participantObjectQuery)
auditMessage.setEventDateTime(datetime);

Or you can do this:

auditMessage = new QueryMessage(new TimeStamp().toString(), 0,"Bill", "Registry", "localhost", "the patient","select eo.id FROM...");
agent.getAudit().eventTriggered(auditMessage);
 java.net.URI getAuditRepository()
           
static java.net.URI getDefaultAuditRepository()
           
 java.io.InputStream getInputStream(java.net.URI uri)
          Connects to the given uri, using TLS if appropriate, and returns the input stream
 java.net.Socket getSocket(java.net.URI uri, boolean useTLS)
          Creates a returns a socket to the given URI
 boolean isDoAudit()
           
 javax.xml.soap.SOAPMessage send(javax.xml.soap.SOAPMessage message, java.net.URI uri)
          Send the given SOAP message to the URI.
 void setAuditRepository(java.net.URI hosturi)
          sets the uri for auditservice
static void setDefaultAuditRepository(java.net.URI hosturi)
          sets the uri for auditservice
 void setDoAudit(boolean doAudit)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtnaAgent

public AtnaAgent()
Deprecated. Use AtnaAgentFactory to obtain an AtnaAgent instance.

Method Detail

exampleMessage

public static java.lang.String exampleMessage()
BSD example audit message From /syslog/gov/nist/registry/syslog/bsd/BSDClient.java http://iheos.cvs.sourceforge.net/iheos/syslog/gov/nist/registry/syslog/bsd/BSDClient.java?view=markup

Returns:

getInputStream

public java.io.InputStream getInputStream(java.net.URI uri)
                                   throws NoSecurityDomainException,
                                          java.net.MalformedURLException,
                                          java.io.IOException,
                                          java.security.NoSuchAlgorithmException
Connects to the given uri, using TLS if appropriate, and returns the input stream

Parameters:
uri -
Returns:
Throws:
java.security.NoSuchAlgorithmException
NoSecurityDomainException
java.net.MalformedURLException
java.io.IOException

send

public javax.xml.soap.SOAPMessage send(javax.xml.soap.SOAPMessage message,
                                       java.net.URI uri)
                                throws java.lang.Exception
Send the given SOAP message to the URI. TLS will be used if the URI has HTTPS as its protocol.

Parameters:
message -
uri -
Returns:
Throws:
java.lang.Exception

getSocket

public java.net.Socket getSocket(java.net.URI uri,
                                 boolean useTLS)
                          throws java.security.KeyManagementException,
                                 NoSecurityDomainException,
                                 java.security.NoSuchAlgorithmException,
                                 java.net.UnknownHostException,
                                 java.io.IOException
Creates a returns a socket to the given URI

Parameters:
uri -
useTLS - if true a secure TLS connection will be estalished, false an open connection will be setup
Returns:
Throws:
java.io.IOException
java.net.UnknownHostException
java.security.NoSuchAlgorithmException
NoSecurityDomainException
java.security.KeyManagementException
java.lang.Exception

getAudit

public AuditService getAudit()
To use this do something like :

AtnaAgent agent = new AtnaAgent();
AuditMessage auditMessage = agent.getAudit().eventPending("query");
auditMessage.setEventOutcomeIndicator(eventOutcomeIndicator)
auditMessage.setUserIDActiveParticipantConsumer(userIDActiveParticipantConsumer)
auditMessage.setUserIDActiveParticipantRegistry(userIDActiveParticipantRegistry)
auditMessage.setAuditSourceId(auditSourceId)
auditMessage.setParticipantObjectId(participantObjectId)
auditMessage.setParticipantObjectQuery(participantObjectQuery)
auditMessage.setEventDateTime(datetime);

Or you can do this:

auditMessage = new QueryMessage(new TimeStamp().toString(), 0,"Bill", "Registry", "localhost", "the patient","select eo.id FROM...");
agent.getAudit().eventTriggered(auditMessage);

Parameters:
auditMessage -

eventTriggered

public void eventTriggered(AuditMessage msg)
Sends the AuditMessage to the host server

Parameters:
msg -

eventPending

public AuditMessage eventPending(java.lang.String eventType)
Given "query", "import" , or "export" returns a AuditMessage.

Parameters:
eventType -
Returns:

setAuditRepository

public void setAuditRepository(java.net.URI hosturi)
sets the uri for auditservice

Parameters:
hosturi -

getAuditRepository

public java.net.URI getAuditRepository()

setDefaultAuditRepository

public static void setDefaultAuditRepository(java.net.URI hosturi)
sets the uri for auditservice

Parameters:
hosturi -

getDefaultAuditRepository

public static java.net.URI getDefaultAuditRepository()

isDoAudit

public boolean isDoAudit()
Returns:
the doAudit

setDoAudit

public void setDoAudit(boolean doAudit)
Parameters:
doAudit - the doAudit to set