From 8d5b86b0b48e72823ca74cf9b809878c8d499c90 Mon Sep 17 00:00:00 2001 From: Al Niessner Date: Wed, 9 Oct 2024 09:27:06 -0700 Subject: [PATCH] remove harvest config User must now supply the conneciton URL and auth file. --- pom.xml | 5 ----- .../gov/nasa/pds/validate/ri/AuthInformation.java | 10 +--------- .../nasa/pds/validate/ri/CommandLineInterface.java | 14 ++++---------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 95f85c05f..55ab9c0c2 100644 --- a/pom.xml +++ b/pom.xml @@ -379,11 +379,6 @@ registry-common 2.1.0-SNAPSHOT - - gov.nasa.pds - harvest - 4.1.0-SNAPSHOT - jakarta.xml.bind jakarta.xml.bind-api diff --git a/src/main/java/gov/nasa/pds/validate/ri/AuthInformation.java b/src/main/java/gov/nasa/pds/validate/ri/AuthInformation.java index 9ec0a0d20..af73c1916 100644 --- a/src/main/java/gov/nasa/pds/validate/ri/AuthInformation.java +++ b/src/main/java/gov/nasa/pds/validate/ri/AuthInformation.java @@ -1,21 +1,17 @@ package gov.nasa.pds.validate.ri; -import java.io.File; import org.apache.commons.cli.CommandLine; import org.apache.commons.lang.NotImplementedException; import gov.nasa.pds.registry.common.ConnectionFactory; import gov.nasa.pds.registry.common.EstablishConnectionFactory; -import gov.nasa.pds.registry.common.cfg.ConfigManager; public class AuthInformation { final private String apiAuthFile; - final private String harvestConfig; final private String osAuthFile; final private String regConn; private transient ConnectionFactory factory = null; - private AuthInformation(String a, String A, String c, String r) { + private AuthInformation(String a, String A, String r) { this.apiAuthFile = A; - this.harvestConfig = c; this.osAuthFile = a; this.regConn = r; } @@ -23,7 +19,6 @@ public static AuthInformation buildFrom(CommandLine cl) { return new AuthInformation( cl.getOptionValue("a",""), cl.getOptionValue("A",""), - cl.getOptionValue("c",""), cl.getOptionValue("r","")); } public synchronized ConnectionFactory getConnectionFactory() throws Exception { @@ -34,9 +29,6 @@ public synchronized ConnectionFactory getConnectionFactory() throws Exception { if (!this.osAuthFile.isBlank()) { this.factory = EstablishConnectionFactory.from(this.regConn, this.osAuthFile); } - if (!this.harvestConfig.isBlank()) { - this.factory = ConfigManager.exchangeRegistry(ConfigManager.read(new File(this.harvestConfig)).getRegistry()); - } if (this.factory == null) { throw new IllegalArgumentException("did not supply necessary arguments on the CLI"); } diff --git a/src/main/java/gov/nasa/pds/validate/ri/CommandLineInterface.java b/src/main/java/gov/nasa/pds/validate/ri/CommandLineInterface.java index dbc509fd8..32060ba28 100644 --- a/src/main/java/gov/nasa/pds/validate/ri/CommandLineInterface.java +++ b/src/main/java/gov/nasa/pds/validate/ri/CommandLineInterface.java @@ -34,9 +34,6 @@ public CommandLineInterface() { this.opts.addOption(Option.builder("a").argName("auth-file").desc( "file with the credential content to have full, direct read-only access to the Registry OpenSearch DB") .hasArg(true).longOpt("auth-opensearch").numberOfArgs(1).optionalArg(true).build()); - this.opts.addOption(Option.builder("c").argName("harvest-config").desc( - "file used by harvest to ingest data that contains the appropriate authorization and registry connection information") - .hasArg(true).longOpt("harvest-config").numberOfArgs(1).optionalArg(true).build()); this.opts.addOption(Option.builder("h").desc("show this text and exit").hasArg(false) .longOpt("help").optionalArg(true).build()); this.opts.addOption(Option.builder("r").argName("registry-connection").desc( @@ -65,7 +62,7 @@ public void help() { "with two variables, 'user' and 'password' for example: \n" + " user=janedoe\n" + " password=mypassword\n\n" + - "Both -a and -r are required with using them and are mutually exclusive with -c.\n\n", + "Both -a and -r are required.\n\n", true); } @@ -91,14 +88,11 @@ public int process(String[] args) ctx.updateLoggers(); if (cl.hasOption("A")) { - throw new ParseException("Not yet implemented. Must provide OpenSearch Registry authorization information through -a and -r, or through -c."); + throw new ParseException("Not yet implemented. Must provide OpenSearch Registry authorization information through -a and -r."); } else { boolean both = cl.hasOption("a") && cl.hasOption("r"); - boolean neither = !cl.hasOption("a") && !cl.hasOption("r"); - if (cl.hasOption("c") && !neither) { - throw new ParseException("Cannot give -a nor -r with -c."); - } else if (!both) { - throw new ParseException("Both -a and -r must be given when either is given."); + if (!both) { + throw new ParseException("Both -a and -r must be given."); } else { log.warn("Using Registry OpenSearch Database to check references."); }