diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/IDmsService.java b/src/main/java/org/opengroup/osdu/core/common/dms/IDmsService.java new file mode 100644 index 0000000000000000000000000000000000000000..c116cbe017d7d2b3539eaeb29fc0192ec488d26e --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/IDmsService.java @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms; + +import org.opengroup.osdu.core.common.dms.model.*; +import org.opengroup.osdu.core.common.model.storage.Record; + +import java.util.List; + +/** + * Interface for different DMS functionalities. + * Each DMS or CSP could have different implementations but should adhere to this interface. + */ +public interface IDmsService { + /** + * Method is used to generate storage instructions for datasets. + * The storage instructions response include the Signed URL / Temporary credentials along with other CSP specific metadata required to identify a Dataset. + * @return StorageInstructionsResponse + */ + StorageInstructionsResponse getStorageInstructions(); + + /** + * Method is used to generate retrieval instructions for datasets. + * The storage instructions response include the Signed URL / Temporary credentials along with other CSP specific metadata required to identify a Dataset. + * @param retrievalInstructionsRequest Request containing dataset ids which should be downloaded + * @return RetrievalInstructionsResponse + */ + RetrievalInstructionsResponse getRetrievalInstructions(RetrievalInstructionsRequest retrievalInstructionsRequest); + + /** + * Method is used to Copy Datasets from staging locations to persistent locations + * @param datasetSources Request containing list of Dataset Metadata Records from which DMS implementations + * will parse Dataset path in Cloud Blob Stores and copies content to persistent locations. + * @return Copy operation responses that contain if operation is successful and the location to which the dataset is copied to. + */ + List copyDatasetsToPersistentLocation(List datasetSources); +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/constants/DatasetConstants.java b/src/main/java/org/opengroup/osdu/core/common/dms/constants/DatasetConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..6ffdf2767d9ef97497f06101a2be1267c0ea01da --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/constants/DatasetConstants.java @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.constants; + +public final class DatasetConstants { + private DatasetConstants() { + // Avoid initialization + } + + // Roles required to perform read and write operations on Datasets. + public static final String DATASET_VIEWER_ROLE = "service.dataset.viewers"; + public static final String DATASET_EDITOR_ROLE = "service.dataset.editors"; +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsRequest.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsRequest.java new file mode 100644 index 0000000000000000000000000000000000000000..166150c8591ccb72d06a1cc901421630646a6620 --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsRequest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import org.opengroup.osdu.core.common.model.storage.Record; + +import java.util.ArrayList; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +public class CopyDmsRequest { + List datasetSources; + + public CopyDmsRequest() { + this.datasetSources = new ArrayList<>(); + } +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsResponse.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..2b0d218bc65145bf90cbefbdf817f2977b286e53 --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/CopyDmsResponse.java @@ -0,0 +1,32 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.opengroup.osdu.core.common.model.storage.Record; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CopyDmsResponse { + private boolean success; + private String datasetBlobStoragePath; +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/DatasetRetrievalProperties.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/DatasetRetrievalProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..dd55c26e94fab21b993ea48c7f7993390b7354ca --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/DatasetRetrievalProperties.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DatasetRetrievalProperties { + private String datasetRegistryId; + private Map retrievalProperties; +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsRequest.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsRequest.java new file mode 100644 index 0000000000000000000000000000000000000000..5f92eeb8e91165fc2f3bcb4c4d480f906c6882ac --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsRequest.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@AllArgsConstructor +public class RetrievalInstructionsRequest { + public List datasetRegistryIds; + + public RetrievalInstructionsRequest() { + this.datasetRegistryIds = new ArrayList<>(); + } +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsResponse.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..e5679005a1c7f7f0608763177e7fdee59fa06fb1 --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/RetrievalInstructionsResponse.java @@ -0,0 +1,36 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +public class RetrievalInstructionsResponse { + private String providerKey; + private List datasets; + + public RetrievalInstructionsResponse() { + this.datasets = new ArrayList<>(); + } +} diff --git a/src/main/java/org/opengroup/osdu/core/common/dms/model/StorageInstructionsResponse.java b/src/main/java/org/opengroup/osdu/core/common/dms/model/StorageInstructionsResponse.java new file mode 100644 index 0000000000000000000000000000000000000000..44590be8a8488ab71fc691686c4505bda733d368 --- /dev/null +++ b/src/main/java/org/opengroup/osdu/core/common/dms/model/StorageInstructionsResponse.java @@ -0,0 +1,33 @@ +/* + * Copyright 2021 Microsoft Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opengroup.osdu.core.common.dms.model; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StorageInstructionsResponse { + private String providerKey; + private Map storageLocation; +}