Package org.wso2.carbon.registry.api
Interface CoreRegistry
-
- All Known Subinterfaces:
Registry
public interface CoreRegistryThis represents the most fundamental API for the Registry. This is typically what you want if you're a Java programmer wanting to simply store and manage Resources. This interface can be used to perform all basic registry operations, and can also be used to implement a simple registry implementation. Being an interface, this gives the developers the flexibility of using this without having to worry about the implementation. If you want programmatic access to features like tags, comments, ratings, and versions, please have a look at the fullRegistryinterface which extends this.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddelete(String path)Deletes the resource at the given path.Resourceget(String path)Returns the resource at the given path.Collectionget(String path, int start, int pageSize)Returns the Collection at the given path, with the content paginated according to the arguments.CollectionnewCollection()Creates a new collection.ResourcenewResource()Creates a new resource.Stringput(String suggestedPath, Resource resource)Adds or updates resources in the registry.booleanresourceExists(String path)Check whether a resource exists at the given path
-
-
-
Method Detail
-
newResource
Resource newResource() throws RegistryException
Creates a new resource.- Returns:
- the created resource.
- Throws:
RegistryException- if the operation failed.
-
newCollection
Collection newCollection() throws RegistryException
Creates a new collection.- Returns:
- the created collection.
- Throws:
RegistryException- if the operation failed.
-
get
Resource get(String path) throws RegistryException
Returns the resource at the given path.- Parameters:
path- Path of the resource. e.g. /project1/server/deployment.xml- Returns:
- Resource instance
- Throws:
RegistryException- is thrown if the resource is not in the registry
-
get
Collection get(String path, int start, int pageSize) throws RegistryException
Returns the Collection at the given path, with the content paginated according to the arguments.- Parameters:
path- the path of the collection. MUST point to a collection!start- the initial index of the child to return. If there are fewer children than the specified value, a RegistryException will be thrown.pageSize- the maximum number of results to return- Returns:
- a Collection containing the specified results in the content
- Throws:
RegistryException- if the resource is not found, or if the path does not reference a Collection, or if the start index is greater than the number of children.
-
resourceExists
boolean resourceExists(String path) throws RegistryException
Check whether a resource exists at the given path- Parameters:
path- Path of the resource to be checked- Returns:
- true if a resource exists at the given path, false otherwise.
- Throws:
RegistryException- if an error occurs
-
put
String put(String suggestedPath, Resource resource) throws RegistryException
Adds or updates resources in the registry. If there is no resource at the given path, resource is added. If a resource already exist at the given path, it will be replaced with the new resource.- Parameters:
suggestedPath- the path which we'd like to use for the new resource.resource- Resource instance for the new resource- Returns:
- the actual path that the server chose to use for our Resource
- Throws:
RegistryException- is thrown depending on the implementation.
-
delete
void delete(String path) throws RegistryException
Deletes the resource at the given path. If the path refers to a directory, all child resources of the directory will also be deleted.- Parameters:
path- Path of the resource to be deleted.- Throws:
RegistryException- is thrown depending on the implementation.
-
-