Skip to content

Commit 6f569fe

Browse files
authored
Merge pull request #3067 from ControlSystemStudio/save-and-restore-default-epics-protocol
Override default EPICS protocol for save&restore service. Updated doc.
2 parents 99614b6 + 79e36ec commit 6f569fe

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

services/save-and-restore/doc/index.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The save-and-restore service implements service as a collection
55
of REST endpoints. These can be used by clients to manage configurations (aka save sets) and
66
snapshots, to compare snapshots and to restore PV values from snapshots.
77

8-
The service is packaged as a self-contained Spring Boot jar file. External dependencies are limited to a JVM (Java 11+)
8+
The service is packaged as a self-contained Spring Boot jar file. External dependencies are limited to a JVM (Java 17+)
99
and a running instance of Elasticsearch (8.x).
1010

1111
Running the service
@@ -14,6 +14,18 @@ Running the service
1414
The file ``application.properties`` lists a few settings that can be customized to each site's need, e.g.
1515
connection parameters for Elasticsearch.
1616

17+
Server-side IOC communication
18+
-----------------------------
19+
20+
The service exposes endpoints for reading and writing PVs, i.e. to create or restore snapshots. Depending on the
21+
setup this server-side IOC communication may need some configuration:
22+
23+
For ca (channel access) the service must be started with the ``-Dca.use_env=true`` Java option, and the list of
24+
gateways - if any - must be set as a system environment named ``EPICS_CA_ADDR_LIST``.
25+
26+
For pva (pv access) the service must be started with the ``-DdefaultProtocol=pva`` Java option, and the list of
27+
gateways - if any - must be set as a system environment named ``EPICS_PVA_ADDR_LIST``.
28+
1729
Elasticsearch setup
1830
-------------------
1931

services/save-and-restore/src/main/java/org/phoebus/service/saveandrestore/application/Application.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.phoebus.service.saveandrestore.application;
1919

20+
import org.phoebus.pv.PVPool;
2021
import org.phoebus.service.saveandrestore.migration.MigrateRdbToElastic;
2122
import org.phoebus.service.saveandrestore.persistence.dao.impl.elasticsearch.ElasticsearchDAO;
2223
import org.springframework.boot.SpringApplication;
@@ -55,6 +56,13 @@ private static void help() {
5556
*/
5657
public static void main(String[] args) {
5758

59+
// Hack: PVPool reads properties from dependency jar. Override of default
60+
// protocol done here by direct access to PVPool.default_type.
61+
String defaultProtocol = System.getProperty("defaultProtocol");
62+
if(defaultProtocol != null && !defaultProtocol.isEmpty()){
63+
PVPool.default_type = defaultProtocol;
64+
}
65+
System.out.println("Using default EPICS protocol: " + PVPool.default_type);
5866
// load the default properties
5967
final Properties properties = PropertiesHelper.getProperties();
6068

0 commit comments

Comments
 (0)