-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
518 changed files
with
6,145 additions
and
5,625 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<parent> | ||
<artifactId>gemma</artifactId> | ||
<groupId>gemma</groupId> | ||
<version>1.29.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>gemma-cli</artifactId> | ||
<name>Gemma CLI</name> | ||
<description>Module containing the Gemma CLI.</description> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>appassembler-maven-plugin</artifactId> | ||
<version>2.1.0</version> | ||
<configuration> | ||
<repositoryName>lib</repositoryName> | ||
<repositoryLayout>flat</repositoryLayout> | ||
<copyConfigurationDirectory>true</copyConfigurationDirectory> | ||
<platforms> | ||
<platform>unix</platform> | ||
</platforms> | ||
<programs> | ||
<program> | ||
<id>gemma-cli</id> | ||
<mainClass>ubic.gemma.core.apps.GemmaCLI</mainClass> | ||
</program> | ||
</programs> | ||
<!-- this allows Log4j 2 to lookup for Log4j 1.2 configuration --> | ||
<extraJvmArguments>-Dlog4j1.compatibility=true -Djava.awt.headless=true</extraJvmArguments> | ||
<!-- Gemma CLI extensions can be dropped in that folder --> | ||
<endorsedDir>contrib</endorsedDir> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-appassembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>assemble</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.3.0</version> | ||
<configuration> | ||
<descriptors> | ||
<descriptor>src/assembly/appassembler.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>gemma</groupId> | ||
<artifactId>gemma-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>gemma</groupId> | ||
<artifactId>gemma-core</artifactId> | ||
<version>${project.version}</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
<version>1.5.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Gemma Contrib Apps | ||
|
||
This package can be used by other Java packages to include CLIs. | ||
|
||
Standard applications reside in `ubic.pavlab.gemma.core.apps`. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
112 changes: 112 additions & 0 deletions
112
gemma-cli/src/main/java/ubic/gemma/core/apps/ExternalDatabaseUpdaterCli.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package ubic.gemma.core.apps; | ||
|
||
import org.apache.commons.cli.CommandLine; | ||
import org.apache.commons.cli.Option; | ||
import org.apache.commons.cli.Options; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import ubic.gemma.core.util.AbstractCLI; | ||
import ubic.gemma.core.util.AbstractSpringAwareCLI; | ||
import ubic.gemma.model.common.description.ExternalDatabase; | ||
import ubic.gemma.persistence.service.common.description.ExternalDatabaseService; | ||
|
||
import java.net.URL; | ||
import java.util.Date; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
@Component | ||
public class ExternalDatabaseUpdaterCli extends AbstractSpringAwareCLI { | ||
|
||
private static final String NAME_OPTION = "n", | ||
DESCRIPTION_OPTION = "d", | ||
RELEASE_OPTION = "release", | ||
RELEASE_NOTE_OPTION = "releaseNote", | ||
RELEASE_VERSION_OPTION = "releaseVersion", | ||
RELEASE_URL_OPTION = "releaseUrl", | ||
LAST_UPDATED_OPTION = "lastUpdated"; | ||
|
||
@Autowired | ||
private ExternalDatabaseService externalDatabaseService; | ||
|
||
private String name; | ||
private String description; | ||
private boolean release; | ||
private String releaseNote; | ||
private String releaseVersion; | ||
private URL releaseUrl; | ||
private Date lastUpdated; | ||
|
||
@Override | ||
public String getCommandName() { | ||
return "updateExternalDatabase"; | ||
} | ||
|
||
@Override | ||
public GemmaCLI.CommandGroup getCommandGroup() { | ||
return GemmaCLI.CommandGroup.SYSTEM; | ||
} | ||
|
||
@Override | ||
protected boolean requireLogin() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected void buildOptions( Options options ) { | ||
options.addOption( Option.builder( NAME_OPTION ) | ||
.longOpt( "name" ) | ||
.hasArg() | ||
.optionalArg( false ) | ||
.desc( "External database name" ).build() ); | ||
options.addOption( DESCRIPTION_OPTION, "description", true, "New description" ); | ||
options.addOption( RELEASE_OPTION, "release", false, "Update the release (only affects last modified moment))" ); | ||
options.addOption( RELEASE_VERSION_OPTION, "release-version", true, "Release version" ); | ||
options.addOption( Option.builder( RELEASE_URL_OPTION ) | ||
.longOpt( "release-url" ) | ||
.hasArg() | ||
.desc( "Release URL (optional)" ) | ||
.type( URL.class ).build() ); | ||
options.addOption( RELEASE_NOTE_OPTION, "release-note", true, "Note to include in the audit event related to the new release" ); | ||
options.addOption( Option.builder( LAST_UPDATED_OPTION ) | ||
.longOpt( "last-updated" ) | ||
.hasArg() | ||
.desc( "Moment the release was performed if known, otherwise the current time will be used." ) | ||
.type( Date.class ).build() ); | ||
} | ||
|
||
@Override | ||
protected void processOptions( CommandLine commandLine ) throws Exception { | ||
name = commandLine.getOptionValue( NAME_OPTION ); | ||
description = commandLine.getOptionValue( DESCRIPTION_OPTION ); | ||
release = commandLine.hasOption( RELEASE_OPTION ); | ||
releaseNote = commandLine.getOptionValue( RELEASE_NOTE_OPTION ); | ||
releaseVersion = commandLine.getOptionValue( RELEASE_VERSION_OPTION ); | ||
releaseUrl = ( URL ) commandLine.getParsedOptionValue( RELEASE_URL_OPTION ); | ||
lastUpdated = ( Date ) commandLine.getParsedOptionValue( LAST_UPDATED_OPTION ); | ||
if ( lastUpdated == null ) { | ||
lastUpdated = new Date(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void doWork() throws Exception { | ||
ExternalDatabase ed = requireNonNull( externalDatabaseService.findByNameWithAuditTrail( name ), | ||
String.format( "No database with name %s.", name ) ); | ||
if ( description != null ) { | ||
ed.setDescription( description ); | ||
} | ||
if ( release || releaseVersion != null ) { | ||
if ( releaseVersion != null ) { | ||
AbstractCLI.log.info( String.format( "Updating %s release version to %s.", name, releaseVersion ) ); | ||
externalDatabaseService.updateReleaseDetails( ed, releaseVersion, releaseUrl, releaseNote, lastUpdated ); | ||
} else { | ||
AbstractCLI.log.info( String.format( "Updating %s last updated moment to %s.", name, lastUpdated ) ); | ||
externalDatabaseService.updateReleaseLastUpdated( ed, releaseNote, lastUpdated ); | ||
} | ||
} else { | ||
AbstractCLI.log.info( String.format( "Updating %s. Use the --release flag to update last updated or release infos.", name ) ); | ||
externalDatabaseService.update( ed ); /* only update description, etc. */ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.