Class AclImporter
java.lang.Object
com.illumon.iris.db.v2.permissions.AclPorter
com.illumon.iris.db.v2.permissions.AclImporter
A utility class for importing ACLS from an XML file generated by
AclExporter.
Supports an optional continueAfterError mode (off by default) which, when enabled via
setContinueAfterError(boolean), allows the import to log and skip individual records that
fail validation rather than aborting the entire import. This is useful for streaming ACL updates
from a primary cluster into a secondary one where some records may be invalid on the target
(e.g. non-ASCII account names, invalid column ACLs such as column="*", or user-name
group memberships that are no longer permitted).
After an import with continueAfterError enabled, callers can inspect skipped records via
getErrors() and getErrorCount().
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class com.illumon.iris.db.v2.permissions.AclPorter
dbAclGuiHelper, dbAclProvider, dbAclWriter, log -
Constructor Summary
ConstructorsConstructorDescriptionAclImporter(DbAclWriter dbAclWriter, DbAclProvider dbAclProvider, DbAclGuiHelper dbAclGuiHelper, AclImporter.Mode importMode, com.fishlib.io.logger.Logger log) Create an ACLImporter for importing files from anAclExporter -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic String[]Get the default set of protected users.intGet the list of error messages from records that were skipped during import.voidimportAcls(Acl acl, String... types) voidimportAcls(String filename, String... types) Import the ACLs from the file.booleanvoidsetContinueAfterError(boolean continueAfterError) Enable or disable continue-after-error mode.voidsetProtectedUsers(String... users) Set the protected users.Methods inherited from class com.illumon.iris.db.v2.permissions.AclPorter
deserialize, processTypes, serialize
-
Field Details
-
ACL_IMPORTER_PROTECTED_USERS_PROPERTY
- See Also:
-
-
Constructor Details
-
AclImporter
public AclImporter(@NotNull DbAclWriter dbAclWriter, @NotNull DbAclProvider dbAclProvider, @NotNull DbAclGuiHelper dbAclGuiHelper, @NotNull AclImporter.Mode importMode, @NotNull com.fishlib.io.logger.Logger log) Create an ACLImporter for importing files from anAclExporter- Parameters:
dbAclWriter- the acl writerdbAclProvider- ther acl providerdbAclGuiHelper- the gui helperimportMode- the import modelog- the logger
-
-
Method Details
-
getDefaultProtectedUsers
Get the default set of protected users.- Returns:
- the default set of protected users.
-
setContinueAfterError
public void setContinueAfterError(boolean continueAfterError) Enable or disable continue-after-error mode. When enabled, import errors for individual records are logged as warnings and skipped, rather than aborting the entire import. This is useful for streaming ACL updates from a primary cluster where some records may be invalid on the target (e.g. non-ASCII account names, invalid column ACLs, or user-name group membership).- Parameters:
continueAfterError- true to skip bad records and continue, false to abort on first error (default)
-
isContinueAfterError
public boolean isContinueAfterError()- Returns:
- true if continue-after-error mode is enabled
-
getErrors
Get the list of error messages from records that were skipped during import. Only populated whensetContinueAfterError(boolean)is true.- Returns:
- an unmodifiable list of error descriptions
-
getErrorCount
public int getErrorCount()- Returns:
- the number of records that were skipped due to errors
-
importAcls
Import the ACLs from the file.- Parameters:
filename- the file name.types- the types to import. SeeAclEntryTypes- Throws:
IOExceptionAclStoreException
-
importAcls
- Throws:
AclStoreException
-
setProtectedUsers
Set the protected users. When importing ACLs, keys for these users will not be modified.- Parameters:
users- the users to protect
-
deleteAllAclData
- Throws:
AclStoreException
-