• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WindhoverLabs / yamcs-cfs / #109

22 Sep 2023 07:20PM UTC coverage: 0.0%. Remained the same
#109

push

web-flow
Merge pull request #40 from WindhoverLabs/udp_plugin

-Minimally functional UDP plugin.

60 of 60 new or added lines in 3 files covered. (100.0%)

0 of 6268 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/windhoverlabs/yamcs/util/UdpPlugin.java
1
package com.windhoverlabs.yamcs.util;
2

3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.util.List;
6
import org.yamcs.Plugin;
7
import org.yamcs.PluginException;
8
import org.yamcs.YConfiguration;
9
import org.yamcs.YamcsServer;
10
import org.yamcs.events.EventProducer;
11
import org.yamcs.events.EventProducerFactory;
12
import org.yamcs.http.HttpServer;
13
import org.yamcs.logging.Log;
14

15
public class UdpPlugin implements Plugin {
×
16
  private static final Log log = new Log(UdpPlugin.class);
×
17

18
  @Override
19
  public void onLoad(YConfiguration config) throws PluginException {
20
    YamcsServer yamcs = YamcsServer.getServer();
×
21

22
    EventProducer eventProducer =
×
23
        EventProducerFactory.getEventProducer(null, this.getClass().getSimpleName(), 10000);
×
24

25
    eventProducer.sendInfo("UdpPlugin loaded");
×
26
    List<HttpServer> httpServers = yamcs.getGlobalServices(HttpServer.class);
×
27
    if (httpServers.isEmpty()) {
×
28
      log.warn(
×
29
          "Yamcs does not appear to be running an HTTP Server. The CfsApi was not initialized.");
30
      return;
×
31
    }
32

33
    HttpServer httpServer = httpServers.get(0);
×
34
    // Add API to server
35
    try (InputStream in = getClass().getResourceAsStream("/yamcs-cfs.protobin")) {
×
36
      httpServer.getProtobufRegistry().importDefinitions(in);
×
37
    } catch (IOException e) {
×
38
      throw new PluginException(e);
×
39
    }
×
40

41
    httpServer.addApi(new org.yamcs.http.api.UDPApi());
×
42
  }
×
43

44
  /**
45
   * The workspace directory is the directory that holds all of our yamcs configuration.
46
   *
47
   * @return
48
   */
49
  public String getWorkspaceDir() {
50
    return System.getProperty("user.dir");
×
51
  }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc