aeddc729f47e7f3528502b7cf22814c9e919ca1f
[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 CHANGE_ME = "changeme";
57     private static final String NODE_CONFIG_MANAGER = "NodeConfigManager";
58     private static EELFLogger eelfLogger = EELFManager.getInstance().getLogger(NodeConfigManager.class);
59     private static NodeConfigManager base = new NodeConfigManager();
60
61     private Timer timer = new Timer("Node Configuration Timer", true);
62     private long maxfailuretimer;
63     private long initfailuretimer;
64     private long waitForFileProcessFailureTimer;
65     private long expirationtimer;
66     private double failurebackoff;
67     private long fairtimelimit;
68     private int fairfilelimit;
69     private double fdpstart;
70     private double fdpstop;
71     private int deliverythreads;
72     private String provurl;
73     private String provhost;
74     private IsFrom provcheck;
75     private int gfport;
76     private int svcport;
77     private int port;
78     private String spooldir;
79     private String logdir;
80     private long logretention;
81     private String redirfile;
82     private String kstype;
83     private String ksfile;
84     private String kspass;
85     private String kpass;
86     private String tstype;
87     private String tsfile;
88     private String tspass;
89     private String myname;
90     private RedirManager rdmgr;
91     private RateLimitedOperation pfetcher;
92     private NodeConfig config;
93     private File quiesce;
94     private PublishId pid;
95     private String nak;
96     private TaskList configtasks = new TaskList();
97     private String eventlogurl;
98     private String eventlogprefix;
99     private String eventlogsuffix;
100     private String eventloginterval;
101     private boolean followredirects;
102     private String[] enabledprotocols;
103     private String aafType;
104     private String aafInstance;
105     private String aafAction;
106     private String aafURL;
107     private boolean cadiEnabled;
108     private NodeAafPropsUtils nodeAafPropsUtils;
109
110
111     /**
112      * Initialize the configuration of a Data Router node.
113      */
114     private NodeConfigManager() {
115
116         Properties drNodeProperties = new Properties();
117         try {
118             eelfLogger.debug("NODE0301 Loading local config file node.properties");
119             drNodeProperties.load(new FileInputStream(System
120                     .getProperty("org.onap.dmaap.datarouter.node.properties", "/opt/app/datartr/etc/node.properties")));
121         } catch (Exception e) {
122             NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER);
123             eelfLogger.error(EelfMsgs.MESSAGE_PROPERTIES_LOAD_ERROR, e,
124                     System.getProperty("org.onap.dmaap.datarouter.node.properties",
125                             "/opt/app/datartr/etc/node.properties"));
126         }
127         provurl = drNodeProperties.getProperty("ProvisioningURL", "https://dmaap-dr-prov:8443/internal/prov");
128         String aafPropsFilePath = drNodeProperties
129             .getProperty("AAFPropsFilePath", "/opt/app/osaaf/local/org.onap.dmaap-dr.props");
130         try {
131             nodeAafPropsUtils = new NodeAafPropsUtils(new File(aafPropsFilePath));
132         } catch (IOException e) {
133             eelfLogger.error("NODE0314 Failed to load AAF props. Exiting", e);
134             exit(1);
135         }
136         /*
137          * START - AAF changes: TDP EPIC US# 307413
138          * Pull AAF settings from node.properties
139          */
140         aafType = drNodeProperties.getProperty("AAFType", "org.onap.dmaap-dr.feed");
141         aafInstance = drNodeProperties.getProperty("AAFInstance", "legacy");
142         aafAction = drNodeProperties.getProperty("AAFAction", "publish");
143         cadiEnabled = Boolean.parseBoolean(drNodeProperties.getProperty("CadiEnabled", "false"));
144         aafURL = nodeAafPropsUtils.getPropAccess().getProperty("aaf_locate_url", "https://aaf-locate:8095");
145         /*
146          * END - AAF changes: TDP EPIC US# 307413
147          * Pull AAF settings from node.properties
148          */
149         //Disable and enable protocols*/
150         enabledprotocols = ((drNodeProperties.getProperty("NodeHttpsProtocols")).trim()).split("\\|");
151         try {
152             provhost = (new URL(provurl)).getHost();
153         } catch (Exception e) {
154             NodeUtils.setIpAndFqdnForEelf(NODE_CONFIG_MANAGER);
155             eelfLogger.error(EelfMsgs.MESSAGE_BAD_PROV_URL, e, provurl);
156             exit(1);
157         }
158         eelfLogger.debug("NODE0303 Provisioning server is " + provhost);
159         eventlogurl = drNodeProperties.getProperty("LogUploadURL", "https://feeds-drtr.web.att.com/internal/logs");
160         provcheck = new IsFrom(provhost);
161         gfport = Integer.parseInt(drNodeProperties.getProperty("IntHttpPort", "8080"));
162         svcport = Integer.parseInt(drNodeProperties.getProperty("IntHttpsPort", "8443"));
163         port = Integer.parseInt(drNodeProperties.getProperty("ExtHttpsPort", "443"));
164         spooldir = drNodeProperties.getProperty("SpoolDir", "spool");
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             Reader reader = new InputStreamReader((new URL(provurl)).openStream());
304             config = new NodeConfig(new ProvData(reader), myname, spooldir, port, nak);
305             localconfig();
306             configtasks.startRun();
307             runTasks();
308         } catch (Exception e) {
309             NodeUtils.setIpAndFqdnForEelf("fetchconfigs");
310             eelfLogger.error(EelfMsgs.MESSAGE_CONF_FAILED, e.toString());
311             eelfLogger.error("NODE0306 Configuration failed " + e.toString() + " - try again later", e);
312             pfetcher.request();
313         }
314     }
315
316     private void runTasks() {
317         Runnable rr;
318         while ((rr = configtasks.next()) != null) {
319             try {
320                 rr.run();
321             } catch (Exception e) {
322                 eelfLogger.error("NODE0518 Exception fetchconfig: " + e);
323             }
324         }
325     }
326
327     /**
328      * Process a gofetch request from a particular IP address.  If the IP address is not an IP address we would go to to
329      * fetch the provisioning data, ignore the request.  If the data has been fetched very recently (default 10
330      * seconds), wait a while before fetching again.
331      */
332     public synchronized void gofetch(String remoteAddr) {
333         if (provcheck.isReachable(remoteAddr)) {
334             eelfLogger.debug("NODE0307 Received configuration fetch request from provisioning server " + remoteAddr);
335             pfetcher.request();
336         } else {
337             eelfLogger.debug("NODE0308 Received configuration fetch request from unexpected server " + remoteAddr);
338         }
339     }
340
341     /**
342      * Am I configured.
343      */
344     public boolean isConfigured() {
345         return (config != null);
346     }
347
348     /**
349      * Am I shut down.
350      */
351     public boolean isShutdown() {
352         return (quiesce.exists());
353     }
354
355     /**
356      * Given a routing string, get the targets.
357      *
358      * @param routing Target string
359      * @return array of targets
360      */
361     public Target[] parseRouting(String routing) {
362         return (config.parseRouting(routing));
363     }
364
365     /**
366      * Given a set of credentials and an IP address, is this request from another node.
367      *
368      * @param credentials Credentials offered by the supposed node
369      * @param ip IP address the request came from
370      * @return If the credentials and IP address are recognized, true, otherwise false.
371      */
372     public boolean isAnotherNode(String credentials, String ip) {
373         return (config.isAnotherNode(credentials, ip));
374     }
375
376     /**
377      * Check whether publication is allowed.
378      *
379      * @param feedid The ID of the feed being requested
380      * @param credentials The offered credentials
381      * @param ip The requesting IP address
382      * @return True if the IP and credentials are valid for the specified feed.
383      */
384     public String isPublishPermitted(String feedid, String credentials, String ip) {
385         return (config.isPublishPermitted(feedid, credentials, ip));
386     }
387
388     /**
389      * Check whether publication is allowed for AAF Feed.
390      *
391      * @param feedid The ID of the feed being requested
392      * @param ip The requesting IP address
393      * @return True if the IP and credentials are valid for the specified feed.
394      */
395     public String isPublishPermitted(String feedid, String ip) {
396         return (config.isPublishPermitted(feedid, ip));
397     }
398
399     /**
400      * Check whether delete file is allowed.
401      *
402      * @param subId The ID of the subscription being requested
403      * @return True if the delete file is permitted for the subscriber.
404      */
405     public boolean isDeletePermitted(String subId) {
406         return (config.isDeletePermitted(subId));
407     }
408
409     /**
410      * Check who the user is given the feed ID and the offered credentials.
411      *
412      * @param feedid The ID of the feed specified
413      * @param credentials The offered credentials
414      * @return Null if the credentials are invalid or the user if they are valid.
415      */
416     public String getAuthUser(String feedid, String credentials) {
417         return (config.getAuthUser(feedid, credentials));
418     }
419
420     /**
421      * AAF changes: TDP EPIC US# 307413 Check AAF_instance for feed ID in NodeConfig.
422      *
423      * @param feedid The ID of the feed specified
424      */
425     public String getAafInstance(String feedid) {
426         return (config.getAafInstance(feedid));
427     }
428
429     public String getAafInstance() {
430         return aafInstance;
431     }
432
433     /**
434      * Check if the publish request should be sent to another node based on the feedid, user, and source IP address.
435      *
436      * @param feedid The ID of the feed specified
437      * @param user The publishing user
438      * @param ip The IP address of the publish endpoint
439      * @return Null if the request should be accepted or the correct hostname if it should be sent to another node.
440      */
441     public String getIngressNode(String feedid, String user, String ip) {
442         return (config.getIngressNode(feedid, user, ip));
443     }
444
445     /**
446      * Get a provisioned configuration parameter (from the provisioning server configuration).
447      *
448      * @param name The name of the parameter
449      * @return The value of the parameter or null if it is not defined.
450      */
451     public String getProvParam(String name) {
452         return (config.getProvParam(name));
453     }
454
455     /**
456      * Get a provisioned configuration parameter (from the provisioning server configuration).
457      *
458      * @param name The name of the parameter
459      * @param defaultValue The value to use if the parameter is not defined
460      * @return The value of the parameter or deflt if it is not defined.
461      */
462     public String getProvParam(String name, String defaultValue) {
463         name = config.getProvParam(name);
464         if (name == null) {
465             name = defaultValue;
466         }
467         return (name);
468     }
469
470     /**
471      * Generate a publish ID.
472      */
473     public String getPublishId() {
474         return (pid.next());
475     }
476
477     /**
478      * Get all the outbound spooling destinations. This will include both subscriptions and nodes.
479      */
480     public DestInfo[] getAllDests() {
481         return (config.getAllDests());
482     }
483
484     /**
485      * Register a task to run whenever the configuration changes.
486      */
487     public void registerConfigTask(Runnable task) {
488         configtasks.addTask(task);
489     }
490
491     /**
492      * Deregister a task to run whenever the configuration changes.
493      */
494     public void deregisterConfigTask(Runnable task) {
495         configtasks.removeTask(task);
496     }
497
498     /**
499      * Get the URL to deliver a message to.
500      *
501      * @param destinationInfo The destination information
502      * @param fileid The file ID
503      * @return The URL to deliver to
504      */
505     public String getDestURL(DestInfo destinationInfo, String fileid) {
506         String subid = destinationInfo.getSubId();
507         String purl = destinationInfo.getURL();
508         if (followredirects && subid != null) {
509             purl = rdmgr.lookup(subid, purl);
510         }
511         return (purl + "/" + fileid);
512     }
513
514     /**
515      * Set up redirection on receipt of a 3XX from a target URL.
516      */
517     public boolean handleRedirection(DestInfo destinationInfo, String redirto, String fileid) {
518         fileid = "/" + fileid;
519         String subid = destinationInfo.getSubId();
520         String purl = destinationInfo.getURL();
521         if (followredirects && subid != null && redirto.endsWith(fileid)) {
522             redirto = redirto.substring(0, redirto.length() - fileid.length());
523             if (!redirto.equals(purl)) {
524                 rdmgr.redirect(subid, purl, redirto);
525                 return (true);
526             }
527         }
528         return (false);
529     }
530
531     /**
532      * Handle unreachable target URL.
533      */
534     public void handleUnreachable(DestInfo destinationInfo) {
535         String subid = destinationInfo.getSubId();
536         if (followredirects && subid != null) {
537             rdmgr.forget(subid);
538         }
539     }
540
541     /**
542      * Get the timeout before retrying after an initial delivery failure.
543      */
544     public long getInitFailureTimer() {
545         return (initfailuretimer);
546     }
547
548     /**
549      * Get the timeout before retrying after delivery and wait for file processing.
550      */
551     public long getWaitForFileProcessFailureTimer() {
552         return (waitForFileProcessFailureTimer);
553     }
554
555     /**
556      * Get the maximum timeout between delivery attempts.
557      */
558     public long getMaxFailureTimer() {
559         return (maxfailuretimer);
560     }
561
562     /**
563      * Get the ratio between consecutive delivery attempts.
564      */
565     public double getFailureBackoff() {
566         return (failurebackoff);
567     }
568
569     /**
570      * Get the expiration timer for deliveries.
571      */
572     public long getExpirationTimer() {
573         return (expirationtimer);
574     }
575
576     /**
577      * Get the maximum number of file delivery attempts before checking if another queue has work to be performed.
578      */
579     public int getFairFileLimit() {
580         return (fairfilelimit);
581     }
582
583     /**
584      * Get the maximum amount of time spent delivering files before checking if another queue has work to be performed.
585      */
586     public long getFairTimeLimit() {
587         return (fairtimelimit);
588     }
589
590     /**
591      * Get the targets for a feed.
592      *
593      * @param feedid The feed ID
594      * @return The targets this feed should be delivered to
595      */
596     public Target[] getTargets(String feedid) {
597         return (config.getTargets(feedid));
598     }
599
600     /**
601      * Get the spool directory for temporary files.
602      */
603     public String getSpoolDir() {
604         return (spooldir + "/f");
605     }
606
607     /**
608      * Get the spool directory for a subscription.
609      */
610     public String getSpoolDir(String subid, String remoteaddr) {
611         if (provcheck.isFrom(remoteaddr)) {
612             String sdir = config.getSpoolDir(subid);
613             if (sdir != null) {
614                 eelfLogger.debug("NODE0310 Received subscription reset request for subscription " + subid
615                         + " from provisioning server " + remoteaddr);
616             } else {
617                 eelfLogger.debug("NODE0311 Received subscription reset request for unknown subscription " + subid
618                         + " from provisioning server " + remoteaddr);
619             }
620             return (sdir);
621         } else {
622             eelfLogger.debug("NODE0312 Received subscription reset request from unexpected server " + remoteaddr);
623             return (null);
624         }
625     }
626
627     /**
628      * Get the base directory for spool directories.
629      */
630     public String getSpoolBase() {
631         return (spooldir);
632     }
633
634     /**
635      * Get the key store type.
636      */
637     public String getKSType() {
638         return (kstype);
639     }
640
641     /**
642      * Get the key store file.
643      */
644     public String getKSFile() {
645         return (ksfile);
646     }
647
648     /**
649      * Get the key store password.
650      */
651     public String getKSPass() {
652         return (kspass);
653     }
654
655     /**
656      * Get the key password.
657      */
658     public String getKPass() {
659         return (kpass);
660     }
661
662     /**
663      * Get the http port.
664      */
665     public int getHttpPort() {
666         return (gfport);
667     }
668
669     /**
670      * Get the https port.
671      */
672     public int getHttpsPort() {
673         return (svcport);
674     }
675
676     /**
677      * Get the externally visible https port.
678      */
679     public int getExtHttpsPort() {
680         return (port);
681     }
682
683     /**
684      * Get the external name of this machine.
685      */
686     public String getMyName() {
687         return (myname);
688     }
689
690     /**
691      * Get the number of threads to use for delivery.
692      */
693     public int getDeliveryThreads() {
694         return (deliverythreads);
695     }
696
697     /**
698      * Get the URL for uploading the event log data.
699      */
700     public String getEventLogUrl() {
701         return (eventlogurl);
702     }
703
704     /**
705      * Get the prefix for the names of event log files.
706      */
707     public String getEventLogPrefix() {
708         return (eventlogprefix);
709     }
710
711     /**
712      * Get the suffix for the names of the event log files.
713      */
714     public String getEventLogSuffix() {
715         return (eventlogsuffix);
716     }
717
718     /**
719      * Get the interval between event log file rollovers.
720      */
721     public String getEventLogInterval() {
722         return (eventloginterval);
723     }
724
725     /**
726      * Should I follow redirects from subscribers.
727      */
728     public boolean isFollowRedirects() {
729         return (followredirects);
730     }
731
732     /**
733      * Get the directory where the event and node log files live.
734      */
735     public String getLogDir() {
736         return (logdir);
737     }
738
739     /**
740      * How long do I keep log files (in milliseconds).
741      */
742     public long getLogRetention() {
743         return (logretention);
744     }
745
746     /**
747      * Get the timer.
748      */
749     public Timer getTimer() {
750         return (timer);
751     }
752
753     /**
754      * Get the feed ID for a subscription.
755      *
756      * @param subid The subscription ID
757      * @return The feed ID
758      */
759     public String getFeedId(String subid) {
760         return (config.getFeedId(subid));
761     }
762
763     /**
764      * Get the authorization string this node uses.
765      *
766      * @return The Authorization string for this node
767      */
768     public String getMyAuth() {
769         return (config.getMyAuth());
770     }
771
772     /**
773      * Get the fraction of free spool disk space where we start throwing away undelivered files.  This is
774      * FREE_DISK_RED_PERCENT / 100.0.  Default is 0.05.  Limited by 0.01 <= FreeDiskStart <= 0.5.
775      */
776     public double getFreeDiskStart() {
777         return (fdpstart);
778     }
779
780     /**
781      * Get the fraction of free spool disk space where we stop throwing away undelivered files.  This is
782      * FREE_DISK_YELLOW_PERCENT / 100.0.  Default is 0.2.  Limited by FreeDiskStart <= FreeDiskStop <= 0.5.
783      */
784     public double getFreeDiskStop() {
785         return (fdpstop);
786     }
787
788     /**
789      * Disable and enable protocols.
790      */
791     public String[] getEnabledprotocols() {
792         return enabledprotocols;
793     }
794
795     public String getAafType() {
796         return aafType;
797     }
798
799     public String getAafAction() {
800         return aafAction;
801     }
802
803     /*
804      * Get aafURL from SWM variable
805      * */
806     public String getAafURL() {
807         return aafURL;
808     }
809
810     public boolean getCadiEnabled() {
811         return cadiEnabled;
812     }
813
814     public NodeAafPropsUtils getNodeAafPropsUtils() {
815         return nodeAafPropsUtils;
816     }
817
818     /**
819      * Builds the permissions string to be verified.
820      *
821      * @param aafInstance The aaf instance
822      * @return The permissions
823      */
824     protected String getPermission(String aafInstance) {
825         try {
826             String type = getAafType();
827             String action = getAafAction();
828             if ("".equals(aafInstance)) {
829                 aafInstance = getAafInstance();
830             }
831             return type + "|" + aafInstance + "|" + action;
832         } catch (Exception e) {
833             eelfLogger.error("NODE0543 NodeConfigManager.getPermission: ", e);
834         }
835         return null;
836     }
837 }