summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java)285
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchException.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchPrincipal.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Action.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Action.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionDAO.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CacheTouch.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java)3
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredDelete.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPrint.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPrint.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Email.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/EmailPrint.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/FuturePrint.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/FuturePrint.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Key.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Key.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Message.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSACreate.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSADelete.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSDescUpdate.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermCreate.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermDelete.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermModify.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java)6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleCreate.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleDelete.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleModify.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java)6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URAdd.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URDelete.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApprove.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java)6
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java)8
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFuturePrint.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFuturePrint.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URModify.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPrint.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPrint.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approver.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CQLBatch.java)24
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java)15
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java (renamed from auth/auth-core/src/main/java/org/onap/aaf/auth/org/ExpireRange.java)3
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/History.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/InputIterator.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Loader.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Loader.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MiscID.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MonthData.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Notification.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java)2
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java)30
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Visitor.java)17
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/X509.java)26
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/Expiring.java)22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java200
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java185
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/AbsCredBody.java39
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java185
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java54
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java31
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringOrig.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringOrig.java)46
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringP2.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java)16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyApprovals.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java)16
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java)22
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java207
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java (renamed from auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Upload.java)4
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Remove.java124
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_ActionDAO.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_ActionDAO.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_CredPrintTest.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_CredPrintTest.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Email.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Email.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_EmailPrint.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_EmailPrint.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_FuturePrintTest.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_FuturePrintTest.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Message.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Message.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFuturePrintTest.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URFuturePrintTest.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URPrintTest.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URPrintTest.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/creators/RowCreator.java)2
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approval.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approver.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approver.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_CacheChange.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Creator.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Cred.java)8
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java (renamed from auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_ExpireRange.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Future.java)8
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_History.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_History.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_InputIterator.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MiscID.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MiscID.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MonthData.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java)10
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NsAttrib.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Perm.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Role.java)6
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_UserRole.java)10
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_Batch.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchException.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchPrincipal.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_CassBatch.java)4
-rw-r--r--auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java (renamed from auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/JU_NotificationTest.java)10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java18
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java10
-rw-r--r--auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java2
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java5
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java78
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java39
-rw-r--r--auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java4
-rw-r--r--auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java6
-rw-r--r--auth/docker/.gitignore2
-rw-r--r--auth/sample/.gitignore1
-rw-r--r--cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java7
-rw-r--r--misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java65
-rw-r--r--misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java8
112 files changed, 1551 insertions, 558 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
index 5a19ab38..ff605203 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/Batch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth;
+package org.onap.aaf.auth.batch;
import java.io.File;
import java.io.FileInputStream;
@@ -33,31 +33,33 @@ import java.net.URL;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TimeZone;
+import org.apache.log4j.Logger;
import org.onap.aaf.auth.common.Define;
import org.onap.aaf.auth.dao.CassAccess;
-import org.onap.aaf.auth.dao.cass.RoleDAO;
-import org.onap.aaf.auth.dao.cass.UserRoleDAO;
-import org.onap.aaf.auth.dao.hl.Question;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.layer.Result;
+import org.onap.aaf.auth.log4j.Log4JAccessAppender;
import org.onap.aaf.auth.org.Organization;
-import org.onap.aaf.auth.org.Organization.Identity;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.OrganizationFactory;
-import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.Access.Level;
+import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.StaticSlot;
import org.onap.aaf.misc.env.TimeTaken;
+import org.onap.aaf.misc.env.util.Chrono;
+import org.onap.aaf.misc.env.util.Split;
+import org.onap.aaf.misc.env.util.StringBuilderOutputStream;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
@@ -67,8 +69,6 @@ import com.datastax.driver.core.Statement;
public abstract class Batch {
- private static String rootNs;
-
private static StaticSlot ssargs;
protected static final String STARS = "*****";
@@ -77,27 +77,20 @@ public abstract class Batch {
protected static AuthzEnv env;
protected static Session session;
protected static Set<String> specialNames;
+ protected static List<String> specialDomains;
protected static boolean dryRun;
protected static String batchEnv;
public static final String CASS_ENV = "CASS_ENV";
public static final String LOG_DIR = "LOG_DIR";
- protected static final String PUNT="punt";
protected static final String MAX_EMAILS="MAX_EMAILS";
protected static final String VERSION="VERSION";
public static final String GUI_URL="GUI_URL";
protected final Organization org;
-
-
protected Batch(AuthzEnv env) throws APIException, IOException, OrganizationException {
- // Be able to change Environments
- // load extra properties, i.e.
- // PERF.cassandra.clusters=....
- batchEnv = env.getProperty(CASS_ENV);
if (batchEnv != null) {
- batchEnv = batchEnv.trim();
env.info().log("Redirecting to ",batchEnv,"environment");
String str;
for (String key : new String[]{
@@ -105,7 +98,7 @@ public abstract class Batch {
CassAccess.CASSANDRA_CLUSTERS_PORT,
CassAccess.CASSANDRA_CLUSTERS_USER_NAME,
CassAccess.CASSANDRA_CLUSTERS_PASSWORD,
- VERSION,GUI_URL,PUNT,MAX_EMAILS,
+ VERSION,GUI_URL,MAX_EMAILS,
LOG_DIR,
"SPECIAL_NAMES"
}) {
@@ -131,14 +124,18 @@ public abstract class Batch {
// Special names to allow behaviors beyond normal rules
specialNames = new HashSet<>();
+ specialDomains = new ArrayList<>();
String names = env.getProperty( "SPECIAL_NAMES" );
if ( names != null )
{
env.info().log("Loading SPECIAL_NAMES");
- for (String s :names.split(",") )
- {
+ for (String s :names.split(",") ) {
env.info().log("\tspecial: " + s );
- specialNames.add( s.trim() );
+ if(s.indexOf('@')>0) {
+ specialNames.add( s.trim() );
+ } else {
+ specialDomains.add(s.trim());
+ }
}
}
}
@@ -156,13 +153,23 @@ public abstract class Batch {
}
public boolean isSpecial(String user) {
+ if(user==null) {
+ return false;
+ }
if (specialNames != null && specialNames.contains(user)) {
env.info().log("specialName: " + user);
-
return (true);
} else {
- return (false);
+ if(specialDomains!=null) {
+ for(String sd : specialDomains) {
+ if(user.endsWith(sd)) {
+ env.info().log("specialDomain: " + user + " matches " + sd);
+ return (true);
+ }
+ }
+ }
}
+ return (false);
}
@@ -317,35 +324,6 @@ public abstract class Batch {
}
}
- // IMPORTANT! VALIDATE Organization isUser method
- protected void checkOrganizationAcccess(AuthzTrans trans, Question q) throws APIException, OrganizationException {
- Set<String> testUsers = new HashSet<>();
- Result<List<RoleDAO.Data>> rrd = q.roleDAO.readNS(trans, rootNs);
- if (rrd.isOK()) {
- for (RoleDAO.Data r : rrd.value) {
- Result<List<UserRoleDAO.Data>> rur = q.userRoleDAO.readByRole(trans, r.fullName());
- if (!rur.isOK()) {
- continue;
- }
- for (UserRoleDAO.Data udd : rur.value) {
- testUsers.add(udd.user);
- }
- }
- if (testUsers.size() < 2) {
- throw new APIException("Not enough Users in Roles for " + rootNs + " to Validate");
- }
-
- Identity iden;
- for (String user : testUsers) {
- if ((iden = org.getIdentity(trans, user)) == null) {
- throw new APIException("Failed Organization Entity Validation Check: " + user);
- } else {
- trans.info().log("Organization Validation Check: " + iden.id());
- }
- }
- }
- }
-
protected static String logDir() {
String ld = env.getProperty(LOG_DIR);
if (ld==null) {
@@ -375,13 +353,21 @@ public abstract class Batch {
}
public static void main(String[] args) {
- PropAccess access = new PropAccess(args);
+ // Use a StringBuilder to save off logs until a File can be setup
+ StringBuilderOutputStream sbos = new StringBuilderOutputStream();
+ PropAccess access = new PropAccess(new PrintStream(sbos),args);
+ access.log(Level.INIT, "------- Starting Batch ------\n Args: ");
+ for(String s: args) {
+ sbos.getBuffer().append(s);
+ sbos.getBuffer().append(' ');
+ }
+
InputStream is = null;
String filename;
String propLoc;
try {
Define.set(access);
- rootNs =Define.ROOT_NS();
+
if(access.getProperty(Config.CADI_PROP_FILES)==null) {
File f = new File("authBatch.props");
try {
@@ -411,97 +397,118 @@ public abstract class Batch {
access.log(Level.INFO,"Configuring from", propLoc);
}
- env = new AuthzEnv(access);
+ env = new AuthzEnv(access);
+
transferVMProps(env, CASS_ENV, "DRY_RUN", "NS", "Organization");
- // Flow all Env Logs to Log4j, with ENV
-
-// LogFileNamer lfn;
-// lfn = new LogFileNamer(logDir(),"").noPID();
-// lfn.setAppender("authz-batch");
-// lfn.setAppender("aspr|ASPR");
-// lfn.setAppender("sync");
-// lfn.setAppender("jobchange");
-// lfn.setAppender("validateuser");
-// aspr = Logger.getLogger("aspr");
-// Log4JLogTarget.setLog4JEnv("authz-batch", env);
-// propLoc = null;
-
- Batch batch = null;
- // setup ATTUser and Organization Slots before starting this:
- // TODO redo this
- // env.slot(ATT.ATT_USERSLOT);
- //
- // OrganizationFactory.setDefaultOrg(env, ATT.class.getName());
- AuthzTrans trans = env.newTrans();
-
- TimeTaken tt = trans.start("Total Run", Env.SUB);
- try {
- int len = args.length;
- if (len > 0) {
- String toolName = args[0];
- len -= 1;
- if (len < 0)
- len = 0;
- String nargs[] = new String[len];
- if (len > 0) {
- System.arraycopy(args, 1, nargs, 0, len);
- }
-
- env.put(ssargs = env.staticSlot("ARGS"), nargs);
-
- /*
- * Add New Batch Programs (inherit from Batch) here
- */
-
- // Might be a Report, Update or Temp Batch
- Class<?> cls;
- String classifier = "";
- try {
- cls = ClassLoader.getSystemClassLoader().loadClass("org.onap.aaf.auth.update." + toolName);
- classifier = "Update:";
- } catch (ClassNotFoundException e) {
- try {
- cls = ClassLoader.getSystemClassLoader().loadClass("org.onap.aaf.auth.reports." + toolName);
- classifier = "Report:";
- } catch (ClassNotFoundException e2) {
- try {
- cls = ClassLoader.getSystemClassLoader()
- .loadClass("org.onap.aaf.auth.temp." + toolName);
- classifier = "Temp Utility:";
- } catch (ClassNotFoundException e3) {
- cls = null;
- }
- }
- }
- if (cls != null) {
- Constructor<?> cnst = cls.getConstructor(new Class[] { AuthzTrans.class });
- batch = (Batch) cnst.newInstance(trans);
- env.info().log("Begin", classifier, toolName);
- }
-
-
- if (batch == null) {
- trans.error().log("No Batch named", toolName, "found");
- }
- /*
- * End New Batch Programs (inherit from Batch) here
- */
+ // Be able to change Environments
+ // load extra properties, i.e.
+ // PERF.cassandra.clusters=....
+ batchEnv = env.getProperty(CASS_ENV);
+ if(batchEnv!=null) {
+ batchEnv = batchEnv.trim();
+ }
- }
- if (batch != null) {
- batch.run(trans);
- }
+ File logFile = new File(logDir() + "/batch" + Chrono.dateOnlyStamp(new Date()) + ".log" );
+ PrintStream batchLog = new PrintStream(new FileOutputStream(logFile,true));
+ try {
+ access.setStreamLogIt(batchLog);
+ sbos.flush();
+ batchLog.print(sbos.getBuffer());
+ sbos = null;
+ Logger.getRootLogger().addAppender(new Log4JAccessAppender(access));
+
+ Batch batch = null;
+ AuthzTrans trans = env.newTrans();
+
+ TimeTaken tt = trans.start("Total Run", Env.SUB);
+ try {
+ int len = args.length;
+ if (len > 0) {
+ String toolName = args[0];
+ len -= 1;
+ if (len < 0)
+ len = 0;
+ String nargs[] = new String[len];
+ if (len > 0) {
+ System.arraycopy(args, 1, nargs, 0, len);
+ }
+
+ env.put(ssargs = env.staticSlot("ARGS"), nargs);
+
+ /*
+ * Add New Batch Programs (inherit from Batch) here
+ */
+
+ // Might be a Report, Update or Temp Batch
+ Class<?> cls = null;
+ String classifier = "";
+
+ String[] pkgs = new String[] {
+ "org.onap.aaf.auth.batch.update",
+ "org.onap.aaf.auth.batch.reports",
+ "org.onap.aaf.auth.batch.temp"
+ };
+
+ String ebp = env.getProperty("EXTRA_BATCH_PKGS");
+ if(ebp!=null) {
+ String[] ebps = Split.splitTrim(':', ebp);
+ String[] temp = new String[ebps.length + pkgs.length];
+ System.arraycopy(pkgs,0, temp, 0, pkgs.length);
+ System.arraycopy(ebps,0,temp,pkgs.length,ebps.length);
+ pkgs = temp;
+ }
+
+ for(String p : pkgs) {
+ try {
+ cls = ClassLoader.getSystemClassLoader().loadClass(p + '.' + toolName);
+ int lastDot = p.lastIndexOf('.');
+ if(p.length()>0 || p.length()!=lastDot) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Character.toUpperCase(p.charAt(++lastDot)));
+ while(++lastDot<p.length()) {
+ sb.append(p.charAt(lastDot));
+ }
+ sb.append(':');
+ classifier = sb.toString();
+ break;
+ }
+ } catch (ClassNotFoundException e) {
+ cls = null;
+ }
+ }
+ if (cls != null) {
+ Constructor<?> cnst = cls.getConstructor(AuthzTrans.class);
+ batch = (Batch) cnst.newInstance(trans);
+ env.info().log("Begin", classifier, toolName);
+ }
+
+
+ if (batch == null) {
+ trans.error().log("No Batch named", toolName, "found");
+ }
+ /*
+ * End New Batch Programs (inherit from Batch) here
+ */
+
+ }
+ if (batch != null) {
+ batch.run(trans);
+ }
+ } finally {
+ tt.done();
+ if (batch != null) {
+ batch.close(trans);
+ }
+ StringBuilder sb = new StringBuilder("Task Times\n");
+ trans.auditTrail(4, sb, AuthzTrans.SUB, AuthzTrans.REMOTE);
+ trans.info().log(sb);
+ }
} finally {
- tt.done();
- if (batch != null) {
- batch.close(trans);
- }
- StringBuilder sb = new StringBuilder("Task Times\n");
- trans.auditTrail(4, sb, AuthzTrans.SUB, AuthzTrans.REMOTE);
- trans.info().log(sb);
+ batchLog.close();
}
+
} catch (Exception e) {
e.printStackTrace(System.err);
// Exceptions thrown by DB aren't stopping the whole process.
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchException.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
index 15bec4e4..dbb2dc31 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchException.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchException.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth;
+package org.onap.aaf.auth.batch;
public class BatchException extends Exception {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchPrincipal.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
index 66431c8a..0bc58add 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/BatchPrincipal.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/BatchPrincipal.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*
*/
-package org.onap.aaf.auth;
+package org.onap.aaf.auth.batch;
import org.onap.aaf.cadi.principal.TaggedPrincipal;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
index 4ebb3a94..1fc16e4e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/CassBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/CassBatch.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth;
+package org.onap.aaf.auth.batch;
import java.io.IOException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Action.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Action.java
index 54e2ee2d..544d049d 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Action.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Action.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.layer.Result;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionDAO.java
index 5275cf93..416a13ce 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionDAO.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java
index ed032c95..37abbaf4 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/ActionPuntDAO.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/ActionPuntDAO.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.Date;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CacheTouch.java
index 269edc77..94df581b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CacheTouch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CacheTouch.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
@@ -45,6 +45,7 @@ public class CacheTouch extends ActionDAO<String,Void, String> {
trans.info().printf("Would mark %s cache in DB for clearing: %s",table, text);
return Result.ok();
} else {
+
Result<Void> rv = q.clearCache(trans, table);
trans.info().printf("Set DB Cache %s for clearing: %s",table, text);
return rv;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredDelete.java
index ceb0453b..61da6094 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredDelete.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPrint.java
index 658ef8b5..9780f2ba 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPrint.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import org.onap.aaf.auth.dao.cass.CredDAO;
import org.onap.aaf.auth.env.AuthzTrans;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java
index 33151d9f..ef6bb94e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/CredPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/CredPunt.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.Date;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Email.java
index f40eeb58..461d3fc7 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Email.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Email.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.PrintStream;
import java.util.ArrayList;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/EmailPrint.java
index 141e382f..3ab481f5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/EmailPrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/EmailPrint.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.PrintStream;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/FuturePrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/FuturePrint.java
index eda96629..f95e9222 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/FuturePrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/FuturePrint.java
@@ -19,10 +19,10 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
+import org.onap.aaf.auth.batch.helpers.Future;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Future;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Key.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Key.java
index ee2e8c3b..fb43a425 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Key.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Key.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
public interface Key<HELPER> {
public String key(HELPER H);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Message.java
index f1eadb20..8bef131c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/Message.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/Message.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.util.ArrayList;
import java.util.List;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSACreate.java
index 58a8c4b8..567bccfc 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSACreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSACreate.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.NsAttrib;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.NsAttrib;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSADelete.java
index c8a1c82c..86eff7ea 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSADelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSADelete.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.NsAttrib;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.NsAttrib;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSDescUpdate.java
index d5d93b38..2542e045 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/NSDescUpdate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/NSDescUpdate.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.NS;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.NS;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermCreate.java
index a6c02f2c..65555704 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermCreate.java
@@ -19,14 +19,14 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.Perm;
import org.onap.aaf.auth.dao.cass.PermDAO;
import org.onap.aaf.auth.dao.cass.PermDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Perm;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermDelete.java
index db549948..b9ae8d56 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermDelete.java
@@ -19,13 +19,13 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.Perm;
import org.onap.aaf.auth.dao.cass.PermDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Perm;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermModify.java
index a3d4bb6d..4b76baf5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/PermModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/PermModify.java
@@ -19,18 +19,18 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.List;
+import org.onap.aaf.auth.batch.helpers.Perm;
+import org.onap.aaf.auth.batch.helpers.Role;
import org.onap.aaf.auth.dao.cass.PermDAO;
import org.onap.aaf.auth.dao.cass.RoleDAO;
import org.onap.aaf.auth.dao.cass.Status;
import org.onap.aaf.auth.dao.cass.PermDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Perm;
-import org.onap.aaf.auth.helpers.Role;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleCreate.java
index cdbe92b4..512d4a31 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleCreate.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleCreate.java
@@ -19,14 +19,14 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.Role;
import org.onap.aaf.auth.dao.cass.RoleDAO;
import org.onap.aaf.auth.dao.cass.RoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Role;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleDelete.java
index 67491b5b..3e109b2b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleDelete.java
@@ -19,13 +19,13 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.Role;
import org.onap.aaf.auth.dao.cass.RoleDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Role;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleModify.java
index 75937ef7..388e6692 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/RoleModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/RoleModify.java
@@ -19,18 +19,18 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.List;
+import org.onap.aaf.auth.batch.helpers.Perm;
+import org.onap.aaf.auth.batch.helpers.Role;
import org.onap.aaf.auth.dao.cass.PermDAO;
import org.onap.aaf.auth.dao.cass.RoleDAO;
import org.onap.aaf.auth.dao.cass.Status;
import org.onap.aaf.auth.dao.cass.RoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Perm;
-import org.onap.aaf.auth.helpers.Role;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URAdd.java
index 4538c56b..e0c1bb80 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URAdd.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URAdd.java
@@ -19,14 +19,14 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URDelete.java
index cf519f6f..00208ad9 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URDelete.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URDelete.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApprove.java
index 63d4ef7c..a228a8ca 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApprove.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApprove.java
@@ -19,20 +19,20 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.Date;
import java.util.GregorianCalendar;
+import org.onap.aaf.auth.batch.helpers.Approval;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.dao.cass.FutureDAO;
import org.onap.aaf.auth.dao.cass.NsDAO;
import org.onap.aaf.auth.dao.hl.Function;
import org.onap.aaf.auth.dao.hl.Question;
import org.onap.aaf.auth.dao.hl.Function.FUTURE_OP;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Approval;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.auth.org.Organization.Expiration;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java
index 75bbd813..631a8115 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFutureApproveExec.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFutureApproveExec.java
@@ -19,12 +19,15 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import org.onap.aaf.auth.batch.helpers.Approval;
+import org.onap.aaf.auth.batch.helpers.Future;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.dao.cass.ApprovalDAO;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.dao.cass.ApprovalDAO.Data;
@@ -32,9 +35,6 @@ import org.onap.aaf.auth.dao.hl.Function.FUTURE_OP;
import org.onap.aaf.auth.dao.hl.Function.Lookup;
import org.onap.aaf.auth.dao.hl.Function.OP_STATUS;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Approval;
-import org.onap.aaf.auth.helpers.Future;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFuturePrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFuturePrint.java
index b749c648..bf6ead36 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URFuturePrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URFuturePrint.java
@@ -19,10 +19,10 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URModify.java
index 12460c97..a17c4fd2 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URModify.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URModify.java
@@ -19,16 +19,16 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.List;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.dao.cass.Status;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPrint.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPrint.java
index be464d42..12eb115a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPrint.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPrint.java
@@ -19,10 +19,10 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java
index 6371ebb5..18705fb8 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/actions/URPunt.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/actions/URPunt.java
@@ -19,16 +19,16 @@
*
*/
-package org.onap.aaf.auth.actions;
+package org.onap.aaf.auth.batch.actions;
import java.io.IOException;
import java.util.Date;
import java.util.List;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
import org.onap.aaf.misc.env.util.Chrono;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
index a4c4efbc..fb3aefbe 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.Date;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approver.java
index 977964f1..6e27495f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Approver.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approver.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.HashMap;
import java.util.Map;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.actions.Message;
import org.onap.aaf.auth.org.Organization;
public class Approver {
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CQLBatch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
index e4d487d6..efd1ec9e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CQLBatch.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CQLBatch.java
@@ -18,7 +18,9 @@
* ============LICENSE_END====================================================
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
+
+import org.onap.aaf.misc.env.LogTarget;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
@@ -27,8 +29,10 @@ public class CQLBatch {
private Session session;
private StringBuilder sb;
private int hasAdded;
+ private LogTarget log;
- public CQLBatch(Session session) {
+ public CQLBatch(LogTarget log, Session session) {
+ this.log = log;
this.session = session;
sb = new StringBuilder();
hasAdded = 0;
@@ -42,11 +46,10 @@ public class CQLBatch {
private boolean end() {
if(sb.length()==hasAdded) {
- System.out.println("Nothing to Process");
return false;
} else {
sb.append("APPLY BATCH;\n");
- System.out.println(sb);
+ log.log(sb);
return true;
}
}
@@ -66,6 +69,17 @@ public class CQLBatch {
} else {
return execute();
}
-
+ }
+
+ public void touch(String table, int begin, int end, boolean dryRun) {
+ StringBuilder sb = begin();
+ for(int i=begin;i<end;++i) {
+ sb.append("UPDATE cache SET touched=dateof(now()) WHERE name='");
+ sb.append(table);
+ sb.append("' AND seg=");
+ sb.append(i);
+ sb.append(";\n");
+ }
+ execute(dryRun);
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
index 1407bdd0..a4cfcbec 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/CacheChange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/CacheChange.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.List;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
index a3eb8363..152c6331 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Creator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Creator.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import com.datastax.driver.core.Row;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
index ec609488..e3ac9e63 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Cred.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Cred.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.Date;
@@ -280,7 +280,7 @@ public class Cred {
}
- public static void row(StringBuilder sb, List<String> row) {
+ public static void batchDelete(StringBuilder sb, List<String> row) {
sb.append("DELETE from authz.cred WHERE id='");
sb.append(row.get(1));
sb.append("' AND type=");
@@ -291,7 +291,6 @@ public class Cred {
sb.append("));\n");
}
-
public String toString() {
StringBuilder sb = new StringBuilder(id);
sb.append('[');
@@ -322,4 +321,14 @@ public class Cred {
return id.equals(obj);
}
+
+ public static String histSubject(List<String> row) {
+ return row.get(1);
+ }
+
+
+ public static String histMemo(String fmt, String orgName, List<String> row) {
+ return String.format(fmt, row.get(1),orgName,row.get(4));
+ }
+
} \ No newline at end of file
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/ExpireRange.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
index c21b2bef..a985640b 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/ExpireRange.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/ExpireRange.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*/
-package org.onap.aaf.auth.org;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.Date;
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.PropAccess;
public class ExpireRange {
private static final String AAF_BATCH_RANGE = "aaf_batch_range.";
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
index 8a11479e..ac4a1323 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.nio.ByteBuffer;
import java.util.ArrayList;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/History.java
index cffb55a5..a172738c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/History.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/History.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.nio.ByteBuffer;
import java.util.Iterator;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/InputIterator.java
index 5fb3e5dc..04d9a019 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/InputIterator.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/InputIterator.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.io.BufferedReader;
import java.io.IOException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Loader.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Loader.java
index 1ec64b7b..ea533b8b 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Loader.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Loader.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
public interface Loader<T> {
public void exec(T t);
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MiscID.java
index 8eecb656..45875a20 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MiscID.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MiscID.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.Map;
import java.util.TreeMap;
-import org.onap.aaf.auth.BatchException;
+import org.onap.aaf.auth.batch.BatchException;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.TimeTaken;
import org.onap.aaf.misc.env.Trans;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MonthData.java
index e15a6bc2..35ad6a10 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/MonthData.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/MonthData.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.io.BufferedReader;
import java.io.File;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
index 5692d116..3df72e12 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NS.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.Iterator;
import java.util.Map;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Notification.java
index b178c377..5c7a8269 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Notification.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Notification.java
@@ -19,14 +19,14 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TreeMap;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.actions.Message;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.misc.env.Env;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
index a3354f38..c8419d50 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/NsAttrib.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.List;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java
index ee588f31..21bd71ee 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Perm.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Perm.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.Iterator;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
index 04a5dceb..4b4a2551 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Role.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Role.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.util.ArrayList;
import java.util.HashSet;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
index d9e6bed3..bea3b5ec 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/UserRole.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/UserRole.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.io.PrintStream;
import java.util.ArrayList;
@@ -29,7 +29,7 @@ import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
-import org.onap.aaf.auth.actions.URDelete;
+import org.onap.aaf.auth.batch.actions.URDelete;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.dao.cass.UserRoleDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
@@ -106,6 +106,10 @@ public class UserRole implements Cloneable, CacheChange.Data {
return byRole;
}
+ public static void load(Trans trans, Session session, Creator<UserRole> creator) {
+ load(trans,session,creator,null,new DataLoadVisitor());
+ }
+
public static void load(Trans trans, Session session, Creator<UserRole> creator, Visitor<UserRole> visitor ) {
load(trans,session,creator,null,visitor);
}
@@ -305,10 +309,10 @@ public class UserRole implements Cloneable, CacheChange.Data {
}
public void row(final CSV.Writer csvw) {
- csvw.row("ur",user(),ns(),rname(),Chrono.dateOnlyStamp(expires()));
+ csvw.row("ur",user(),ns(),rname(),Chrono.dateOnlyStamp(expires()),expires().getTime());
}
- public static void row(StringBuilder sb, List<String> row) {
+ public static void batchDelete(StringBuilder sb, List<String> row) {
sb.append("DELETE from authz.user_role WHERE user='");
sb.append(row.get(1));
sb.append("' AND role='");
@@ -317,6 +321,24 @@ public class UserRole implements Cloneable, CacheChange.Data {
sb.append(row.get(3));
sb.append("';\n");
}
+
+ public static void batchExtend(StringBuilder sb, List<String> row, String newDate ) {
+ sb.append("UPDATE authz.user_role SET expires='");
+ sb.append(newDate);
+ sb.append("' WHERE user='");
+ sb.append(row.get(1));
+ sb.append("' AND role='");
+ sb.append(row.get(2));
+ sb.append('.');
+ sb.append(row.get(3));
+ sb.append("';\n");
+ }
+ public static String histMemo(String fmt, List<String> row) {
+ return String.format(fmt, row.get(1),row.get(2)+'.'+row.get(3), row.get(4));
+ }
+ public static String histSubject(List<String> row) {
+ return row.get(1) + '|' + row.get(2)+'.'+row.get(3);
+ }
} \ No newline at end of file
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Visitor.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
index 1eb9ffec..17f289a1 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/Visitor.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Visitor.java
@@ -18,8 +18,23 @@
* ============LICENSE_END====================================================
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
public interface Visitor<T> {
void visit(T t);
+
+ public static class Multi<T> implements Visitor<T> {
+ private final Visitor<T>[] visitors;
+ @SafeVarargs
+ public Multi(Visitor<T> ... vs) {
+ visitors = vs;
+ }
+
+ @Override
+ public void visit(T t) {
+ for(Visitor<T> v : visitors) {
+ v.visit(t);
+ }
+ }
+ };
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/X509.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
index 95fe3c0e..0ffaa8f5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/helpers/X509.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/X509.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.helpers;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -33,6 +33,7 @@ import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.TimeTaken;
import org.onap.aaf.misc.env.Trans;
import org.onap.aaf.misc.env.util.Chrono;
+import org.onap.aaf.misc.env.util.Split;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
@@ -59,7 +60,7 @@ public class X509 {
private static void load(Trans trans, Session session, String query, Visitor<X509> visitor) {
trans.info().log( "query: " + query );
- TimeTaken tt = trans.start("Read Roles", Env.REMOTE);
+ TimeTaken tt = trans.start("Read X509", Env.REMOTE);
ResultSet results;
try {
@@ -116,4 +117,25 @@ public class X509 {
sb.append(";\n");
}
+
+ public static String histSubject(List<String> row) {
+ return row.get(4);
+ }
+
+
+ public static String histMemo(String fmt, List<String> row) {
+ String id="n/a";
+ for(String s : Split.splitTrim(',', row.get(4))) {
+ if(s.startsWith("OU=") && s.indexOf('@')>=0) {
+ int colon = s.indexOf(':');
+ if(colon<0) {
+ colon=s.length();
+ }
+ id=s.substring(3,colon);
+ break;
+ }
+ }
+ return String.format(fmt, "Cert for " + id,"CA " + row.get(1),row.get(3));
+ }
+
} \ No newline at end of file
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/Expiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
index 289da58e..d8eee6d5 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/reports/Expiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Expiring.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.reports;
+package org.onap.aaf.auth.batch.reports;
import java.io.File;
import java.io.FileNotFoundException;
@@ -35,16 +35,16 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import org.onap.aaf.auth.Batch;
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.ExpireRange;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.Visitor;
+import org.onap.aaf.auth.batch.helpers.X509;
+import org.onap.aaf.auth.batch.helpers.Cred.Instance;
+import org.onap.aaf.auth.batch.helpers.ExpireRange.Range;
import org.onap.aaf.auth.dao.cass.CredDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Cred;
-import org.onap.aaf.auth.helpers.Cred.Instance;
-import org.onap.aaf.auth.helpers.UserRole;
-import org.onap.aaf.auth.helpers.Visitor;
-import org.onap.aaf.auth.helpers.X509;
-import org.onap.aaf.auth.org.ExpireRange;
-import org.onap.aaf.auth.org.ExpireRange.Range;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.cadi.configure.Factory;
import org.onap.aaf.cadi.util.CSV;
@@ -80,7 +80,6 @@ public class Expiring extends Batch {
// Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
Cred.load(trans, session);
- UserRole.load(trans, session, UserRole.v2_0_11, new UserRole.DataLoadVisitor());
minOwners=1;
@@ -100,8 +99,9 @@ public class Expiring extends Batch {
cw.row(INFO,r.name(),Chrono.dateOnlyStamp(expireRange.now),r.reportingLevel());
writerList.put(r.name(),cw);
if("Delete".equals(r.name())) {
- deleteDate = r.getStart();
+ deleteDate = r.getEnd();
}
+ trans.init().log("Creating File:",file.getAbsolutePath());
}
}
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
new file mode 100644
index 00000000..2ba5d022
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/NotInOrg.java
@@ -0,0 +1,200 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.batch.reports;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.Cred.Instance;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.Visitor;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.org.Organization;
+import org.onap.aaf.auth.org.Organization.Identity;
+import org.onap.aaf.auth.org.OrganizationException;
+import org.onap.aaf.cadi.util.CSV;
+import org.onap.aaf.cadi.util.CSV.Writer;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.TimeTaken;
+import org.onap.aaf.misc.env.util.Chrono;
+
+
+public class NotInOrg extends Batch {
+
+ private static final String NOT_IN_ORG = "NotInOrg";
+ private static final String CSV = ".csv";
+ private static final String INFO = "info";
+ private Map<String, CSV.Writer> writerList;
+ private Map<String, CSV.Writer> whichWriter;
+ private File logDir;
+ private Date now;
+ private Writer notInOrgW;
+ private Writer notInOrgDeleteW;
+
+ public NotInOrg(AuthzTrans trans) throws APIException, IOException, OrganizationException {
+ super(trans.env());
+ trans.info().log("Starting Connection Process");
+
+ TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
+ try {
+ TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
+ try {
+ session = cluster.connect();
+ } finally {
+ tt.done();
+ }
+
+ // Load Cred. We don't follow Visitor, because we have to gather up everything into Identity Anyway
+ Cred.load(trans, session);
+
+ // Create Intermediate Output
+ writerList = new HashMap<>();
+ whichWriter = new TreeMap<>();
+ logDir = new File(logDir());
+ logDir.mkdirs();
+
+ now = new Date();
+ String sdate = Chrono.dateOnlyStamp(now);
+ File file = new File(logDir,NOT_IN_ORG + sdate +CSV);
+ CSV csv = new CSV(file);
+ notInOrgW = csv.writer(false);
+ notInOrgW.row(INFO,NOT_IN_ORG,Chrono.dateOnlyStamp(now),0);
+ writerList.put(NOT_IN_ORG,notInOrgW);
+
+ // These will have been double-checked by the Organization, and can be deleted immediately.
+ String fn = NOT_IN_ORG+"Delete";
+ file = new File(logDir,fn + sdate +CSV);
+ CSV csvDelete = new CSV(file);
+ notInOrgDeleteW = csvDelete.writer(false);
+ notInOrgDeleteW.row(INFO,fn,Chrono.dateOnlyStamp(now),0);
+ writerList.put(NOT_IN_ORG,notInOrgW);
+
+ } finally {
+ tt0.done();
+ }
+ }
+
+ @Override
+ protected void run(AuthzTrans trans) {
+ try {
+ Map<String,Boolean> checked = new TreeMap<String, Boolean>();
+ trans.info().log("Process Organization Identities");
+ trans.info().log("User Roles");
+
+ final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
+ UserRole.load(trans, session, UserRole.v2_0_11, new Visitor<UserRole>() {
+ @Override
+ public void visit(UserRole ur) {
+ try {
+ if(!check(transNoAvg, checked, ur.user())) {
+ ur.row(whichWriter(transNoAvg,ur.user()));
+ }
+ } catch (OrganizationException e) {
+ trans.error().log(e, "Error Decrypting X509");
+ }
+ }
+ });
+
+ trans.info().log("Checking for Creds without IDs");
+
+ for (Cred cred : Cred.data.values()) {
+ if(!check(transNoAvg,checked, cred.id)) {
+ CSV.Writer cw = whichWriter(transNoAvg, cred.id);
+ for(Instance inst : cred.instances) {
+ cred.row(cw, inst);
+ }
+ }
+ }
+
+ /*
+ * Do we delete now? Or work on Revocation semantics
+ *
+ trans.info().log("Checking for X509s without IDs");
+ X509.load(trans, session, new Visitor<X509>() {
+ @Override
+ public void visit(X509 x509) {
+ try {
+ for(Certificate cert : Factory.toX509Certificate(x509.x509)) {
+ X509Certificate xc = (X509Certificate)cert;
+ xc.getSubjectDN();
+ if(!check(transNoAvg,checked, (X))) {
+ x509.row(notInOrgW,);
+ }
+ }
+ } catch (CertificateException | IOException e) {
+ trans.error().log(e, "Error Decrypting X509");
+ }
+ }
+ });
+ */
+ } catch (OrganizationException e) {
+ trans.info().log(e);
+ }
+ }
+
+
+ private Writer whichWriter(AuthzTrans transNoAvg, String id) {
+ Writer w = whichWriter.get(id);
+ if(w==null) {
+ w = org.mayAutoDelete(transNoAvg, id)?
+ notInOrgDeleteW:
+ notInOrgW;
+ whichWriter.put(id,w);
+ }
+ return w;
+ }
+
+ private boolean check(AuthzTrans trans, Map<String, Boolean> checked, String id) throws OrganizationException {
+ Boolean rv = checked.get(id);
+ if(rv==null) {
+ if(isSpecial(id)) { // do not check against org... too important to delete.
+ return true;
+ }
+ Organization org = trans.org();
+ if(org != null) {
+ Identity identity = org.getIdentity(trans, id);
+ rv = identity!=null;
+ checked.put(id, rv);
+ } else {
+ throw new OrganizationException("No Organization Found for " + id + ": required for processing");
+ }
+ }
+ return rv;
+ }
+
+
+ @Override
+ protected void _close(AuthzTrans trans) {
+ session.close();
+ for(CSV.Writer cw : writerList.values()) {
+ cw.close();
+ }
+ }
+
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
new file mode 100644
index 00000000..cb57497e
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/Notify.java
@@ -0,0 +1,185 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */package org.onap.aaf.auth.batch.reports;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.reports.bodies.NotifyBody;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.org.Mailer;
+import org.onap.aaf.auth.org.Organization.Identity;
+import org.onap.aaf.auth.org.OrganizationException;
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.client.Holder;
+import org.onap.aaf.cadi.util.CSV;
+import org.onap.aaf.misc.env.APIException;
+
+public class Notify extends Batch {
+ private final Mailer mailer;
+ private final String mailFrom;
+ private final String header;
+ private final String footer;
+ private List<File> notifyFile;
+
+ public Notify(AuthzTrans trans) throws APIException, IOException, OrganizationException {
+ super(trans.env());
+ String mailerCls = env.getProperty("MAILER");
+ mailFrom = env.getProperty("MAIL_FROM");
+ String header_html = env.getProperty("HEADER_HTML");
+ String footer_html = env.getProperty("FOOTER_HTML");
+ if(mailerCls==null || mailFrom==null || header_html==null || footer_html==null) {
+ throw new APIException("Notify requires MAILER, MAILER_FROM, HEADER_HTML and FOOTER_HTML properties");
+ }
+ try {
+ Class<?> mailc = Class.forName(mailerCls);
+ Constructor<?> mailcst = mailc.getConstructor(Access.class);
+ mailer = (Mailer)mailcst.newInstance(env.access());
+ } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new APIException("Unable to construct " + mailerCls,e);
+ }
+
+ FileInputStream fis = new FileInputStream(header_html);
+ try {
+ byte[] content = new byte[(int)fis.getChannel().size()];
+ fis.read(content);
+ header = new String(content);
+ } finally {
+ fis.close();
+ }
+
+ fis = new FileInputStream(footer_html);
+ try {
+ byte[] content = new byte[(int)fis.getChannel().size()];
+ fis.read(content);
+ footer = new String(content);
+ } finally {
+ fis.close();
+ }
+
+ // Class Load possible data
+ NotifyBody.load(env.access());
+
+ // Create Intermediate Output
+ File logDir = new File(logDir());
+ notifyFile = new ArrayList<>();
+ if(args().length>0) {
+ for(int i=0;i<args().length;++i) {
+ notifyFile.add(new File(logDir, args()[i]));
+ }
+ }
+ }
+
+ @Override
+ protected void run(AuthzTrans trans) {
+ List<String> toList = new ArrayList<>();
+ List<String> ccList = new ArrayList<>();
+ AuthzTrans noAvg = trans.env().newTransNoAvg();
+ String subject = "Test Notify";
+ boolean urgent = false;
+
+
+
+ final Notify notify = this;
+ final Holder<List<String>> info = new Holder<>(null);
+ final Set<String> errorSet = new HashSet<>();
+
+ try {
+ for(File f : notifyFile) {
+ CSV csv = new CSV(f);
+ try {
+ csv.visit(new CSV.Visitor() {
+ @Override
+ public void visit(List<String> row) throws IOException, CadiException {
+ if("info".equals(row.get(0))) {
+ info.set(row);
+ }
+ if(info.get()==null) {
+ throw new CadiException("First line of Feed MUST contain 'info' record");
+ }
+ String key = row.get(0)+'|'+info.get().get(1);
+ NotifyBody body = NotifyBody.get(key);
+ if(body==null) {
+ errorSet.add("No NotifyBody defined for " + key);
+ } else {
+ body.store(row);
+ }
+ }
+ });
+ } catch (IOException | CadiException e) {
+ e.printStackTrace();
+ }
+
+ // now create Notification
+ for(NotifyBody nb : NotifyBody.getAll()) {
+ for(String id : nb.users()) {
+ toList.clear();
+ ccList.clear();
+ try {
+ String bodyS = nb.body(noAvg, notify, id);
+ Identity identity = trans.org().getIdentity(noAvg, id);
+ if(!identity.isPerson()) {
+ identity = identity.responsibleTo();
+ }
+ for(int i=1;i<nb.escalation();++i) {
+ if(identity != null) {
+ if(i==1) {
+ toList.add(identity.email());
+ } else {
+ identity=identity.responsibleTo();
+ ccList.add(identity.email());
+ }
+ }
+ }
+
+ mailer.sendEmail(noAvg, dryRun, mailFrom, toList, ccList, subject,
+ String.format(header,"2.1.9",Identity.mixedCase(identity.firstName()))+
+ bodyS +
+ footer, urgent);
+ } catch (OrganizationException e) {
+ trans.error().log(e);
+ }
+ }
+ }
+
+ }
+ } finally {
+ for(String s : errorSet) {
+ trans.audit().log(s);
+ }
+ }
+ }
+
+ @Override
+ protected void _close(AuthzTrans trans) {
+ }
+
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/AbsCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/AbsCredBody.java
new file mode 100644
index 00000000..c0d16b06
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/AbsCredBody.java
@@ -0,0 +1,39 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.batch.reports.bodies;
+
+import java.io.IOException;
+import java.util.List;
+
+public abstract class AbsCredBody extends NotifyBody {
+
+ public AbsCredBody(final String name) throws IOException {
+ super("cred",name);
+ }
+
+ @Override
+ public String user(List<String> row) {
+ if(row.size()>0) {
+ return row.get(1);
+ }
+ return null;
+ }
+}
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
new file mode 100644
index 00000000..429ea6d2
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java
@@ -0,0 +1,185 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.batch.reports.bodies;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.onap.aaf.auth.batch.reports.Notify;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.cadi.Access;
+import org.onap.aaf.misc.env.APIException;
+
+public abstract class NotifyBody {
+ private static final Map<String,NotifyBody> bodyMap = new HashMap<>();
+
+ protected Map<String,List<List<String>>> rows;
+ private final String name;
+ private final String type;
+ private String date;
+ private int escalation;
+
+ public NotifyBody(final String type, final String name) {
+ rows = new TreeMap<>();
+ this.name = name;
+ this.type = type;
+ date="";
+ escalation = 1;
+ }
+
+ public void store(List<String> row) {
+ if(!row.isEmpty()) {
+ if("info".equals(row.get(0))) {
+ if(row.size()>2) {
+ date = row.get(2);
+ }
+ 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) {
+ List<List<String>> lss = rows.get(user);
+ if(lss == null) {
+ lss = new ArrayList<>();
+ rows.put(user,lss);
+ }
+ lss.add(row);
+ }
+ }
+ }
+ }
+
+ public String name() {
+ return name;
+ }
+
+ public String date() {
+ return date;
+ }
+ public int escalation() {
+ return escalation;
+ }
+
+ public Set<String> users() {
+ return rows.keySet();
+ }
+
+ /**
+ * ID must be set from Row for Email lookup
+ *
+ * @param trans
+ * @param n
+ * @param id
+ * @param row
+ * @return
+ */
+ public abstract String body(AuthzTrans trans, Notify n, String id);
+
+ /**
+ * Return "null" if user not found in row... Code will handle.
+ * @param row
+ * @return
+ */
+ protected abstract String user(List<String> row);
+
+ /**
+ * Get Notify Body based on key of
+ * type|name
+ */
+ public static NotifyBody get(String key) {
+ return bodyMap.get(key);
+ }
+
+ /**
+ * Return set of loaded NotifyBodies
+ *
+ */
+ public static Collection<NotifyBody> getAll() {
+ return bodyMap.values();
+ }
+
+ /**
+ * @param propAccess
+ * @throws URISyntaxException
+ *
+ */
+ public static void load(Access access) throws APIException, IOException {
+ // class load available NotifyBodies
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ Package pkg = NotifyBody.class.getPackage();
+ String path = pkg.getName().replace('.', '/');
+// Enumeration<URL> urls = cl.getResources(path);
+// while(urls.hasMoreElements()) {
+// URL url = urls.nextElement();
+ URL url = cl.getResource(path);
+ if(url == null) {
+ throw new APIException("Cannot load resources from " + path);
+ }
+ System.out.println(url);
+ File dir;
+ try {
+ dir = new File(url.toURI());
+ } catch (URISyntaxException e) {
+ throw new APIException(e);
+ }
+ if(dir.exists()) {
+ String[] files = dir.list();
+ if(files!=null) {
+ for(String sf : files) {
+ int dot = sf.indexOf('.');
+ if(dot>=0) {
+ String cls = pkg.getName()+'.'+sf.substring(0,dot);
+ try {
+ Class<?> c = cl.loadClass(cls);
+ if(c!=null) {
+ if(!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);
+ }
+ }
+ }
+ } 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/reports/bodies/NotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
new file mode 100644
index 00000000..db96d50a
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
@@ -0,0 +1,54 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.batch.reports.bodies;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.onap.aaf.auth.batch.reports.Notify;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.cadi.Access;
+
+public class NotifyCredBody extends AbsCredBody {
+ private final String explanation;
+ public NotifyCredBody(Access access, String name) throws IOException {
+ super(name);
+
+ // Default
+ explanation = "The following Credentials are expiring on the dates shown. "
+ + "Failure to act before the expiration date will cause your App's Authentications to fail.";
+ }
+
+ @Override
+ public String body(AuthzTrans trans, Notify n, String id) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(explanation);
+ sb.append("<br>");
+ sb.append("<tr>\n" +
+ "<th>Role</th>\n" +
+ "<th>Expires</th>\n" +
+ "</tr>\n");
+ for(List<String> row : rows.get(id)) {
+
+ }
+ return sb.toString();
+ }
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
new file mode 100644
index 00000000..97f09ac2
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/TwoWeeksNotifyCredBody.java
@@ -0,0 +1,31 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+package org.onap.aaf.auth.batch.reports.bodies;
+
+import java.io.IOException;
+
+import org.onap.aaf.cadi.Access;
+
+public class TwoWeeksNotifyCredBody extends NotifyCredBody {
+ public TwoWeeksNotifyCredBody(Access access) throws IOException {
+ super(access, "CredTwoWeek");
+ }
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringOrig.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringOrig.java
index 36d08b7a..6d759a06 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringOrig.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringOrig.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.update;
+package org.onap.aaf.auth.batch.update;
import java.io.BufferedReader;
import java.io.File;
@@ -32,32 +32,32 @@ import java.util.GregorianCalendar;
import java.util.List;
import java.util.UUID;
-import org.onap.aaf.auth.Batch;
-import org.onap.aaf.auth.BatchPrincipal;
-import org.onap.aaf.auth.actions.Action;
-import org.onap.aaf.auth.actions.ActionDAO;
-import org.onap.aaf.auth.actions.CacheTouch;
-import org.onap.aaf.auth.actions.CredDelete;
-import org.onap.aaf.auth.actions.CredPrint;
-import org.onap.aaf.auth.actions.Email;
-import org.onap.aaf.auth.actions.Message;
-import org.onap.aaf.auth.actions.URDelete;
-import org.onap.aaf.auth.actions.URFutureApprove;
-import org.onap.aaf.auth.actions.URFutureApproveExec;
-import org.onap.aaf.auth.actions.URPrint;
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.BatchPrincipal;
+import org.onap.aaf.auth.batch.actions.Action;
+import org.onap.aaf.auth.batch.actions.ActionDAO;
+import org.onap.aaf.auth.batch.actions.CacheTouch;
+import org.onap.aaf.auth.batch.actions.CredDelete;
+import org.onap.aaf.auth.batch.actions.CredPrint;
+import org.onap.aaf.auth.batch.actions.Email;
+import org.onap.aaf.auth.batch.actions.Message;
+import org.onap.aaf.auth.batch.actions.URDelete;
+import org.onap.aaf.auth.batch.actions.URFutureApprove;
+import org.onap.aaf.auth.batch.actions.URFutureApproveExec;
+import org.onap.aaf.auth.batch.actions.URPrint;
+import org.onap.aaf.auth.batch.helpers.Approval;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.Future;
+import org.onap.aaf.auth.batch.helpers.NS;
+import org.onap.aaf.auth.batch.helpers.Role;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.Cred.Instance;
import org.onap.aaf.auth.dao.cass.ApprovalDAO;
import org.onap.aaf.auth.dao.cass.CredDAO;
import org.onap.aaf.auth.dao.cass.FutureDAO;
import org.onap.aaf.auth.dao.hl.Function.FUTURE_OP;
import org.onap.aaf.auth.dao.hl.Function.OP_STATUS;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Approval;
-import org.onap.aaf.auth.helpers.Cred;
-import org.onap.aaf.auth.helpers.Future;
-import org.onap.aaf.auth.helpers.NS;
-import org.onap.aaf.auth.helpers.Role;
-import org.onap.aaf.auth.helpers.UserRole;
-import org.onap.aaf.auth.helpers.Cred.Instance;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.Organization.Identity;
@@ -95,7 +95,7 @@ public class ExpiringOrig extends Batch {
TimeTaken tt = trans.start("Connect to Cluster with DAOs", Env.REMOTE);
try {
urFutureApprove = new URFutureApprove(trans, cluster,isDryRun());
- checkOrganizationAcccess(trans, urFutureApprove.question());
+// checkOrganizationAcccess(trans, urFutureApprove.question());
urFutureApproveExec = new URFutureApproveExec(trans, urFutureApprove);
urPrint = new URPrint("User Roles:");
crDelete = new CredDelete(trans, urFutureApprove);
@@ -142,8 +142,6 @@ public class ExpiringOrig extends Batch {
}
email.addTo(address);
- } catch (OrganizationException e) {
- throw new APIException("Error getting valid Organization",e);
} finally {
tt0.done();
}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringP2.java
index dae62573..a75f0a1c 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/ExpiringP2.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/ExpiringP2.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.update;
+package org.onap.aaf.auth.batch.update;
import java.io.BufferedReader;
import java.io.File;
@@ -30,14 +30,14 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.onap.aaf.auth.Batch;
-import org.onap.aaf.auth.BatchPrincipal;
-import org.onap.aaf.auth.actions.Action;
-import org.onap.aaf.auth.actions.ActionDAO;
-import org.onap.aaf.auth.actions.CacheTouch;
-import org.onap.aaf.auth.actions.URDelete;
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.BatchPrincipal;
+import org.onap.aaf.auth.batch.actions.Action;
+import org.onap.aaf.auth.batch.actions.ActionDAO;
+import org.onap.aaf.auth.batch.actions.CacheTouch;
+import org.onap.aaf.auth.batch.actions.URDelete;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.cadi.util.Split;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyApprovals.java
index 50c6dc21..c88eecde 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyApprovals.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyApprovals.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.update;
+package org.onap.aaf.auth.batch.update;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -30,18 +30,18 @@ import java.util.GregorianCalendar;
import java.util.List;
import java.util.Map.Entry;
-import org.onap.aaf.auth.Batch;
-import org.onap.aaf.auth.BatchPrincipal;
-import org.onap.aaf.auth.actions.Email;
-import org.onap.aaf.auth.actions.EmailPrint;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.BatchPrincipal;
+import org.onap.aaf.auth.batch.actions.Email;
+import org.onap.aaf.auth.batch.actions.EmailPrint;
+import org.onap.aaf.auth.batch.actions.Message;
+import org.onap.aaf.auth.batch.helpers.Approval;
+import org.onap.aaf.auth.batch.helpers.Future;
import org.onap.aaf.auth.dao.CassAccess;
import org.onap.aaf.auth.dao.cass.ApprovalDAO;
import org.onap.aaf.auth.dao.cass.FutureDAO;
import org.onap.aaf.auth.dao.cass.HistoryDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Approval;
-import org.onap.aaf.auth.helpers.Future;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.auth.org.OrganizationFactory;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java
index 848b54e8..ab7525b6 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/NotifyCredExpiring.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/NotifyCredExpiring.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.update;
+package org.onap.aaf.auth.batch.update;
import java.io.File;
import java.io.FileOutputStream;
@@ -38,19 +38,19 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
-import org.onap.aaf.auth.Batch;
-import org.onap.aaf.auth.BatchPrincipal;
-import org.onap.aaf.auth.actions.Email;
-import org.onap.aaf.auth.actions.EmailPrint;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.BatchPrincipal;
+import org.onap.aaf.auth.batch.actions.Email;
+import org.onap.aaf.auth.batch.actions.EmailPrint;
+import org.onap.aaf.auth.batch.actions.Message;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.NS;
+import org.onap.aaf.auth.batch.helpers.Notification;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.Notification.TYPE;
import org.onap.aaf.auth.dao.cass.CredDAO;
import org.onap.aaf.auth.dao.hl.Question;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Cred;
-import org.onap.aaf.auth.helpers.NS;
-import org.onap.aaf.auth.helpers.Notification;
-import org.onap.aaf.auth.helpers.Notification.TYPE;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.auth.org.EmailWarnings;
import org.onap.aaf.auth.org.Organization;
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
new file mode 100644
index 00000000..5f6021b3
--- /dev/null
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Remove.java
@@ -0,0 +1,207 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.batch.update;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.onap.aaf.auth.batch.Batch;
+import org.onap.aaf.auth.batch.BatchPrincipal;
+import org.onap.aaf.auth.batch.helpers.CQLBatch;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.X509;
+import org.onap.aaf.auth.dao.CassAccess;
+import org.onap.aaf.auth.dao.cass.CertDAO;
+import org.onap.aaf.auth.dao.cass.CredDAO;
+import org.onap.aaf.auth.dao.cass.HistoryDAO;
+import org.onap.aaf.auth.dao.cass.UserRoleDAO;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.auth.org.OrganizationException;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.client.Holder;
+import org.onap.aaf.cadi.util.CSV;
+import org.onap.aaf.misc.env.APIException;
+import org.onap.aaf.misc.env.Env;
+import org.onap.aaf.misc.env.TimeTaken;
+import org.onap.aaf.misc.env.util.Chrono;
+
+public class Remove extends Batch {
+ private final AuthzTrans noAvg;
+ private HistoryDAO historyDAO;
+ private CQLBatch cqlBatch;
+
+ public Remove(AuthzTrans trans) throws APIException, IOException, OrganizationException {
+ super(trans.env());
+ trans.info().log("Starting Connection Process");
+
+ noAvg = env.newTransNoAvg();
+ noAvg.setUser(new BatchPrincipal("Remove"));
+
+ TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
+ try {
+ historyDAO = new HistoryDAO(trans, cluster, CassAccess.KEYSPACE);
+ TimeTaken tt2 = trans.start("Connect to Cluster", Env.REMOTE);
+ try {
+ session = historyDAO.getSession(trans);
+ } finally {
+ tt2.done();
+ }
+ cqlBatch = new CQLBatch(noAvg.info(),session);
+
+
+ } finally {
+ tt0.done();
+ }
+ }
+
+ @Override
+ protected void run(AuthzTrans trans) {
+ final int maxBatch = 25;
+
+ // Create Intermediate Output
+ File logDir = new File(logDir());
+
+ List<File> remove = new ArrayList<>();
+ if(args().length>0) {
+ for(int i=0;i<args().length;++i) {
+ remove.add(new File(logDir, args()[i]));
+ }
+ } else {
+ remove.add(new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv"));
+ }
+
+ for(File f : remove) {
+ trans.init().log("Processing File:",f.getAbsolutePath());
+ }
+
+ final Holder<Boolean> ur = new Holder<>(false);
+ final Holder<Boolean> cred = new Holder<>(false);
+ final Holder<Boolean> x509 = new Holder<>(false);
+ final Holder<String> memoFmt = new Holder<String>("");
+ final HistoryDAO.Data hdd = new HistoryDAO.Data();
+ final String orgName = trans.org().getName();
+
+ hdd.action="delete";
+ hdd.reconstruct = ByteBuffer.allocate(0);
+ hdd.user = noAvg.user();
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
+ hdd.yr_mon = Integer.parseInt(sdf.format(new Date()));
+
+ try {
+ for(File f : remove) {
+ trans.info().log("Processing ",f.getAbsolutePath(),"for Deletions");
+ if(f.exists()) {
+ CSV removeCSV = new CSV(f);
+
+ try {
+ final StringBuilder sb = cqlBatch.begin();
+ final Holder<Integer> hi = new Holder<Integer>(0);
+ removeCSV.visit(new CSV.Visitor() {
+ @Override
+ public void visit(List<String> row) throws IOException, CadiException {
+ int i = hi.get();
+ if(i>=maxBatch) {
+ cqlBatch.execute(dryRun);
+ hi.set(0);
+ cqlBatch.begin();
+ i=0;
+ }
+ switch(row.get(0)) {
+ case "info":
+ switch(row.get(1)) {
+ case "Delete":
+ memoFmt.set("%s expired from %s on %s");
+ break;
+ case "NotInOrgDelete":
+ memoFmt.set("Identity %s was removed from %s on %s");
+ break;
+ }
+ break;
+ case "ur":
+ if(!ur.get()) {
+ ur.set(true);
+ }
+ hi.set(++i);
+ UserRole.batchDelete(sb,row);
+ hdd.target=UserRoleDAO.TABLE;
+ hdd.subject=UserRole.histSubject(row);
+ hdd.memo=UserRole.histMemo(memoFmt.get(), row);
+ historyDAO.createBatch(sb, hdd);
+ break;
+ case "cred":
+ if(!cred.get()) {
+ cred.set(true);
+ }
+ hi.set(++i);
+ Cred.batchDelete(sb,row);
+ hdd.target=CredDAO.TABLE;
+ hdd.subject=Cred.histSubject(row);
+ hdd.memo=Cred.histMemo(memoFmt.get(), orgName,row);
+ historyDAO.createBatch(sb, hdd);
+ break;
+ case "x509":
+ if(!x509.get()) {
+ x509.set(true);
+ }
+ hi.set(++i);
+ X509.row(sb,row);
+ hdd.target=CertDAO.TABLE;
+ hdd.subject=X509.histSubject(row);
+ hdd.memo=X509.histMemo(memoFmt.get(),row);
+ historyDAO.createBatch(sb, hdd);
+ break;
+ }
+ }
+ });
+ cqlBatch.execute(dryRun);
+ } catch (IOException | CadiException e) {
+ e.printStackTrace();
+ }
+ } else {
+ trans.error().log("File",f.getAbsolutePath(),"does not exist.");
+ }
+ }
+ } finally {
+ if(ur.get()) {
+ cqlBatch.touch(UserRoleDAO.TABLE, 0, UserRoleDAO.CACHE_SEG, dryRun);
+ }
+ if(cred.get()) {
+ cqlBatch.touch(CredDAO.TABLE, 0, CredDAO.CACHE_SEG, dryRun);
+ }
+ if(x509.get()) {
+ cqlBatch.touch(CertDAO.TABLE, 0, CertDAO.CACHE_SEG, dryRun);
+ }
+ }
+ }
+
+ @Override
+ protected void _close(AuthzTrans trans) {
+ session.close();
+ }
+
+}
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Upload.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
index a670f37d..76472b5f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Upload.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*/
-package org.onap.aaf.auth.update;
+package org.onap.aaf.auth.batch.update;
import java.io.BufferedReader;
import java.io.File;
@@ -27,7 +27,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.onap.aaf.auth.Batch;
+import org.onap.aaf.auth.batch.Batch;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Remove.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Remove.java
deleted file mode 100644
index d35cfd34..00000000
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/update/Remove.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END====================================================
- *
- */
-
-package org.onap.aaf.auth.update;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.onap.aaf.auth.Batch;
-import org.onap.aaf.auth.BatchPrincipal;
-import org.onap.aaf.auth.actions.CacheTouch;
-import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.CQLBatch;
-import org.onap.aaf.auth.helpers.Cred;
-import org.onap.aaf.auth.helpers.UserRole;
-import org.onap.aaf.auth.helpers.X509;
-import org.onap.aaf.auth.org.OrganizationException;
-import org.onap.aaf.cadi.CadiException;
-import org.onap.aaf.cadi.client.Holder;
-import org.onap.aaf.cadi.util.CSV;
-import org.onap.aaf.misc.env.APIException;
-import org.onap.aaf.misc.env.Env;
-import org.onap.aaf.misc.env.TimeTaken;
-import org.onap.aaf.misc.env.util.Chrono;
-
-public class Remove extends Batch {
- private final AuthzTrans noAvg;
- private CacheTouch cacheTouch;
- private CQLBatch cqlBatch;
-
- public Remove(AuthzTrans trans) throws APIException, IOException, OrganizationException {
- super(trans.env());
- trans.info().log("Starting Connection Process");
-
- noAvg = env.newTransNoAvg();
- noAvg.setUser(new BatchPrincipal("batch:RemoveExpired"));
-
- TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
- try {
- cacheTouch = new CacheTouch(trans, cluster, dryRun);
- TimeTaken tt2 = trans.start("Connect to Cluster", Env.REMOTE);
- try {
- session = cacheTouch.getSession(trans);
- } finally {
- tt2.done();
- }
- cqlBatch = new CQLBatch(session);
-
-
- } finally {
- tt0.done();
- }
- }
-
- @Override
- protected void run(AuthzTrans trans) {
- final int maxBatch = 50;
-
- // Create Intermediate Output
- File logDir = new File(logDir());
-
- File expired = new File(logDir,"Delete"+Chrono.dateOnlyStamp()+".csv");
- CSV expiredCSV = new CSV(expired);
- try {
- final StringBuilder sb = cqlBatch.begin();
- final Holder<Integer> hi = new Holder<Integer>(0);
- expiredCSV.visit(new CSV.Visitor() {
- @Override
- public void visit(List<String> row) throws IOException, CadiException {
- int i = hi.get();
- if(i>=maxBatch) {
- cqlBatch.execute(dryRun);
- hi.set(0);
- cqlBatch.begin();
- i=0;
- }
- switch(row.get(0)) {
- case "ur":
- hi.set(++i);
- UserRole.row(sb,row);
- break;
- case "cred":
- hi.set(++i);
- Cred.row(sb,row);
- break;
- case "x509":
- hi.set(++i);
- X509.row(sb,row);
- break;
- }
- }
- });
- cqlBatch.execute(dryRun);
- } catch (IOException | CadiException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void _close(AuthzTrans trans) {
- session.close();
- cacheTouch.close(trans);
- }
-
-}
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_ActionDAO.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_ActionDAO.java
index 254a6adf..9376da4b 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_ActionDAO.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_ActionDAO.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.actions.ActionDAO;
+import org.onap.aaf.auth.batch.actions.ActionDAO;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_CredPrintTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_CredPrintTest.java
index 2e6ad09c..ebb307c2 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_CredPrintTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_CredPrintTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
@@ -28,7 +28,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.onap.aaf.auth.actions.CredPrint;
+import org.onap.aaf.auth.batch.actions.CredPrint;
import org.onap.aaf.auth.dao.cass.CredDAO;
import org.onap.aaf.auth.dao.cass.CredDAO.Data;
import org.onap.aaf.auth.env.AuthzTrans;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Email.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Email.java
index d3d4719e..3a170679 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Email.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Email.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -28,8 +28,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.actions.Email;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.actions.Email;
+import org.onap.aaf.auth.batch.actions.Message;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.Organization.Identity;
import org.onap.aaf.auth.org.Organization;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_EmailPrint.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_EmailPrint.java
index fe87219b..64d02ee3 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_EmailPrint.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_EmailPrint.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.actions.EmailPrint;
+import org.onap.aaf.auth.batch.actions.EmailPrint;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.Organization;
import org.onap.aaf.cadi.client.Future;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_FuturePrintTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_FuturePrintTest.java
index 121bf48f..00542a2f 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_FuturePrintTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_FuturePrintTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
@@ -31,9 +31,9 @@ import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.onap.aaf.auth.actions.FuturePrint;
+import org.onap.aaf.auth.batch.actions.FuturePrint;
+import org.onap.aaf.auth.batch.helpers.Future;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Future;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Message.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Message.java
index ada1dbae..86bab83e 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_Message.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_Message.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.actions.Message;
import static org.mockito.Mockito.*;
import org.junit.Test;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URFuturePrintTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFuturePrintTest.java
index 95406425..9f569d65 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URFuturePrintTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFuturePrintTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
@@ -29,9 +29,9 @@ import java.util.Calendar;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.onap.aaf.auth.actions.URFuturePrint;
+import org.onap.aaf.auth.batch.actions.URFuturePrint;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URPrintTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URPrintTest.java
index 1e99ec66..8a037ece 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/actions/test/JU_URPrintTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URPrintTest.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.actions.test;
+package org.onap.aaf.auth.batch.actions.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
@@ -30,9 +30,9 @@ import java.util.Calendar;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.onap.aaf.auth.actions.URPrint;
+import org.onap.aaf.auth.batch.actions.URPrint;
+import org.onap.aaf.auth.batch.helpers.UserRole;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.UserRole;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/creators/RowCreator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java
index 078c383b..661105d3 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/creators/RowCreator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*
*/
-package org.onap.aaf.auth.helpers.creators;
+package org.onap.aaf.auth.batch.helpers.creators;
import java.math.BigDecimal;
import java.math.BigInteger;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approval.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
index 6020dcc0..44c72763 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approval.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -33,10 +33,10 @@ import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
+import org.onap.aaf.auth.batch.helpers.Approval;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import org.onap.aaf.auth.dao.cass.ApprovalDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Approval;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.LogTarget;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approver.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approver.java
index b4ae1213..bd498f58 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Approver.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approver.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,8 +27,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.actions.Message;
-import org.onap.aaf.auth.helpers.Approver;
+import org.onap.aaf.auth.batch.actions.Message;
+import org.onap.aaf.auth.batch.helpers.Approver;
import org.onap.aaf.auth.org.Organization;
import static org.mockito.Mockito.*;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_CacheChange.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java
index fc934e6c..27d2d3cc 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_CacheChange.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_CacheChange.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.CacheChange;
+import org.onap.aaf.auth.batch.helpers.CacheChange;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Creator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java
index ad4d2022..2a266f54 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Creator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Creator.java
@@ -20,7 +20,7 @@
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -28,7 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.Creator;
+import org.onap.aaf.auth.batch.helpers.Creator;
import com.datastax.driver.core.Row;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Cred.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java
index 35a63059..20831c66 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Cred.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Cred.java
@@ -20,7 +20,7 @@
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -28,10 +28,10 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.onap.aaf.auth.batch.helpers.Cred;
+import org.onap.aaf.auth.batch.helpers.Cred.CredCount;
+import org.onap.aaf.auth.batch.helpers.Cred.Instance;
import org.onap.aaf.auth.common.Define;
-import org.onap.aaf.auth.helpers.Cred;
-import org.onap.aaf.auth.helpers.Cred.CredCount;
-import org.onap.aaf.auth.helpers.Cred.Instance;
import org.onap.aaf.cadi.CadiException;
import org.onap.aaf.cadi.PropAccess;
import org.onap.aaf.cadi.config.Config;
diff --git a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_ExpireRange.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java
index c42cf53d..4ed167e9 100644
--- a/auth/auth-core/src/test/java/org/onap/aaf/auth/org/test/JU_ExpireRange.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*/
-package org.onap.aaf.auth.org.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
@@ -26,7 +26,7 @@ import java.util.GregorianCalendar;
import java.util.Set;
import org.junit.Test;
-import org.onap.aaf.auth.org.ExpireRange;
+import org.onap.aaf.auth.batch.helpers.ExpireRange;
import org.onap.aaf.cadi.PropAccess;
public class JU_ExpireRange {
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Future.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java
index fe3d5d95..91950c66 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Future.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -34,11 +34,11 @@ import java.util.UUID;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.onap.aaf.auth.batch.helpers.Creator;
+import org.onap.aaf.auth.batch.helpers.Future;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import org.onap.aaf.auth.dao.cass.FutureDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Creator;
-import org.onap.aaf.auth.helpers.Future;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
import org.onap.aaf.auth.layer.Result;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.LogTarget;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_History.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_History.java
index 3346f229..beaaad31 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_History.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_History.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.History;
+import org.onap.aaf.auth.batch.helpers.History;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_InputIterator.java
index 07fd65f0..f30ad3cc 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_InputIterator.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_InputIterator.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.InputIterator;
+import org.onap.aaf.auth.batch.helpers.InputIterator;
import static org.mockito.Mockito.*;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MiscID.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MiscID.java
index 6f44b391..d8a2682c 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MiscID.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MiscID.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,8 +27,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.BatchException;
-import org.onap.aaf.auth.helpers.MiscID;
+import org.onap.aaf.auth.batch.BatchException;
+import org.onap.aaf.auth.batch.helpers.MiscID;
import com.datastax.driver.core.Row;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MonthData.java
index 97b6c56b..d9d9d018 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_MonthData.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_MonthData.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,8 +27,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.MonthData;
-import org.onap.aaf.auth.helpers.MonthData.Row;
+import org.onap.aaf.auth.batch.helpers.MonthData;
+import org.onap.aaf.auth.batch.helpers.MonthData.Row;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java
index b69f8873..1208ba92 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NS.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -30,10 +30,10 @@ import java.util.ArrayList;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aaf.auth.helpers.Creator;
-import org.onap.aaf.auth.helpers.NS;
-import org.onap.aaf.auth.helpers.NS.NSSplit;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
+import org.onap.aaf.auth.batch.helpers.Creator;
+import org.onap.aaf.auth.batch.helpers.NS;
+import org.onap.aaf.auth.batch.helpers.NS.NSSplit;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.LogTarget;
import org.onap.aaf.misc.env.TimeTaken;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NsAttrib.java
index acf9b478..6df877fe 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_NsAttrib.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NsAttrib.java
@@ -19,12 +19,12 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aaf.auth.helpers.NsAttrib;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
+import org.onap.aaf.auth.batch.helpers.NsAttrib;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Perm.java
index 0ccc77a2..10cbd359 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Perm.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Perm.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.Perm;
+import org.onap.aaf.auth.batch.helpers.Perm;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Role.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java
index 3fd9f870..250c7a10 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_Role.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Role.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,8 +27,8 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.helpers.Perm;
-import org.onap.aaf.auth.helpers.Role;
+import org.onap.aaf.auth.batch.helpers.Perm;
+import org.onap.aaf.auth.batch.helpers.Role;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_UserRole.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java
index b20f9ded..6b7011c6 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/test/JU_UserRole.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.helpers.test;
+package org.onap.aaf.auth.batch.helpers.test;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -33,12 +33,12 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aaf.auth.actions.URDelete;
+import org.onap.aaf.auth.batch.actions.URDelete;
+import org.onap.aaf.auth.batch.helpers.Creator;
+import org.onap.aaf.auth.batch.helpers.UserRole;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import org.onap.aaf.auth.dao.cass.UserRoleDAO;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Creator;
-import org.onap.aaf.auth.helpers.UserRole;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.LogTarget;
import org.onap.aaf.misc.env.TimeTaken;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_Batch.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java
index 5394c323..1ef6f3b8 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_Batch.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_Batch.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.test;
+package org.onap.aaf.auth.batch.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.Batch;
+import org.onap.aaf.auth.batch.Batch;
import org.onap.aaf.auth.env.AuthzEnv;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.Organization;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchException.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java
index c56a76c8..47a7c278 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchException.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchException.java
@@ -20,7 +20,7 @@
*/
-package org.onap.aaf.auth.test;
+package org.onap.aaf.auth.batch.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -28,7 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.BatchException;
+import org.onap.aaf.auth.batch.BatchException;
import static org.mockito.Mockito.*;
import org.junit.Test;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchPrincipal.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java
index 6186df95..4e5ad675 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_BatchPrincipal.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_BatchPrincipal.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.test;
+package org.onap.aaf.auth.batch.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.BatchPrincipal;
+import org.onap.aaf.auth.batch.BatchPrincipal;
import junit.framework.Assert;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_CassBatch.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java
index d1934a42..dfb30819 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/test/JU_CassBatch.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_CassBatch.java
@@ -19,7 +19,7 @@
*
*/
-package org.onap.aaf.auth.test;
+package org.onap.aaf.auth.batch.test;
import static org.junit.Assert.*;
import org.junit.After;
@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.aaf.auth.CassBatch;
+import org.onap.aaf.auth.batch.CassBatch;
import org.onap.aaf.auth.env.AuthzTrans;
import org.onap.aaf.auth.org.OrganizationException;
import org.onap.aaf.misc.env.APIException;
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/JU_NotificationTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java
index d3a1258d..79e4168e 100644
--- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/helpers/JU_NotificationTest.java
+++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END====================================================
*
*/
-package org.onap.aaf.auth.helpers;
+package org.onap.aaf.auth.batch.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@@ -29,10 +29,12 @@ import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
-import org.onap.aaf.auth.actions.Message;
+import org.onap.aaf.auth.batch.actions.Message;
+import org.onap.aaf.auth.batch.helpers.Creator;
+import org.onap.aaf.auth.batch.helpers.Notification;
+import org.onap.aaf.auth.batch.helpers.Notification.TYPE;
+import org.onap.aaf.auth.batch.helpers.creators.RowCreator;
import org.onap.aaf.auth.env.AuthzTrans;
-import org.onap.aaf.auth.helpers.Notification.TYPE;
-import org.onap.aaf.auth.helpers.creators.RowCreator;
import org.onap.aaf.misc.env.Env;
import org.onap.aaf.misc.env.LogTarget;
import org.onap.aaf.misc.env.TimeTaken;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
index a40b28fb..69d1d26e 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
@@ -171,6 +171,24 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
// data.day_time = Integer.parseInt(dayTimeFormat.format(now));
return data;
}
+
+ public void createBatch(StringBuilder sb, Data data) {
+ sb.append("INSERT INTO history (");
+ sb.append(helpers[FIELD_COMMAS]);
+ sb.append(") VALUES(now(),");
+ sb.append(data.yr_mon);
+ sb.append(",'");
+ sb.append(data.user);
+ sb.append("','");
+ sb.append(data.action);
+ sb.append("','");
+ sb.append(data.target);
+ sb.append("','");
+ sb.append(data.subject);
+ sb.append("','");
+ sb.append(data.memo);
+ sb.append("',null);\n");
+ }
public Result<List<Data>> readByYYYYMM(AuthzTrans trans, int yyyymm) {
Result<ResultSet> rs = readByYRMN.exec(trans, "yr_mon", yyyymm);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index f55e1c1c..4a307693 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -953,27 +953,27 @@ public class Question {
rv = cacheInfoDAO.touch(trans, NsDAO.TABLE, seg);
}
if (all || PermDAO.TABLE.equals(cname)) {
- int seg[] = series(NsDAO.CACHE_SEG);
+ int seg[] = series(PermDAO.CACHE_SEG);
for (int i: seg) {cacheClear(trans, PermDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, PermDAO.TABLE,seg);
}
if (all || RoleDAO.TABLE.equals(cname)) {
- int seg[] = series(NsDAO.CACHE_SEG);
+ int seg[] = series(RoleDAO.CACHE_SEG);
for (int i: seg) {cacheClear(trans, RoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, RoleDAO.TABLE,seg);
}
if (all || UserRoleDAO.TABLE.equals(cname)) {
- int seg[] = series(NsDAO.CACHE_SEG);
+ int seg[] = series(UserRoleDAO.CACHE_SEG);
for (int i: seg) {cacheClear(trans, UserRoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, UserRoleDAO.TABLE,seg);
}
if (all || CredDAO.TABLE.equals(cname)) {
- int seg[] = series(NsDAO.CACHE_SEG);
+ int seg[] = series(CredDAO.CACHE_SEG);
for (int i: seg) {cacheClear(trans, CredDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CredDAO.TABLE,seg);
}
if (all || CertDAO.TABLE.equals(cname)) {
- int seg[] = series(NsDAO.CACHE_SEG);
+ int seg[] = series(CertDAO.CACHE_SEG);
for (int i: seg) {cacheClear(trans, CertDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CertDAO.TABLE,seg);
}
diff --git a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
index 874019d7..71ccf3c7 100644
--- a/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
+++ b/auth/auth-certman/src/main/java/org/onap/aaf/auth/cm/data/CertResp.java
@@ -42,7 +42,7 @@ public class CertResp {
private String[] trustChain;
private String[] notes;
- public CertResp(Trans trans, CA ca, X509Certificate x509, CSRMeta csrMeta, String[] trustChain, String[] notes) throws IOException, GeneralSecurityException, CertException {
+ public CertResp(Trans trans, CA ca, X509Certificate x509, CSRMeta csrMeta, String[] trustChain, String[] notes) throws IOException, CertException {
keyPair = csrMeta.keypair(trans);
privateKey = Factory.toString(trans, keyPair.getPrivate());
certString = Factory.toString(trans,x509);
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
index 1064c9b8..1b1b1831 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Version.java
@@ -38,6 +38,6 @@ public class Version extends Cmd {
pw().println("AAF Command Line Tool");
pw().print("Version: ");
pw().println(Config.AAF_DEFAULT_API_VERSION);
- return 200 /*HttpStatus.OK_200;*/;
+ return 200;
}
}
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
index 3431a0ea..feb1dec8 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByPerm.java
@@ -3,6 +3,7 @@
* org.onap.aaf
* ===========================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018 IBM.
* ===========================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,8 +50,8 @@ public class ListByPerm extends Cmd {
}
@Override
- public int _exec(int _idx, final String ... args) throws CadiException, APIException, LocatorException {
- int idx = _idx;
+ public int _exec(int idx0, final String ... args) throws CadiException, APIException, LocatorException {
+ int idx = idx0;
final String type=args[idx];
final String instance=args[++idx];
final String action=args[++idx];
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
new file mode 100644
index 00000000..7bda155c
--- /dev/null
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/log4j/Log4JAccessAppender.java
@@ -0,0 +1,78 @@
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * ===========================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.log4j;
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.Level;
+import org.apache.log4j.spi.LoggingEvent;
+import org.onap.aaf.cadi.Access;
+
+public class Log4JAccessAppender extends AppenderSkeleton{
+ private Access access;
+
+ public Log4JAccessAppender(Access access) {
+ this.access = access;
+ }
+
+ @Override
+ public void close() {
+ }
+
+ @Override
+ public boolean requiresLayout() {
+ return false;
+ }
+
+ @Override
+ protected void append(LoggingEvent event) {
+ Access.Level al = null;
+ switch(event.getLevel().toInt()) {
+ case Level.FATAL_INT:
+ case Level.ERROR_INT:
+ if(access.willLog(Access.Level.ERROR)) {
+ al=Access.Level.ERROR;
+ }
+ break;
+ case Level.WARN_INT:
+ if(!access.willLog(Access.Level.WARN)) {
+ al=Access.Level.WARN;
+ }
+ break;
+ case Level.ALL_INT:
+ case Level.INFO_INT:
+ if(!access.willLog(Access.Level.INFO)) {
+ al=Access.Level.INFO;
+ }
+ break;
+ case Level.TRACE_INT:
+ if(!access.willLog(Access.Level.TRACE)) {
+ al=Access.Level.TRACE;
+ }
+ break;
+ }
+ if(al!=null) {
+ access.log(al,"Log4J["+event.getLoggerName()+"]["+event.getLevel()+']',event.getMessage());
+ }
+ }
+
+}
+
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
index fd252fe4..69cfc7d7 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/Organization.java
@@ -64,6 +64,18 @@ public interface Organization {
public boolean isPerson(); // Whether a Person or a Machine (App)
public Organization org(); // Organization of Identity
+
+ public static String mixedCase(String in) {
+ StringBuilder sb = new StringBuilder();
+ for(int i=0;i<in.length();++i) {
+ if(i==0) {
+ sb.append(Character.toUpperCase(in.charAt(i)));
+ } else {
+ sb.append(Character.toLowerCase(in.charAt(i)));
+ }
+ }
+ return sb.toString();
+ }
}
@@ -83,9 +95,7 @@ public interface Organization {
public void addSupportedRealm(String r);
-
-
- String getDomain();
+ public String getDomain();
/**
* Get Identity information based on userID
@@ -95,6 +105,20 @@ public interface Organization {
*/
public Identity getIdentity(AuthzTrans trans, String id) throws OrganizationException;
+ /**
+ * May AutoDelete
+ *
+ * Deletion of an Identity that has been removed from an Organization can be dangerous. Mistakes may have been made
+ * in the Organization side, a Feed might be corrupted, an API might not be quite right.
+ *
+ * The implementation of this method can use a double check of some sort, such as comparsion of missing ID in Organization
+ * feed with a "Deleted ID" feed.
+ *
+ * The failure to be in Organization will still be reported, if returned "false", but if true, it is taken as an
+ * ok to proceed with deletion.
+ */
+ public boolean mayAutoDelete(AuthzTrans trans, String id);
+
/**
* Does the ID pass Organization Standards
@@ -516,15 +540,22 @@ public interface Organization {
}
};
+
+
}
@Override
public String[] getPasswordRules() {
return nullStringArray;
}
+
+ @Override
+ public boolean mayAutoDelete(AuthzTrans trans, String id) {
+ // provide a corresponding feed that indicates that an ID has been intentionally removed from identities.dat table.
+ return false;
+ }
};
-
}
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
index 80a382a8..33201864 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/org/OrganizationFactory.java
@@ -76,7 +76,7 @@ public class OrganizationFactory {
}
Organization org = orgs.get(orgNS);
if (org == null) {
- env.debug().printf("Attempting to instantiate Organization %s\n",orgNS);
+ env.debug().printf("Attempting to instantiate Organization %s",orgNS);
String orgClass = env.getProperty(ORGANIZATION_DOT+orgNS);
if (orgClass == null) {
@@ -117,7 +117,7 @@ public class OrganizationFactory {
if ((isDefault="true".equalsIgnoreCase(env.getProperty(orgNS+".default")))) {
defaultOrg = org;
}
- env.init().printf("Instantiated %s with %s%s\n",orgNS,orgClass,(isDefault?" as default":""));
+ env.init().printf("Instantiated %s with %s%s",orgNS,orgClass,(isDefault?" as default":""));
}
if (org==null) {
if (defaultOrg!=null) {
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index 3c6176e6..c7dd3d33 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -597,4 +597,10 @@ public class DefaultOrg implements Organization {
return 0;
}
}
+
+ @Override
+ public boolean mayAutoDelete(AuthzTrans trans, String user) {
+ // provide a corresponding feed that indicates that an ID has been intentionally removed from identities.dat table.
+ return false;
+ }
}
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore
index d3c3ab60..9e4bcf51 100644
--- a/auth/docker/.gitignore
+++ b/auth/docker/.gitignore
@@ -4,3 +4,5 @@
/aaf.props
/cass.props
/policy*
+/*.yaml
+/*.orig
diff --git a/auth/sample/.gitignore b/auth/sample/.gitignore
index 62fd177d..80014ba2 100644
--- a/auth/sample/.gitignore
+++ b/auth/sample/.gitignore
@@ -1 +1,2 @@
theme
+.DS_Store
diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
index 97984b03..a9d671cc 100644
--- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
+++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java
@@ -392,13 +392,16 @@ public class PropAccess implements Access {
ps.println(buildMsg(level,elements));
ps.flush();
}
-
}
public void set(LogIt logit) {
logIt = logit;
}
-
+
+ public void setStreamLogIt(PrintStream ps) {
+ logIt = new StreamLogIt(ps);
+ }
+
public String toString() {
return props.toString();
}
diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
index f2b539a3..84eb5ee6 100644
--- a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
+++ b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java
@@ -63,10 +63,26 @@ public interface LogTarget {
};
// A Convenient LogTarget to write to the Console
- public static final LogTarget SYSOUT = new LogTarget() {
+ public static final LogTarget SYSOUT = new StreamLogTarget(System.out,false);
+
+ // A Convenient LogTarget to write to the Console
+ public static final LogTarget SYSERR = new StreamLogTarget(System.err,false);
+
+ public static class StreamLogTarget implements LogTarget {
+ private final PrintStream out;
+ private final boolean closeMe;
+
+ public StreamLogTarget(PrintStream ps) {
+ this(ps,true);
+ }
+
+ /* Do NOT close SYSTEM ERR or OUT*/
+ protected StreamLogTarget(PrintStream ps, boolean shouldClose) {
+ out = ps;
+ closeMe = shouldClose;
+ }
public void log(Object ... msgs) {
- PrintStream out = System.out;
- out.print(org.onap.aaf.misc.env.util.Chrono.dateFmt.format(new Date()));
+ out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
for (Object str : msgs) {
if (str!=null) {
@@ -80,7 +96,6 @@ public interface LogTarget {
}
public void log(Throwable t, Object ... msgs) {
- PrintStream out = System.out;
out.print(Chrono.dateFmt.format(new Date()));
out.print(": ");
for (Object str : msgs) {
@@ -100,43 +115,13 @@ public interface LogTarget {
public void printf(String fmt, Object ... vars) {
log(String.format(fmt,vars));
}
- };
-
- // A Convenient LogTarget to write to the Console
- public static final LogTarget SYSERR = new LogTarget() {
- public void log(Object ... msgs) {
- PrintStream out = System.err;
- out.print(Chrono.dateFmt.format(new Date()));
- out.print(": ");
- for (Object str : msgs) {
- out.print(str.toString());
- out.print(' ');
- }
- out.println();
- out.flush();
- }
-
- public void log(Throwable t, Object ... msgs) {
- PrintStream out = System.err;
- out.print(Chrono.dateFmt.format(new Date()));
- out.print(": ");
- for (Object str : msgs) {
- out.print(str.toString());
- out.print(' ');
- }
- out.println();
- t.printStackTrace(out);
- }
-
- public boolean isLoggable() {
- return true;
+
+ public void close() {
+ if(closeMe) {
+ out.close();
+ }
}
- @Override
- public void printf(String fmt, Object ... vars) {
- log(String.format(fmt,vars));
- }
-
- };
+ }
}; \ No newline at end of file
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java
index c679d11e..2388964f 100644
--- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java
+++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java
@@ -65,9 +65,9 @@ public class JU_LogTargetTest {
outTarget.log(t);
outTarget.log(t, "First String Object");
- assertTrue(outTarget.isLoggable());
+ assertTrue(outTarget.isLoggable());
- verify(t, times(2)).printStackTrace(System.out);
+ verify(t, times(2)).printStackTrace(System.out);
}
@Test
@@ -80,9 +80,9 @@ public class JU_LogTargetTest {
errTarget.log(t);
errTarget.log(t, "First String Object");
- assertTrue(errTarget.isLoggable());
+ assertTrue(errTarget.isLoggable());
- verify(t, times(2)).printStackTrace(System.err);
+ verify(t, times(2)).printStackTrace(System.err);
}
}