1515import org .phoebus .channelfinder .entity .Channel ;
1616import org .phoebus .channelfinder .entity .Property ;
1717import org .phoebus .channelfinder .processors .ChannelProcessor ;
18+ import org .phoebus .channelfinder .processors .ChannelProcessorInfo ;
1819import org .springframework .beans .factory .annotation .Autowired ;
1920import org .springframework .beans .factory .annotation .Value ;
2021import org .springframework .context .annotation .Configuration ;
@@ -64,8 +65,15 @@ public boolean enabled() {
6465 }
6566
6667 @ Override
67- public String processorInfo () {
68- Map <String , String > processorProperties =
68+ public void setEnabled (boolean enabled ) {
69+ this .aaEnabled = enabled ;
70+ }
71+
72+ @ Override
73+ public ChannelProcessorInfo processorInfo () {
74+ return new ChannelProcessorInfo (
75+ "AAChannelProcessor" ,
76+ aaEnabled ,
6977 Map .of (
7078 "archiveProperty" ,
7179 archivePropertyName ,
@@ -74,8 +82,7 @@ public String processorInfo() {
7482 "Archivers" ,
7583 aaURLs .keySet ().toString (),
7684 "AutoPauseOn" ,
77- autoPauseOptions .toString ());
78- return "AAChannelProcessor: ProcessProperties " + processorProperties ;
85+ autoPauseOptions .toString ()));
7986 }
8087
8188 /**
@@ -199,7 +206,7 @@ private void addChannelChange(
199206 aaArchivePVS .get (archiverAlias ).add (newArchiverPV );
200207 }
201208 }
202-
209+
203210 private ArchiveAction pickArchiveAction (String archiveStatus , String pvStatus ) {
204211 if (archiveStatus .equals ("Being archived" ) && (pvStatus .equals (PV_STATUS_INACTIVE ))) {
205212 return ArchiveAction .PAUSE ;
@@ -209,52 +216,57 @@ private ArchiveAction pickArchiveAction(String archiveStatus, String pvStatus) {
209216 && !archiveStatus .equals ("Paused" )
210217 && pvStatus .equals (PV_STATUS_ACTIVE )) { // If archive status anything else
211218 return ArchiveAction .ARCHIVE ;
212-
213219 }
214220
215221 return ArchiveAction .NONE ;
216222 }
217223
218224 private Map <ArchiveAction , List <ArchivePVOptions >> getArchiveActions (
219- Map <String , ArchivePVOptions > archivePVS , ArchiverInfo archiverInfo ) {
225+ Map <String , ArchivePVOptions > archivePVS , ArchiverInfo archiverInfo ) {
220226 if (archiverInfo == null ) {
221227 return Map .of ();
222228 }
223229
224230 logger .log (Level .INFO , () -> String .format ("Get archiver status in archiver %s" , archiverInfo ));
225231
226232 Map <ArchiveAction , List <ArchivePVOptions >> result = new EnumMap <>(ArchiveAction .class );
227- Arrays .stream (ArchiveAction .values ()).forEach (archiveAction -> result .put (archiveAction , new ArrayList <>()));
233+ Arrays .stream (ArchiveAction .values ())
234+ .forEach (archiveAction -> result .put (archiveAction , new ArrayList <>()));
228235 // Don't request to archive an empty list.
229236 if (archivePVS .isEmpty ()) {
230237 return result ;
231238 }
232- List <Map <String , String >> statuses = archiverClient .getStatuses (archivePVS , archiverInfo .url (), archiverInfo .alias ());
239+ List <Map <String , String >> statuses =
240+ archiverClient .getStatuses (archivePVS , archiverInfo .url (), archiverInfo .alias ());
233241 logger .log (Level .FINER , "Statuses {0}" , statuses );
234- statuses .forEach (archivePVStatusJsonMap -> {
235- String archiveStatus = archivePVStatusJsonMap .get ("status" );
236- String pvName = archivePVStatusJsonMap .get ("pvName" );
242+ statuses .forEach (
243+ archivePVStatusJsonMap -> {
244+ String archiveStatus = archivePVStatusJsonMap .get ("status" );
245+ String pvName = archivePVStatusJsonMap .get ("pvName" );
237246
238- if (archiveStatus == null || pvName == null ) {
239- logger .log (Level .WARNING , "Missing status or pvName in archivePVStatusJsonMap: {0}" , archivePVStatusJsonMap );
240- return ;
241- }
247+ if (archiveStatus == null || pvName == null ) {
248+ logger .log (
249+ Level .WARNING ,
250+ "Missing status or pvName in archivePVStatusJsonMap: {0}" ,
251+ archivePVStatusJsonMap );
252+ return ;
253+ }
242254
243- ArchivePVOptions archivePVOptions = archivePVS .get (pvName );
244- if (archivePVOptions == null ) {
245- logger .log (Level .WARNING , "archivePVS does not contain pvName: {0}" , pvName );
246- return ;
247- }
255+ ArchivePVOptions archivePVOptions = archivePVS .get (pvName );
256+ if (archivePVOptions == null ) {
257+ logger .log (Level .WARNING , "archivePVS does not contain pvName: {0}" , pvName );
258+ return ;
259+ }
248260
249- String pvStatus = archivePVOptions .getPvStatus ();
250- ArchiveAction action = pickArchiveAction (archiveStatus , pvStatus );
261+ String pvStatus = archivePVOptions .getPvStatus ();
262+ ArchiveAction action = pickArchiveAction (archiveStatus , pvStatus );
251263
252- List <ArchivePVOptions > archivePVOptionsList = result .get (action );
253- archivePVOptionsList .add (archivePVOptions );
254- });
264+ List <ArchivePVOptions > archivePVOptionsList = result .get (action );
265+ archivePVOptionsList .add (archivePVOptions );
266+ });
255267 return result ;
256268 }
257-
269+
258270 private ArchivePVOptions createArchivePV (
259271 List <String > policyList , Channel channel , String archiveProperty , String pvStaus ) {
260272 ArchivePVOptions newArchiverPV = new ArchivePVOptions ();
0 commit comments