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