pl.edu.icm.unity.webadmin.WebAdminEndpointFactory Maven / Gradle / Ivy
/*
* Copyright (c) 2013 ICM Uniwersytet Warszawski All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.webadmin;
import java.util.Collections;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import pl.edu.icm.unity.MessageSource;
import pl.edu.icm.unity.engine.api.endpoint.EndpointFactory;
import pl.edu.icm.unity.engine.api.endpoint.EndpointInstance;
import pl.edu.icm.unity.engine.api.server.AdvertisedAddressProvider;
import pl.edu.icm.unity.engine.api.server.NetworkServer;
import pl.edu.icm.unity.types.endpoint.EndpointTypeDescription;
import pl.edu.icm.unity.webui.VaadinEndpoint;
import pl.edu.icm.unity.webui.authn.VaadinAuthentication;
/**
* Factory creating endpoints exposing {@link WebAdminUI}.
* @author K. Benedyczak
*/
@Component
public class WebAdminEndpointFactory implements EndpointFactory
{
public static final String NAME = "WebAdminUI";
public static final String SERVLET_PATH = "/admin";
public static final EndpointTypeDescription TYPE = new EndpointTypeDescription(NAME,
"Web administrative user interface", VaadinAuthentication.NAME,
Collections.singletonMap(SERVLET_PATH, "Web admin endpoint"));
private ApplicationContext applicationContext;
private NetworkServer server;
private MessageSource msg;
private AdvertisedAddressProvider advertisedAddrProvider;
@Autowired
public WebAdminEndpointFactory(ApplicationContext applicationContext,
NetworkServer server,
AdvertisedAddressProvider advertisedAddrProvider,
MessageSource msg)
{
this.applicationContext = applicationContext;
this.server = server;
this.msg = msg;
this.advertisedAddrProvider = advertisedAddrProvider;
}
@Override
public EndpointTypeDescription getDescription()
{
return TYPE;
}
@Override
public EndpointInstance newInstance()
{
return new VaadinEndpoint(server, advertisedAddrProvider, msg, applicationContext,
WebAdminUI.class.getSimpleName(), SERVLET_PATH);
}
}