org.openxri.xml.XDIService Maven / Gradle / Ivy
The newest version!
package org.openxri.xml;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
/**
* This is an XDI Service.
* @author =peacekeeper
*/
public class XDIService extends Service {
public static final String SERVICE_TYPE = "xri://$xdi!($v!1)";
public static final String SERVICE_PATH = "($context)!($xdi)!($v!1) ";
/**
* Constructs a new XDI Service endpoint for use in an authority.
* @param providerID - The global i-number of the provider of this service.
*/
public XDIService(URI[] uris, String providerID) {
super();
/*
* The ProviderID of the XDI Service
* SHOULD be set to the global i-number of the provider.
*/
if (providerID != null) this.setProviderId(providerID);
/*
* This setting is REQUIRED to establish the XDI Service.
*/
this.addType(new SEPType(SERVICE_TYPE, null, Boolean.TRUE));
/*
* This setting is REQUIRED to establish the XDI Service.
*/
this.addPath(new SEPPath(SERVICE_PATH, null, Boolean.TRUE));
/*
* Setting a media type to default
* is not strictly necessary, since this setting is implied anyway, if no other
* media type is specified. On the other hand, it can't really harm.
*/
this.addMediaType(new SEPMediaType(null, SEPMediaType.MATCH_ATTR_DEFAULT, null));
/*
* These are the URIs where the XDI Service is implemented. Nothing will be appended.
*/
for (int i=0; i