001/* 002 * (C) Copyright 2017-2018 Nuxeo (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 * 017 * Contributors: 018 * bdelbosc 019 */ 020package org.nuxeo.runtime.stream; 021 022import java.util.ArrayList; 023import java.util.HashMap; 024import java.util.List; 025import java.util.Map; 026 027import org.nuxeo.common.xmap.annotation.XNode; 028import org.nuxeo.common.xmap.annotation.XNodeList; 029import org.nuxeo.common.xmap.annotation.XNodeMap; 030import org.nuxeo.common.xmap.annotation.XObject; 031import org.nuxeo.runtime.model.Descriptor; 032 033@XObject("logConfig") 034public class LogConfigDescriptor implements Descriptor { 035 036 @XObject(value = "log") 037 public static class StreamDescriptor implements Descriptor { 038 039 public static final Integer DEFAULT_PARTITIONS = 4; 040 041 @XNode("@name") 042 public String name; 043 044 @XNode("@size") 045 public Integer size = DEFAULT_PARTITIONS; 046 047 @Override 048 public String getId() { 049 return name; 050 } 051 } 052 053 @XNode("@name") 054 public String name; 055 056 @XNode("@type") 057 public String type; 058 059 @XNodeMap(value = "option", key = "@name", type = HashMap.class, componentType = String.class) 060 public Map<String, String> options = new HashMap<>(); 061 062 @XNodeList(value = "log", type = ArrayList.class, componentType = StreamDescriptor.class) 063 public List<StreamDescriptor> logs = new ArrayList<>(); 064 065 @Override 066 public String getId() { 067 return name; 068 } 069 070}