Class AccessorObjectService
java.lang.Object
io.clonecloudstore.accessor.server.application.AccessorObjectService
- All Implemented Interfaces:
AccessorObjectServiceInterface
@ApplicationScoped
public class AccessorObjectService
extends Object
implements AccessorObjectServiceInterface
Accessor Object Service
-
Constructor Summary
ConstructorsConstructorDescriptionAccessorObjectService
(LocalReplicatorService localReplicatorService, jakarta.enterprise.inject.Instance<DaoAccessorBucketRepository> bucketRepositoryInstance, jakarta.enterprise.inject.Instance<DaoAccessorObjectRepository> objectRepositoryInstance, OwnershipApiClientFactory ownershipApiClientFactory, FilesystemHandler filesystemHandler) -
Method Summary
Modifier and TypeMethodDescriptioncheckPullable
(String bucketName, String objectName, boolean external, String clientId, String opId) Check from DB if Object is pullablecreateObject
(AccessorObject accessorObject, String hash, long len, String clientId) Before really creating Object, creates it in DB if possiblecreateObjectFinalize
(AccessorObject accessorObject, String hash, long len, String clientId, boolean external) Once Object really created in Driver Storage, finalize the Object in DB and Replicator if neededvoid
deleteObject
(String bucketName, String objectName, String clientId, boolean external) Delete object in DB and through Replicator if neededfilterObjects
(String bucketName, AccessorFilter filter, String clientId, boolean external) void
generateReplicationOrderForObject
(String bucketName, String objectOrDirectoryName, String clientId, String opId, String targetId, long len, String hash) getObjectInfo
(String bucketName, String objectName, String clientId) Get DB Object DTOgetObjectMetadata
(String bucketName, String objectName) Utility to get Object Metadata from Driver StoragegetRemotePullInputStream
(String bucketName, String objectName, String clientId, String targetId, String opId) When remote read is allowed, will try to read InputStream and DTO from remotevoid
Called only when QuarkusStreamHandler is in Error and Object in status UPLOAD or UNKNOWNobjectOrDirectoryExists
(String bucketName, String objectOrDirectoryName, boolean fullCheck, String clientId) Check if object or directory exists (internal)objectOrDirectoryExists
(String bucketName, String objectOrDirectoryName, boolean fullCheck, String clientId, String opId, boolean external) Check if object or directory exists
-
Constructor Details
-
AccessorObjectService
public AccessorObjectService(LocalReplicatorService localReplicatorService, jakarta.enterprise.inject.Instance<DaoAccessorBucketRepository> bucketRepositoryInstance, jakarta.enterprise.inject.Instance<DaoAccessorObjectRepository> objectRepositoryInstance, OwnershipApiClientFactory ownershipApiClientFactory, FilesystemHandler filesystemHandler)
-
-
Method Details
-
objectOrDirectoryExists
public StorageType objectOrDirectoryExists(String bucketName, String objectOrDirectoryName, boolean fullCheck, String clientId) throws CcsOperationException Check if object or directory exists (internal)- Specified by:
objectOrDirectoryExists
in interfaceAccessorObjectServiceInterface
- Parameters:
bucketName
- bucket nameobjectOrDirectoryName
- prefix or full namefullCheck
- if True, and if Object, will check on Driver Storage- Returns:
- the associated StorageType
- Throws:
CcsOperationException
-
objectOrDirectoryExists
public StorageType objectOrDirectoryExists(String bucketName, String objectOrDirectoryName, boolean fullCheck, String clientId, String opId, boolean external) throws CcsOperationException Check if object or directory exists- Specified by:
objectOrDirectoryExists
in interfaceAccessorObjectServiceInterface
- Throws:
CcsOperationException
-
generateReplicationOrderForObject
-
filterObjects
public InputStream filterObjects(String bucketName, AccessorFilter filter, String clientId, boolean external) throws CcsOperationException - Specified by:
filterObjects
in interfaceAccessorObjectServiceInterface
- Parameters:
bucketName
- bucket namefilter
- the filter to apply on Objectsexternal
- True if bucket will be for external usage- Returns:
- a stream (InputStream) of AccessorObject line by line (newline separated)
- Throws:
CcsOperationException
-
checkPullable
public ReplicatorResponse<AccessorObject> checkPullable(String bucketName, String objectName, boolean external, String clientId, String opId) throws CcsNotExistException, CcsOperationException Check from DB if Object is pullable -
getRemotePullInputStream
public InputStreamBusinessOut<AccessorObject> getRemotePullInputStream(String bucketName, String objectName, String clientId, String targetId, String opId) throws CcsNotExistException When remote read is allowed, will try to read InputStream and DTO from remote- Throws:
CcsNotExistException
-
getObjectMetadata
public StorageObject getObjectMetadata(String bucketName, String objectName) throws CcsNotExistException, CcsOperationException Utility to get Object Metadata from Driver Storage -
getObjectInfo
public AccessorObject getObjectInfo(String bucketName, String objectName, String clientId) throws CcsNotExistException, CcsOperationException Get DB Object DTO- Specified by:
getObjectInfo
in interfaceAccessorObjectServiceInterface
- Throws:
CcsNotExistException
CcsOperationException
-
createObject
public AccessorObject createObject(AccessorObject accessorObject, String hash, long len, String clientId) throws CcsOperationException, CcsAlreadyExistException, CcsNotExistException, CcsNotAcceptableException Before really creating Object, creates it in DB if possible- Specified by:
createObject
in interfaceAccessorObjectServiceInterface
- Throws:
CcsNotAcceptableException
- if already in creation stepCcsOperationException
CcsAlreadyExistException
CcsNotExistException
-
createObjectFinalize
public AccessorObject createObjectFinalize(AccessorObject accessorObject, String hash, long len, String clientId, boolean external) throws CcsOperationException Once Object really created in Driver Storage, finalize the Object in DB and Replicator if needed- Specified by:
createObjectFinalize
in interfaceAccessorObjectServiceInterface
- Throws:
CcsOperationException
-
deleteObject
public void deleteObject(String bucketName, String objectName, String clientId, boolean external) throws CcsDeletedException, CcsNotExistException, CcsOperationException Delete object in DB and through Replicator if needed- Specified by:
deleteObject
in interfaceAccessorObjectServiceInterface
- Throws:
CcsDeletedException
CcsNotExistException
CcsOperationException
-
inError
Called only when QuarkusStreamHandler is in Error and Object in status UPLOAD or UNKNOWN
-