/**
* Constructs a new Proxy Resolution endpoint.
* @param resolvers - The Uri(s) where the proxy is implemented.
* @param providerID - The global i-number of the I-Broker providing this Proxy Resolution Service.
* @param trustType - The Trust Type supported by the proxy
* @param refs - Whether the proxy supports following references
* @param sep - Whether the proxy supports service endpoint selection
*/
public ProxyResolutionService(Uri[] proxies, string providerID, TrustType trustType, bool? refs, bool? sep)
{
/*
* The ProviderID of a Proxy Resolution Service is OPTIONAL.
*/
if (providerID != null) this.setProviderId(providerID);
/*
* This setting is REQUIRED.
*/
this.addType(new SEPType(SERVICE_TYPE, null, true));
/*
* This setting is REQUIRED.
*/
for (int i = 0; i < SERVICE_MEDIA_TYPES.Length; i++) {
string mediaType = SERVICE_MEDIA_TYPES[i];
if (trustType != null && !trustType.Equals(TrustType.TRUST_NONE)) {
mediaType += TRUST_TYPE_SEPARATOR + trustType.getParameterPair();
if (refs != null) mediaType += REFS_SEPARATOR + refs;
if (sep != null) mediaType += SEP_SEPARATOR + sep;
}
this.addMediaType(new SEPMediaType(mediaType, null, false));
}
/*
* These are the URIs where the Proxy Resolution Service is implemented.
*/
for (int i = 0; i < proxies.Length; i++) {
Uri resolver = proxies[i];
try {
int? priority = resolver.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase) ?
URI_PRIORITY_HTTPS : URI_PRIORITY_DEFAULT;
this.addURI(new SEPUri(resolver.ToString(), priority, SEPUri.APPEND_NONE));
} catch (UriFormatException) {
continue;
}
}
}