Skip to content

Commit

Permalink
Merge pull request #1417 from NCEAS/dev-2.12
Browse files Browse the repository at this point in the history
Dev 2.12
  • Loading branch information
taojing2002 authored Jan 9, 2020
2 parents 252a841 + d5a3525 commit 5126298
Show file tree
Hide file tree
Showing 23 changed files with 564 additions and 122 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Metacat: Data Preservation and Discovery System

Version: 2.12.2 Release
Version: 2.12.3 Release

Send feedback and bugs to: [email protected]
http://github.com/NCEAS/metacat
Expand Down Expand Up @@ -67,6 +67,11 @@ for the next release.

## Release Notes

### Release Notes for 2.12.3
New features and bugs fixed in this release:
* Return an invalid response to the call of cn.getLogRecords if some log records have a null ip address
* Add the indication of completing the database upgrade process during configuration

### Release Notes for 2.12.2
Bugs fixed in this release:
* Modify the schema files of the format ids of portal and collections
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#Version of this build. This needs to be a dotted numeric version. For
#instance 1.9.1 is okay. 1.9.1_rc1 is not.
metacat.version=2.12.2
metacat.version=2.12.3

#This is for packaging purposes. leave it blank for final production release.
metacat.releaseCandidate=
Expand Down
65 changes: 54 additions & 11 deletions docs/user/metacat/source/dataone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,60 @@ These Apache directives are crucial for Metacat to function as a Tier 2+ Member
::

...
AllowEncodedSlashes On
AcceptPathInfo On
JkOptions +ForwardURICompatUnparsed
SSLEngine on
SSLOptions +StrictRequire +StdEnvVars +ExportCertData
SSLVerifyClient optional
SSLVerifyDepth 10
SSLCertificateFile /etc/ssl/certs/<your_server_certificate>
SSLCertificateKeyFile /etc/ssl/private/<your_server_key>
SSLCertificateChainFile /etc/ssl/certs/<CA_chain_file>.crt
SSLCACertificatePath /etc/ssl/certs/
<VirtualHost XXX.XXX.XXX.XXX:443>
DocumentRoot /var/www
ServerName dev.nceas.ucsb.edu
## Allow CORS requests from all origins to use cookies
SetEnvIf Origin "^(.*)$" ORIGIN_DOMAIN=$1
Header set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
Header set Access-Control-Allow-Headers "Authorization, Content-Type, Origin, Cache-Control"
Header set Access-Control-Allow-Methods "GET, POST, PUT, OPTIONS"
Header set Access-Control-Allow-Credentials "true"
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/httpd/access_log common
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory /var/www/cgi-bin/>
AllowOverride None
Options ExecCGI
Require all granted
</Directory>
ScriptAlias /metacat/cgi-bin/ "/var/www/webapps/metacat/cgi-bin/"
<Directory "/var/www/webapps/metacat/cgi-bin/">
AllowOverride None
Options ExecCGI
Require all granted
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
</IfModule>
JkMount /metacat ajp13
JkMount /metacat/* ajp13
JkMount /metacat/metacat ajp13
JkUnMount /metacat/cgi-bin/* ajp13
JkMount /metacatui ajp13
JkMount /metacatui/* ajp13
JkMount /*.jsp ajp13
AllowEncodedSlashes On
AcceptPathInfo On
JkOptions +ForwardURICompatUnparsed
SSLEngine on
SSLOptions +StrictRequire +StdEnvVars +ExportCertData
SSLVerifyClient optional
SSLVerifyDepth 10
SSLCertificateFile /etc/ssl/certs/<your_server_certificate>
SSLCertificateKeyFile /etc/ssl/private/<your_server_key>
SSLCertificateChainFile /etc/ssl/certs/<CA_chain_file>.crt
SSLCACertificatePath /etc/ssl/certs/
<Location "/metacat/d1/mn">
#SSLRenegBufferSize 10000000
#SSLOptions +OptRenegotiate
<If " ! ( %{HTTP_USER_AGENT} =~ /(windows|chrome|mozilla|safari|webkit|httr|julia|python)/i )">
SSLVerifyClient optional
</If>
</Location>
</VirtualHost>
...
Where ``<your_server_certificate>`` and ``<your_server_key>`` are the certificate/key pair used by Apache
Expand Down
10 changes: 4 additions & 6 deletions docs/user/metacat/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ install and run the Metacat Registry or to use the Metacat Replication feature.
DocumentRoot /var/www
ServerName dev.nceas.ucsb.edu
## Allow CORS requests from all origins to use cookies
#SetEnvIf Origin "^(.*)$" ORIGIN_DOMAIN=$1
#Header set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
SetEnvIf Origin "^(.*)$" ORIGIN_DOMAIN=$1
Header set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
Header set Access-Control-Allow-Headers "Authorization, Content-Type, Origin, Cache-Control"
Header set Access-Control-Allow-Methods "GET, POST, PUT, OPTIONS"
Header set Access-Control-Allow-Credentials "true"
Expand All @@ -263,15 +263,13 @@ install and run the Metacat Registry or to use the Metacat Replication feature.
<Directory /var/www/cgi-bin/>
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
ScriptAlias /metacat/cgi-bin/ "/var/www/webapps/metacat/cgi-bin/"
<Directory "/var/www/webapps/metacat/cgi-bin/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
Require all granted
</Directory>
JkMount /metacat ajp13
JkMount /metacat/* ajp13
Expand Down
9 changes: 8 additions & 1 deletion lib/metacat.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ configutil.geoserverConfigured=false
configutil.dataoneConfigured=false
configutil.ezidConfigured=bypassed

#The property of configutil.upgrade.status depends on other status (database, java et al).
#If all of them are success, the property of configutil.upgrade will be successs; otherwise failure.
configutil.upgrade.status=
configutil.upgrade.database.status=
configutil.upgrade.java.status=

############### Server Values #################

server.name=localhost
Expand All @@ -25,7 +31,7 @@ server.internalPort=80
############### Application Values ############

## one of the few places where we use ANT tokens
application.metacatVersion=2.12.2
application.metacatVersion=2.12.3
application.metacatReleaseInfo=-1
application.readOnlyMode=false

Expand Down Expand Up @@ -119,6 +125,7 @@ database.upgradeVersion.2.11.1=upgrade-db-to-2.11.1
database.upgradeVersion.2.12.0=upgrade-db-to-2.12.0
database.upgradeVersion.2.12.1=upgrade-db-to-2.12.1
database.upgradeVersion.2.12.2=upgrade-db-to-2.12.2
database.upgradeVersion.2.12.3=upgrade-db-to-2.12.3

## for running java-based utilities
database.upgradeUtility.1.5.0=edu.ucsb.nceas.metacat.admin.upgrade.Upgrade1_5_0
Expand Down
2 changes: 1 addition & 1 deletion metacat-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>edu.ucsb.nceas.metacat.common</groupId>
<artifactId>metacat-common</artifactId>
<packaging>jar</packaging>
<version>2.12.2</version>
<version>2.12.3</version>
<name>metacat-common</name>
<url>http://maven.apache.org</url>
<properties>
Expand Down
4 changes: 2 additions & 2 deletions metacat-index/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<groupId>edu.ucsb.nceas.metacat.index</groupId>
<artifactId>metacat-index</artifactId>
<packaging>war</packaging>
<version>2.12.2</version>
<version>2.12.3</version>
<name>metacat-index</name>
<url>http://maven.apache.org</url>

<properties>
<d1_cn_index_processor_version>2.3.8</d1_cn_index_processor_version>
<metacat_common_version>2.12.2</metacat_common_version>
<metacat_common_version>2.12.3</metacat_common_version>
</properties>

<repositories>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.ecoinformatics</groupId>
<artifactId>metacat</artifactId>
<version>2.12.2</version>
<version>2.12.3</version>
<name>metacat</name>
<packaging>war</packaging>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<d1_libclient_version>2.3.1</d1_libclient_version>
<d1_portal_version>2.3.1</d1_portal_version>
<metacat_common_version>2.12.2</metacat_common_version>
<metacat_common_version>2.12.3</metacat_common_version>
</properties>
<repositories>
<repository>
Expand Down
25 changes: 21 additions & 4 deletions src/edu/ucsb/nceas/metacat/EventLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -642,21 +642,38 @@ public Log getD1Report(String[] ipAddress, String[] principal, String[] docid,
//process the result and return it
while (rs.next()) {
LogEntry logEntry = new LogEntry();
logEntry.setEntryId(rs.getString(1));
String logId = rs.getString(1);
if (logId == null || logId.trim().equals("")) {
logId = "N/A";
}
logEntry.setEntryId(logId);

Identifier identifier = new Identifier();
identifier.setValue(rs.getString(2));
String id = rs.getString(2);
if (id == null || id.trim().equals("")) {
id = "N/A";
}
identifier.setValue(id);
logEntry.setIdentifier(identifier);

logEntry.setIpAddress(anonymous ? "N/A" : rs.getString(3));
String ip = rs.getString(3);
if (ip == null || ip.trim().equals("")) {
ip = "N/A";
}
logEntry.setIpAddress(anonymous ? "N/A" : ip);

String userAgent = "N/A";
if (rs.getString(4) != null) {
userAgent = rs.getString(4);
}
logEntry.setUserAgent(userAgent);

Subject subject = new Subject();
subject.setValue(anonymous ? "N/A" : rs.getString(5));
String subjectStr = rs.getString(5);
if (subjectStr == null || subjectStr.trim().equals("")) {
subjectStr = "N/A";
}
subject.setValue(anonymous ? "N/A" : subjectStr);
logEntry.setSubject(subject);

String logEventString = rs.getString(6);
Expand Down
17 changes: 14 additions & 3 deletions src/edu/ucsb/nceas/metacat/MetaCatServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,20 @@ private void handleGetOrPost(HttpServletRequest request,
out.close();
} else if (action.equals("getversion")) {
response.setContentType("text/xml");
PrintWriter out = response.getWriter();
out.println(MetacatVersion.getVersionAsXml());
out.close();
String version = null;
try {
version = MetacatVersion.getVersionAsXml();
PrintWriter out = response.getWriter();
out.println(version);
out.close();
} catch (SQLException e) {
PrintWriter out = response.getWriter();
out.println("<?xml version=\"1.0\"?>");
out.println("<erorr>");
out.println(StringEscapeUtils.escapeXml(e.getMessage()));
out.println("</erorr>");
out.close();
}
} else if (action.equals("getlog")) {
handler.handleGetLogAction(params, request, response, userName, groupNames, sessionId);
} else if (action.equals("getloggedinuserinfo")) {
Expand Down
53 changes: 51 additions & 2 deletions src/edu/ucsb/nceas/metacat/MetacatVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
*/
package edu.ucsb.nceas.metacat;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Date;

import edu.ucsb.nceas.metacat.database.DBConnection;
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
import edu.ucsb.nceas.metacat.properties.PropertyService;
import edu.ucsb.nceas.utilities.PropertyNotFoundException;

Expand Down Expand Up @@ -52,12 +60,53 @@ public static String getVersionID() throws PropertyNotFoundException {
*
* @return the version wrapped in an XML document
*/
public static String getVersionAsXml() throws PropertyNotFoundException {
public static String getVersionAsXml() throws SQLException {
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\"?>");
sb.append("<version>");
sb.append(getVersionID());
sb.append(getVersionFromDB());
sb.append("</version>");
return sb.toString();
}


/**
* Get the version number from DB
* @return a string of the Metacat version from DB
* @throws SQLException
*/
public static String getVersionFromDB() throws SQLException {
DBConnection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String version = null;
int serialNumber = -1;
try {
// check out DBConnection
conn = DBConnectionPool.getDBConnection("MetacatVersion.getVersionFromDB()");
serialNumber = conn.getCheckOutSerialNumber();
pstmt = conn.prepareStatement("SELECT version FROM db_version WHERE status = ?");
pstmt.setInt(1, 1);
rs = pstmt.executeQuery();
if(rs.next()) {
version = rs.getString(1);
}
pstmt.close();
rs.close();
} catch (SQLException e) {
throw new SQLException("MetacatVersion.getVersionFromDB - sql error: " + e.getMessage());
}finally {
try {
if (pstmt != null) {
pstmt.close();
}
if (rs != null) {
rs.close();
}
} finally {
DBConnectionPool.returnDBConnection(conn, serialNumber);
}
}
return version;
}
}
Loading

0 comments on commit 5126298

Please sign in to comment.