|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.freecompany.brimstone.core.DefaultResolver
public class DefaultResolver
The "standard" resolver.
This resolver uses Java Service Discovery to locate other ResolverService implementations and delegates requests to them one at a time. The result indicated by the first delegate to show definitive knowledge of the URI is returned from this service.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.freecompany.brimstone.core.ResolverService |
---|
ResolverService.I2C, ResolverService.I2Cs, ResolverService.I2L, ResolverService.I2Ls, ResolverService.I2N, ResolverService.I2Ns, ResolverService.I2R, ResolverService.I2Rs, ResolverService.IeqI |
Constructor Summary | |
---|---|
DefaultResolver()
|
Method Summary | ||
---|---|---|
java.lang.Boolean |
equal(java.net.URI u1,
java.net.URI u2)
Test whether two URIs identify the same resource. |
|
java.lang.Object |
getCharacteristic(java.net.URI uri)
Translate the given URI to a Universal Resource Characteristics (URC) for the resource. |
|
|
getCharacteristic(java.net.URI uri,
java.lang.Class<T> cl)
|
|
java.util.List<java.lang.Object> |
getCharacteristics(java.net.URI uri)
Translate the given URI to a list of URCs for the resource. |
|
java.net.URI |
getName(java.net.URI uri)
Translate the given URI to a URN for the resource. |
|
java.util.List<java.net.URI> |
getNames(java.net.URI uri)
Translate the given URI to a list of known URNs for the resource. |
|
java.lang.Object |
getResource(java.net.URI uri)
Retrieve the resource identified by the URI, in its default format. |
|
|
getResource(java.net.URI uri,
java.lang.Class<T> cl)
Retrieve the resource identified by the URI, in a specified format. |
|
java.util.List<java.lang.Object> |
getResources(java.net.URI uri)
Translate the given URI to a list of resources for the object. |
|
java.net.URI |
getURL(java.net.URI uri)
Translate the given URI to a locator (URL) for the resource. |
|
java.util.List<java.net.URI> |
getURLs(java.net.URI uri)
Translate the given URI to a list of locators for the resource. |
|
boolean |
local()
This resolver may discover and delegate to resolvers that are remote, so it should be attempted after any known local resolvers. |
|
boolean |
resolvable(java.net.URI uri)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultResolver()
Method Detail |
---|
public boolean local()
local
in interface ResolverService
true
if this resolver only looks locally,
false
if it uses remote resources.public boolean resolvable(java.net.URI uri)
resolvable
in interface ResolverService
public java.net.URI getURL(java.net.URI uri) throws URIResolutionException
ResolverService.I2L
The returned locator should be one that "works" for the resoure - that is, aside from authorization issues or network problems, one that can be used to retrieve the resource.
Note that this returns a URI, not a URL
. While the return value is
intended to be a locator, the resolver system works exclusively with the URI class
to avoid issues associated with missing protocol implementations.
getURL
in interface ResolverService.I2L
uri
- the URI to resolve.
null
if no locator can be found.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.util.List<java.net.URI> getURLs(java.net.URI uri) throws URIResolutionException
ResolverService.I2Ls
Note that not all of the returned locators need work. If a resolver knows a list of locations
that, if they exist would have the resource, it may return the corresponding locators. This
differs from ResolverService.I2L
, which shouldn't return a locator that "might" refer to the resource.
getURLs
in interface ResolverService.I2Ls
uri
- the URI to resolve.
null
if no locators are known.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.lang.Object getResource(java.net.URI uri) throws URIResolutionException
ResolverService.I2R
It's up to the implementation to decide the format in which the resource is returned. Most implementations will return an InputStream with the content of the resource.
getResource
in interface ResolverService.I2R
uri
- the URI to retrieve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public <T> T getResource(java.net.URI uri, java.lang.Class<T> cl) throws URIResolutionException
ResolverService.I2R
If the service cannot provide the resource as an instance of the requested class, it should return null.
getResource
in interface ResolverService.I2R
uri
- the URI to retrieve.cl
- a Class indicating the type of resource expected.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.util.List<java.lang.Object> getResources(java.net.URI uri) throws URIResolutionException
ResolverService.I2Rs
getResources
in interface ResolverService.I2Rs
uri
- the URI to resolve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.lang.Object getCharacteristic(java.net.URI uri) throws URIResolutionException
ResolverService.I2C
getCharacteristic
in interface ResolverService.I2C
uri
- the URI to resolve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public <T> T getCharacteristic(java.net.URI uri, java.lang.Class<T> cl) throws URIResolutionException
getCharacteristic
in interface ResolverService.I2C
URIResolutionException
public java.util.List<java.lang.Object> getCharacteristics(java.net.URI uri) throws URIResolutionException
ResolverService.I2Cs
getCharacteristics
in interface ResolverService.I2Cs
uri
- the URI to resolve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.net.URI getName(java.net.URI uri) throws URIResolutionException
ResolverService.I2N
getName
in interface ResolverService.I2N
uri
- the URI to resolve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.util.List<java.net.URI> getNames(java.net.URI uri) throws URIResolutionException
ResolverService.I2Ns
getNames
in interface ResolverService.I2Ns
uri
- the URI to resolve.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.public java.lang.Boolean equal(java.net.URI u1, java.net.URI u2) throws URIResolutionException
ResolverService.IeqI
Note that this is a more extensive test than URI#equals()
. If the service reports
two URIs to be equal, then they are definitively known to refer to the same resource - even
if they differ syntactically. If the operation returns null
, then the service cannot
definitively test the equality of the URIs.
equal
in interface ResolverService.IeqI
u1
- a URI to compareu2
- another URI to compare
null
if the URIs cannot be compared by the service.
NoSuchURIException
- if the URI is definitively known not to represent a resource.
URIGoneException
- if the URI existed in the past but nothing is currently known about it.
URINotFoundException
- URI exists but there is no available output from this operation.
URIResolutionException
- If another problem prevents resolution of the URI.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |