001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.platform.ui.web.auth.service; 018 019import org.nuxeo.runtime.model.SimpleContributionRegistry; 020 021/** 022 * Registry handling hot-reload and merge of {@link LoginScreenConfig} contributions. 023 * 024 * @since 7.10 025 */ 026public class LoginScreenConfigRegistry extends SimpleContributionRegistry<LoginScreenConfig> { 027 028 LoginScreenConfig config; 029 030 @Override 031 public String getContributionId(LoginScreenConfig contrib) { 032 // only one contrib 033 return "static"; 034 } 035 036 @Override 037 public void contributionUpdated(String id, LoginScreenConfig contrib, LoginScreenConfig newOrigContrib) { 038 config = contrib; 039 } 040 041 @Override 042 public void contributionRemoved(String id, LoginScreenConfig origContrib) { 043 config = currentContribs.get("static"); 044 } 045 046 @Override 047 public boolean isSupportingMerge() { 048 return true; 049 } 050 051 @Override 052 public LoginScreenConfig clone(LoginScreenConfig orig) { 053 return orig.clone(); 054 } 055 056 @Override 057 public void merge(LoginScreenConfig src, LoginScreenConfig dst) { 058 dst.merge(src); 059 } 060 061 public LoginScreenConfig getConfig() { 062 return config; 063 } 064 065}