package riomhaire.lti.core.infrastructure.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.ModelAndView;
import riomhaire.lti.core.model.LTIMessage;
import riomhaire.lti.core.model.interfaces.ApplicationRegistry;
import riomhaire.lti.core.model.interfaces.CommandDispatcher;

import javax.annotation.PostConstruct;

public class Endpoint {
    // Logger
    protected Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ApplicationRegistry registry;

    private CommandDispatcher<ModelAndView, ApplicationRegistry, LTIMessage> dispatcher;

    @PostConstruct
    protected void initEndpoint() {
        dispatcher = registry.commandDispatcher();
    }

    /**
     * Return the dispatcher
     * @return
     */
    public CommandDispatcher<ModelAndView, ApplicationRegistry, LTIMessage> getDispatcher() {
        return dispatcher;
    }


    public ApplicationRegistry getRegistry() {
        return registry;
    }

}
