Skip to content
Open
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
12 changes: 0 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.11.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId> <!-- Need for running tests on mac -->
<artifactId>netty-all</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
import org.apache.commons.lang3.StringUtils;
import org.phoebus.channelfinder.entity.Channel;
import org.phoebus.channelfinder.entity.Property;
import org.phoebus.channelfinder.service.external.ArchiverClient;
import org.phoebus.channelfinder.service.external.ArchiverService;
import org.phoebus.channelfinder.service.model.archiver.ChannelProcessorInfo;
import org.phoebus.channelfinder.service.model.archiver.aa.ArchiveAction;
import org.phoebus.channelfinder.service.model.archiver.aa.ArchivePVOptions;
import org.phoebus.channelfinder.service.model.archiver.aa.ArchiverInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;

/**
Expand All @@ -31,6 +32,7 @@
* <p>e.g. archive=monitor@1.0
*/
@Configuration
@ConditionalOnProperty(name = "aa.enabled", havingValue = "true")
public class AAChannelProcessor implements ChannelProcessor {

private static final Logger logger = Logger.getLogger(AAChannelProcessor.class.getName());
Expand Down Expand Up @@ -60,7 +62,7 @@ public class AAChannelProcessor implements ChannelProcessor {
@Value("${aa.auto_pause:}")
private List<String> autoPauseOptions;

@Autowired private final ArchiverClient archiverClient = new ArchiverClient();
@Autowired private ArchiverService archiverService;

@Override
public boolean enabled() {
Expand Down Expand Up @@ -180,7 +182,7 @@ public long process(List<Channel> channels) throws JsonProcessingException {
Collectors.toMap(ArchivePVOptions::getPv, archivePVOptions -> archivePVOptions));
Map<ArchiveAction, List<ArchivePVOptions>> archiveActionArchivePVMap =
getArchiveActions(archivePVSList, archiverInfo);
count += archiverClient.configureAA(archiveActionArchivePVMap, archiverInfo.url());
count += archiverService.configureAA(archiveActionArchivePVMap, archiverInfo.url());
}
long finalCount = count;
logger.log(Level.INFO, () -> String.format("Configured %s channels.", finalCount));
Expand Down Expand Up @@ -240,7 +242,7 @@ private Map<ArchiveAction, List<ArchivePVOptions>> getArchiveActions(
return result;
}
List<Map<String, String>> statuses =
archiverClient.getStatuses(archivePVS, archiverInfo.url(), archiverInfo.alias());
archiverService.getStatuses(archivePVS, archiverInfo.url(), archiverInfo.alias());
logger.log(Level.FINER, "Statuses {0}", statuses);
statuses.forEach(
archivePVStatusJsonMap -> {
Expand Down Expand Up @@ -290,9 +292,8 @@ private Map<String, ArchiverInfo> getArchiversInfo(Map<String, String> aaURLs) {
// Empty archiver tagged
continue;
}
String version = archiverClient.getVersion(aa.getValue());
List<String> policies = archiverClient.getAAPolicies(aa.getValue());
result.put(aa.getKey(), new ArchiverInfo(aa.getKey(), aa.getValue(), version, policies));
List<String> policies = archiverService.getAAPolicies(aa.getValue());
result.put(aa.getKey(), new ArchiverInfo(aa.getKey(), aa.getValue(), policies));
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.phoebus.channelfinder.exceptions;

public class ArchiverServiceException extends RuntimeException {

public ArchiverServiceException(String message) {
super(message);
}

public ArchiverServiceException(String message, Throwable cause) {
super(message, cause);
}
}

This file was deleted.

Loading
Loading