Skip to content

Commit

Permalink
add deprecation notices to Java code for rsync #8985
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 7, 2024
1 parent ace254b commit 44b43f8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 9 deletions.
8 changes: 8 additions & 0 deletions doc/release-notes/8985-deprecate-rsync.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
Support for rsync has been deprecated. Information has been removed from the guides for rsync and related software such as Data Capture Module (DCM) and Repository Storage Abstraction Layer (RSAL). You can still find this information in [older versions](https://guides.dataverse.org/en/6.2/developers/big-data-support.html#data-capture-module-dcm) of the guides.

The following related database settings have been deprecated as well:

- :DataCaptureModuleUrl
- :DownloadMethods
- :LocalDataAccessPath
- :PublicInstall
- :RepositoryStorageAbstractionLayerUrl
1 change: 1 addition & 0 deletions src/main/java/edu/harvard/iq/dataverse/FilePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,7 @@ public String getIngestMessage() {
}

//Determines whether this File uses a public store and therefore doesn't support embargoed or restricted files
@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isHasPublicStore() {
return settingsWrapper.isTrueForKey(SettingsServiceBean.Key.PublicInstall, StorageIO.isPublicStore(DataAccess.getStorageDriverFromIdentifier(file.getStorageIdentifier())));
}
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,23 @@ public Long getZipDownloadLimit(){
return zipDownloadLimit;
}

@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isPublicInstall(){
if (publicInstall == null) {
publicInstall = systemConfig.isPublicInstall();
}
return publicInstall;
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncUpload() {
if (rsyncUpload == null) {
rsyncUpload = getUploadMethodAvailable(SystemConfig.FileUploadMethods.RSYNC.toString());
}
return rsyncUpload;
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncDownload() {
if (rsyncDownload == null) {
rsyncDownload = systemConfig.isRsyncDownload();
Expand Down Expand Up @@ -379,7 +382,8 @@ public boolean isWebloaderUpload() {
}
return webloaderUpload;
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncOnly() {
if (rsyncOnly == null) {
String downloadMethods = getValueForKey(SettingsServiceBean.Key.DownloadMethods);
Expand All @@ -398,7 +402,7 @@ public boolean isRsyncOnly() {
}
return rsyncOnly;
}

public boolean isHTTPUpload(){
if (httpUpload == null) {
httpUpload = getUploadMethodAvailable(SystemConfig.FileUploadMethods.NATIVE.toString());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -2297,6 +2297,7 @@ public Response removeDatasetLogo(@Context ContainerRequestContext crc, @PathPar
}
}

@Deprecated(forRemoval = true, since = "2024-07-07")
@GET
@AuthRequired
@Path("{identifier}/dataCaptureModule/rsync")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package edu.harvard.iq.dataverse.datacapturemodule;

@Deprecated(forRemoval = true, since = "2024-07-07")
public class DataCaptureModuleException extends Exception {

@Deprecated(forRemoval = true, since = "2024-07-07")
public DataCaptureModuleException(String message, Throwable cause) {
super(message, cause);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
import jakarta.json.JsonObject;
import jakarta.json.JsonObjectBuilder;

@Deprecated(forRemoval = true, since = "2024-07-07")
public class DataCaptureModuleUtil {

private static final Logger logger = Logger.getLogger(DataCaptureModuleUtil.class.getCanonicalName());

@Deprecated(forRemoval = true, since = "2024-07-07")
public static boolean rsyncSupportEnabled(String uploadMethodsSettings) {
logger.fine("uploadMethodsSettings: " + uploadMethodsSettings);;
if (uploadMethodsSettings==null){
Expand All @@ -28,6 +30,7 @@ public static boolean rsyncSupportEnabled(String uploadMethodsSettings) {
/**
* generate JSON to send to DCM
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
public static JsonObject generateJsonForUploadRequest(AuthenticatedUser user, Dataset dataset) {
JsonObjectBuilder jab = Json.createObjectBuilder();
// The general rule should be to always pass the user id and dataset identifier to the DCM.
Expand All @@ -39,6 +42,7 @@ public static JsonObject generateJsonForUploadRequest(AuthenticatedUser user, Da
/**
* transfer script from DCM
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
public static ScriptRequestResponse getScriptFromRequest(HttpResponse<JsonNode> uploadRequest) {
int status = uploadRequest.getStatus();
JsonNode body = uploadRequest.getBody();
Expand All @@ -54,13 +58,15 @@ public static ScriptRequestResponse getScriptFromRequest(HttpResponse<JsonNode>
return scriptRequestResponse;
}

@Deprecated(forRemoval = true, since = "2024-07-07")
static UploadRequestResponse makeUploadRequest(HttpResponse<String> uploadRequest) {
int status = uploadRequest.getStatus();
String body = uploadRequest.getBody();
logger.fine("Got " + status + " with body: " + body);
return new UploadRequestResponse(uploadRequest.getStatus(), body);
}

@Deprecated(forRemoval = true, since = "2024-07-07")
public static String getMessageFromException(DataCaptureModuleException ex) {
if (ex == null) {
return "DataCaptureModuleException was null!";
Expand All @@ -76,6 +82,7 @@ public static String getMessageFromException(DataCaptureModuleException ex) {
return message + " was caused by " + cause.getMessage();
}

@Deprecated(forRemoval = true, since = "2024-07-07")
public static String getScriptName(DatasetVersion datasetVersion) {
return "upload-" + datasetVersion.getDataset().getIdentifier().replace("/", "_") + ".bash";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* "actiontype" in the actionlogrecord rather than "InternalError" if you throw
* a CommandExecutionException.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
@RequiredPermissions(Permission.EditDataset)
public class RequestRsyncScriptCommand extends AbstractCommand<ScriptRequestResponse> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jakarta.inject.Named;
import jakarta.json.JsonArray;

@Deprecated(forRemoval = true, since = "2024-07-07")
@Stateless
@Named
public class RepositoryStorageAbstractionLayerPage {
Expand All @@ -22,17 +23,20 @@ public class RepositoryStorageAbstractionLayerPage {
@EJB
StorageSiteServiceBean storageSiteServiceBean;

@Deprecated(forRemoval = true, since = "2024-07-07")
public String getLocalDataAccessDirectory(DatasetVersion datasetVersion) {
String localDataAccessParentDir = settingsService.getValueForKey(SettingsServiceBean.Key.LocalDataAccessPath);
return RepositoryStorageAbstractionLayerUtil.getLocalDataAccessDirectory(localDataAccessParentDir, datasetVersion.getDataset());
}

@Deprecated(forRemoval = true, since = "2024-07-07")
public List<RsyncSite> getRsyncSites(DatasetVersion datasetVersion) {
List<StorageSite> storageSites = storageSiteServiceBean.findAll();
JsonArray storageSitesAsJson = RepositoryStorageAbstractionLayerUtil.getStorageSitesAsJson(storageSites);
return RepositoryStorageAbstractionLayerUtil.getRsyncSites(datasetVersion.getDataset(), storageSitesAsJson);
}

@Deprecated(forRemoval = true, since = "2024-07-07")
public String getVerifyDataCommand(DatasetVersion datasetVersion) {
return RepositoryStorageAbstractionLayerUtil.getVerifyDataCommand(datasetVersion.getDataset());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
import jakarta.json.JsonArrayBuilder;
import jakarta.json.JsonObject;

@Deprecated(forRemoval = true, since = "2024-07-07")
public class RepositoryStorageAbstractionLayerUtil {

private static final Logger logger = Logger.getLogger(RepositoryStorageAbstractionLayerUtil.class.getCanonicalName());

@Deprecated(forRemoval = true, since = "2024-07-07")
public static List<RsyncSite> getRsyncSites(Dataset dataset, JsonArray rsalSitesAsJson) {
List<RsyncSite> rsalSites = new ArrayList<>();
boolean leafDirectoryOnly = false;
Expand All @@ -30,6 +32,7 @@ public static List<RsyncSite> getRsyncSites(Dataset dataset, JsonArray rsalSites
return rsalSites;
}

@Deprecated(forRemoval = true, since = "2024-07-07")
static String getLocalDataAccessDirectory(String localDataAccessParentDir, Dataset dataset) {
if (localDataAccessParentDir == null) {
localDataAccessParentDir = File.separator + "UNCONFIGURED ( " + SettingsServiceBean.Key.LocalDataAccessPath + " )";
Expand All @@ -38,6 +41,7 @@ static String getLocalDataAccessDirectory(String localDataAccessParentDir, Datas
return localDataAccessParentDir + File.separator + getDirectoryContainingTheData(dataset, leafDirectoryOnly);
}

@Deprecated(forRemoval = true, since = "2024-07-07")
static String getVerifyDataCommand(Dataset dataset) {
boolean leafDirectoryOnly = true;
// TODO: if "files.sha" is defined somewhere, use it.
Expand All @@ -51,6 +55,7 @@ static String getVerifyDataCommand(Dataset dataset) {
* leafDirectoryOnly. See also
* http://www.gnu.org/software/coreutils/manual/html_node/basename-invocation.html
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
public static String getDirectoryContainingTheData(Dataset dataset, boolean leafDirectoryOnly) {
/**
* FIXME: What if there is more than one package in the dataset?
Expand Down Expand Up @@ -81,6 +86,7 @@ public static String getDirectoryContainingTheData(Dataset dataset, boolean leaf
* RSAL or some other "big data" component live for a list of remotes sites
* to which a particular dataset is replicated to.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
static JsonArray getStorageSitesAsJson(List<StorageSite> storageSites) {
JsonArrayBuilder arraybuilder = Json.createArrayBuilder();
if (storageSites == null || storageSites.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ public enum Key {
CustomDatasetSummaryFields,
/**
* Defines a public installation -- all datafiles are unrestricted
*
* This was added for rsync, which is now deprecated.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
PublicInstall,
/**
* Sets the name of your cloud computing environment.
Expand All @@ -75,9 +78,12 @@ public enum Key {
/**
* For example, https://datacapture.example.org
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
DataCaptureModuleUrl,
@Deprecated(forRemoval = true, since = "2024-07-07")
RepositoryStorageAbstractionLayerUrl,
UploadMethods,
@Deprecated(forRemoval = true, since = "2024-07-07")
DownloadMethods,
/**
* If the data replicated around the world using RSAL (Repository
Expand All @@ -87,6 +93,7 @@ public enum Key {
* TODO: Think about if it makes sense to make this a column in the
* StorageSite database table.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
LocalDataAccessPath,
/**
* The algorithm used to generate PIDs, randomString (default) or
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/edu/harvard/iq/dataverse/util/SystemConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ public enum FileUploadMethods {
* DCM stands for Data Capture Module. Right now it supports upload over
* rsync+ssh but DCM may support additional methods in the future.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
RSYNC("dcm/rsync+ssh"),
/**
* Traditional Dataverse file handling, which tends to involve users
Expand Down Expand Up @@ -809,6 +810,7 @@ public enum FileDownloadMethods {
* RSAL stands for Repository Storage Abstraction Layer. Downloads don't
* go through Glassfish.
*/
@Deprecated(forRemoval = true, since = "2024-07-07")
RSYNC("rsal/rsync"),
NATIVE("native/http"),
GLOBUS("globus")
Expand Down Expand Up @@ -862,6 +864,7 @@ public String toString() {
*/
public enum TransferProtocols {

@Deprecated(forRemoval = true, since = "2024-07-07")
RSYNC("rsync"),
/**
* POSIX includes NFS. This is related to Key.LocalDataAccessPath in
Expand Down Expand Up @@ -893,12 +896,14 @@ public String toString() {
}

}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isPublicInstall(){
boolean saneDefault = false;
return settingsService.isTrueForKey(SettingsServiceBean.Key.PublicInstall, saneDefault);
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncUpload(){
return getMethodAvailable(SystemConfig.FileUploadMethods.RSYNC.toString(), true);
}
Expand All @@ -915,7 +920,8 @@ public boolean isWebloaderUpload(){
public boolean isHTTPUpload(){
return getMethodAvailable(SystemConfig.FileUploadMethods.NATIVE.toString(), true);
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncOnly(){
String downloadMethods = settingsService.getValueForKey(SettingsServiceBean.Key.DownloadMethods);
if(downloadMethods == null){
Expand All @@ -931,11 +937,12 @@ public boolean isRsyncOnly(){
return Arrays.asList(uploadMethods.toLowerCase().split("\\s*,\\s*")).size() == 1 && uploadMethods.toLowerCase().equals(SystemConfig.FileUploadMethods.RSYNC.toString());
}
}


@Deprecated(forRemoval = true, since = "2024-07-07")
public boolean isRsyncDownload() {
return getMethodAvailable(SystemConfig.FileUploadMethods.RSYNC.toString(), false);
}

public boolean isHTTPDownload() {
return getMethodAvailable(SystemConfig.FileUploadMethods.NATIVE.toString(), false);
}
Expand Down

0 comments on commit 44b43f8

Please sign in to comment.