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 *
009 * Contributors:
010 */
011package org.nuxeo.ecm.core.opencmis.bindings;
012
013import java.util.HashMap;
014import java.util.Map;
015
016import org.nuxeo.common.xmap.annotation.XNode;
017import org.nuxeo.common.xmap.annotation.XNodeMap;
018import org.nuxeo.common.xmap.annotation.XObject;
019
020/**
021 * Nuxeo CmisServiceFactory Descriptor.
022 */
023@XObject(value = "factory")
024public class NuxeoCmisServiceFactoryDescriptor {
025
026    @XNode("@class")
027    public Class<? extends NuxeoCmisServiceFactory> factoryClass;
028
029    public Class<? extends NuxeoCmisServiceFactory> getFactoryClass() {
030        return factoryClass == null ? NuxeoCmisServiceFactory.class : factoryClass;
031    }
032
033    @XNodeMap(value = "parameter", key = "@name", type = HashMap.class, componentType = String.class)
034    public Map<String, String> factoryParameters = new HashMap<>();
035
036    public NuxeoCmisServiceFactoryDescriptor() {
037    }
038
039    /** Copy constructor. */
040    public NuxeoCmisServiceFactoryDescriptor(NuxeoCmisServiceFactoryDescriptor other) {
041        factoryClass = other.factoryClass;
042        factoryParameters = new HashMap<>(other.factoryParameters);
043    }
044
045    public void merge(NuxeoCmisServiceFactoryDescriptor other) {
046        if (other.factoryClass != null) {
047            factoryClass = other.factoryClass;
048        }
049        factoryParameters.putAll(other.factoryParameters);
050    }
051
052}