diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPITemplateFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPITemplateFactory.java index 518b1b74..391258ff 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPITemplateFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/LmsAPITemplateFactory.java @@ -11,7 +11,11 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.lms; 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 */ +/** Abstract factory to create an LmsAPITemplate for specific LMS type. + * Since a LmsAPITemplate of a specific LMS type + * is whether a singleton component nor a simple prototype but one (singleton) instance + * can exist per defined LMSSetup, we need a specialized factory to build such + * a LmsAPITemplate for a specific LMSSetup. */ public interface LmsAPITemplateFactory { /** Defines the LMS type if a specific implementation. diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplateFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplateFactory.java index d64e54e1..e768bccf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplateFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsAPITemplateFactory.java @@ -8,9 +8,12 @@ package ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.olat; +import org.springframework.cache.CacheManager; import org.springframework.context.annotation.Lazy; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; +import ch.ethz.seb.sebserver.gbl.async.AsyncService; import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetup.LmsType; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; import ch.ethz.seb.sebserver.gbl.util.Result; @@ -21,8 +24,29 @@ import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplateFactory; @Lazy @Service @WebServiceProfile +/** Factory for OlatLmsAPITemplate. Since a LmsAPITemplate of a specific LMS type + * is whether a singleton component nor a simple prototype but one (singleton) instance + * can exist per defined LMSSetup, we need a specialized factory to build such + * a LmsAPITemplate for a specific LMSSetup. + * create(final APITemplateDataSupplier apiTemplateDataSupplier) { - // TODO Auto-generated method stub - return null; + return Result.tryCatch(() -> { + return new OlatLmsAPITemplate( + apiTemplateDataSupplier, + this.asyncService, + this.environment, + this.cacheManager); + }); } }