X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Fconfigure%2FPropHolder.java;h=a0bd6e8b1fc85f1eebac8f633450ebb673ed07b6;hb=refs%2Fchanges%2F24%2F97124%2F3;hp=3140df61ad0441477c946b3fd6a0f03e11a95a30;hpb=bdce7667a6e272e2fa32e298d957a0d9090c5bc9;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java index 3140df61..a0bd6e8b 100644 --- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java +++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -68,10 +68,10 @@ public class PropHolder { if(ph == null) { ph = new PropHolder(dir,file,new File(dir,arti.getNs()+".keyfile")); propHolders.put(file.getAbsolutePath(), ph); - } + } return ph; } - + private PropHolder(File dir, File file, File keyfile) throws IOException { this.dir = dir; this.file = file; @@ -79,11 +79,11 @@ public class PropHolder { symm = null; props = new TreeMap<>(); } - + public String getPath() { return file.getAbsolutePath(); } - + public File getDir() { return dir; } @@ -125,7 +125,7 @@ public class PropHolder { } addEnc(tag,pwd); } - + public void write() throws IOException { if (props.size()==0) { return; @@ -138,7 +138,7 @@ public class PropHolder { } else { System.out.println("Creating new " + file.getCanonicalPath()); } - + // Append if not first PrintWriter pw = new PrintWriter(new FileWriter(file)); try { @@ -157,7 +157,7 @@ public class PropHolder { pw.print('#'); } pw.println(); - + for (Map.Entry me : props.entrySet()) { String key = me.getKey(); pw.print(key); @@ -169,13 +169,13 @@ public class PropHolder { } Chmod.to644.chmod(file); } - + public static void writeAll() throws IOException { for(PropHolder ph : propHolders.values()) { ph.write(); } } - + @Override public String toString() { return file.getAbsolutePath() + ": " + props;