001/*******************************************************************************
002 * Copyright (c) 2006-2014 Nuxeo SA (http://nuxeo.com/) and others.
003 * 
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 ******************************************************************************/
009package org.nuxeo.ecm.core.redis;
010
011import org.nuxeo.runtime.model.SimpleContributionRegistry;
012
013public class SingletonContributionRegistry<T> extends SimpleContributionRegistry<T> {
014
015    protected T main;
016
017    @Override
018    public String getContributionId(T contrib) {
019        return "main";
020    }
021
022    @Override
023    public void contributionUpdated(String id, T contrib, T newOrigContrib) {
024        main = contrib;
025    }
026
027    @Override
028    public void contributionRemoved(String id, T origContrib) {
029        main = null;
030    }
031}