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_USERNAME
and$GEMMA_PASSWORD
variables. A more secure$GEMMA_PASSWORD_CMD
variable 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 void
executeBatchTasks(Collection<? extends Runnable> tasks)
Execute the given batch tasks.protected void
processStandardOptions(org.apache.commons.cli.CommandLine commandLine)
You must override this method to process any options you added.protected boolean
requireLogin()
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.ParseException
You must override this method to process any options you added.- Overrides:
processStandardOptions
in 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
DelegatingSecurityContextCallable
to ensure that they execute with the security context set up byauthenticate()
.- Overrides:
executeBatchTasks
in classAbstractCLI
- Throws:
InterruptedException
-
-