001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Guillaume 018 */ 019package org.nuxeo.ecm.core.blob; 020 021import java.util.HashMap; 022import java.util.Map; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XNodeMap; 026import org.nuxeo.common.xmap.annotation.XObject; 027 028/** 029 * Descriptor for a {@link BlobProvider}. 030 */ 031@XObject(value = "blobprovider") 032public class BlobProviderDescriptor { 033 034 public static final String PREVENT_USER_UPDATE = "preventUserUpdate"; 035 036 /** 037 * Flags this blob provider as transient: blobs may disappear after a while, so a caller should not rely on them 038 * being available forever. 039 * 040 * @since 10.1 041 */ 042 public static final String TRANSIENT = "transient"; 043 044 /** 045 * A comma-separated list of users that can create blobs in this blob provider based only on a key. 046 * 047 * @since 10.2 048 */ 049 public static final String CREATE_FROM_KEY_USERS = "createFromKey.users"; 050 051 /** 052 * A comma-separated list of groups that can create blobs in this blob provider based only on a key. 053 * 054 * @since 10.2 055 */ 056 public static final String CREATE_FROM_KEY_GROUPS = "createFromKey.groups"; 057 058 @XNode("@name") 059 public String name = ""; 060 061 @XNode("class") 062 public Class<?> klass; 063 064 @XNodeMap(value = "property", key = "@name", type = HashMap.class, componentType = String.class) 065 public Map<String, String> properties = new HashMap<String, String>(); 066 067 public BlobProviderDescriptor() { 068 } 069 070 /** Copy constructor. */ 071 public BlobProviderDescriptor(BlobProviderDescriptor other) { 072 name = other.name; 073 klass = other.klass; 074 properties = new HashMap<String, String>(other.properties); 075 } 076 077 public void merge(BlobProviderDescriptor other) { 078 if (other.name != null) { 079 name = other.name; 080 } 081 if (other.klass != null) { 082 klass = other.klass; 083 } 084 properties.putAll(other.properties); 085 } 086 087}