Class FSMigrater
- java.lang.Object
-
- org.oa4mp.server.admin.migrate.tools.oauth2.myproxy.FSMigrater
-
- All Implemented Interfaces:
MigrationConstants
public class FSMigrater extends Object implements MigrationConstants
Created by Jeff Gaynor
on 3/5/24 at 7:20 AM
-
-
Field Summary
-
Fields inherited from interface edu.uiuc.ncsa.myproxy.oauth2.tools.migrate.MigrationConstants
ALL_FAILURE_CODES, IMPORT_CODE_COULD_NOT_READ, IMPORT_CODE_EMPTY_FILE, IMPORT_CODE_FILE_IS_A_DIRECTORY, IMPORT_CODE_FILE_NOT_FOUND, IMPORT_CODE_FILE_PERMISSION, IMPORT_CODE_MISSING_ID, IMPORT_CODE_NO_CORRESPONDING_ENTRY, IMPORT_CODE_NOT_DONE, IMPORT_CODE_OTHER_ERROR, IMPORT_CODE_PARSE_ERROR, IMPORT_CODE_SUCCESS, IMPORT_CODE_UNKNOWN_ERROR, IMPORT_CODE_UPKEEP_ARCHIVED, IMPORT_CODE_UPKEEP_DELETED, IMPORT_CODE_UPKEEP_SKIPPED, IMPORT_CODE_UPKEEP_TEST_ONLY, IMPORT_MESSAGE_COULD_NOT_READ, IMPORT_MESSAGE_EMPTY_FILE, IMPORT_MESSAGE_FILE_IS_A_DIRECTORY, IMPORT_MESSAGE_FILE_NOT_FOUND, IMPORT_MESSAGE_FILE_PERMISSION, IMPORT_MESSAGE_MISSING_ID, IMPORT_MESSAGE_NO_CORRESPONDING_ENTRY, IMPORT_MESSAGE_OTHER_ERROR, IMPORT_MESSAGE_PARSE_ERROR, IMPORT_MESSAGE_UNKNOWN_ERROR, IMPORT_MESSAGE_UNKNOWN_ERROR_CODE, IMPORT_MESSAGE_UPKEEP_DELETED, IMPORT_MESSAGE_UPKEEP_SKIPPED
-
-
Constructor Summary
Constructors Constructor Description FSMigrater(MigrateStore migrateStore, Writer echoWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
approvalCheck(ClientApproval clientApproval)
protected String
computeHerz(long value, long startTime)
Adds blanks to the output since the units may vary widely at times.protected boolean
doCheck(edu.uiuc.ncsa.security.core.Identifiable identifiable)
protected boolean
doUpkeep(edu.uiuc.ncsa.security.storage.monitored.upkeep.UpkeepConfiguration upkeepConfiguration, MigrationEntry me, edu.uiuc.ncsa.security.storage.monitored.Monitored monitored)
Evaluates the entry for action.protected String
getAllIDs(edu.uiuc.ncsa.security.storage.sql.SQLStore sqlStore)
String
getImportMessage(int importCode)
protected String
getStoreComponent(edu.uiuc.ncsa.security.core.Store s)
protected boolean
hasEchoWriter()
protected boolean
hasErrorCodes(int[] importErrorCodes)
void
ingest(org.oa4mp.server.loader.oauth2.OA2SE source, boolean noTransactions, int batchSize, boolean pacerOn)
protected int[]
ingest(edu.uiuc.ncsa.security.storage.FileStore fileStore, int batchSize, boolean pacerOn)
Read all the names of the file that the OS knows about.protected boolean
isFS(edu.uiuc.ncsa.security.core.Store store, boolean noTransactions)
protected boolean
isSQLStore(edu.uiuc.ncsa.security.core.Store store, boolean noTransactions)
void
migrate(org.oa4mp.server.loader.oauth2.OA2SE targetSE, int batchSize, boolean runUpkeep, String name, boolean pacerOn)
protected void
migrate(edu.uiuc.ncsa.security.storage.sql.SQLStore targetStore, boolean runUpkeep, String component, int batchSize, boolean pacerOn)
Takes the entries in the migration table and puts them into the store.void
migrateAll(org.oa4mp.server.loader.oauth2.OA2SE targetSE, boolean noTransactions, int batchSize, boolean runUpkeep, boolean pacerOn)
Main entry point for migration.protected boolean
permissionCheck(org.oa4mp.server.api.permissions.admin.Permission permission)
Checks if the permission actually points to anything in the store.protected void
setIDs(edu.uiuc.ncsa.security.storage.sql.SQLStore sqlStore, HashSet<edu.uiuc.ncsa.security.core.Identifier> ids)
void
setImportMessage(MigrationEntry me, int code)
void
setImportMessage(MigrationEntry me, int code, Throwable t)
void
setImportMessage(MigrationEntry me, Throwable t)
-
-
-
Constructor Detail
-
FSMigrater
public FSMigrater(MigrateStore migrateStore, Writer echoWriter)
-
-
Method Detail
-
setImportMessage
public void setImportMessage(MigrationEntry me, int code, Throwable t)
-
setImportMessage
public void setImportMessage(MigrationEntry me, int code)
-
setImportMessage
public void setImportMessage(MigrationEntry me, Throwable t)
-
getImportMessage
public String getImportMessage(int importCode)
-
isFS
protected boolean isFS(edu.uiuc.ncsa.security.core.Store store, boolean noTransactions)
-
isSQLStore
protected boolean isSQLStore(edu.uiuc.ncsa.security.core.Store store, boolean noTransactions)
-
ingest
public void ingest(org.oa4mp.server.loader.oauth2.OA2SE source, boolean noTransactions, int batchSize, boolean pacerOn) throws SQLException
- Throws:
SQLException
-
getStoreComponent
protected String getStoreComponent(edu.uiuc.ncsa.security.core.Store s)
-
ingest
protected int[] ingest(edu.uiuc.ncsa.security.storage.FileStore fileStore, int batchSize, boolean pacerOn) throws SQLException
Read all the names of the file that the OS knows about. This is designed to be quick so that the system is not ovewhelmed with too much processing for huge directories.- Parameters:
fileStore
-- Returns:
- Throws:
SQLException
-
hasErrorCodes
protected boolean hasErrorCodes(int[] importErrorCodes)
-
computeHerz
protected String computeHerz(long value, long startTime)
Adds blanks to the output since the units may vary widely at times. This way if this is used by pacer, there are not odd artifacts at the end of the line.- Parameters:
value
-startTime
-- Returns:
-
migrate
public void migrate(org.oa4mp.server.loader.oauth2.OA2SE targetSE, int batchSize, boolean runUpkeep, String name, boolean pacerOn)
-
migrateAll
public void migrateAll(org.oa4mp.server.loader.oauth2.OA2SE targetSE, boolean noTransactions, int batchSize, boolean runUpkeep, boolean pacerOn)
Main entry point for migration. This will resume where it left off as needed.- Parameters:
targetSE
-noTransactions
-batchSize
-runUpkeep
-pacerOn
-
-
getAllIDs
protected String getAllIDs(edu.uiuc.ncsa.security.storage.sql.SQLStore sqlStore)
-
setIDs
protected void setIDs(edu.uiuc.ncsa.security.storage.sql.SQLStore sqlStore, HashSet<edu.uiuc.ncsa.security.core.Identifier> ids) throws SQLException
- Throws:
SQLException
-
migrate
protected void migrate(edu.uiuc.ncsa.security.storage.sql.SQLStore targetStore, boolean runUpkeep, String component, int batchSize, boolean pacerOn) throws SQLException
Takes the entries in the migration table and puts them into the store. This tracks a batch update to the target store and a batch update to the migration store. This allows us to resume the import if there is a failure.- Parameters:
targetStore
-component
-- Throws:
SQLException
-
doCheck
protected boolean doCheck(edu.uiuc.ncsa.security.core.Identifiable identifiable)
-
permissionCheck
protected boolean permissionCheck(org.oa4mp.server.api.permissions.admin.Permission permission)
Checks if the permission actually points to anything in the store.- Parameters:
permission
-- Returns:
-
approvalCheck
protected boolean approvalCheck(ClientApproval clientApproval)
-
doUpkeep
protected boolean doUpkeep(edu.uiuc.ncsa.security.storage.monitored.upkeep.UpkeepConfiguration upkeepConfiguration, MigrationEntry me, edu.uiuc.ncsa.security.storage.monitored.Monitored monitored) throws SQLException
Evaluates the entry for action. This returns true if the monitored object is skipped- Parameters:
upkeepConfiguration
-me
-monitored
-- Returns:
- Throws:
SQLException
-
hasEchoWriter
protected boolean hasEchoWriter()
-
-