001/*
002 * (C) Copyright 2016 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 *     Stephane Lacoin at Nuxeo (aka matic)
016 */
017package org.nuxeo.ecm.core.work;
018
019import org.nuxeo.ecm.core.work.api.WorkQueuingDescriptor;
020import org.nuxeo.runtime.model.ContributionFragmentRegistry;
021
022/**
023 *
024 *
025 * @since 8.3
026 */
027public class WorkQueuingRegistry extends ContributionFragmentRegistry<WorkQueuingDescriptor> {
028
029    Class<? extends WorkQueuing> klass = MemoryWorkQueuing.class;
030
031    @Override
032    public String getContributionId(WorkQueuingDescriptor contrib) {
033        return "singleton";
034    }
035
036    @Override
037    public void contributionUpdated(String id, WorkQueuingDescriptor contrib, WorkQueuingDescriptor newOrigContrib) {
038        klass = contrib.klass;
039    }
040
041    @Override
042    public void contributionRemoved(String id, WorkQueuingDescriptor origContrib) {
043        klass = origContrib.klass;
044    }
045
046    @Override
047    public WorkQueuingDescriptor clone(WorkQueuingDescriptor orig) {
048        WorkQueuingDescriptor other = new WorkQueuingDescriptor();
049        other.klass = orig.klass;
050        return other;
051    }
052
053    @Override
054    public void merge(WorkQueuingDescriptor src, WorkQueuingDescriptor dst) {
055        dst.klass = src.klass;
056    }
057
058
059}