Represents any file or collection stored in the registry. It encapsulates both the content of the entity and its meta data. In addition to files and collections, instances of Resource are used to represent results of runtime queries. In such scenarios, comments, tags, ratings as well as collections of comments, etc. are also represented by Resource objects.
Each resource instance contains a unique path within a Registry instance. {@link Registry#get(String)} method invocation using this path gives an instance of that resource. Thispath can be combined with the base URL of the registry server to generate a URI for the resource.
Handling content Contents of resource can be set either as an input stream or an object. If an input stream is set, an unique file based content will be created for the given input stream. If an object of type byte[] or String is set, an in-memory input stream will be created from it and then a unique file based input stream is created. If an object of any other type is set, there should be a handler to convert it to an input stream before reaching the repository.
When a resource is retrieved from the database layer, its content is not retrieved from the database. Instead, UUID referring to the database content is stored in dbBasedContentID. When the content is first accessed, a file based input stream is created from the database content and fileBasedContentID is set (fileBasedContentID = dbBasedContentID).