summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-batch')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java5
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java5
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java67
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java9
5 files changed, 46 insertions, 44 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
index b5ff59b1..d2695a35 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
@@ -264,8 +264,7 @@ public abstract class Batch {
try {
hostname = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
- e.printStackTrace();
- env.warn().log("Unable to get hostname");
+ env.warn().log("Unable to get hostname : "+e.getMessage());
return (0);
}
@@ -545,7 +544,7 @@ public abstract class Batch {
if(cluster!=null && !cluster.isClosed()) {
cluster.close();
}
- e.printStackTrace(System.err);
+ env.warn().log(System.err);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
index 49309004..4c14f0fd 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
@@ -316,7 +316,7 @@ public class Cred {
}
public static void batchDelete(StringBuilder sb, List<String> row) {
- Long l = Long.parseLong(row.get(5));
+ long l = Long.parseLong(row.get(5));
String date = Chrono.batchFmt.format(new Date(l));
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
@@ -326,9 +326,6 @@ public class Cred {
sb.append(" AND expires='");
sb.append(date);
sb.append("';\n");
-// sb.append(" AND expires=dateof(maxtimeuuid(");
-// sb.append(row.get(5));
-// sb.append("));\n");
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
index bb3a3e94..3c246db6 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
@@ -77,10 +77,6 @@ public class ExpireRange {
lcred.add(new Range(TWO_MONTH,1,-1,-1,GregorianCalendar.MONTH,1,GregorianCalendar.MONTH,2));
lur.add( new Range(ONE_MONTH,1,-1,-1,0,0,GregorianCalendar.MONTH,1));
- // Comment out until we can get some more clear actions in place for GUI
- // lur.add( new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
- // lur.add( new Range(ONE_WEEK,2,-1,1,0,0,GregorianCalendar.WEEK_OF_MONTH,1));
-
lx509.add(new Range(ONE_MONTH,1,-1,-1,GregorianCalendar.WEEK_OF_MONTH,2,GregorianCalendar.MONTH,1));
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
index 04814e01..b002dd8b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
@@ -80,7 +80,6 @@ public abstract class NotifyBody {
if(row.size()>3) {
escalation = Integer.parseInt(row.get(3));
}
- return;
} else if(type.equals(row.get(0))) {
String user = user(row);
if(user!=null) {
@@ -180,42 +179,46 @@ public abstract class NotifyBody {
String path = pkg.getName().replace('.', '/');
URL url = cl.getResource(path);
List<String> classNames = new ArrayList<>();
- String urlString = url.toString();
- if(urlString.startsWith("jar:file:")) {
- int exclam = urlString.lastIndexOf('!');
- JarFile jf = new JarFile(urlString.substring(9,exclam));
- try {
- Enumeration<JarEntry> jfe = jf.entries();
- while(jfe.hasMoreElements()) {
- String name = jfe.nextElement().getName();
- if(name.startsWith(path) && name.endsWith(".class")) {
- classNames.add(name.substring(0,name.length()-6).replace('/', '.'));
+ String urlString;
+ if (url != null) {
+ urlString = url.toString();
+ if (urlString.startsWith("jar:file:")) {
+ int exclam = urlString.lastIndexOf('!');
+ JarFile jf = new JarFile(urlString.substring(9, exclam));
+ try {
+ Enumeration<JarEntry> jfe = jf.entries();
+ while (jfe.hasMoreElements()) {
+ String name = jfe.nextElement().getName();
+ if (name.startsWith(path) && name.endsWith(".class")) {
+ classNames.add(name.substring(0, name.length() - 6).replace('/', '.'));
+ }
}
+ } finally {
+ jf.close();
}
- } finally {
- jf.close();
- }
- } else {
- File dir = new File(url.getFile());
- for( String f : dir.list()) {
- if(f.endsWith(".class")) {
- classNames.add(pkg.getName() + '.' + f.substring(0,f.length() - 6));
+ } else {
+ File dir = new File(url.getFile());
+ String[] dirs = dir.list();
+ if (dirs != null) {
+ for (String f : dirs) {
+ if (f.endsWith(".class")) {
+ classNames.add(pkg.getName() + '.' + f.substring(0, f.length() - 6));
+ }
+ }
}
}
- }
- for(String cls : classNames) {
- try {
- Class<?> c = cl.loadClass(cls);
- if((c!=null)&&(!Modifier.isAbstract(c.getModifiers()))) {
- Constructor<?> cst = c.getConstructor(Access.class);
- NotifyBody nb = (NotifyBody)cst.newInstance(access);
- if(nb!=null) {
- bodyMap.put("info|" + nb.name, nb);
- bodyMap.put(nb.type+'|' + nb.name, nb);
- }
+ for (String cls : classNames) {
+ try {
+ Class<?> c = cl.loadClass(cls);
+ if ((c != null) && (!Modifier.isAbstract(c.getModifiers()))) {
+ Constructor<?> cst = c.getConstructor(Access.class);
+ NotifyBody nb = (NotifyBody) cst.newInstance(access);
+ bodyMap.put("info|" + nb.name, nb);
+ bodyMap.put(nb.type + '|' + nb.name, nb);
+ }
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ e.printStackTrace();
}
- } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- e.printStackTrace();
}
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
index 087ab952..3d26ce99 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
@@ -94,7 +94,14 @@ public class Remove extends Batch {
remove.add(new File(logDir, args()[i]));
}
} else {
- remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv"));
+ final String ending = Chrono.dateOnlyStamp()+".csv";
+ for (File file : logDir.listFiles(f -> {
+ String name = f.getName();
+ return name.endsWith(ending) && (
+ name.startsWith("Delete") || name.startsWith("Clean."));
+ })) {
+ remove.add(file);
+ };
}
for(File f : remove) {