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