org.nhindirect.stagent
Class NHINDAddress

java.lang.Object
  extended by javax.mail.Address
      extended by javax.mail.internet.InternetAddress
          extended by org.nhindirect.stagent.NHINDAddress
All Implemented Interfaces:
Serializable, Cloneable

public class NHINDAddress
extends javax.mail.internet.InternetAddress

NHIN-Direct agent specific logic for an InternetAddress.

Author:
Greg Meyer, Umesh Madan
See Also:
Serialized Form

Constructor Summary
NHINDAddress(javax.mail.internet.InternetAddress address)
          Constructs an address from an InternetAddress.
NHINDAddress(javax.mail.internet.InternetAddress address, AddressSource source)
          Constructs an address from an InternetAddress.
NHINDAddress(String address)
          Constructs an address from a string representation.
NHINDAddress(String address, AddressSource source)
          Constructs an address from a string representation.
NHINDAddress(String address, Collection<X509Certificate> certificates)
          Constructs an address from a string representation and associates a collection X509Certificates with the address.
 
Method Summary
 boolean domainEquals(String domain)
          Indicates if the address's domain matches the provided domain.
 Collection<X509Certificate> getCertificates()
          Gets the X509 certificates associated with the address.
 String getHost()
          Gets the domain host associated with the address.
static String getHost(javax.mail.internet.InternetAddress theAddress)
          Gets the domain host associated with the address.
 AddressSource getSource()
          Gets the source type of the address such as TO, CC, and BCC.
 TrustEnforcementStatus getStatus()
          Gets the trust status of the address.
 Collection<X509Certificate> getTrustAnchors()
          Gets all certificate anchors that this address trusts.
 boolean hasCertificates()
          Indicates if the address is associated with a certificate.
 boolean hasTrustAnchors()
          Indicates if the address has certificate trust anchors associated with it.
 boolean isInDomain(Collection<String> domains)
          Indicates if the the address's domain is in the list of domains.
 boolean isTrusted(TrustEnforcementStatus minTrustStatus)
          Indicates if the provided trust status is trusted by this address.
 void setCertificates(Collection<X509Certificate> certs)
          Associates an X509 certificate with the address.
 void setSource(AddressSource source)
          Sets the source type of the address.
 void setStatus(TrustEnforcementStatus value)
          Sets the trust status of the address.
 void setTrustAnchors(Collection<X509Certificate> certs)
          Sets all certificate anchors that this address trusts.
 
Methods inherited from class javax.mail.internet.InternetAddress
clone, equals, getAddress, getGroup, getLocalAddress, getPersonal, getType, hashCode, isGroup, parse, parse, parseHeader, setAddress, setPersonal, setPersonal, toString, toString, toString, toUnicodeString, validate
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NHINDAddress

public NHINDAddress(String address)
Constructs an address from a string representation. The address must be parsable into an InternetAddress.

Parameters:
address - String representation of an address.

NHINDAddress

public NHINDAddress(javax.mail.internet.InternetAddress address)
Constructs an address from an InternetAddress.

Parameters:
address - The internet address.

NHINDAddress

public NHINDAddress(String address,
                    AddressSource source)
Constructs an address from a string representation. The address must be parsable into an InternetAddress.

Parameters:
address - String representation of an address.
source - Indicates the type of address respective to the message.

NHINDAddress

public NHINDAddress(javax.mail.internet.InternetAddress address,
                    AddressSource source)
Constructs an address from an InternetAddress.

Parameters:
address - The internet address.
source - Indicates the type of address respective to the message.

NHINDAddress

public NHINDAddress(String address,
                    Collection<X509Certificate> certificates)
Constructs an address from a string representation and associates a collection X509Certificates with the address. The address must be parsable into an InternetAddress.

Parameters:
address - String representation of an address.
certificates - The certificates to be associated with the address.
Method Detail

getHost

public String getHost()
Gets the domain host associated with the address.

Returns:
The host associated with the address.

getCertificates

public Collection<X509Certificate> getCertificates()
Gets the X509 certificates associated with the address.

Returns:
The X509 certificates associated with the address. Returns null if no certificates is not associated.

setCertificates

public void setCertificates(Collection<X509Certificate> certs)
Associates an X509 certificate with the address.

Parameters:
value - The certificate to associates with the address.

hasCertificates

public boolean hasCertificates()
Indicates if the address is associated with a certificate.

Returns:
True is a certificate is associated. False otherwise.

getTrustAnchors

public Collection<X509Certificate> getTrustAnchors()
Gets all certificate anchors that this address trusts. The returned collection is unmodifiable.

Returns:
A collection of certificate anchors that are trusted by this address.

setTrustAnchors

public void setTrustAnchors(Collection<X509Certificate> certs)
Sets all certificate anchors that this address trusts.

Parameters:
certs - A collection of certificate anchors that are trusted by this address.

hasTrustAnchors

public boolean hasTrustAnchors()
Indicates if the address has certificate trust anchors associated with it.

Returns:
True if the address has certificate trust anchors associate with it. False otherwise.

getStatus

public TrustEnforcementStatus getStatus()
Gets the trust status of the address.

Returns:
The trust status of the address.

setStatus

public void setStatus(TrustEnforcementStatus value)
Sets the trust status of the address.

Parameters:
value - The trust status of the address.

isTrusted

public boolean isTrusted(TrustEnforcementStatus minTrustStatus)
Indicates if the provided trust status is trusted by this address. The minimum trust status is considered to be trusted if its Enum ordinal value is greater than or equal to this address' trust status ordinal value.

Parameters:
minTrustStatus - The trust status to compare with the address' trust status.
Returns:
True if the status trusted. False otherwise.

getSource

public AddressSource getSource()
Gets the source type of the address such as TO, CC, and BCC.

Returns:
The source type of the address

setSource

public void setSource(AddressSource source)
Sets the source type of the address.

Parameters:
source - The source type of the address.

domainEquals

public boolean domainEquals(String domain)
Indicates if the address's domain matches the provided domain. The domain check is case insensitive.

Parameters:
domain - The domain to match.
Returns:
True if the address's domain matches the provided domain. False otherwise.

isInDomain

public boolean isInDomain(Collection<String> domains)
Indicates if the the address's domain is in the list of domains. The domain check is case insensitive.

Parameters:
domains - The domain to check.
Returns:
True if the address's domain is in the list of provided domains. False otherwise.

getHost

public static String getHost(javax.mail.internet.InternetAddress theAddress)
Gets the domain host associated with the address.

Parameters:
theAddress - The address to get the host from.
Returns:
The host associated with the address.


Copyright © 2010-2013 NHIN Direct. All Rights Reserved.