Package org.fcrepo.kernel.api.models
Interface ResourceFactory
public interface ResourceFactory
Interface to a factory to instantiate FedoraResources
- Since:
- 2019-09-23
- Author:
- whikloj
-
Method Summary
Modifier and TypeMethodDescriptiongetChildren(Transaction transaction, FedoraId resourceId) Get immediate children of the resourcegetContainer(Transaction transaction, FedoraId resourceId) Get the containing resource (if exists).getResource(Transaction transaction, FedoraId fedoraID) Get a FedoraResource for existing resource<T extends FedoraResource>
TgetResource(Transaction transaction, FedoraId fedoraID, Class<T> clazz) Get a resource as a particular type
-
Method Details
-
getResource
Get a FedoraResource for existing resource- Parameters:
transaction- The transaction associated with this request or null if not in a transaction.fedoraID- The identifier for the resource.- Returns:
- The resource.
- Throws:
PathNotFoundException- If the identifier cannot be found.
-
getResource
<T extends FedoraResource> T getResource(Transaction transaction, FedoraId fedoraID, Class<T> clazz) throws PathNotFoundException Get a resource as a particular type- Type Parameters:
T- type for the resource- Parameters:
transaction- The transaction associated with this request or nullfedoraID- The identifier for the resource.clazz- class the resource will be cast to- Returns:
- The resource.
- Throws:
PathNotFoundException- If the identifier cannot be found.
-
getContainer
Get the containing resource (if exists).- Parameters:
transaction- The current transactionresourceId- The internal identifier- Returns:
- The containing resource or null if none.
-
getChildren
Get immediate children of the resource- Parameters:
transaction- The transactionresourceId- Identifier of the resource- Returns:
- Stream of child resources
-