More bug fix and refactoring
[dmaap/datarouter.git] / datarouter-node / src / main / java / org / onap / dmaap / datarouter / node / NodeConfigManager.java
1 /*******************************************************************************
2  * ============LICENSE_START==================================================
3  * * org.onap.dmaap
4  * * ===========================================================================
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * * ===========================================================================
7  * * Licensed under the Apache License, Version 2.0 (the "License");
8  * * you may not use this file except in compliance with the License.
9  * * You may obtain a copy of the License at
10  * *
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * *
13  *  * Unless required by applicable law or agreed to in writing, software
14  * * distributed under the License is distributed on an "AS IS" BASIS,
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * * See the License for the specific language governing permissions and
17  * * limitations under the License.
18  * * ============LICENSE_END====================================================
19  * *
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  * *
22  ******************************************************************************/
23
24
25 package org.onap.dmaap.datarouter.node;
26
27 import static java.lang.System.exit;
28
29 import com.att.eelf.configuration.EELFLogger;
30 import com.att.eelf.configuration.EELFManager;
31 import java.io.File;
32 import java.io.FileInputStream;
33 import java.io.IOException;
34 import java.io.InputStreamReader;
35 import java.io.Reader;
36 import java.net.URL;
37 import java.nio.file.Files;
38 import java.util.Objects;
39 import java.util.Properties;
40 import java.util.Timer;
41 import org.onap.dmaap.datarouter.node.eelf.EelfMsgs;
42
43
44 /**
45  * Maintain the configuration of a Data Router node
46  *
47  * <p>The NodeConfigManager is the single point of contact for servlet, delivery, event logging, and log retention
48  * subsystems to access configuration information.
49  *
50  * <p>There are two basic sets of configuration data.  The static local configuration data, stored in a local
51  * configuration file (created as part of installation by SWM), and the dynamic global configuration data fetched from
52  * the data router provisioning server.
53  */
54 public class NodeConfigManager implements DeliveryQueueHelper {
55
56     private static final String NODE_CONFIG_MANAGER = "NodeConfigManager";
57     private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(NodeConfigManager.class);
58     private static NodeConfigManager base = new NodeConfigManager();
59
60     private Timer timer = new Timer("Node Configuration Timer", true);
61     private long maxfailuretimer;
62     private long initfailuretimer;
63     private long waitForFileProcessFailureTimer;
64     private long expirationtimer;
65     private double failurebackoff;
66     private long fairtimelimit;
67     private int fairfilelimit;
68     private double fdpstart;
69     private double fdpstop;
70     private int deliverythreads;
71     private String provurl;
72     private String provhost;
73     private IsFrom provcheck;
74     private int gfport;
75     private int svcport;
76     private int port;
77     private String spooldir;
78     private String logdir;
79     private long logretention;
80     private String redirfile;
81     private String kstype;
82     private String ksfile;
83     private String kspass;
84     private String kpass;
85     private String tstype;
86     private String tsfile;
87     private String tspass;
88     private String myname;
89     private RedirManager rdmgr;
90     private RateLimitedOperation pfetcher;
91     private NodeConfig config;
92     private File quiesce;
93     private PublishId pid;
94     private String nak;
95     private TaskList configtasks = new TaskList();
96     private String eventlogurl;
97     private String eventlogprefix;
98     private String eventlogsuffix;
99     private String eventloginterval;
100     private boolean followredirects;
101     private String[] enabledprotocols;
102     private String aafType;
103     private String aafInstance;
104     private String aafAction;
105     private boolean cadiEnabled;
106     private NodeAafPropsUtils nodeAafPropsUtils;
107
108
109     /**
110      * Initialize the configuration of a Data Router node.
111      */
112     private NodeConfigManager() {
113
114         Properties drNodeProperties = new Properties();
115         try {
116             eelfLogger.debug("NODE0301 Loading local config file node.properties");
117             drNodeProperties.load(new FileInputStream(System
118                     .getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")));
119         } catch (Exception e) {
120             NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER);
121             eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, e,
122                     System.getProperty("org.onap.dmaap.datarouter.node.properties",
123                             "/opt/app/datartr/etc/node.properties"));
124         }
125         provurl = drNodeProperties.getProperty("ProvisioningURL", "https://dmaap-dr-prov:8443/internal/prov");
126         String aafPropsFilePath = drNodeProperties
127             .getProperty("AAFPropsFilePath", "/opt/app/osaaf/local/org.onap.dmaap-dr.props");
128         try {
129             nodeAafPropsUtils = new NodeAafPropsUtils(new File(aafPropsFilePath));
130         } catch (IOException e) {
131             eelfLogger.error("NODE0314 Failed to load AAF props. Exiting", e);
132             exit(1);
133         }
134         /*
135          * START - AAF changes: TDP EPIC US# 307413
136          * Pull AAF settings from node.properties
137          */
138         aafType = drNodeProperties.getProperty("AAFType", "org.onap.dmaap-dr.feed");
139         aafInstance = drNodeProperties.getProperty("AAFInstance", "legacy");
140         aafAction = drNodeProperties.getProperty("AAFAction", "publish");
141         cadiEnabled = Boolean.parseBoolean(drNodeProperties.getProperty("CadiEnabled", "false"));
142         /*
143          * END - AAF changes: TDP EPIC US# 307413
144          * Pull AAF settings from node.properties
145          */
146         //Disable and enable protocols*/
147         enabledprotocols = ((drNodeProperties.getProperty("NodeHttpsProtocols")).trim()).split("\\|");
148         try {
149             provhost = (new URL(provurl)).getHost();
150         } catch (Exception e) {
151             NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER);
152             eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, e, provurl);
153             exit(1);
154         }
155         eelfLogger.debug("NODE0303 Provisioning server is " + provhost);
156         eventlogurl = drNodeProperties.getProperty("LogUploadURL", "https://feeds-drtr.web.att.com/internal/logs");
157         provcheck = new IsFrom(provhost);
158         gfport = Integer.parseInt(drNodeProperties.getProperty("IntHttpPort", "8080"));
159         svcport = Integer.parseInt(drNodeProperties.getProperty("IntHttpsPort", "8443"));
160         port = Integer.parseInt(drNodeProperties.getProperty("ExtHttpsPort", "443"));
161         spooldir = drNodeProperties.getProperty("SpoolDir", "spool");
162         File fdir = new File(spooldir + "/f");
163         fdir.mkdirs();
164         for (File junk : Objects.requireNonNull(fdir.listFiles())) {
165             try {
166                 Files.deleteIfExists(junk.toPath());
167             } catch (IOException e) {
168                 eelfLogger.error("NODE0313 Failed to clear junk files from " + fdir.getPath(), e);
169             }
170         }
171         logdir = drNodeProperties.getProperty("LogDir", "logs");
172         (new File(logdir)).mkdirs();
173         logretention = Long.parseLong(drNodeProperties.getProperty("LogRetention", "30")) * 86400000L;
174         eventlogprefix = logdir + "/events";
175         eventlogsuffix = ".log";
176         redirfile = drNodeProperties.getProperty("RedirectionFile", "etc/redirections.dat");
177         kstype = drNodeProperties.getProperty("KeyStoreType", "PKCS12");
178         ksfile = nodeAafPropsUtils.getPropAccess().getProperty("cadi_keystore");
179         kspass = nodeAafPropsUtils.getDecryptedPass("cadi_keystore_password");
180         kpass = nodeAafPropsUtils.getDecryptedPass("cadi_keystore_password");
181         tstype = drNodeProperties.getProperty("TrustStoreType", "jks");
182         tsfile = nodeAafPropsUtils.getPropAccess().getProperty("cadi_truststore");
183         tspass = nodeAafPropsUtils.getDecryptedPass("cadi_truststore_password");
184         if (tsfile != null && tsfile.length() > 0) {
185             System.setProperty("javax.net.ssl.trustStoreType", tstype);
186             System.setProperty("javax.net.ssl.trustStore", tsfile);
187             System.setProperty("javax.net.ssl.trustStorePassword", tspass);
188         }
189         nak = drNodeProperties.getProperty("NodeAuthKey", "Node123!");
190         quiesce = new File(drNodeProperties.getProperty("QuiesceFile", "etc/SHUTDOWN"));
191         myname = NodeUtils.getCanonicalName(kstype, ksfile, kspass);
192         if (myname == null) {
193             NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER);
194             eelfLogger.error(EelfMsgs.MESSAGE_KEYSTORE_FETCH_ERROR, ksfile);
195             eelfLogger.error("NODE0309 Unable to fetch canonical name from keystore file " + ksfile);
196             exit(1);
197         }
198         eelfLogger.debug("NODE0304 My certificate says my name is " + myname);
199         pid = new PublishId(myname);
200         long minrsinterval = Long.parseLong(drNodeProperties.getProperty("MinRedirSaveInterval", "10000"));
201         long minpfinterval = Long.parseLong(drNodeProperties.getProperty("MinProvFetchInterval", "10000"));
202         rdmgr = new RedirManager(redirfile, minrsinterval, timer);
203         pfetcher = new RateLimitedOperation(minpfinterval, timer) {
204             public void run() {
205                 fetchconfig();
206             }
207         };
208         eelfLogger.debug("NODE0305 Attempting to fetch configuration at " + provurl);
209         pfetcher.request();
210     }
211
212     /**
213      * Get the default node configuration manager.
214      */
215     public static NodeConfigManager getInstance() {
216         return base;
217     }
218
219     private void localconfig() {
220         followredirects = Boolean.parseBoolean(getProvParam("FOLLOW_REDIRECTS", "false"));
221         eventloginterval = getProvParam("LOGROLL_INTERVAL", "30s");
222         initfailuretimer = 10000;
223         waitForFileProcessFailureTimer = 600000;
224         maxfailuretimer = 3600000;
225         expirationtimer = 86400000;
226         failurebackoff = 2.0;
227         deliverythreads = 40;
228         fairfilelimit = 100;
229         fairtimelimit = 60000;
230         fdpstart = 0.05;
231         fdpstop = 0.2;
232         try {
233             initfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_INIT_RETRY_INTERVAL")) * 1000);
234         } catch (Exception e) {
235             eelfLogger.trace("Error parsing DELIVERY_INIT_RETRY_INTERVAL", e);
236         }
237         try {
238             waitForFileProcessFailureTimer = (long) (Double.parseDouble(getProvParam("DELIVERY_FILE_PROCESS_INTERVAL"))
239                     * 1000);
240         } catch (Exception e) {
241             eelfLogger.trace("Error parsing DELIVERY_FILE_PROCESS_INTERVAL", e);
242         }
243         try {
244             maxfailuretimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_RETRY_INTERVAL")) * 1000);
245         } catch (Exception e) {
246             eelfLogger.trace("Error parsing DELIVERY_MAX_RETRY_INTERVAL", e);
247         }
248         try {
249             expirationtimer = (long) (Double.parseDouble(getProvParam("DELIVERY_MAX_AGE")) * 1000);
250         } catch (Exception e) {
251             eelfLogger.trace("Error parsing DELIVERY_MAX_AGE", e);
252         }
253         try {
254             failurebackoff = Double.parseDouble(getProvParam("DELIVERY_RETRY_RATIO"));
255         } catch (Exception e) {
256             eelfLogger.trace("Error parsing DELIVERY_RETRY_RATIO", e);
257         }
258         try {
259             deliverythreads = Integer.parseInt(getProvParam("DELIVERY_THREADS"));
260         } catch (Exception e) {
261             eelfLogger.trace("Error parsing DELIVERY_THREADS", e);
262         }
263         try {
264             fairfilelimit = Integer.parseInt(getProvParam("FAIR_FILE_LIMIT"));
265         } catch (Exception e) {
266             eelfLogger.trace("Error parsing FAIR_FILE_LIMIT", e);
267         }
268         try {
269             fairtimelimit = (long) (Double.parseDouble(getProvParam("FAIR_TIME_LIMIT")) * 1000);
270         } catch (Exception e) {
271             eelfLogger.trace("Error parsing FAIR_TIME_LIMIT", e);
272         }
273         try {
274             fdpstart = Double.parseDouble(getProvParam("FREE_DISK_RED_PERCENT")) / 100.0;
275         } catch (Exception e) {
276             eelfLogger.trace("Error parsing FREE_DISK_RED_PERCENT", e);
277         }
278         try {
279             fdpstop = Double.parseDouble(getProvParam("FREE_DISK_YELLOW_PERCENT")) / 100.0;
280         } catch (Exception e) {
281             eelfLogger.trace("Error parsing FREE_DISK_YELLOW_PERCENT", e);
282         }
283         if (fdpstart < 0.01) {
284             fdpstart = 0.01;
285         }
286         if (fdpstart > 0.5) {
287             fdpstart = 0.5;
288         }
289         if (fdpstop < fdpstart) {
290             fdpstop = fdpstart;
291         }
292         if (fdpstop > 0.5) {
293             fdpstop = 0.5;
294         }
295     }
296
297     private void fetchconfig() {
298         try {
299             eelfLogger.debug("NodeConfigMan.fetchConfig: provurl:: " + provurl);
300             URL url = new URL(provurl);
301             Reader reader = new InputStreamReader(url.openStream());
302             config = new NodeConfig(new ProvData(reader), myname, spooldir, port, nak);
303             localconfig();
304             configtasks.startRun();
305             runTasks();
306         } catch (Exception e) {
307             NodeUtils.setIpAndFqdnForEelf("fetchconfigs");
308             eelfLogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
309             eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e);
310             pfetcher.request();
311         }
312     }
313
314     private void runTasks() {
315         Runnable rr;
316         while ((rr = configtasks.next()) != null) {
317             try {
318                 rr.run();
319             } catch (Exception e) {
320                 eelfLogger.error("NODE0518 Exception fetchconfig: " + e);
321             }
322         }
323     }
324
325     /**
326      * Process a gofetch request from a particular IP address.  If the IP address is not an IP address we would go to to
327      * fetch the provisioning data, ignore the request.  If the data has been fetched very recently (default 10
328      * seconds), wait a while before fetching again.
329      */
330     synchronized void gofetch(String remoteAddr) {
331         if (provcheck.isReachable(remoteAddr)) {
332             eelfLogger.debug("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
333             pfetcher.request();
334         } else {
335             eelfLogger.debug("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
336         }
337     }
338
339     /**
340      * Am I configured.
341      */
342     boolean isConfigured() {
343         return config != null;
344     }
345
346     /**
347      * Am I shut down.
348      */
349     boolean isShutdown() {
350         return quiesce.exists();
351     }
352
353     /**
354      * Given a routing string, get the targets.
355      *
356      * @param routing Target string
357      * @return array of targets
358      */
359     Target[] parseRouting(String routing) {
360         return config.parseRouting(routing);
361     }
362
363     /**
364      * Given a set of credentials and an IP address, is this request from another node.
365      *
366      * @param credentials Credentials offered by the supposed node
367      * @param ip IP address the request came from
368      * @return If the credentials and IP address are recognized, true, otherwise false.
369      */
370     boolean isAnotherNode(String credentials, String ip) {
371         return config.isAnotherNode(credentials, ip);
372     }
373
374     /**
375      * Check whether publication is allowed.
376      *
377      * @param feedid The ID of the feed being requested
378      * @param credentials The offered credentials
379      * @param ip The requesting IP address
380      * @return True if the IP and credentials are valid for the specified feed.
381      */
382     String isPublishPermitted(String feedid, String credentials, String ip) {
383         return config.isPublishPermitted(feedid, credentials, ip);
384     }
385
386     /**
387      * Check whether publication is allowed for AAF Feed.
388      *
389      * @param feedid The ID of the feed being requested
390      * @param ip The requesting IP address
391      * @return True if the IP and credentials are valid for the specified feed.
392      */
393     String isPublishPermitted(String feedid, String ip) {
394         return config.isPublishPermitted(feedid, ip);
395     }
396
397     /**
398      * Check whether delete file is allowed.
399      *
400      * @param subId The ID of the subscription being requested
401      * @return True if the delete file is permitted for the subscriber.
402      */
403     boolean isDeletePermitted(String subId) {
404         return config.isDeletePermitted(subId);
405     }
406
407     /**
408      * Check who the user is given the feed ID and the offered credentials.
409      *
410      * @param feedid The ID of the feed specified
411      * @param credentials The offered credentials
412      * @return Null if the credentials are invalid or the user if they are valid.
413      */
414     String getAuthUser(String feedid, String credentials) {
415         return config.getAuthUser(feedid, credentials);
416     }
417
418     /**
419      * AAF changes: TDP EPIC US# 307413 Check AAF_instance for feed ID in NodeConfig.
420      *
421      * @param feedid The ID of the feed specified
422      */
423     String getAafInstance(String feedid) {
424         return config.getAafInstance(feedid);
425     }
426
427     String getAafInstance() {
428         return aafInstance;
429     }
430
431     /**
432      * Check if the publish request should be sent to another node based on the feedid, user, and source IP address.
433      *
434      * @param feedid The ID of the feed specified
435      * @param user The publishing user
436      * @param ip The IP address of the publish endpoint
437      * @return Null if the request should be accepted or the correct hostname if it should be sent to another node.
438      */
439     String getIngressNode(String feedid, String user, String ip) {
440         return config.getIngressNode(feedid, user, ip);
441     }
442
443     /**
444      * Get a provisioned configuration parameter (from the provisioning server configuration).
445      *
446      * @param name The name of the parameter
447      * @return The value of the parameter or null if it is not defined.
448      */
449     private String getProvParam(String name) {
450         return config.getProvParam(name);
451     }
452
453     /**
454      * Get a provisioned configuration parameter (from the provisioning server configuration).
455      *
456      * @param name The name of the parameter
457      * @param defaultValue The value to use if the parameter is not defined
458      * @return The value of the parameter or deflt if it is not defined.
459      */
460     private String getProvParam(String name, String defaultValue) {
461         name = config.getProvParam(name);
462         if (name == null) {
463             name = defaultValue;
464         }
465         return name;
466     }
467
468     /**
469      * Generate a publish ID.
470      */
471     public String getPublishId() {
472         return pid.next();
473     }
474
475     /**
476      * Get all the outbound spooling destinations. This will include both subscriptions and nodes.
477      */
478     DestInfo[] getAllDests() {
479         return config.getAllDests();
480     }
481
482     /**
483      * Register a task to run whenever the configuration changes.
484      */
485     void registerConfigTask(Runnable task) {
486         configtasks.addTask(task);
487     }
488
489     /**
490      * Deregister a task to run whenever the configuration changes.
491      */
492     void deregisterConfigTask(Runnable task) {
493         configtasks.removeTask(task);
494     }
495
496     /**
497      * Get the URL to deliver a message to.
498      *
499      * @param destinationInfo The destination information
500      * @param fileid The file ID
501      * @return The URL to deliver to
502      */
503     public String getDestURL(DestInfo destinationInfo, String fileid) {
504         String subid = destinationInfo.getSubId();
505         String purl = destinationInfo.getURL();
506         if (followredirects && subid != null) {
507             purl = rdmgr.lookup(subid, purl);
508         }
509         return (purl + "/" + fileid);
510     }
511
512     /**
513      * Set up redirection on receipt of a 3XX from a target URL.
514      */
515     public boolean handleRedirection(DestInfo destinationInfo, String redirto, String fileid) {
516         fileid = "/" + fileid;
517         String subid = destinationInfo.getSubId();
518         String purl = destinationInfo.getURL();
519         if (followredirects && subid != null && redirto.endsWith(fileid)) {
520             redirto = redirto.substring(0, redirto.length() - fileid.length());
521             if (!redirto.equals(purl)) {
522                 rdmgr.redirect(subid, purl, redirto);
523                 return (true);
524             }
525         }
526         return (false);
527     }
528
529     /**
530      * Handle unreachable target URL.
531      */
532     public void handleUnreachable(DestInfo destinationInfo) {
533         String subid = destinationInfo.getSubId();
534         if (followredirects && subid != null) {
535             rdmgr.forget(subid);
536         }
537     }
538
539     /**
540      * Get the timeout before retrying after an initial delivery failure.
541      */
542     public long getInitFailureTimer() {
543         return initfailuretimer;
544     }
545
546     /**
547      * Get the timeout before retrying after delivery and wait for file processing.
548      */
549     public long getWaitForFileProcessFailureTimer() {
550         return waitForFileProcessFailureTimer;
551     }
552
553     /**
554      * Get the maximum timeout between delivery attempts.
555      */
556     public long getMaxFailureTimer() {
557         return maxfailuretimer;
558     }
559
560     /**
561      * Get the ratio between consecutive delivery attempts.
562      */
563     public double getFailureBackoff() {
564         return failurebackoff;
565     }
566
567     /**
568      * Get the expiration timer for deliveries.
569      */
570     public long getExpirationTimer() {
571         return expirationtimer;
572     }
573
574     /**
575      * Get the maximum number of file delivery attempts before checking if another queue has work to be performed.
576      */
577     public int getFairFileLimit() {
578         return fairfilelimit;
579     }
580
581     /**
582      * Get the maximum amount of time spent delivering files before checking if another queue has work to be performed.
583      */
584     public long getFairTimeLimit() {
585         return fairtimelimit;
586     }
587
588     /**
589      * Get the targets for a feed.
590      *
591      * @param feedid The feed ID
592      * @return The targets this feed should be delivered to
593      */
594     Target[] getTargets(String feedid) {
595         return config.getTargets(feedid);
596     }
597
598     /**
599      * Get the spool directory for temporary files.
600      */
601     String getSpoolDir() {
602         return spooldir + "/f";
603     }
604
605     /**
606      * Get the spool directory for a subscription.
607      */
608     String getSpoolDir(String subid, String remoteaddr) {
609         if (provcheck.isFrom(remoteaddr)) {
610             String sdir = config.getSpoolDir(subid);
611             if (sdir != null) {
612                 eelfLogger.debug("NODE0310 Received subscription reset request for subscription " + subid
613                         + " from provisioning server " + remoteaddr);
614             } else {
615                 eelfLogger.debug("NODE0311 Received subscription reset request for unknown subscription " + subid
616                         + " from provisioning server " + remoteaddr);
617             }
618             return sdir;
619         } else {
620             eelfLogger.debug("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
621             return null;
622         }
623     }
624
625     /**
626      * Get the base directory for spool directories.
627      */
628     String getSpoolBase() {
629         return spooldir;
630     }
631
632     /**
633      * Get the key store type.
634      */
635     String getKSType() {
636         return kstype;
637     }
638
639     /**
640      * Get the key store file.
641      */
642     String getKSFile() {
643         return ksfile;
644     }
645
646     /**
647      * Get the key store password.
648      */
649     String getKSPass() {
650         return kspass;
651     }
652
653     /**
654      * Get the key password.
655      */
656     String getKPass() {
657         return kpass;
658     }
659
660
661     String getTstype() {
662         return tstype;
663     }
664
665     String getTsfile() {
666         return tsfile;
667     }
668
669     String getTspass() {
670         return tspass;
671     }
672
673     /**
674      * Get the http port.
675      */
676     int getHttpPort() {
677         return gfport;
678     }
679
680     /**
681      * Get the https port.
682      */
683     int getHttpsPort() {
684         return svcport;
685     }
686
687     /**
688      * Get the externally visible https port.
689      */
690     int getExtHttpsPort() {
691         return port;
692     }
693
694     /**
695      * Get the external name of this machine.
696      */
697     String getMyName() {
698         return myname;
699     }
700
701     /**
702      * Get the number of threads to use for delivery.
703      */
704     int getDeliveryThreads() {
705         return deliverythreads;
706     }
707
708     /**
709      * Get the URL for uploading the event log data.
710      */
711     String getEventLogUrl() {
712         return eventlogurl;
713     }
714
715     /**
716      * Get the prefix for the names of event log files.
717      */
718     String getEventLogPrefix() {
719         return eventlogprefix;
720     }
721
722     /**
723      * Get the suffix for the names of the event log files.
724      */
725     String getEventLogSuffix() {
726         return eventlogsuffix;
727     }
728
729     /**
730      * Get the interval between event log file rollovers.
731      */
732     String getEventLogInterval() {
733         return eventloginterval;
734     }
735
736     /**
737      * Should I follow redirects from subscribers.
738      */
739     public boolean isFollowRedirects() {
740         return followredirects;
741     }
742
743     /**
744      * Get the directory where the event and node log files live.
745      */
746     String getLogDir() {
747         return logdir;
748     }
749
750     /**
751      * How long do I keep log files (in milliseconds).
752      */
753     long getLogRetention() {
754         return logretention;
755     }
756
757     /**
758      * Get the timer.
759      */
760     public Timer getTimer() {
761         return timer;
762     }
763
764     /**
765      * Get the feed ID for a subscription.
766      *
767      * @param subid The subscription ID
768      * @return The feed ID
769      */
770     public String getFeedId(String subid) {
771         return config.getFeedId(subid);
772     }
773
774     /**
775      * Get the authorization string this node uses.
776      *
777      * @return The Authorization string for this node
778      */
779     String getMyAuth() {
780         return config.getMyAuth();
781     }
782
783     /**
784      * Get the fraction of free spool disk space where we start throwing away undelivered files.  This is
785      * FREE_DISK_RED_PERCENT / 100.0.  Default is 0.05.  Limited by 0.01 <= FreeDiskStart <= 0.5.
786      */
787     double getFreeDiskStart() {
788         return fdpstart;
789     }
790
791     /**
792      * Get the fraction of free spool disk space where we stop throwing away undelivered files.  This is
793      * FREE_DISK_YELLOW_PERCENT / 100.0.  Default is 0.2.  Limited by FreeDiskStart <= FreeDiskStop <= 0.5.
794      */
795     double getFreeDiskStop() {
796         return fdpstop;
797     }
798
799     /**
800      * Disable and enable protocols.
801      */
802     String[] getEnabledprotocols() {
803         return enabledprotocols;
804     }
805
806     String getAafType() {
807         return aafType;
808     }
809
810     String getAafAction() {
811         return aafAction;
812     }
813
814     boolean getCadiEnabled() {
815         return cadiEnabled;
816     }
817
818     NodeAafPropsUtils getNodeAafPropsUtils() {
819         return nodeAafPropsUtils;
820     }
821
822     /**
823      * Builds the permissions string to be verified.
824      *
825      * @param aafInstance The aaf instance
826      * @return The permissions
827      */
828     String getPermission(String aafInstance) {
829         try {
830             String type = getAafType();
831             String action = getAafAction();
832             if ("".equals(aafInstance)) {
833                 aafInstance = getAafInstance();
834             }
835             return type + "|" + aafInstance + "|" + action;
836         } catch (Exception e) {
837             eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e);
838         }
839         return null;
840     }
841 }