Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/queue-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.19.1</version>
</dependency>
<!-- Jython for Python scripting -->
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>${jython.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@SuppressWarnings("nls")
public final class QueueServerApp implements AppResourceDescriptor {

public static final Logger LOGGER = Logger.getLogger(QueueServerApp.class.getPackageName());
public static final Logger logger = Logger.getLogger(QueueServerApp.class.getPackageName());

public static final String NAME = "queue-server";
private static final String DISPLAY_NAME = "Queue Server";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static RunEngineHttpClient get() {
private final String base;
private final String apiKey;
private final RateLimiter limiter;
private static final Logger LOG = HttpSupport.LOG;
private static final Logger logger = HttpSupport.logger;

private RunEngineHttpClient(String baseUrl, String apiKey, double permitsPerSecond) {
this.http = HttpClient.newBuilder()
Expand Down Expand Up @@ -118,14 +118,14 @@ private <T> T executeWithRetry(HttpRequest req, ApiEndpoint ep,
limiter.acquire();
long t0 = System.nanoTime();
try {
LOG.log(Level.FINEST, ep + " attempt " + attempt);
logger.log(Level.FINEST, ep + " attempt " + attempt);
HttpResponse<String> rsp = http.send(req, HttpResponse.BodyHandlers.ofString());
LOG.log(Level.FINEST, ep + " " + rsp.statusCode() + " " + HttpSupport.elapsed(t0) + " ms");
logger.log(Level.FINEST, ep + " " + rsp.statusCode() + " " + HttpSupport.elapsed(t0) + " ms");
check(rsp, ep);
return reader.apply(rsp);
} catch (java.io.IOException ex) {
if (!HttpSupport.isRetryable(req) || attempt >= HttpSupport.MAX_RETRIES) throw ex;
LOG.log(Level.WARNING, ep + " transport error (" + ex.getClass().getSimpleName() +
logger.log(Level.WARNING, ep + " transport error (" + ex.getClass().getSimpleName() +
"), retry in " + back + " ms (attempt " + attempt + ")");
Thread.sleep(back);
back = Math.round(back * HttpSupport.BACKOFF_MULTIPLIER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
public final class RunEngineService {

private final RunEngineHttpClient http = RunEngineHttpClient.get();
private static final Logger LOG = Logger.getLogger(RunEngineService.class.getName());
private static final Logger logger = Logger.getLogger(RunEngineService.class.getPackageName());

/* ---- Ping & status --------------------------------------------------- */

public Envelope<?> ping() throws Exception { return http.call(ApiEndpoint.PING, NoBody.INSTANCE); }
public StatusResponse status() throws Exception {
LOG.log(Level.FINEST, "Fetching status");
logger.log(Level.FINEST, "Fetching status");
return http.send(ApiEndpoint.STATUS, NoBody.INSTANCE, StatusResponse.class);
}
public Envelope<?> configGet() throws Exception { return http.call(ApiEndpoint.CONFIG_GET, NoBody.INSTANCE); }
Expand Down Expand Up @@ -168,7 +168,7 @@ public Envelope<?> queueItemUpdate(QueueItem item) throws Exception {
/* ───────── Console monitor ───────── */

public InputStream streamConsoleOutput() throws Exception {
LOG.info("Opening console output stream");
logger.log(Level.FINE, "Opening console output stream");
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create(http.getBaseUrl() + ApiEndpoint.STREAM_CONSOLE_OUTPUT.endpoint().path()))
.header("Authorization", "ApiKey " + http.getApiKey())
Expand All @@ -178,10 +178,10 @@ public InputStream streamConsoleOutput() throws Exception {
HttpResponse<InputStream> rsp =
http.httpClient().send(req, HttpResponse.BodyHandlers.ofInputStream());
if (rsp.statusCode() < 200 || rsp.statusCode() >= 300) {
LOG.log(Level.WARNING, "Console stream failed with HTTP " + rsp.statusCode());
logger.log(Level.WARNING, "Console stream failed with HTTP " + rsp.statusCode());
throw new IOException("console stream - HTTP " + rsp.statusCode());
}
LOG.info("Console output stream opened successfully");
logger.log(Level.FINE, "Console output stream opened successfully");
return rsp.body();
}

Expand Down Expand Up @@ -251,7 +251,7 @@ public Envelope<?> rePause(String option) throws Exception {

public Envelope<?> plansAllowed() throws Exception { return http.call(ApiEndpoint.PLANS_ALLOWED, NoBody.INSTANCE); }
public Map<String, Object> plansAllowedRaw() throws Exception {
LOG.log(Level.FINE, "Fetching plans allowed (raw)");
logger.log(Level.FINE, "Fetching plans allowed (raw)");
return http.send(ApiEndpoint.PLANS_ALLOWED, NoBody.INSTANCE);
}
public Envelope<?> devicesAllowed() throws Exception { return http.call(ApiEndpoint.DEVICES_ALLOWED, NoBody.INSTANCE); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,55 @@
import org.phoebus.applications.queueserver.view.ViewFactory;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableView;

import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;

public final class ApplicationController implements Initializable {

@FXML private Tab monitorQueueTab;
@FXML private Tab editAndControlQueueTab;

private static final Logger LOG = Logger.getLogger(ApplicationController.class.getName());
@FXML private TabPane tabPane;

private static final Logger logger = Logger.getLogger(ApplicationController.class.getPackageName());

@Override public void initialize(URL url, ResourceBundle rb) {
LOG.info("Initializing ApplicationController");
logger.log(Level.FINE, "Initializing ApplicationController");
monitorQueueTab.setContent(ViewFactory.MONITOR_QUEUE.get());
editAndControlQueueTab.setContent(ViewFactory.EDIT_AND_CONTROL_QUEUE.get());
LOG.info("ApplicationController initialization complete");

// Disable focus traversal on all components
disableFocusTraversal(monitorQueueTab.getContent());
disableFocusTraversal(editAndControlQueueTab.getContent());

logger.log(Level.FINE, "ApplicationController initialization complete");
}

/**
* Recursively disables focus traversal on all nodes in the scene graph,
* except for TableView which remains focus traversable for arrow key navigation.
*/
private void disableFocusTraversal(Node node) {
if (node == null) return;

// Allow TableView to remain focus traversable for arrow key navigation
if (!(node instanceof TableView)) {
node.setFocusTraversable(false);
}

if (node instanceof Parent) {
Parent parent = (Parent) node;
for (Node child : parent.getChildrenUnmodifiable()) {
disableFocusTraversal(child);
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class EditAndControlQueueController implements Initializable {
@FXML private AnchorPane planQueueContainer;
@FXML private AnchorPane planHistoryContainer;

private static final Logger LOG = Logger.getLogger(EditAndControlQueueController.class.getName());
private static final Logger logger = Logger.getLogger(EditAndControlQueueController.class.getPackageName());

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
LOG.info("Initializing EditAndControlQueueController");
logger.log(Level.FINE, "Initializing EditAndControlQueueController");
loadInto(runningPlanContainer, "/org/phoebus/applications/queueserver/view/ReRunningPlan.fxml", new ReRunningPlanController(false));
loadInto(planQueueContainer, "/org/phoebus/applications/queueserver/view/RePlanQueue.fxml", new RePlanQueueController(false));
loadInto(planHistoryContainer, "/org/phoebus/applications/queueserver/view/RePlanHistory.fxml", new RePlanHistoryController(false));
Expand All @@ -40,7 +40,7 @@ private void loadInto(AnchorPane container, String fxml, Object controller) {
AnchorPane.setLeftAnchor(view, 0.0);
AnchorPane.setRightAnchor(view, 0.0);
} catch (IOException e) {
LOG.log(Level.SEVERE, "Failed to load FXML: " + fxml, e);
logger.log(Level.SEVERE, "Failed to load FXML: " + fxml, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MonitorQueueController implements Initializable {
@FXML private VBox stack;

private final Map<TitledPane, Double> savedHeights = new HashMap<>();
private static final Logger LOG = Logger.getLogger(MonitorQueueController.class.getName());
private static final Logger logger = Logger.getLogger(MonitorQueueController.class.getPackageName());

private static final String BAR_NORMAL =
"-fx-background-color: linear-gradient(to bottom, derive(-fx-base,15%) 0%, derive(-fx-base,-5%) 100%);" +
Expand All @@ -34,7 +34,7 @@ public class MonitorQueueController implements Initializable {

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
LOG.info("Initializing MonitorQueueController");
logger.log(Level.FINE, "Initializing MonitorQueueController");
loadInto(runningPlanContainer, "/org/phoebus/applications/queueserver/view/ReRunningPlan.fxml", new ReRunningPlanController(true));
loadInto(planQueueContainer, "/org/phoebus/applications/queueserver/view/RePlanQueue.fxml", new RePlanQueueController(true));
loadInto(planHistoryContainer, "/org/phoebus/applications/queueserver/view/RePlanHistory.fxml", new RePlanHistoryController(true));
Expand Down Expand Up @@ -76,7 +76,7 @@ private void loadInto(AnchorPane container, String fxml, Object controller) {
AnchorPane.setLeftAnchor(view, 0.0);
AnchorPane.setRightAnchor(view, 0.0);
} catch (IOException e) {
LOG.log(Level.SEVERE, "Failed to load FXML: " + fxml, e);
logger.log(Level.SEVERE, "Failed to load FXML: " + fxml, e);
}
}

Expand Down
Loading