diff --git a/.secrets.baseline b/.secrets.baseline
index ec96274..7636327 100644
--- a/.secrets.baseline
+++ b/.secrets.baseline
@@ -1,6 +1,9 @@
{
"version": "1.4.0",
"plugins_used": [
+ {
+ "name": "AbsolutePathDetectorExperimental"
+ },
{
"name": "ArtifactoryDetector"
},
@@ -84,6 +87,10 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
+ {
+ "path": "detect_secrets.filters.common.is_baseline_file",
+ "filename": ".secrets.baseline"
+ },
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
@@ -132,7 +139,8 @@
"filename": "src/changes/changes.xml",
"hashed_secret": "0595fbe615f63e4c2738d16fdba8304078158506",
"is_verified": false,
- "line_number": 22
+ "line_number": 22,
+ "is_secret": false
}
],
"src/site/xdoc/index.xml": [
@@ -141,21 +149,24 @@
"filename": "src/site/xdoc/index.xml",
"hashed_secret": "4559f82eb53128029fe5c67cb1bfee1e6ff17f54",
"is_verified": false,
- "line_number": 21
+ "line_number": 21,
+ "is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/index.xml",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
- "line_number": 22
+ "line_number": 22,
+ "is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/index.xml",
"hashed_secret": "3a6d7aa49a8e4a2fe32a5cd0e53da9cb96bd8d29",
"is_verified": false,
- "line_number": 33
+ "line_number": 33,
+ "is_secret": false
}
],
"src/site/xdoc/install/index.xml.vm": [
@@ -164,14 +175,16 @@
"filename": "src/site/xdoc/install/index.xml.vm",
"hashed_secret": "4559f82eb53128029fe5c67cb1bfee1e6ff17f54",
"is_verified": false,
- "line_number": 22
+ "line_number": 22,
+ "is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/install/index.xml.vm",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
- "line_number": 23
+ "line_number": 23,
+ "is_secret": false
}
],
"src/site/xdoc/operate/index.xml.vm": [
@@ -180,16 +193,18 @@
"filename": "src/site/xdoc/operate/index.xml.vm",
"hashed_secret": "4559f82eb53128029fe5c67cb1bfee1e6ff17f54",
"is_verified": false,
- "line_number": 22
+ "line_number": 22,
+ "is_secret": false
},
{
"type": "Email Address",
"filename": "src/site/xdoc/operate/index.xml.vm",
"hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd",
"is_verified": false,
- "line_number": 23
+ "line_number": 23,
+ "is_secret": false
}
]
},
- "generated_at": "2023-11-22T18:53:30Z"
+ "generated_at": "2024-02-05T18:03:09Z"
}
diff --git a/README-PACKAGE.txt b/README-PACKAGE.txt
deleted file mode 100644
index fc8c0ac..0000000
--- a/README-PACKAGE.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-For documentation regarding installation and operation of the Search Service
-software, point your favorite browser to the ./doc/index.html file.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..060e58e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,223 @@
+# πͺ Legacy Search UI and Server
+
+The Legacy Search UI is the user interface for the PDS Keyword Search and the Registry Legacy Server is a middleware layer to pass queries from the Search UI to Apache Solr.
+
+The software is packaged in a WAR file.
+
+This is the XYZ that does this, that, and the other thing for the Planetary Data System.
+
+Please visit our website at: https://nasa-pds.github.io/search-ui-legacy
+
+It has useful information for developers and end-users.
+
+- [π Quick Start: Installation and Usage](#user-content--quick-start-installation-and-usage)
+ - [πββοΈ Using this Package](#user-content-οΈ-using-this-package)
+- [π₯ Contributing](#user-content--contributing)
+ - [π’ Versioning](#user-content--versioning)
+ - [πͺ Development](#user-content--development)
+ - [π
Continuous Integration & Deployment](#user-content--continuous-integration--deployment)
+ - [π§ Manual Publication](#user-content--manual-publication)
+ - [Update Version Numbers](#user-content-update-version-numbers)
+ - [Update Changelog](#user-content-update-changelog)
+ - [Commit Changes](#user-content-commit-changes)
+ - [Build and Deploy Software to Maven Central Repo](#user-content-build-and-deploy-software-to-maven-central-repo)
+ - [Push Tagged Release](#user-content-push-tagged-release)
+ - [Deploy Site to Github Pages](#user-content-deploy-site-to-github-pages)
+ - [Update Versions For Development](#user-content-update-versions-for-development)
+ - [Complete Release in Github](#user-content-complete-release-in-github)
+- [π License](#user-content--license)
+
+
+## π Quick Start: Installation and Usage
+
+### System Requirements
+* Working Legacy Registry up and running with data loaded:
+ * https://github.com/NASA-PDS/registry-mgr-legacy
+ * https://github.com/NASA-PDS/harvest-legacy
+
+* Apache Tomcat 8.5+
+
+### πββοΈ Using this Package
+
+```
+# Generate the WAR package
+$ mvn clean package
+
+# Copy the WAR to Tomcat
+$ cp target/*.war /path/to/tomcat/webapps
+
+# Check some queries work against Solr
+$ curl --GET http://localhost:8080/search-ui-legacy/search?q=*:*
+```
+
+## π₯ Contributing
+
+Within the NASA Planetary Data System, we value the health of our community as much as the code. Towards that end, we ask that you read and practice what's described in these documents:
+
+- Our [contributor's guide](https://github.com/NASA-PDS/.github/blob/main/CONTRIBUTING.md) delineates the kinds of contributions we accept.
+- Our [code of conduct](https://github.com/NASA-PDS/.github/blob/main/CODE_OF_CONDUCT.md) outlines the standards of behavior we practice and expect by everyone who participates with our software.
+
+
+### π’ Versioning
+
+We use the [SemVer](https://semver.org/) philosophy for versioning this software.
+
+
+### πͺ Development
+
+To develop this project, use your favorite text editor, or an integrated development environment with Java support, such as [Eclipse](https://www.eclipse.org/ide/). You'll also need [Apache Maven](https://maven.apache.org/) version 3. With these tools, you can typically run
+
+ mvn package
+
+to produce a complete package. This runs all the phases necessary, including compilation, testing, and package assembly. Other common Maven phases include:
+
+- `compile` - just compile the source code
+- `test` - just run unit tests
+- `install` - install into your local repository
+- `deploy` - deploy to a remote repository β note that the Roundup action does this automatically for releases
+
+
+#### :guardsman: Secrets Detection Setup and Update
+The PDS uses [Detect Secrets](https://nasa-ammos.github.io/slim/docs/guides/software-lifecycle/security/secrets-detection/)) to help prevent committing information to a repository that should remain secret.
+
+For Detect Secrets to work, there is a one-time setup required to your personal global Git configuration, as well as several steps to create or update the **required** `.secrets.baseline` file needed to avoid false positive failures of the software. See [the wiki entry on Detect Secrets](https://github.com/NASA-PDS/nasa-pds.github.io/wiki/Git-and-Github-Guide#detect-secrets) to learn how to do this.
+
+#### πͺΒ Pre-Commit Hooks
+
+This package comes with a configuration for [Pre-Commit](https://pre-commit.com/), a system for automating and standardizing `git` hooks for code linting, security scanning, etc. Here in this Java template repository, we use Pre-Commit with [Detect Secrets](https://nasa-ammos.github.io/slim/docs/guides/software-lifecycle/security/secrets-detection/) to prevent the accidental committing or commit messages containing secrets like API keys and passwords.
+
+Pre-Commit and `detect-secrets` are language-neutral, but they themselves are written in Python. To take advantage of these features, you'll need a nearby Python installation. A recommended way to do this is with a virtual Python environment. Using the command line interface, run:
+
+```console
+$ python -m venv .venv
+$ source .venv/bin/activate # Use source .venv/bin/activate.csh if you're using a C-style shell
+$ pip install pre-commit git+https://github.com/NASA-AMMOS/slim-detect-secrets.git@exp
+```
+
+See Detect Secrets information above to setup your secrets baseline prior to proceeding.
+
+Finally, install the pre-commit hooks:
+
+ pre-commit install
+ pre-commit install -t pre-push
+ pre-commit install -t prepare-commit-msg
+ pre-commit install -t commit-msg
+
+You can then work normally. Pre-commit will run automatically during `git commit` and `git push` so long as the Python virtual environment is active.
+
+π **Note:** For Detect Secrets to work, there is a one-time setup required to your personal global Git configuration. See [the wiki entry on Detect Secrets](https://github.com/NASA-PDS/nasa-pds.github.io/wiki/Git-and-Github-Guide#detect-secrets) to learn how to do this.
+
+
+### π
Continuous Integration & Deployment
+
+Thanks to [GitHub Actions](https://github.com/features/actions) and the [Roundup Action](https://github.com/NASA-PDS/roundup-action), this software undergoes continuous integration and deployment. Every time a change is merged into the `main` branch, an "unstable" (known in Java software development circles as a "SNAPSHOT") is created and delivered to [the releases page](https://github.com/NASA-PDS/pds-template-repo-java/releases) and to the [OSSRH](https://central.sonatype.org/publish/publish-guide/).
+
+You can make an official delivery by pushing a `release/X.Y.Z` branch to GitHub, replacing `X` with the major version number, `Y` with the minor version number, and `Z` with the micro version number. This results in a stable (non-SNAPSHOT) release generated and cryptographically signed (but by an automated process so alter trust expectations accordingly) and made available on the releases page and OSSRH; the [website published](https://nasa-pds.github.io/pds-template-repo-java/); changelogs and requirements updated; and a new version number in the `main` branch prepared for future development.
+
+The following sections detail how to do this manually should the automated steps fail.
+
+
+### π§ Manual Publication
+
+**π Note:** Requires using [PDS Maven Parent POM](https://github.com/NASA-PDS/pdsen-maven-parent) to ensure release profile is set.
+
+
+#### Update Version Numbers
+
+Update pom.xml for the release version or use the Maven Versions Plugin, e.g.:
+```console
+$ # Skip this step if this is a RELEASE CANDIDATE, we will deploy as SNAPSHOT version for testing
+$ VERSION=1.15.0
+$ mvn -DnewVersion=$VERSION versions:set
+$ git add pom.xml
+$ git add */pom.xml
+```
+
+
+#### Update Changelog
+
+Update Changelog using [Github Changelog Generator](https://github.com/github-changelog-generator/github-changelog-generator). Note: Make sure you set `$CHANGELOG_GITHUB_TOKEN` in your `.bash_profile` or use the `--token` flag.
+```console
+$ # For RELEASE CANDIDATE, set VERSION to future release version.
+$ GITHUB_ORG=NASA-PDS
+$ GITHUB_REPO=validate
+$ github_changelog_generator --future-release v$VERSION --user $GITHUB_ORG --project $GITHUB_REPO --configure-sections '{"improvements":{"prefix":"**Improvements:**","labels":["Epic"]},"defects":{"prefix":"**Defects:**","labels":["bug"]},"deprecations":{"prefix":"**Deprecations:**","labels":["deprecation"]}}' --no-pull-requests --token $GITHUB_TOKEN
+$ git add CHANGELOG.md
+```
+
+
+#### Commit Changes
+
+Commit changes using following template commit message:
+```console
+$ # For operational release
+$ git commit -m "[RELEASE] Validate v$VERSION"
+$ # Push changes to main
+$ git push --set-upstream origin main
+```
+
+
+#### Build and Deploy Software to Maven Central Repo
+```console
+$ # For operational release
+$ mvn --activate-profiles release clean site site:stage package deploy
+$ # For release candidate
+$ mvn clean site site:stage package deploy
+```
+
+
+#### Push Tagged Release
+```console
+$ # For Release Candidate, you may need to delete old SNAPSHOT tag
+$ git push origin :v$VERSION
+$ # Now tag and push
+$ REPO=validate
+$ git tag v${VERSION} -m "[RELEASE] $REPO v$VERSION" -m "See [CHANGELOG](https://github.com/NASA-PDS/$REPO/blob/main/CHANGELOG.md) for more details."
+$ git push --tags
+
+```
+
+
+#### Deploy Site to Github Pages
+
+From cloned repo:
+```console
+$ git checkout gh-pages
+$ # Copy the over to version-specific and default sites
+$ rsync --archive --verbose target/staging/ .
+$ git add .
+$ # For operational release
+$ git commit -m "Deploy v$VERSION docs"
+$ # For release candidate
+$ git commit -m "Deploy v${VERSION}-rc${CANDIDATE_NUM} docs"
+$ git push origin gh-pages
+```
+
+
+#### Update Versions For Development
+
+Update `pom.xml` with the next SNAPSHOT version either manually or using Github Versions Plugin.
+
+For RELEASE CANDIDATE, ignore this step.
+```console
+$ git checkout main
+$ # For release candidates, skip to push changes to main
+$ VERSION=1.16.0-SNAPSHOT
+$ mvn -DnewVersion=$VERSION versions:set
+$ git add pom.xml
+$ git commit -m "Update version for $VERSION development"
+$ # Push changes to main
+$ git push --set-upstream origin main
+```
+
+
+#### Complete Release in Github
+
+Currently the process to create more formal release notes and attach Assets is done manually through the Github UI.
+
+*NOTE: Be sure to add the `tar.gz` and `zip` from the `target/` directory to the release assets, and use the CHANGELOG generated above to create the RELEASE NOTES.*
+
+
+## π License
+
+The project is licensed under the [Apache version 2](LICENSE.md) license. Or it isn't. Change this after consulting with your lawyers.
diff --git a/README.txt b/README.txt
deleted file mode 100644
index 557b083..0000000
--- a/README.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-The Search UI is the user interface for the PDS Search Service.
-The software is packaged in a WAR file.
-
-The software can be compiled with the "mvn compile" command but in order
-to create the WAR file, you must execute the "mvn compile war:war" command.
-The documentation including release notes, installation and operation of the
-software should be online at
-http://pds-cm.jpl.nasa.gov/pds4/search/search-ui/. If it is not
-accessible, you can execute the "mvn site:run" command and view the
-documentation locally at http://localhost:8080.
-
-In order to create a complete package for distribution, execute the
-following commands:
-
-% mvn site
-% mvn package
-
-This software package includes several external directories from the PDS
-web site that reside in the /src/main/resources/extras directory. The file
-"svn_externals.txt", which resides a directory level above, details the
-locations in Subversion repository where these directories reside. If these
-locations are changed, perform the following commands from the "extras"
-directory to delete and then set the new locations (after the
-"svn_externals.txt" file has been modified for the new locations):
-
-% svn propdel svn:externals .
-% svn propset svn:externals . -F ../svn_externals.txt
-% svn commit
-
-The updated properties can be viewed with the following command:
-
-% svn propget svn:externals .
diff --git a/pom.xml b/pom.xml
index cd71135..39d2f69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,11 +21,11 @@
gov.nasa
pds
- 1.13.0
+ 1.15.0
gov.nasa.pds.2010.search
- search-ui
+ search-ui-legacy
2.2.0-SNAPSHOT
war
@@ -41,6 +41,10 @@
http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+ 9.3.0
+
diff --git a/src/main/assembly/tar-assembly.xml b/src/main/assembly/tar-assembly.xml
index bdec15b..44f3a81 100644
--- a/src/main/assembly/tar-assembly.xml
+++ b/src/main/assembly/tar-assembly.xml
@@ -1,21 +1,5 @@
-
-
-
-
REQUEST_HANDLERS =
+ new ArrayList(List.of("search", "archive-filter", "select"));
+ private static String REQUEST_HANDLER_PARAM = "qt";
+ private static String SOLR_BASE_URL = "http://localhost:8983/solr";
+ private static String SOLR_COLLECTION = "data";
+ private static String DEFAULT_REQUEST_HANDLER = "archive-filter";
+
+ // private static final List SOLR_QUERY_PARAMS = Arrays.asList("defType", "sort", "start",
+ // )
+
+ /**
+ * Constructor for the search servlet.
+ */
+ public RegistryLegacyServlet() {}
+
+ /**
+ * Initialize the servlet.
+ *
+ * It turns out that we don't need the solrServerUrl property for this implementation, but I left
+ * the code in as an example.
+ *
+ * @param servletConfig The servlet configuration.
+ * @throws ServletException
+ */
+ public void init(ServletConfig servletConfig) throws ServletException {
+
+ // Grab the solrServerUrl parameter from the servlet config.
+ this.solrServerUrl = servletConfig.getInitParameter("solrServerUrl");
+ if (solrServerUrl == null) {
+ this.solrServerUrl = SOLR_BASE_URL;
+ }
+
+ this.solrCollection = servletConfig.getInitParameter("solrCollection");
+ if (this.solrCollection == null) {
+ this.solrCollection = SOLR_COLLECTION;
+ }
+
+ this.solrRequestHandler = servletConfig.getInitParameter("solrRequestHandler");
+ if (this.solrRequestHandler == null) {
+ this.solrRequestHandler = DEFAULT_REQUEST_HANDLER;
+ }
+
+ LOG.info("Solr Server URL: " + this.solrServerUrl);
+
+ super.init(servletConfig);
+ }
+
+ /**
+ * Handle a GET request.
+ *
+ * @param req The servlet request.
+ * @param res The servlet response.
+ * @throws ServletException
+ * @throws IOException
+ */
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ try {
+ // Forward the query to the results page.
+ LOG.info("Query: " + request.getQueryString());
+
+ String queryString = getQueryString(request);
+ String url = String.format("%s/%s/%s?%s", this.solrServerUrl, this.solrCollection,
+ this.solrRequestHandler, queryString);
+
+
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest solrRequest = HttpRequest.newBuilder().uri(URI.create(url)).build();
+
+
+ HttpResponse solrResponse = client.send(solrRequest, BodyHandlers.ofString());
+
+ response.setStatus(solrResponse.statusCode());
+ response.addHeader(HttpHeaders.CONTENT_TYPE, "text/html; charset=UTF-8");
+ response.getOutputStream().write(solrResponse.body().getBytes());
+ } catch (Exception e) {
+ LOG.severe(e.getMessage());
+ response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
+ }
+ }
+
+ /**
+ * Handle a POST request.
+ *
+ * @param req The servlet request.
+ * @param res The servlet response.
+ * @throws ServletException
+ * @throws IOException
+ */
+ public void doPost(HttpServletRequest req, HttpServletResponse res)
+ throws ServletException, IOException {
+ res.sendError(HttpServletResponse.SC_BAD_REQUEST,
+ "POST requests are not supported by this API");
+ }
+
+ private String getQueryString(HttpServletRequest request) throws UnsupportedEncodingException {
+ String queryString = "";
+
+ Enumeration> parameterNames = request.getParameterNames();
+ while (parameterNames.hasMoreElements()) {
+ String paramKey = String.valueOf(parameterNames.nextElement());
+ LOG.info("paramKey: " + paramKey);
+
+ String value = "";
+ if (paramKey.equals(REQUEST_HANDLER_PARAM)) {
+ value = request.getParameter(REQUEST_HANDLER_PARAM);
+ if (REQUEST_HANDLERS.contains(value)) {
+ this.solrRequestHandler = value;
+ }
+ } else if (SOLR_QUERY_PARAMS.contains(paramKey)) {
+ value = URLDecoder.decode(request.getParameter(paramKey), "UTF-8");
+ queryString +=
+ String.format("%s=%s&", paramKey, URLEncoder.encode(value, "UTF-8"));
+ LOG.info("QueryString: " + queryString);
+ }
+ }
+ return queryString;
+ }
+}
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index e006884..b69667d 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -1,105 +1,31 @@
-
+
-
- pdshome.url
- /
-
-
-
-
-
+
+ search
+ gov.nasa.pds.search.servlet.RegistryLegacyServlet
+
+
+
+
+
- .war
- xxx
- admin
- stats.jsp
- -->
-
-
-
-
-
-
-
-
-
-
-
-
- .xsl
-
- application/xslt+xml
-
+
+
+ search
+ /search
+
+
+ .xsl
+
+ application/xslt+xml
+