All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openxri.xml.AuthorityResolutionService Maven / Gradle / Ivy

The newest version!
package org.openxri.xml;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;

import org.openxri.resolve.TrustType;

/**
 * This is an Authority Resolution 2.0 Service.
 * @author =peacekeeper
 */
public class AuthorityResolutionService extends Service {

	public static final String SERVICE_TYPE = "xri://$res*auth*($v*2.0)";
	public static final String SERVICE_MEDIA_TYPE = "application/xrds+xml";
	public static final String TRUST_TYPE_SEPARATOR = ";";

	public static final Integer URI_PRIORITY_HTTPS = new Integer(1);
	public static final Integer URI_PRIORITY_DEFAULT = new Integer(2);

	/**
	 * Constructs a new Authority Resolution 2.0 endpoint.
	 * @param resolvers - The URI(s) where the authority will be resolved.
	 * @param providerID - The global i-number of the I-Broker providing this Authority Resolution Service.
	 * @param append - The append attribute to use for the URIs.
	 */
	public AuthorityResolutionService(URI[] resolvers, String providerID, TrustType trustType, String append) {

		super();

		if (append == null) append = SEPUri.APPEND_NONE;

		/*
		 * The ProviderID of an untrusted Authority Resolution Service is OPTIONAL, otherwise REQUIRED.
		 */
		if (providerID != null) this.setProviderId(providerID);

		/*
		 * This setting is REQUIRED. 
		 */
		this.addType(new SEPType(SERVICE_TYPE, null, Boolean.TRUE));

		/*
		 * This setting is REQUIRED. 
		 */

		String mediaType = SERVICE_MEDIA_TYPE;
		if (trustType != null && ! trustType.equals(TrustType.TRUST_NONE)) {

			mediaType += TRUST_TYPE_SEPARATOR + trustType.getParameterPair();
		}

		this.addMediaType(new SEPMediaType(mediaType, null, Boolean.FALSE));

		/*
		 * These are the URIs where the Authority Resolution Service is implemented.
		 */
		for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy