Class FSMigrationTool
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.cli.CLITool2
-
- org.oa4mp.server.admin.oauth2.tools.migrate.FSMigrationTool
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable
public class FSMigrationTool extends edu.uiuc.ncsa.security.util.cli.CLITool2Migration tool for old style file stores to (at this point) a Derby store. This loads or creates stores needed and then runs theFSMigraterThe issue is that a lot of installs have been using file stores which have become immense -- hundreds of thousands of auto-registered clients -- most of which are one-time use or similar. The Upkeep facility cannot stay ahead of this since the assumption with the store initially was pretty small sized. The solution is to have an actual migration tool that will read the entire source store and batch it up a target store.Created by Jeff Gaynor
on 2/24/24 at 7:09 AM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFSMigrationTool.HelpEntry
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIG_BATCH_SIZEstatic StringCONFIG_CLEANUPstatic StringCONFIG_DO_UPKEEPstatic StringCONFIG_ECHO_APPENDstatic StringCONFIG_ECHO_FILEstatic StringCONFIG_HELPstatic StringCONFIG_NO_TRANSACTIONSstatic StringCONFIG_PACE_OFFstatic StringCONFIG_RESETstatic StringCONFIG_SETUPstatic StringCONFIG_SHOW_CONNECTstatic StringCONFIG_SOURCE_CFGstatic StringCONFIG_SOURCE_CFG_NAMEstatic StringCONFIG_STORE_NAMEstatic StringCONFIG_TARGET_CFGstatic StringCONFIG_TARGET_CFG_NAMEstatic StringCONFIG_VERBOSEstatic intDEFAULT_BATCH_SIZEprotected static Map<String,FSMigrationTool.HelpEntry>helpMapstatic StringINGESTION_FILE_NAMEprotected static StringRunSpacer-
Fields inherited from class edu.uiuc.ncsa.security.util.cli.CLITool2
CONFIG_FILE_LONG_OPTION, CONFIG_FILE_OPTION, CONFIG_NAME_ACTION, CONFIG_NAME_LONG_OPTION, CONFIG_NAME_OPTION, DEBUG_LONG_OPTION, DEBUG_OPTION, DEFAULT_LOG_FILE, HELP_LONG_OPTION, HELP_OPTION, LOG_FILE_LONG_OPTION, LOG_FILE_OPTION, NO_ACTION, VERBOSE_LONG_OPTION, VERBOSE_OPTION
-
-
Constructor Summary
Constructors Constructor Description FSMigrationTool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidaddHelpEntry(String name, String type, String description)protected static voidaddHelpEntry(String name, String type, String defaultValue, String description)protected static voidaddHelpEntry(String name, String type, String description, String[] description2)protected static voidaddHelpEntry(String name, String type, String defaultValue, String description, String[] description2)voiddoIt()protected static booleanechoOn()static List<String>getAllConfigNames()protected booleangetArgs(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)intgetBatchSize()StringgetComponentName()protected FilegetDBDir()protected static Map<String,FSMigrationTool.HelpEntry>getHelpMap()Creates the help map.edu.uiuc.ncsa.security.core.util.ConfigurationLoader<? extends edu.uiuc.ncsa.security.core.util.AbstractEnvironment>getLoader()FSMigratergetMigrater()MigrateStoregetMigrateStore()StringgetSourceConfigName()StringgetSourceFile()OA2SEgetSourceSE()StringgetTargetConfigName()StringgetTargetFile()OA2SEgetTargetSE()voidhelp()booleanisEchoAppend()booleanisNoTransactions()booleanisPacerOn()booleanisUpkeepOn()booleanisVerbose()protected booleanloadEnvironments()Loads the environment.static voidmain(String[] args)protected voidnukeDir(File dir)Removes EVERYTHING in the directory, AND the directory itself.protected voidremoveMigrationDB(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)static voidsay(String x)voidsetBatchSize(int batchSize)voidsetEchoAppend(boolean echoAppend)voidsetMigrater(FSMigrater migrater)voidsetMigrateStore(MigrateStore migrateStore)voidsetNoTransactions(boolean noTransactions)voidsetPacerOn(boolean pacerOn)voidsetSourceConfigName(String sourceConfigName)voidsetSourceFile(String sourceFile)voidsetTargetConfigName(String targetConfigName)voidsetTargetFile(String targetFile)voidsetUpkeepOn(boolean upkeepOn)voidsetVerbose(boolean verbose)static voidshowHelp()protected voidvsay(String x)-
Methods inherited from class edu.uiuc.ncsa.security.util.cli.CLITool2
debug, defaultHelp, error, error, getBufferedReader, getConfigFile, getConfigName, getConfigurationNode, getEnvironment, getInputLine, getIoInterface, getLogfileName, getMyLogger, getOptions, hasConfigFile, hasConfigName, info, initialize, isDebugOn, readline, run, run, say2, sayv, setBufferedReader, setConfigFile, setConfigName, setConfigurationNode, setDebugOn, setEnvironment, setInputLine, setIoInterface, setLogfileName, setMyLogger, warn
-
-
-
-
Field Detail
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
INGESTION_FILE_NAME
public static String INGESTION_FILE_NAME
-
CONFIG_SOURCE_CFG
public static final String CONFIG_SOURCE_CFG
- See Also:
- Constant Field Values
-
CONFIG_TARGET_CFG
public static final String CONFIG_TARGET_CFG
- See Also:
- Constant Field Values
-
CONFIG_TARGET_CFG_NAME
public static final String CONFIG_TARGET_CFG_NAME
- See Also:
- Constant Field Values
-
CONFIG_SOURCE_CFG_NAME
public static final String CONFIG_SOURCE_CFG_NAME
- See Also:
- Constant Field Values
-
CONFIG_BATCH_SIZE
public static final String CONFIG_BATCH_SIZE
- See Also:
- Constant Field Values
-
CONFIG_NO_TRANSACTIONS
public static final String CONFIG_NO_TRANSACTIONS
- See Also:
- Constant Field Values
-
CONFIG_DO_UPKEEP
public static final String CONFIG_DO_UPKEEP
- See Also:
- Constant Field Values
-
CONFIG_VERBOSE
public static final String CONFIG_VERBOSE
- See Also:
- Constant Field Values
-
CONFIG_PACE_OFF
public static final String CONFIG_PACE_OFF
- See Also:
- Constant Field Values
-
CONFIG_CLEANUP
public static final String CONFIG_CLEANUP
- See Also:
- Constant Field Values
-
CONFIG_SHOW_CONNECT
public static final String CONFIG_SHOW_CONNECT
- See Also:
- Constant Field Values
-
CONFIG_HELP
public static final String CONFIG_HELP
- See Also:
- Constant Field Values
-
CONFIG_SETUP
public static final String CONFIG_SETUP
- See Also:
- Constant Field Values
-
CONFIG_RESET
public static final String CONFIG_RESET
- See Also:
- Constant Field Values
-
CONFIG_STORE_NAME
public static final String CONFIG_STORE_NAME
- See Also:
- Constant Field Values
-
CONFIG_ECHO_FILE
public static final String CONFIG_ECHO_FILE
- See Also:
- Constant Field Values
-
CONFIG_ECHO_APPEND
public static final String CONFIG_ECHO_APPEND
- See Also:
- Constant Field Values
-
helpMap
protected static Map<String,FSMigrationTool.HelpEntry> helpMap
-
RunSpacer
protected static String RunSpacer
-
-
Method Detail
-
getComponentName
public String getComponentName()
- Specified by:
getComponentNamein classedu.uiuc.ncsa.security.util.cli.CLITool2
-
getLoader
public edu.uiuc.ncsa.security.core.util.ConfigurationLoader<? extends edu.uiuc.ncsa.security.core.util.AbstractEnvironment> getLoader() throws Exception- Specified by:
getLoaderin classedu.uiuc.ncsa.security.util.cli.CLITool2- Throws:
Exception
-
getMigrater
public FSMigrater getMigrater()
-
setMigrater
public void setMigrater(FSMigrater migrater)
-
doIt
public void doIt() throws Exception- Specified by:
doItin classedu.uiuc.ncsa.security.util.cli.CLITool2- Throws:
Exception
-
help
public void help()
- Specified by:
helpin classedu.uiuc.ncsa.security.util.cli.CLITool2
-
setSourceFile
public void setSourceFile(String sourceFile)
-
setTargetFile
public void setTargetFile(String targetFile)
-
setSourceConfigName
public void setSourceConfigName(String sourceConfigName)
-
setTargetConfigName
public void setTargetConfigName(String targetConfigName)
-
setVerbose
public void setVerbose(boolean verbose)
- Overrides:
setVerbosein classedu.uiuc.ncsa.security.util.cli.CLITool2
-
setBatchSize
public void setBatchSize(int batchSize)
-
isPacerOn
public boolean isPacerOn()
-
setPacerOn
public void setPacerOn(boolean pacerOn)
-
setNoTransactions
public void setNoTransactions(boolean noTransactions)
-
getSourceSE
public OA2SE getSourceSE()
-
getTargetSE
public OA2SE getTargetSE()
-
getSourceFile
public String getSourceFile()
-
getTargetFile
public String getTargetFile()
-
getSourceConfigName
public String getSourceConfigName()
-
getTargetConfigName
public String getTargetConfigName()
-
isVerbose
public boolean isVerbose()
- Overrides:
isVerbosein classedu.uiuc.ncsa.security.util.cli.CLITool2
-
getBatchSize
public int getBatchSize()
-
loadEnvironments
protected boolean loadEnvironments()
Loads the environment. This returns true if the operation succeeded.- Returns:
-
vsay
protected void vsay(String x)
-
getMigrateStore
public MigrateStore getMigrateStore()
-
setMigrateStore
public void setMigrateStore(MigrateStore migrateStore)
-
isUpkeepOn
public boolean isUpkeepOn()
-
setUpkeepOn
public void setUpkeepOn(boolean upkeepOn)
-
say
public static void say(String x)
-
echoOn
protected static boolean echoOn()
-
getHelpMap
protected static Map<String,FSMigrationTool.HelpEntry> getHelpMap()
Creates the help map. This adds the entry by key. Later these are alphabetized, formatted, etc.- Returns:
-
addHelpEntry
protected static void addHelpEntry(String name, String type, String description, String[] description2)
-
addHelpEntry
protected static void addHelpEntry(String name, String type, String defaultValue, String description)
-
addHelpEntry
protected static void addHelpEntry(String name, String type, String defaultValue, String description, String[] description2)
-
showHelp
public static void showHelp() throws IllegalAccessException- Throws:
IllegalAccessException
-
isNoTransactions
public boolean isNoTransactions()
-
removeMigrationDB
protected void removeMigrationDB(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
-
getDBDir
protected File getDBDir()
-
nukeDir
protected void nukeDir(File dir)
Removes EVERYTHING in the directory, AND the directory itself.- Parameters:
dir-
-
getArgs
protected boolean getArgs(edu.uiuc.ncsa.security.util.cli.InputLine inputLine) throws IOException- Throws:
IOException
-
isEchoAppend
public boolean isEchoAppend()
-
setEchoAppend
public void setEchoAppend(boolean echoAppend)
-
getAllConfigNames
public static List<String> getAllConfigNames() throws IllegalAccessException
- Throws:
IllegalAccessException
-
-