Class RemoteRepositoryImpl<Type extends IridaRepresentationModel>
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.repositories.remote.impl.RemoteRepositoryImpl<Type>
-
- Type Parameters:
Type
- The type of object to be stored in this repository (extendsIridaRepresentationModel
)
- All Implemented Interfaces:
RemoteRepository<Type>
- Direct Known Subclasses:
Fast5ObjectRemoteRepositoryImpl
,GenomeAssemblyRemoteRepositoryImpl
,ProjectRemoteRepositoryImpl
,SampleRemoteRepositoryImpl
,SequenceFilePairRemoteRepositoryImpl
,SequenceFileRemoteRepositoryImpl
,SingleEndSequenceFileRemoteRepositoryImpl
public abstract class RemoteRepositoryImpl<Type extends IridaRepresentationModel> extends java.lang.Object implements RemoteRepository<Type>
Remote repository to request from remote IRIDA instances usingOAuthTokenRestTemplate
s
-
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.core.ParameterizedTypeReference<ListResourceWrapper<Type>>
listTypeReference
protected org.springframework.core.ParameterizedTypeReference<ResourceWrapper<Type>>
objectTypeReference
-
Constructor Summary
Constructors Constructor Description RemoteRepositoryImpl(RemoteAPITokenService tokenService, UserService userService, org.springframework.core.ParameterizedTypeReference<ListResourceWrapper<Type>> listTypeReference, org.springframework.core.ParameterizedTypeReference<ResourceWrapper<Type>> objectTypeReference)
Create a new repository with the given rest template and object params
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getServiceStatus(RemoteAPI remoteAPI)
Get the status of the remote servicejava.util.List<Type>
list(java.lang.String uri, RemoteAPI remoteAPI)
List the resources available from this serviceType
read(java.lang.String uri, RemoteAPI remoteAPI)
Read an individual resourceprotected <T extends IridaRepresentationModel>
TsetRemoteStatus(T entity, RemoteAPI api)
Set theRemoteStatus
of a read remote entity
-
-
-
Field Detail
-
listTypeReference
protected final org.springframework.core.ParameterizedTypeReference<ListResourceWrapper<Type extends IridaRepresentationModel>> listTypeReference
-
objectTypeReference
protected final org.springframework.core.ParameterizedTypeReference<ResourceWrapper<Type extends IridaRepresentationModel>> objectTypeReference
-
-
Constructor Detail
-
RemoteRepositoryImpl
public RemoteRepositoryImpl(RemoteAPITokenService tokenService, UserService userService, org.springframework.core.ParameterizedTypeReference<ListResourceWrapper<Type>> listTypeReference, org.springframework.core.ParameterizedTypeReference<ResourceWrapper<Type>> objectTypeReference)
Create a new repository with the given rest template and object params- Parameters:
tokenService
- service storing api tokens for communication with the remote APIsuserService
- service for reading userslistTypeReference
- AParameterizedTypeReference
for objects listed by the rest templateobjectTypeReference
- AParameterizedTypeReference
for individual resources read by the rest template
-
-
Method Detail
-
read
public Type read(java.lang.String uri, RemoteAPI remoteAPI)
Read an individual resource- Specified by:
read
in interfaceRemoteRepository<Type extends IridaRepresentationModel>
- Parameters:
uri
- The URI of the resource to readremoteAPI
- the API to read from- Returns:
- An object of Type
-
list
public java.util.List<Type> list(java.lang.String uri, RemoteAPI remoteAPI)
List the resources available from this service- Specified by:
list
in interfaceRemoteRepository<Type extends IridaRepresentationModel>
- Parameters:
uri
- the URI of the resource to list.remoteAPI
- The API to read from- Returns:
- A
List<Type>
of the resources available
-
getServiceStatus
public boolean getServiceStatus(RemoteAPI remoteAPI)
Get the status of the remote service- Specified by:
getServiceStatus
in interfaceRemoteRepository<Type extends IridaRepresentationModel>
- Parameters:
remoteAPI
- The API to check status for- Returns:
- true if the service is active
-
setRemoteStatus
protected <T extends IridaRepresentationModel> T setRemoteStatus(T entity, RemoteAPI api)
Set theRemoteStatus
of a read remote entity- Type Parameters:
T
- The type of entity you're setting status of- Parameters:
entity
- The entity to set the remote status onapi
- The API to connect to- Returns:
- the enhanced entity
-
-