Class FSMigrationTool
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.cli.CLITool
-
- org.oa4mp.server.admin.migrate.tools.oauth2.myproxy.FSMigrationTool
-
- All Implemented Interfaces:
edu.uiuc.ncsa.security.core.Logable
public class FSMigrationTool extends edu.uiuc.ncsa.security.util.cli.CLITool
Migration tool for old style file stores to (at this point) a Derby store. This loads or creates stores needed and then runs theFSMigrater
The 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 class
FSMigrationTool.HelpEntry
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_BATCH_SIZE
static String
CONFIG_CLEANUP
static String
CONFIG_DO_UPKEEP
static String
CONFIG_ECHO_APPEND
static String
CONFIG_ECHO_FILE
static String
CONFIG_HELP
static String
CONFIG_NO_TRANSACTIONS
static String
CONFIG_PACE_OFF
static String
CONFIG_RESET
static String
CONFIG_SETUP
static String
CONFIG_SHOW_CONNECT
static String
CONFIG_SOURCE_CFG
static String
CONFIG_SOURCE_CFG_NAME
static String
CONFIG_STORE_NAME
static String
CONFIG_TARGET_CFG
static String
CONFIG_TARGET_CFG_NAME
static String
CONFIG_VERBOSE
static int
DEFAULT_BATCH_SIZE
protected static Map<String,FSMigrationTool.HelpEntry>
helpMap
static String
INGESTION_FILE_NAME
protected static String
RunSpacer
-
Fields inherited from class edu.uiuc.ncsa.security.util.cli.CLITool
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 void
addHelpEntry(String name, String type, String description)
protected static void
addHelpEntry(String name, String type, String defaultValue, String description)
protected static void
addHelpEntry(String name, String type, String description, String[] description2)
protected static void
addHelpEntry(String name, String type, String defaultValue, String description, String[] description2)
void
doIt()
protected static boolean
echoOn()
static List<String>
getAllConfigNames()
protected boolean
getArgs(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
int
getBatchSize()
String
getComponentName()
protected File
getDBDir()
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()
FSMigrater
getMigrater()
MigrateStore
getMigrateStore()
String
getSourceConfigName()
String
getSourceFile()
org.oa4mp.server.loader.oauth2.OA2SE
getSourceSE()
String
getTargetConfigName()
String
getTargetFile()
org.oa4mp.server.loader.oauth2.OA2SE
getTargetSE()
void
help()
boolean
isEchoAppend()
boolean
isNoTransactions()
boolean
isPacerOn()
boolean
isUpkeepOn()
boolean
isVerbose()
protected boolean
loadEnvironments()
Loads the environment.static void
main(String[] args)
protected void
nukeDir(File dir)
Removes EVERYTHING in the directory, AND the directory itself.protected void
removeMigrationDB(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
static void
say(String x)
void
setBatchSize(int batchSize)
void
setEchoAppend(boolean echoAppend)
void
setMigrater(FSMigrater migrater)
void
setMigrateStore(MigrateStore migrateStore)
void
setNoTransactions(boolean noTransactions)
void
setPacerOn(boolean pacerOn)
void
setSourceConfigName(String sourceConfigName)
void
setSourceFile(String sourceFile)
void
setTargetConfigName(String targetConfigName)
void
setTargetFile(String targetFile)
void
setUpkeepOn(boolean upkeepOn)
void
setVerbose(boolean verbose)
static void
showHelp()
protected void
vsay(String x)
-
Methods inherited from class edu.uiuc.ncsa.security.util.cli.CLITool
checkAction, debug, defaultHelp, error, error, getAction, getBufferedReader, getCommandLine, getConfigFile, getConfigurationNode, getEnvironment, getIoInterface, getLogfileName, getMyLogger, getOptions, getOptions, hasOption, info, initialize, isDebugOn, parseCommandLine, readline, run, run, say2, sayv, setAction, setBufferedReader, setCommandLine, setConfigFile, setConfigurationNode, setDebugOn, setEnvironment, 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:
getComponentName
in classedu.uiuc.ncsa.security.util.cli.CLITool
-
getLoader
public edu.uiuc.ncsa.security.core.util.ConfigurationLoader<? extends edu.uiuc.ncsa.security.core.util.AbstractEnvironment> getLoader() throws Exception
- Specified by:
getLoader
in classedu.uiuc.ncsa.security.util.cli.CLITool
- Throws:
Exception
-
getMigrater
public FSMigrater getMigrater()
-
setMigrater
public void setMigrater(FSMigrater migrater)
-
doIt
public void doIt() throws Exception
- Specified by:
doIt
in classedu.uiuc.ncsa.security.util.cli.CLITool
- Throws:
Exception
-
help
public void help()
- Specified by:
help
in classedu.uiuc.ncsa.security.util.cli.CLITool
-
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:
setVerbose
in classedu.uiuc.ncsa.security.util.cli.CLITool
-
setBatchSize
public void setBatchSize(int batchSize)
-
isPacerOn
public boolean isPacerOn()
-
setPacerOn
public void setPacerOn(boolean pacerOn)
-
setNoTransactions
public void setNoTransactions(boolean noTransactions)
-
getSourceSE
public org.oa4mp.server.loader.oauth2.OA2SE getSourceSE()
-
getTargetSE
public org.oa4mp.server.loader.oauth2.OA2SE getTargetSE()
-
getSourceFile
public String getSourceFile()
-
getTargetFile
public String getTargetFile()
-
getSourceConfigName
public String getSourceConfigName()
-
getTargetConfigName
public String getTargetConfigName()
-
isVerbose
public boolean isVerbose()
- Overrides:
isVerbose
in classedu.uiuc.ncsa.security.util.cli.CLITool
-
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
-
-