Skip to content

Commit 21efc68

Browse files
committed
Resolve merge conflict
2 parents 42c5858 + 7d8db27 commit 21efc68

File tree

276 files changed

+7344
-4440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+7344
-4440
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Alarm Logger Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
paths: services/alarm-logger/**
7+
tags:
8+
- '**'
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}/service-alarm-logger
13+
14+
jobs:
15+
build-server:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup Maven and Java Action
20+
21+
with:
22+
java-version: '17'
23+
maven-version: '3.9.6'
24+
- name: Build
25+
run: mvn --batch-mode install -DskipTests
26+
build-and-push-image:
27+
permissions:
28+
contents: read
29+
packages: write
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Set up JDK 17
34+
uses: actions/setup-java@v4
35+
with:
36+
java-version: '17'
37+
distribution: 'temurin'
38+
cache: maven
39+
- name: Build with Maven
40+
run: mvn --batch-mode --update-snapshots package
41+
- name: Login to the registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ${{ env.REGISTRY }}
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Extract meta-data for Docker
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
- name: Set up Docker Build
53+
uses: docker/setup-buildx-action@v3
54+
- name: Build and publish the Docker image
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: services/alarm-logger
58+
push: true
59+
platforms: linux/amd64
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Alarm Server Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
paths: services/alarm-server/**
7+
tags:
8+
- '**'
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}/service-alarm-server
13+
14+
jobs:
15+
build-server:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup Maven and Java Action
20+
21+
with:
22+
java-version: '17'
23+
maven-version: '3.9.6'
24+
- name: Build
25+
run: mvn --batch-mode install -DskipTests
26+
build-and-push-image:
27+
permissions:
28+
contents: read
29+
packages: write
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Set up JDK 17
34+
uses: actions/setup-java@v4
35+
with:
36+
java-version: '17'
37+
distribution: 'temurin'
38+
cache: maven
39+
- name: Build with Maven
40+
run: mvn --batch-mode --update-snapshots package
41+
- name: Login to the registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ${{ env.REGISTRY }}
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Extract meta-data for Docker
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
- name: Set up Docker Build
53+
uses: docker/setup-buildx-action@v3
54+
- name: Build and publish the Docker image
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: services/alarm-server
58+
push: true
59+
platforms: linux/amd64
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- name: Setup Maven and Java Action
15-
uses: s4u/setup-maven-action@v1.13.0
15+
uses: s4u/setup-maven-action@v1.18.0
1616
with:
1717
java-version: '17'
1818
maven-version: '3.9.6'

.github/workflows/build_latest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ jobs:
1414

1515
runs-on: ${{ matrix.os }}
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- name: Setup Maven and Java Action
19-
uses: s4u/setup-maven-action@v1.13.0
19+
uses: s4u/setup-maven-action@v1.18.0
2020
with:
2121
java-version: '17'
2222
maven-version: '3.9.6'
2323
- name: Build
2424
run: mvn --batch-mode install -DskipTests
2525

2626
- name: Archive build artifacts
27-
uses: actions/upload-artifact@v3
27+
uses: actions/upload-artifact@v4
2828
with:
2929
name: Phoebus product ${{ matrix.os }}
3030
path: |

.github/workflows/build_swagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- name: Setup Maven and Java Action
15-
uses: s4u/setup-maven-action@v1.13.0
15+
uses: s4u/setup-maven-action@v1.18.0
1616
with:
1717
java-version: '17'
1818
maven-version: '3.9.6'
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Save-And-Restore Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
paths: services/save-and-restore/**
7+
tags:
8+
- '**'
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}/service-save-and-restore
13+
14+
jobs:
15+
build-and-push-image:
16+
permissions:
17+
contents: read
18+
packages: write
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: '17'
26+
distribution: 'temurin'
27+
cache: maven
28+
- name: Build with Maven
29+
run: mvn --batch-mode --update-snapshots package
30+
- name: Login to the registry
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Extract meta-data for Docker
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
- name: Set up Docker Build
42+
uses: docker/setup-buildx-action@v3
43+
- name: Build and publish the Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: services/save-and-restore
47+
push: true
48+
platforms: linux/amd64
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
cache-from: type=gha
52+
cache-to: type=gha,mode=max

app/alarm/audio-annunciator/src/main/java/org/phoebus/applications/alarm/audio/annunciator/AudioAnnunciator.java

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import org.phoebus.applications.alarm.ui.annunciator.AnnunciatorMessage;
1616

1717
import java.util.List;
18+
import java.util.logging.Level;
19+
import java.util.logging.Logger;
1820

1921
/**
2022
* Annunciator class. Uses Audio files to annunciate passed messages.
@@ -23,6 +25,7 @@
2325
*/
2426
@SuppressWarnings("nls")
2527
public class AudioAnnunciator implements Annunciator {
28+
private static final Logger logger = Logger.getLogger(AudioAnnunciator.class.getName());
2629
private final MediaPlayer alarmSound;
2730
private final MediaPlayer minorAlarmSound;
2831
private final MediaPlayer majorAlarmSound;
@@ -33,26 +36,63 @@ public class AudioAnnunciator implements Annunciator {
3336
* Constructor
3437
*/
3538
public AudioAnnunciator() {
36-
alarmSound = new MediaPlayer(new Media(Preferences.alarm_sound_url));
37-
minorAlarmSound = new MediaPlayer(new Media(Preferences.minor_alarm_sound_url));
38-
majorAlarmSound = new MediaPlayer(new Media(Preferences.major_alarm_sound_url));
39-
invalidAlarmSound = new MediaPlayer(new Media(Preferences.invalid_alarm_sound_url));
40-
undefinedAlarmSound = new MediaPlayer(new Media(Preferences.undefined_alarm_sound_url));
39+
alarmSound = createMediaPlayer(Preferences.alarm_sound_url);
40+
minorAlarmSound = createMediaPlayer(Preferences.minor_alarm_sound_url);
41+
majorAlarmSound = createMediaPlayer(Preferences.major_alarm_sound_url);
42+
invalidAlarmSound = createMediaPlayer(Preferences.invalid_alarm_sound_url);
43+
undefinedAlarmSound = createMediaPlayer(Preferences.undefined_alarm_sound_url);
4144
// configure the media players for the different alarm sounds
4245
List.of(alarmSound, minorAlarmSound, majorAlarmSound, invalidAlarmSound, undefinedAlarmSound)
4346
.forEach(sound -> {
44-
sound.setStopTime(Duration.seconds(Preferences.max_alarm_duration));
45-
sound.setVolume(Preferences.volume);
47+
if (sound != null) {
48+
sound.setStopTime(Duration.seconds(Preferences.max_alarm_duration));
49+
sound.setVolume(Preferences.volume);
50+
}
4651
});
4752
}
4853

54+
/**
55+
* Create a MediaPlayer for the given URL
56+
*
57+
* @param url URL of the audio file
58+
* @return MediaPlayer
59+
*/
60+
private MediaPlayer createMediaPlayer(String url) {
61+
try {
62+
MediaPlayer player = new MediaPlayer(new Media(url));
63+
if (player.getError() == null) {
64+
player.setOnError(() -> logger.log(Level.SEVERE, "Error playing alarm sound: " + url, player.getError()));
65+
player.setOnPlaying(() -> logger.log(Level.FINE, "Playing alarm sound: " + url));
66+
player.setOnStopped(() -> logger.log(Level.FINE, "Alarm sound stopped: " + url));
67+
player.setOnEndOfMedia(() -> logger.log(Level.FINE, "Alarm sound finished: " + url));
68+
return player;
69+
}
70+
else {
71+
logger.log(Level.SEVERE, "Error creating MediaPlayer for URL: " + url, player.getError());
72+
return null;
73+
}
74+
} catch (Exception e) {
75+
logger.log(Level.SEVERE, "Failed to create MediaPlayer for URL: " + url, e);
76+
return null;
77+
}
78+
}
79+
4980
/**
5081
* Annunciate the message.
5182
*
5283
* @param message Message text
5384
*/
5485
@Override
5586
public void speak(final AnnunciatorMessage message) {
87+
if (message == null) {
88+
logger.log(Level.WARNING, "Received null AnnunciatorMessage");
89+
return;
90+
}
91+
if (message.severity == null) {
92+
logger.log(Level.WARNING, "Received AnnunciatorMessage with null severity: " + message + ". Playing default alarm sound");
93+
speakAlone(alarmSound); // Play the default alarm sound
94+
return;
95+
}
5696
switch (message.severity) {
5797
case MINOR -> speakAlone(minorAlarmSound);
5898
case MAJOR -> speakAlone(majorAlarmSound);
@@ -62,12 +102,27 @@ public void speak(final AnnunciatorMessage message) {
62102
}
63103
}
64104

105+
/**
106+
* Play the alarm sound alone by first stopping any alarm sounds.
107+
*
108+
* @param alarm Alarm sound
109+
*/
65110
synchronized private void speakAlone(MediaPlayer alarm) {
111+
if (alarm == null) {
112+
logger.log(Level.WARNING, "Alarm sound is null, cannot play sound");
113+
return;
114+
}
66115
List.of(alarmSound, minorAlarmSound, majorAlarmSound, invalidAlarmSound, undefinedAlarmSound)
67116
.forEach(sound -> {
68-
sound.stop();
117+
if (sound != null) {
118+
sound.stop();
119+
}
69120
});
70-
alarm.play();
121+
try {
122+
alarm.play();
123+
} catch (Exception e) {
124+
logger.log(Level.SEVERE, "Failed to play alarm sound", e);
125+
}
71126
}
72127

73128
/**
@@ -77,8 +132,14 @@ synchronized private void speakAlone(MediaPlayer alarm) {
77132
public void shutdown() {
78133
List.of(alarmSound, minorAlarmSound, majorAlarmSound, invalidAlarmSound, undefinedAlarmSound)
79134
.forEach(sound -> {
80-
sound.stop();
81-
sound.dispose();
135+
if (sound != null) {
136+
try {
137+
sound.stop();
138+
sound.dispose();
139+
} catch (Exception e) {
140+
logger.log(Level.WARNING, "Failed to stop and dispose alarm sound" , e);
141+
}
142+
}
82143
});
83144
}
84145
}

app/alarm/logging-ui/src/main/java/org/phoebus/applications/alarm/logging/ui/AlarmLogTable.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.stream.Collectors;
1111

1212
import org.phoebus.framework.nls.NLS;
13+
import org.phoebus.framework.persistence.Memento;
1314
import org.phoebus.framework.spi.AppDescriptor;
1415
import org.phoebus.framework.spi.AppInstance;
1516
import org.phoebus.ui.docking.DockItem;
@@ -87,4 +88,16 @@ public void setNodeResource(URI resource) {
8788
controller.setSearchString(parsedQuery);
8889
controller.setIsNodeTable(true);
8990
}
91+
92+
@Override
93+
public void restore(final Memento memento)
94+
{
95+
controller.restore(memento);
96+
}
97+
98+
@Override
99+
public void save(final Memento memento)
100+
{
101+
controller.save(memento);
102+
}
90103
}

0 commit comments

Comments
 (0)