This is an automated email from the ASF dual-hosted git repository. yasith pushed a commit to branch feat/grpc-armeria-migration in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 5790a9cf464653d60f8cc9da7786d56afe0ca299 Author: yasithdev <[email protected]> AuthorDate: Wed Apr 1 12:57:22 2026 -0400 feat: add SPI interfaces for compute, storage, credential module extraction --- .../compute/spi/ComputeResourceProvider.java | 123 +++++++++++++++++++++ .../credential/spi/CredentialProvider.java | 53 +++++++++ .../airavata/storage/spi/StorageProvider.java | 108 ++++++++++++++++++ 3 files changed, 284 insertions(+) diff --git a/airavata-api/src/main/java/org/apache/airavata/compute/spi/ComputeResourceProvider.java b/airavata-api/src/main/java/org/apache/airavata/compute/spi/ComputeResourceProvider.java new file mode 100644 index 0000000000..e093657dab --- /dev/null +++ b/airavata-api/src/main/java/org/apache/airavata/compute/spi/ComputeResourceProvider.java @@ -0,0 +1,123 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * http://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.apache.airavata.compute.spi; + +import java.util.Map; +import org.apache.airavata.model.appcatalog.computeresource.proto.CloudJobSubmission; +import org.apache.airavata.model.appcatalog.computeresource.proto.ComputeResourceDescription; +import org.apache.airavata.model.appcatalog.computeresource.proto.LOCALSubmission; +import org.apache.airavata.model.appcatalog.computeresource.proto.ResourceJobManager; +import org.apache.airavata.model.appcatalog.computeresource.proto.SSHJobSubmission; +import org.apache.airavata.model.appcatalog.computeresource.proto.UnicoreJobSubmission; +import org.apache.airavata.model.appcatalog.gatewayprofile.proto.GatewayResourceProfile; +import org.apache.airavata.model.appcatalog.groupresourceprofile.proto.GroupComputeResourcePreference; + +/** + * SPI contract for compute resource operations required by the execution engine. + * + * <p>This interface decouples the execution module from the compute module's repository + * and service implementations. Implementations are expected to be provided by the compute + * module and injected into execution components. + */ +public interface ComputeResourceProvider { + + /** + * Retrieve a compute resource description by its identifier. + * + * @param computeResourceId the unique identifier of the compute resource + * @return the compute resource description + * @throws Exception if the resource cannot be found or a data access error occurs + */ + ComputeResourceDescription getComputeResource(String computeResourceId) throws Exception; + + /** + * Retrieve all registered compute resource names. + * + * @return a map of compute resource id to hostname + * @throws Exception if a data access error occurs + */ + Map<String, String> getAllComputeResourceNames() throws Exception; + + /** + * Retrieve a LOCAL job submission configuration. + * + * @param jobSubmissionId the job submission interface identifier + * @return the local submission description + * @throws Exception if not found or a data access error occurs + */ + LOCALSubmission getLocalJobSubmission(String jobSubmissionId) throws Exception; + + /** + * Retrieve an SSH job submission configuration. + * + * @param jobSubmissionId the job submission interface identifier + * @return the SSH submission description + * @throws Exception if not found or a data access error occurs + */ + SSHJobSubmission getSSHJobSubmission(String jobSubmissionId) throws Exception; + + /** + * Retrieve a UNICORE job submission configuration. + * + * @param jobSubmissionId the job submission interface identifier + * @return the UNICORE submission description + * @throws Exception if not found or a data access error occurs + */ + UnicoreJobSubmission getUnicoreJobSubmission(String jobSubmissionId) throws Exception; + + /** + * Retrieve a cloud job submission configuration. + * + * @param jobSubmissionId the job submission interface identifier + * @return the cloud submission description + * @throws Exception if not found or a data access error occurs + */ + CloudJobSubmission getCloudJobSubmission(String jobSubmissionId) throws Exception; + + /** + * Retrieve a resource job manager by its identifier. + * + * @param resourceJobManagerId the resource job manager identifier + * @return the resource job manager + * @throws Exception if not found or a data access error occurs + */ + ResourceJobManager getResourceJobManager(String resourceJobManagerId) throws Exception; + + /** + * Retrieve the gateway resource profile for a given gateway. + * + * @param gatewayId the gateway identifier + * @return the gateway resource profile + * @throws Exception if not found or a data access error occurs + */ + GatewayResourceProfile getGatewayResourceProfile(String gatewayId) throws Exception; + + /** + * Retrieve the group compute resource preference for a specific compute resource + * within a group resource profile. + * + * @param computeResourceId the compute resource identifier + * @param groupResourceProfileId the group resource profile identifier + * @return the group compute resource preference + * @throws Exception if not found or a data access error occurs + */ + GroupComputeResourcePreference getGroupComputeResourcePreference( + String computeResourceId, String groupResourceProfileId) throws Exception; +} diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/spi/CredentialProvider.java b/airavata-api/src/main/java/org/apache/airavata/credential/spi/CredentialProvider.java new file mode 100644 index 0000000000..ae5aa3efec --- /dev/null +++ b/airavata-api/src/main/java/org/apache/airavata/credential/spi/CredentialProvider.java @@ -0,0 +1,53 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * http://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.apache.airavata.credential.spi; + +import org.apache.airavata.model.credential.store.proto.PasswordCredential; +import org.apache.airavata.model.credential.store.proto.SSHCredential; + +/** + * SPI contract for credential operations required by the execution engine. + * + * <p>This interface decouples the execution module from the credential store's handler + * and repository implementations. Implementations are expected to be provided by the + * credential module and injected into execution components. + */ +public interface CredentialProvider { + + /** + * Retrieve an SSH credential by its token and gateway. + * + * @param tokenId the credential token identifier + * @param gatewayId the gateway identifier + * @return the SSH credential, or {@code null} if not found + * @throws Exception if a credential store error occurs + */ + SSHCredential getSSHCredential(String tokenId, String gatewayId) throws Exception; + + /** + * Retrieve a password credential by its token and gateway. + * + * @param tokenId the credential token identifier + * @param gatewayId the gateway identifier + * @return the password credential, or {@code null} if not found + * @throws Exception if a credential store error occurs + */ + PasswordCredential getPasswordCredential(String tokenId, String gatewayId) throws Exception; +} diff --git a/airavata-api/src/main/java/org/apache/airavata/storage/spi/StorageProvider.java b/airavata-api/src/main/java/org/apache/airavata/storage/spi/StorageProvider.java new file mode 100644 index 0000000000..d3023035b3 --- /dev/null +++ b/airavata-api/src/main/java/org/apache/airavata/storage/spi/StorageProvider.java @@ -0,0 +1,108 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * http://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.apache.airavata.storage.spi; + +import java.util.List; +import java.util.Map; +import org.apache.airavata.model.appcatalog.gatewayprofile.proto.StoragePreference; +import org.apache.airavata.model.appcatalog.storageresource.proto.StorageResourceDescription; +import org.apache.airavata.model.data.replica.proto.DataProductModel; + +/** + * SPI contract for storage operations required by the execution engine. + * + * <p>This interface decouples the execution module from the storage module's repository + * implementations. Implementations are expected to be provided by the storage module + * and injected into execution components. + */ +public interface StorageProvider { + + /** + * Retrieve a storage resource description by its identifier. + * + * @param storageResourceId the unique identifier of the storage resource + * @return the storage resource description + * @throws Exception if the resource cannot be found or a data access error occurs + */ + StorageResourceDescription getStorageResource(String storageResourceId) throws Exception; + + /** + * Retrieve all registered storage resource names. + * + * @return a map of storage resource id to name + * @throws Exception if a data access error occurs + */ + Map<String, String> getAllStorageResourceNames() throws Exception; + + /** + * Register a new data product in the replica catalog. + * + * @param dataProductModel the data product to register + * @return the product URI of the registered data product + * @throws Exception if a data access error occurs + */ + String registerDataProduct(DataProductModel dataProductModel) throws Exception; + + /** + * Retrieve a data product by its product URI. + * + * @param productUri the product URI + * @return the data product model + * @throws Exception if not found or a data access error occurs + */ + DataProductModel getDataProduct(String productUri) throws Exception; + + /** + * Retrieve the parent data product for a given child product URI. + * + * @param productUri the child product URI + * @return the parent data product model + * @throws Exception if not found or a data access error occurs + */ + DataProductModel getParentDataProduct(String productUri) throws Exception; + + /** + * Retrieve all child data products for a given parent product URI. + * + * @param productUri the parent product URI + * @return list of child data product models + * @throws Exception if a data access error occurs + */ + List<DataProductModel> getChildDataProducts(String productUri) throws Exception; + + /** + * Retrieve the gateway storage preference for a specific storage resource. + * + * @param gatewayId the gateway identifier + * @param storageId the storage resource identifier + * @return the storage preference + * @throws Exception if not found or a data access error occurs + */ + StoragePreference getGatewayStoragePreference(String gatewayId, String storageId) throws Exception; + + /** + * Retrieve all storage preferences for a given gateway. + * + * @param gatewayId the gateway identifier + * @return list of storage preferences + * @throws Exception if a data access error occurs + */ + List<StoragePreference> getAllGatewayStoragePreferences(String gatewayId) throws Exception; +}
