)doc);
+ }
+ return docs;
+ }
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingImpl.java b/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingImpl.java
new file mode 100644
index 0000000..37b7146
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingImpl.java
@@ -0,0 +1,13 @@
+package gov.nasa.pds.registry.common.connection.aws;
+
+import org.opensearch.client.opensearch.indices.GetIndicesSettingsRequest;
+import gov.nasa.pds.registry.common.Request.Setting;
+
+class SettingImpl implements Setting {
+ final GetIndicesSettingsRequest.Builder craftsman = new GetIndicesSettingsRequest.Builder();
+ @Override
+ public Setting setIndex(String name) {
+ this.craftsman.index(name);
+ return this;
+ }
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingRespImpl.java b/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingRespImpl.java
new file mode 100644
index 0000000..cbf9911
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/aws/SettingRespImpl.java
@@ -0,0 +1,29 @@
+package gov.nasa.pds.registry.common.connection.aws;
+
+import org.opensearch.client.opensearch.indices.GetIndicesSettingsResponse;
+import org.opensearch.client.opensearch.indices.IndexState;
+import gov.nasa.pds.registry.common.Response;
+
+class SettingRespImpl implements Response.Settings {
+ final private int replicas;
+ final private int shards;
+ SettingRespImpl (GetIndicesSettingsResponse response) {
+ int r = -1, s = -1;
+ for (IndexState state : response.result().values()) {
+ // should only ever be one
+ r = Integer.valueOf(state.settings().numberOfReplicas());
+ s = Integer.valueOf(state.settings().numberOfShards());
+ }
+ this.replicas = r;
+ this.shards = s;
+ }
+ @Override
+ public int replicas() {
+ return this.replicas;
+ }
+
+ @Override
+ public int shards() {
+ return this.shards;
+ }
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/config/CognitoType.java b/src/main/java/gov/nasa/pds/registry/common/connection/config/CognitoType.java
new file mode 100644
index 0000000..d7834c9
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/config/CognitoType.java
@@ -0,0 +1,183 @@
+//
+// This file was generated by the Eclipse Implementation of JAXB, v4.0.3
+// See https://eclipse-ee4j.github.io/jaxb-ri
+// Any modifications to this file will be lost upon recompilation of the source schema.
+//
+
+
+package gov.nasa.pds.registry.common.connection.config;
+
+import jakarta.xml.bind.annotation.XmlAccessType;
+import jakarta.xml.bind.annotation.XmlAccessorType;
+import jakarta.xml.bind.annotation.XmlAttribute;
+import jakarta.xml.bind.annotation.XmlSchemaType;
+import jakarta.xml.bind.annotation.XmlType;
+import jakarta.xml.bind.annotation.XmlValue;
+import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
+import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ *
+ * Currently, cognito to serverless opensearh requires three bits of
+ * information:
+ * 1. clientID: magic ID which must be given and is not a secret but
+ * sure looks like one
+ * 3. endpoint: the endpoint for serverless opensearch
+ * 2. @gateway: an endpoint that exchanges the cognito authentication
+ * to an IAM role used for access control with serverless
+ * opensearch on AWS
+ * 3. @IDP: the cognito authentication endpoint that exchanges the
+ * username/password to a set of tokens used by the gateway.
+ *
+ *
+ * Java class for cognito_type complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
{@code
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * }
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "cognito_type", propOrder = {
+ "value"
+})
+public class CognitoType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String value;
+ @XmlAttribute(name = "endpoint")
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String endpoint;
+ @XmlAttribute(name = "gateway")
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String gateway;
+ @XmlAttribute(name = "IDP")
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String idp;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the endpoint property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getEndpoint() {
+ if (endpoint == null) {
+ return "https://p5qmxrldysl1gy759hqf.us-west-2.aoss.amazonaws.com";
+ } else {
+ return endpoint;
+ }
+ }
+
+ /**
+ * Sets the value of the endpoint property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setEndpoint(String value) {
+ this.endpoint = value;
+ }
+
+ /**
+ * Gets the value of the gateway property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getGateway() {
+ if (gateway == null) {
+ return "https://c8u1zk30u5.execute-api.us-west-2.amazonaws.com/dev/signed-url";
+ } else {
+ return gateway;
+ }
+ }
+
+ /**
+ * Sets the value of the gateway property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setGateway(String value) {
+ this.gateway = value;
+ }
+
+ /**
+ * Gets the value of the idp property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIDP() {
+ if (idp == null) {
+ return "cognito-idp.us-west-2.amazonaws.com";
+ } else {
+ return idp;
+ }
+ }
+
+ /**
+ * Sets the value of the idp property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIDP(String value) {
+ this.idp = value;
+ }
+
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/config/DirectType.java b/src/main/java/gov/nasa/pds/registry/common/connection/config/DirectType.java
new file mode 100644
index 0000000..2228301
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/config/DirectType.java
@@ -0,0 +1,150 @@
+//
+// This file was generated by the Eclipse Implementation of JAXB, v4.0.3
+// See https://eclipse-ee4j.github.io/jaxb-ri
+// Any modifications to this file will be lost upon recompilation of the source schema.
+//
+
+
+package gov.nasa.pds.registry.common.connection.config;
+
+import java.math.BigInteger;
+import jakarta.xml.bind.annotation.XmlAccessType;
+import jakarta.xml.bind.annotation.XmlAccessorType;
+import jakarta.xml.bind.annotation.XmlAttribute;
+import jakarta.xml.bind.annotation.XmlSchemaType;
+import jakarta.xml.bind.annotation.XmlType;
+import jakarta.xml.bind.annotation.XmlValue;
+import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
+import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ *
+ * Currently, connecting to an opensearch service directly requires just
+ * two pieces of information:
+ * 1. URL: the URL to directly contact an opensearch instance and its
+ * API to include authentication
+ * 2. @trustSelfSigned: when running locally for testing or development
+ * it is often necessary to use self signed
+ * certificates. Setting this option to true
+ * will all for self signed certificates.
+ *
+ * An optional 3rd piece of information @sdk is the Java SDK version to use
+ * for the connection. The traditional SDK is 1. The newer SDK 2 was
+ * introduced with the serverless opensearch development and beyond can
+ * also be used. The default is 2 as we are deprecating the use of 1.
+ *
+ *
+ * Java class for direct_type complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
{@code
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * }
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "direct_type", propOrder = {
+ "value"
+})
+public class DirectType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String value;
+ @XmlAttribute(name = "sdk")
+ protected BigInteger sdk;
+ @XmlAttribute(name = "trust_self_signed")
+ protected Boolean trustSelfSigned;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the sdk property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getSdk() {
+ if (sdk == null) {
+ return new BigInteger("2");
+ } else {
+ return sdk;
+ }
+ }
+
+ /**
+ * Sets the value of the sdk property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setSdk(BigInteger value) {
+ this.sdk = value;
+ }
+
+ /**
+ * Gets the value of the trustSelfSigned property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public boolean isTrustSelfSigned() {
+ if (trustSelfSigned == null) {
+ return false;
+ } else {
+ return trustSelfSigned;
+ }
+ }
+
+ /**
+ * Sets the value of the trustSelfSigned property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setTrustSelfSigned(Boolean value) {
+ this.trustSelfSigned = value;
+ }
+
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/config/ObjectFactory.java b/src/main/java/gov/nasa/pds/registry/common/connection/config/ObjectFactory.java
new file mode 100644
index 0000000..f25274b
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/config/ObjectFactory.java
@@ -0,0 +1,68 @@
+//
+// This file was generated by the Eclipse Implementation of JAXB, v4.0.3
+// See https://eclipse-ee4j.github.io/jaxb-ri
+// Any modifications to this file will be lost upon recompilation of the source schema.
+//
+
+
+package gov.nasa.pds.registry.common.connection.config;
+
+import jakarta.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the gov.nasa.pds.registry.common.connection.config package.
+ * An ObjectFactory allows you to programmatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: gov.nasa.pds.registry.common.connection.config
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link RegistryConnection }
+ *
+ * @return
+ * the new instance of {@link RegistryConnection }
+ */
+ public RegistryConnection createRegistryConnection() {
+ return new RegistryConnection();
+ }
+
+ /**
+ * Create an instance of {@link CognitoType }
+ *
+ * @return
+ * the new instance of {@link CognitoType }
+ */
+ public CognitoType createCognitoType() {
+ return new CognitoType();
+ }
+
+ /**
+ * Create an instance of {@link DirectType }
+ *
+ * @return
+ * the new instance of {@link DirectType }
+ */
+ public DirectType createDirectType() {
+ return new DirectType();
+ }
+
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/config/RegistryConnection.java b/src/main/java/gov/nasa/pds/registry/common/connection/config/RegistryConnection.java
new file mode 100644
index 0000000..3fe0462
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/config/RegistryConnection.java
@@ -0,0 +1,142 @@
+//
+// This file was generated by the Eclipse Implementation of JAXB, v4.0.3
+// See https://eclipse-ee4j.github.io/jaxb-ri
+// Any modifications to this file will be lost upon recompilation of the source schema.
+//
+
+
+package gov.nasa.pds.registry.common.connection.config;
+
+import jakarta.xml.bind.annotation.XmlAccessType;
+import jakarta.xml.bind.annotation.XmlAccessorType;
+import jakarta.xml.bind.annotation.XmlAttribute;
+import jakarta.xml.bind.annotation.XmlElement;
+import jakarta.xml.bind.annotation.XmlRootElement;
+import jakarta.xml.bind.annotation.XmlSchemaType;
+import jakarta.xml.bind.annotation.XmlType;
+import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
+import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+
+/**
+ *
+ * This terrible construct is so that xjc can autodetect this as the
+ * root node for processing. Many things would be better but this is
+ * the most workable solution especially if the making of the binding
+ * code is automated in the pom. The only other real solution is to
+ * modify one of the classes generated by hand.
+ *
+ *
+ *
Java class for anonymous complex type.
+ *
+ *
The following schema fragment specifies the expected content contained within this class.
+ *
+ *
{@code
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * }
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "cognitoClientId",
+ "serverUrl"
+})
+@XmlRootElement(name = "registry_connection")
+public class RegistryConnection {
+
+ protected CognitoType cognitoClientId;
+ @XmlElement(name = "server_url")
+ protected DirectType serverUrl;
+ @XmlAttribute(name = "index")
+ @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
+ @XmlSchemaType(name = "normalizedString")
+ protected String index;
+
+ /**
+ * Gets the value of the cognitoClientId property.
+ *
+ * @return
+ * possible object is
+ * {@link CognitoType }
+ *
+ */
+ public CognitoType getCognitoClientId() {
+ return cognitoClientId;
+ }
+
+ /**
+ * Sets the value of the cognitoClientId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CognitoType }
+ *
+ */
+ public void setCognitoClientId(CognitoType value) {
+ this.cognitoClientId = value;
+ }
+
+ /**
+ * Gets the value of the serverUrl property.
+ *
+ * @return
+ * possible object is
+ * {@link DirectType }
+ *
+ */
+ public DirectType getServerUrl() {
+ return serverUrl;
+ }
+
+ /**
+ * Sets the value of the serverUrl property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DirectType }
+ *
+ */
+ public void setServerUrl(DirectType value) {
+ this.serverUrl = value;
+ }
+
+ /**
+ * Gets the value of the index property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getIndex() {
+ if (index == null) {
+ return "registry";
+ } else {
+ return index;
+ }
+ }
+
+ /**
+ * Sets the value of the index property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setIndex(String value) {
+ this.index = value;
+ }
+
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkImpl.java b/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkImpl.java
new file mode 100644
index 0000000..c45798a
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkImpl.java
@@ -0,0 +1,50 @@
+package gov.nasa.pds.registry.common.connection.es;
+
+
+import java.util.Collection;
+import gov.nasa.pds.registry.common.Request;
+import gov.nasa.pds.registry.common.Request.Bulk;
+
+class BulkImpl implements Request.Bulk {
+ private String index = null;
+ private String refresh = null;
+ String json = "";
+ //@Override
+ public void add(String statement) {
+ this.json += statement + "\n";
+ }
+ @Override
+ public void add(String statement, String document) {
+ this.json += statement + "\n";
+ this.json += document + "\n";
+ }
+ @Override
+ public Request.Bulk buildUpdateStatus(Collection lidvids, String status) {
+ this.json = JsonHelper.buildUpdateStatusJson(lidvids, status);
+ return this;
+ }
+ @Override
+ public Bulk setIndex(String name) {
+ this.index = name;
+ return this;
+ }
+ @Override
+ public Bulk setRefresh(Refresh type) {
+ switch (type) {
+ case False:
+ this.refresh = "false";
+ break;
+ case True:
+ this.refresh = "true";
+ break;
+ case WaitFor:
+ this.refresh = "wait_for";
+ break;
+ }
+ return this;
+ }
+ @Override
+ public String toString() {
+ return (this.index == null ? "" : "/" + this.index) + "/_bulk" + (this.refresh == null ? "" : "?refresh=" + this.refresh);
+ }
+}
diff --git a/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkRespImpl.java b/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkRespImpl.java
new file mode 100644
index 0000000..3a383e0
--- /dev/null
+++ b/src/main/java/gov/nasa/pds/registry/common/connection/es/BulkRespImpl.java
@@ -0,0 +1,106 @@
+package gov.nasa.pds.registry.common.connection.es;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import com.google.gson.Gson;
+import gov.nasa.pds.registry.common.Response;
+
+class BulkRespImpl implements Response.Bulk {
+ final int errorCount;
+ final private Logger log;
+ final private org.elasticsearch.client.Response response;
+ BulkRespImpl (org.elasticsearch.client.Response response) {
+ this.log = LogManager.getLogger(this.getClass());
+ this.errorCount = this.parse(response.toString());
+ this.response = response;
+ }
+ @SuppressWarnings("rawtypes") // necessary evil to manipulate heterogenous structures
+ private int parse (String resp) {
+ int numErrors = 0;
+ try
+ {
+ // TODO: Use streaming parser. Stop parsing if there are no errors.
+ // Parse JSON response
+ Gson gson = new Gson();
+ Map json = (Map)gson.fromJson(resp, Object.class);
+ Boolean hasErrors = (Boolean)json.get("errors");
+ if(hasErrors)
+ {
+ @SuppressWarnings("unchecked")
+ List