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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stream<FedoraResource>getChildren(String transactionId, FedoraId resourceId)Get immediate children of the resourceFedoraResourcegetContainer(String transactionId, FedoraId resourceId)Get the containing resource (if exists).FedoraResourcegetResource(String transactionId, FedoraId fedoraID)Get a FedoraResource for existing resourceFedoraResourcegetResource(FedoraId fedoraID)Get a FedoraResource for existing resource without using a transaction.<T extends FedoraResource>
TgetResource(FedoraId fedoraID, Class<T> clazz)Get a resource as a particular type without a transactionFedoraResourcegetResource(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 Detail
-
getResource
FedoraResource getResource(FedoraId fedoraID) throws PathNotFoundException
Get a FedoraResource for existing resource without using a transaction.- Parameters:
fedoraID- The path or identifier for the resource.- Returns:
- The resource.
- Throws:
PathNotFoundException- If the identifier cannot be found.
-
getResource
FedoraResource getResource(Transaction transaction, FedoraId fedoraID) throws PathNotFoundException
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
FedoraResource getResource(String transactionId, FedoraId fedoraID) throws PathNotFoundException
Get a FedoraResource for existing resource- Parameters:
transactionId- The transaction id 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(FedoraId fedoraID, Class<T> clazz) throws PathNotFoundException
Get a resource as a particular type without a transaction- Type Parameters:
T- type for the resource- Parameters:
fedoraID- The identifier for the resource.clazz- class the resource will be cast to- 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
FedoraResource getContainer(String transactionId, FedoraId resourceId)
Get the containing resource (if exists).- Parameters:
transactionId- The current transaction idresourceId- The internal identifier- Returns:
- The containing resource or null if none.
-
getChildren
Stream<FedoraResource> getChildren(String transactionId, FedoraId resourceId)
Get immediate children of the resource- Parameters:
transactionId- The transaction idresourceId- Identifier of the resource- Returns:
- Stream of child resources
-
-