public class ResourceRegistry extends Object
| Constructor and Description |
|---|
ResourceRegistry(org.eclipse.californium.core.server.resources.Resource root)
Construct a registry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(OperationalListener operationalListener)
Add a listener to the registry.
|
void |
add(String parentUri,
ResourceConfig resourceDesciption)
Add a new resource to the registry based on given resource configuration.
|
void |
add(String parentUri,
ResourceParams resourceDesciption)
Add a new resource to the registry based on given resource configuration.
|
List<ServedResource> |
findResources(String uriPattern)
Find all resources of that have matching uri's.
|
static String |
getParentUri(String uri)
Get the uri of the parent of a resource.
|
ServedResource |
getResource(String uri)
Get the resources from the registry with given uri.
|
static int |
getUriDepth(String uri)
Get the depth of resource hierarchy in an uri.
|
static String |
getUriPath(String uri)
Get the path part of an uri.
|
static String |
getUriResourceName(String uri)
Get the resource name part of an uri.
|
static int |
matchUri(String uriPattern,
String resourceUri)
Establish the degree in which a resource uri matches an uriPattern.
|
void |
remove(OperationalListener listener)
Remove a listener from the registry.
|
void |
remove(String uriPattern)
Remove a resource from the registry
|
void |
removeAll()
Remove all resources from the registry
|
static boolean |
uriHasWildcard(String uri)
Establish whether the uri has a wildcard and is in fact a pattern.
|
public ResourceRegistry(org.eclipse.californium.core.server.resources.Resource root)
throws InternalResourceRegistryException
root - Mandatory root resource.InternalResourceRegistryException - When the the root resource is null.public void add(String parentUri, ResourceConfig resourceDesciption) throws InternalResourceUriException
parentUri - the uri of the parent of the new resource.resourceDesciption - the definition of the resource to createInternalResourceUriException - the parent uri does not resolve to an
existing resource or resource parameters are invalid.public void add(String parentUri, ResourceParams resourceDesciption) throws InternalResourceUriException
parentUri - The uri of the parent of the new resource.resourceDesciption - The definition of the resource to create.InternalResourceUriException - when the parent uri does not resolve to
an existing resource.public void removeAll()
public void remove(String uriPattern)
uriPattern - The uri pattern defining the resources to removepublic void add(OperationalListener operationalListener) throws InternalUriPatternException
operationalListener - The listener to addInternalUriPatternException - When the listeners uri pattern is
invalid.public void remove(OperationalListener listener)
listener - The listener to addpublic ServedResource getResource(String uri) throws InternalResourceUriException
uri - The uri of the resource to get.InternalResourceUriException - The resource does not exist.public List<ServedResource> findResources(String uriPattern)
uriPattern - the pattern to match to.public static int matchUri(String uriPattern, String resourceUri) throws InternalUriPatternException
uriPattern - The pattern to match to.resourceUri - The resource uri to do the matching on.InternalUriPatternException - when the pattern given is invalidpublic static int getUriDepth(String uri)
uri - the resource uripublic static String getUriPath(String uri)
uri - The uri of the resouce.public static String getUriResourceName(String uri)
uri - The uri of the resource.public static boolean uriHasWildcard(String uri) throws InternalUriPatternException
uri - The uri of a resource.InternalUriPatternExceptionCopyright © 2019–2024 Teslanet.nl. All rights reserved.