]> git.basschouten.com Git - openhab-addons.git/blob
4e163711289890c9fbe2dbee6d3358c7037b2d7b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.paradoxalarm.internal.communication;
14
15 import org.openhab.binding.paradoxalarm.internal.exceptions.ParadoxRuntimeException;
16 import org.openhab.binding.paradoxalarm.internal.model.PanelType;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * The {@link ParadoxBuilderFactory} used to create the proper communicator builder objects for different panel
22  * types.
23  *
24  * @author Konstantin Polihronov - Initial contribution
25  */
26 public class ParadoxBuilderFactory {
27
28     private final Logger logger = LoggerFactory.getLogger(ParadoxBuilderFactory.class);
29
30     public ICommunicatorBuilder createBuilder(PanelType panelType) {
31         switch (panelType) {
32             case EVO48:
33             case EVO96:
34             case EVO192:
35             case EVOHD:
36                 logger.debug("Creating new builder for Paradox {} system", panelType);
37                 return new EvoCommunicator.EvoCommunicatorBuilder(panelType);
38             default:
39                 logger.debug("Unsupported panel type: {}", panelType);
40                 throw new ParadoxRuntimeException("Unsupported panel type: " + panelType);
41         }
42     }
43 }