LMS Setup API improvement comment and compile fix (Java8)
This commit is contained in:
parent
7f2b662244
commit
564b7ec9c9
2 changed files with 15 additions and 2 deletions
|
@ -14,10 +14,22 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup;
|
|||
import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||
|
||||
/** Abstract factory to create an LmsAPITemplate for specific LMS type */
|
||||
public interface LmsAPITemplateFactory {
|
||||
|
||||
/** Defines the LMS type if a specific implementation.
|
||||
* This is used by the service to collect and map the template for specific LMS types.
|
||||
*
|
||||
* @return the LMS type if a specific implementation */
|
||||
LmsType lmsType();
|
||||
|
||||
/** Creates a LmsAPITemplate for the specific implements LMS type.
|
||||
*
|
||||
* @param lmsSetup the LMS setup data to initialize the template
|
||||
* @param credentials the access data for accessing the LMS API. Either client credentials or access token from LMS
|
||||
* setup input
|
||||
* @param proxyData The proxy data used to connect to the LMS if needed.
|
||||
* @return Result refer to the LmsAPITemplate or to an error when happened */
|
||||
Result<LmsAPITemplate> create(
|
||||
final LmsSetup lmsSetup,
|
||||
final ClientCredentials credentials,
|
||||
|
|
|
@ -63,11 +63,12 @@ public class LmsAPIServiceImpl implements LmsAPIService {
|
|||
this.lmsSetupDAO = lmsSetupDAO;
|
||||
this.clientCredentialService = clientCredentialService;
|
||||
|
||||
this.templateFactories = new EnumMap<>(lmsAPITemplateFactories
|
||||
final Map<LmsType, LmsAPITemplateFactory> factories = lmsAPITemplateFactories
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
t -> t.lmsType(),
|
||||
Function.identity())));
|
||||
Function.identity()));
|
||||
this.templateFactories = new EnumMap<>(factories);
|
||||
}
|
||||
|
||||
/** Listen to LmsSetupChangeEvent to release an affected LmsAPITemplate from cache
|
||||
|
|
Loading…
Reference in a new issue