Package ubic.gemma.core.util
Class AbstractAuthenticatedCLI
- java.lang.Object
-
- ubic.gemma.core.util.AbstractCLI
-
- ubic.gemma.core.util.AbstractAuthenticatedCLI
-
- All Implemented Interfaces:
CLI
- Direct Known Subclasses:
ArrayDesignAlternativePopulateCli,ArrayDesignSequenceManipulatingCli,BibRefUpdaterCli,BlacklistCli,DatabaseViewGeneratorCLI,DeleteEvidenceCLI,EvidenceImporterAbstractCLI,ExperimentalDesignImportCli,ExperimentalDesignViewCli,ExpressionExperimentManipulatingCLI,ExternalDatabaseAdderCli,ExternalDatabaseEvidenceImporterAbstractCLI,ExternalDatabaseOverviewCli,ExternalDatabaseUpdaterCli,ExternalFileGeneLoaderCLI,FactorValueMigratorCLI,GenericGenelistDesignGenerator,GeoGrabberCli,LoadEvidenceForClassifier,LoadExpressionDataCli,LoadSimpleExpressionDataCli,MultifunctionalityCli,NCBIGene2GOAssociationLoaderCLI,NcbiGeneLoaderCLI,PubMedLoaderCli,PubMedSearcher,TaxonLoaderCli,UpdateEE2CCli,UpdatePubMedCli
public abstract class AbstractAuthenticatedCLI extends AbstractCLI
Subclass this to create command line interface (CLI) tools that need authentication.Credentials may be supplied via the environment using the
$GEMMMA_USERNAMEand$GEMMA_PASSWORDvariables. A more secure$GEMMA_PASSWORD_CMDvariable can be used to specify a command that produces the password. If no environment variables are supplied, they will be prompted if the standard input is attached to a console (i.e tty).- Author:
- pavlidis
-
-
Field Summary
-
Fields inherited from class ubic.gemma.core.util.AbstractCLI
ABORTED, FAILURE, FAILURE_FROM_ERROR_OBJECTS, FOOTER, HEADER, log, SUCCESS
-
-
Constructor Summary
Constructors Constructor Description AbstractAuthenticatedCLI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidexecuteBatchTasks(Collection<? extends Runnable> tasks)Execute the given batch tasks.protected voidprocessStandardOptions(org.apache.commons.cli.CommandLine commandLine)You must override this method to process any options you added.protected booleanrequireLogin()Indicate if the command requires authentication.-
Methods inherited from class ubic.gemma.core.util.AbstractCLI
addAutoOption, addAutoOption, addBatchOption, addDateOption, addErrorObject, addErrorObject, addErrorObject, addSuccessObject, addSuccessObject, addThreadsOption, allowPositionalArguments, buildOptions, buildStandardOptions, doWork, executeCommand, getAutoSeekEventType, getBean, getBean, getLimitingDate, getNumThreads, getOptions, isAutoSeek, processOptions, promptConfirmationOrAbort, setAllowPositionalArguments
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ubic.gemma.core.util.CLI
getCommandGroup, getCommandName, getShortDesc
-
-
-
-
Method Detail
-
requireLogin
protected boolean requireLogin()
Indicate if the command requires authentication.Override this to return true to make authentication required.
- Returns:
- true if login is required, otherwise false
-
processStandardOptions
protected void processStandardOptions(org.apache.commons.cli.CommandLine commandLine) throws org.apache.commons.cli.ParseExceptionYou must override this method to process any options you added.- Overrides:
processStandardOptionsin classAbstractCLI- Throws:
org.apache.commons.cli.ParseException
-
executeBatchTasks
protected void executeBatchTasks(Collection<? extends Runnable> tasks) throws InterruptedException
Execute the given batch tasks.Errors will be reported with
AbstractCLI.addErrorObject(Object, String, Throwable). However, reporting successes is the responsibility of the caller.Tasks are wrapped with
DelegatingSecurityContextCallableto ensure that they execute with the security context set up byauthenticate().- Overrides:
executeBatchTasksin classAbstractCLI- Throws:
InterruptedException
-
-