2 * Copyright © 2015 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altoslib_11;
23 import java.util.concurrent.*;
27 public class AltosLaunchSites extends Thread {
29 LinkedList<AltosLaunchSite> sites;
30 AltosLaunchSiteListener listener;
32 void notify_complete() {
33 listener.notify_launch_sites(sites);
36 void add(AltosLaunchSite site) {
40 void add(String line) {
42 add(new AltosLaunchSite(line));
43 } catch (ParseException pe) {
44 System.out.printf("parse exception %s\n", pe.toString());
52 path = System.getenv(AltosLib.launch_sites_env);
54 path = AltosLib.launch_sites_url;
56 URLConnection uc = url.openConnection();
58 InputStreamReader in_stream = new InputStreamReader(uc.getInputStream(), AltosLib.unicode_set);
59 BufferedReader in = new BufferedReader(in_stream);
62 String line = in.readLine();
67 } catch (Exception e) {
68 System.out.printf("file exception %s\n", e.toString());
74 public AltosLaunchSites(AltosLaunchSiteListener listener) {
75 sites = new LinkedList<AltosLaunchSite>();
76 this.listener = listener;