]> git.basschouten.com Git - openhab-addons.git/blob
0d9aa977cef340d80eb02ab7b0c4f2c252202d88
[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.astro.internal.job;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.astro.internal.AstroHandlerFactory;
17 import org.openhab.binding.astro.internal.handler.AstroThingHandler;
18
19 /**
20  * Scheduled job for planets
21  *
22  * @author Gerhard Riegler - Initial contribution
23  * @author Amit Kumar Mondal - Implementation to be compliant with ESH Scheduler
24  */
25 @NonNullByDefault
26 public final class PublishPlanetJob extends AbstractJob {
27
28     /**
29      * Constructor
30      *
31      * @param thingUID thing UID
32      * @throws IllegalArgumentException
33      *             if the provided argument is {@code null}
34      */
35     public PublishPlanetJob(String thingUID) {
36         super(thingUID);
37     }
38
39     @Override
40     public void run() {
41         AstroThingHandler astroHandler = AstroHandlerFactory.getHandler(getThingUID());
42         if (astroHandler != null) {
43             astroHandler.publishDailyInfo();
44         } else {
45             LOGGER.trace("AstroThingHandler is null");
46         }
47     }
48
49     @Override
50     public String toString() {
51         return "Publish planet job " + getThingUID();
52     }
53 }